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/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 b83e972c..04a60a01 100644 --- a/main.py +++ b/main.py @@ -34,6 +34,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") @@ -107,6 +109,7 @@ 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') @@ -114,7 +117,9 @@ def _quit(): 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 = { @@ -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, diff --git a/src/Osintgram.py b/src/Osintgram.py index 6db9f79a..139b0580 100644 --- a/src/Osintgram.py +++ b/src/Osintgram.py @@ -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...") @@ -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) @@ -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()