Skip to content

Commit

Permalink
Merge branch 'development' into Development
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrisdafur3 authored May 12, 2021
2 parents 26e1395 + 5a8fe44 commit c648e66
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
4 changes: 2 additions & 2 deletions config/credentials.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[Credentials]
username =
password =
username =
password =
2 changes: 1 addition & 1 deletion config/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{"uuid": "49ed550a-b30f-11eb-ab45-00155d9a47a8", "device_id": "android-49ed5762b30f11eb", "ad_id": "00ea607f-90b5-01af-95ac-c6f37ac93fbd", "session_id": "49ed5848-b30f-11eb-ab45-00155d9a47a8", "cookie": {"__class__": "bytes", "__value__": "gASVRwMAAAAAAAB9lIwOLmluc3RhZ3JhbS5jb22UfZSMAS+UfZQojAljc3JmdG9rZW6UjA5odHRw\nLmNvb2tpZWphcpSMBkNvb2tpZZSTlCmBlH2UKIwHdmVyc2lvbpRLAIwEbmFtZZSMCWNzcmZ0b2tl\nbpSMBXZhbHVllIwgemxlTm5zWjBJeUFPa0NPTzkwVG5rOUc0RHJDbFIzcHCUjARwb3J0lE6MDnBv\ncnRfc3BlY2lmaWVklImMBmRvbWFpbpSMDi5pbnN0YWdyYW0uY29tlIwQZG9tYWluX3NwZWNpZmll\nZJSIjBJkb21haW5faW5pdGlhbF9kb3SUiIwEcGF0aJRoA4wOcGF0aF9zcGVjaWZpZWSUiIwGc2Vj\ndXJllIiMB2V4cGlyZXOUSgCUe2KMB2Rpc2NhcmSUiYwHY29tbWVudJROjAtjb21tZW50X3VybJRO\njAdyZmMyMTA5lImMBV9yZXN0lH2UdWKMA21pZJRoCCmBlH2UKGgLSwBoDGggaA6MHFlKdXhfUUFC\nQUFHUmtGeFRzblNuek5DakpCdXCUaBBOaBGJaBKMDi5pbnN0YWdyYW0uY29tlGgUiGgViGgWaANo\nF4hoGIhoGUr9GF5kaBqJaBtOaBxOaB2JaB59lHVijANydXKUaAgpgZR9lChoC0sAaAxoJmgOjANO\nQU+UaBBOaBGJaBKMDi5pbnN0YWdyYW0uY29tlGgUiGgViGgWaANoF4hoGIhoGU5oGohoG05oHE5o\nHYloHn2UjAhIdHRwT25seZROc3VijApkc191c2VyX2lklGgIKYGUfZQoaAtLAGgMaC1oDowLNDc2\nNTU2NjY1MjeUaBBOaBGJaBKMDi5pbnN0YWdyYW0uY29tlGgUiGgViGgWaANoF4hoGIhoGUoAWRJh\naBqJaBtOaBxOaB2JaB59lHVijAlzZXNzaW9uaWSUaAgpgZR9lChoC0sAaAxoM2gOjCA0NzY1NTY2\nNjUyNyUzQUFkSjZxZkhDZGt2SHdpJTNBM5RoEE5oEYloEowOLmluc3RhZ3JhbS5jb22UaBSIaBWI\naBZoA2gXiGgYiGgZSoDlfGJoGoloG05oHE5oHYloHn2UjAhIdHRwT25seZROc3VidXNzLg==\n"}, "created_ts": 1620816384}
8 changes: 7 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def cmdlist():
print("Enable/disable export in a '<target username>_<command>.json' file'")
pc.printout("addrs\t\t")
print("Get all registered addressed by target photos")
pc.printout("cache\t\t")
print("Clear cache of the tool")
pc.printout("captions\t")
print("Get target's photos captions")
pc.printout("commentdata\t")
Expand Down Expand Up @@ -107,14 +109,17 @@ def _quit():
'to perform analysis on Instagram account of any users by its nickname ')
parser.add_argument('id', type=str, # var = id
help='username')
parser.add_argument('-c','--cookies', help='clear\'s previous cookies', action="store_true")
parser.add_argument('-j', '--json', help='save commands output as JSON file', action='store_true')
parser.add_argument('-f', '--file', help='save output in a file', action='store_true')
parser.add_argument('-c', '--command', help='run in single command mode & execute provided command', action='store')
parser.add_argument('-o', '--output', help='where to store photos', action='store')

args = parser.parse_args()

api = Osintgram(args.id, args.file, args.json, args.command, args.output)

api = Osintgram(args.id, args.file, args.json, args.command, args.output, args.cookies)



commands = {
Expand All @@ -123,6 +128,7 @@ def _quit():
'quit': _quit,
'exit': _quit,
'addrs': api.get_addrs,
'cache': api.clear_cache,
'captions': api.get_captions,
"commentdata": api.get_comment_data,
'comments': api.get_total_comments,
Expand Down
19 changes: 17 additions & 2 deletions src/Osintgram.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ class Osintgram:
cli_mode = False
output_dir = "output"

def __init__(self, target, is_file, is_json, is_cli, output_dir):

def __init__(self, target, is_file, is_json, is_cli, output_dir, clear_cookies):
self.output_dir = output_dir or self.output_dir
Path(self.output_dir).mkdir(parents=True, exist_ok=True)
u = config.getUsername()
p = config.getPassword()
self.clear_cookies(clear_cookies)
self.cli_mode = is_cli
if not is_cli:
print("\nAttempt to login...")
Expand All @@ -47,6 +49,10 @@ def __init__(self, target, is_file, is_json, is_cli, output_dir):
self.writeFile = is_file
self.jsonDump = is_json

def clear_cookies(self,clear_cookies):
if clear_cookies:
self.clear_cache()

def setTarget(self, target):
self.target = target
user = self.get_user(target)
Expand Down Expand Up @@ -1647,4 +1653,13 @@ def get_comments(self):
json.dump(json_data, f)
else:
pc.printout("Sorry! No results found :-(\n", pc.RED)


def clear_cache(self):
try:
f = open("config/settings.json",'w')
f.write("{}")
pc.printout("Cache Cleared.\n",pc.GREEN)
except FileNotFoundError:
pc.printout("Settings.json don't exist.\n",pc.RED)
finally:
f.close()

0 comments on commit c648e66

Please sign in to comment.