From 41a8302ed007b5d1f3ff150b9bed70ce835e9291 Mon Sep 17 00:00:00 2001 From: Datalux Date: Sun, 30 Aug 2020 13:07:04 +0200 Subject: [PATCH 1/2] feat: added fwersemail command --- main.py | 4 +++ src/Osintgram.py | 65 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index a681874b..4f59fed4 100644 --- a/main.py +++ b/main.py @@ -40,6 +40,8 @@ def cmdlist(): print("Get target followers") pc.printout("followings\t") print("Get users followed by target") + pc.printout("fwersemail\t") + print("Get email of users followed by target") pc.printout("hashtags\t") print("Get hashtags used by target") pc.printout("info\t\t") @@ -104,6 +106,8 @@ def signal_handler(sig, frame): api.get_followers() elif cmd == "followings": api.get_followings() + elif cmd == 'fwersemail': + api.get_fwersemail() elif cmd == "hashtags": api.get_hashtags() elif cmd == "info": diff --git a/src/Osintgram.py b/src/Osintgram.py index d95e3fc0..7ae7c402 100644 --- a/src/Osintgram.py +++ b/src/Osintgram.py @@ -487,8 +487,6 @@ def get_user_info(self): if data['connected_fb_page']: user['connected_fb_page'] = data['connected_fb_page'] - - json_file_name = "output/" + self.target + "_info.json" with open(json_file_name, 'w') as f: json.dump(user, f) @@ -1059,5 +1057,68 @@ def check_private_profile(self): return True return False + def get_fwersemail(self): + if self.check_private_profile(): + return + + pc.printout("Searching for emails of target followers... this can take a few minutes\n") + + followers = [] + + rank_token = AppClient.generate_uuid() + data = self.api.user_followers(str(self.target_id), rank_token=rank_token) + + for user in data['users']: + u = { + 'id': user['pk'], + 'username': user['username'], + 'full_name': user['full_name'] + } + followers.append(u) + + results = [] + + for follow in followers: + req = urllib.request.urlopen("https://www.instagram.com/" + str(follow['id']) + "/?__a=1") + data = json.load(req)['graphql']['user'] + if data['business_email']: + follow['email'] = data['business_email'] + results.append(follow) + + if len(results) > 0: + + t = PrettyTable(['ID', 'Username', 'Full Name', 'Email']) + t.align["ID"] = "l" + t.align["Username"] = "l" + t.align["Full Name"] = "l" + t.align["Email"] = "l" + + json_data = {} + + for node in results: + t.add_row([str(node['id']), node['username'], node['full_name'], node['email']]) + + if self.writeFile: + file_name = "output/" + self.target + "_followers.txt" + file = open(file_name, "w") + file.write(str(t)) + file.close() + + if self.jsonDump: + json_data['followers'] = results + json_file_name = "output/" + self.target + "_followers.json" + with open(json_file_name, 'w') as f: + json.dump(json_data, f) + + print(t) + else: + pc.printout("Sorry! No results found :-(\n", pc.RED) + + + + + + + From 72e6d22bbbf8f14ac93dbef09c34fc9251c76e34 Mon Sep 17 00:00:00 2001 From: Datalux Date: Sun, 30 Aug 2020 16:43:59 +0200 Subject: [PATCH 2/2] fix: requests endpoint --- src/Osintgram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Osintgram.py b/src/Osintgram.py index 7ae7c402..a870dcd6 100644 --- a/src/Osintgram.py +++ b/src/Osintgram.py @@ -1079,7 +1079,7 @@ def get_fwersemail(self): results = [] for follow in followers: - req = urllib.request.urlopen("https://www.instagram.com/" + str(follow['id']) + "/?__a=1") + req = urllib.request.urlopen("https://www.instagram.com/" + str(follow['username']) + "/?__a=1") data = json.load(req)['graphql']['user'] if data['business_email']: follow['email'] = data['business_email']