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..a870dcd6 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['username']) + "/?__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) + + + + + + +