From ff12ce7ce5c4ebf06492cf50dd6e32a8d5aef5ec Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 May 2021 14:23:33 +0500 Subject: [PATCH 1/3] Fixed issue #198 --- main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.py b/main.py index 4387adfb..85958b03 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,14 @@ import sys import signal +try: + f = open("config/settings.json",'w') + f.write("{}") +except FileNotFoundError: + print("Settings.json don't exist.") +finally: + f.close() + is_windows = False try: From 214dcbfb09a2c5478159f5901ea9672cd9535335 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 May 2021 13:25:37 +0500 Subject: [PATCH 2/3] Feat: Added cache command --- config/credentials.ini | 4 ++-- main.py | 11 +++-------- src/Osintgram.py | 10 ++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/config/credentials.ini b/config/credentials.ini index 713927b6..44af5bcd 100644 --- a/config/credentials.ini +++ b/config/credentials.ini @@ -1,3 +1,3 @@ [Credentials] -username = -password = +username = +password = \ No newline at end of file diff --git a/main.py b/main.py index 85958b03..e898526a 100644 --- a/main.py +++ b/main.py @@ -6,14 +6,6 @@ import sys import signal -try: - f = open("config/settings.json",'w') - f.write("{}") -except FileNotFoundError: - print("Settings.json don't exist.") -finally: - f.close() - is_windows = False try: @@ -47,6 +39,8 @@ def cmdlist(): print("Enable/disable export in a '_.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") @@ -136,6 +130,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, diff --git a/src/Osintgram.py b/src/Osintgram.py index 2dc5b093..1df18fd0 100644 --- a/src/Osintgram.py +++ b/src/Osintgram.py @@ -1535,3 +1535,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() \ No newline at end of file From 585fcc8f9d7acfeb5bf60c1ec84168617b4e386f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 May 2021 15:48:14 +0500 Subject: [PATCH 3/3] Feat: Added command line arg to clear cookies [-c] --- config/settings.json | 2 +- main.py | 3 ++- src/Osintgram.py | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/settings.json b/config/settings.json index 9e26dfee..0d7c76c9 100644 --- a/config/settings.json +++ b/config/settings.json @@ -1 +1 @@ -{} \ No newline at end of file +{"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} \ No newline at end of file diff --git a/main.py b/main.py index e898526a..35a435d6 100644 --- a/main.py +++ b/main.py @@ -116,12 +116,13 @@ 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') args = parser.parse_args() -api = Osintgram(args.id, args.file, args.json) +api = Osintgram(args.id, args.file, args.json, args.cookies) commands = { diff --git a/src/Osintgram.py b/src/Osintgram.py index 1df18fd0..1db49bd5 100644 --- a/src/Osintgram.py +++ b/src/Osintgram.py @@ -31,15 +31,20 @@ class Osintgram: writeFile = False jsonDump = False - def __init__(self, target, is_file, is_json): + def __init__(self, target, is_file, is_json, clear_cookies): u = config.getUsername() p = config.getPassword() + self.clear_cookies(clear_cookies) print("\nAttempt to login...") self.login(u, p) self.setTarget(target) 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)