Skip to content

Commit

Permalink
Merge pull request Datalux#40 from Datalux/feat/fwersemail
Browse files Browse the repository at this point in the history
feat: added fwersemail command
  • Loading branch information
Datalux authored Aug 30, 2020
2 parents 7f80442 + 72e6d22 commit b7a5d16
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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":
Expand Down
65 changes: 63 additions & 2 deletions src/Osintgram.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)









0 comments on commit b7a5d16

Please sign in to comment.