Skip to content

Commit

Permalink
Add ability to dump cookies as a JSON structure.
Browse files Browse the repository at this point in the history
Fixes #41
  • Loading branch information
leonjza committed Jan 10, 2018
1 parent ee740a5 commit db7708c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion objection/commands/ios/cookies.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import json

import click
from tabulate import tabulate

from objection.utils.frida_transport import FridaRunner
from objection.utils.templates import ios_hook


def get(args: list = None) -> None:
def _should_dump_json(args: list) -> bool:
"""
Check if --json is part of the arguments.
:param args:
:return:
"""

return '--json' in args


def get(args: list) -> None:
"""
Gets cookies using the iOS NSHTTPCookieStorage sharedHTTPCookieStorage
and prints them to the screen.
Expand All @@ -30,6 +43,10 @@ def get(args: list = None) -> None:
click.secho('No cookies found')
return

if _should_dump_json(args):
print(json.dumps(response.data, indent=4))
return

data = []

for cookie in response.data:
Expand Down
1 change: 1 addition & 0 deletions objection/console/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@
'commands': {
'get': {
'meta': 'Get the current apps shared cookies',
'flags': ['--json'],
'exec': cookies.get
}
}
Expand Down

0 comments on commit db7708c

Please sign in to comment.