Projects STRLCPY Osintgram Commits 7853c13b
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    README.md
    1  -[![](https://img.shields.io/badge/version-0.9-green)](https://github.com/Datalux/Osintgram/releases/tag/0.9)
     1 +[![](https://img.shields.io/badge/version-1.0-green)](https://github.com/Datalux/Osintgram/releases/tag/1.0)
    2 2  [![](https://img.shields.io/badge/license-GPLv3-blue)](https://img.shields.io/badge/license-GPLv3-blue)
    3 3  [![](https://img.shields.io/badge/language-Python3-red)](https://img.shields.io/badge/language-Python3-red)
    4 4  [![](https://img.shields.io/badge/Telegram-Channel-blue.svg)](https://t.me/osintgram)
    skipped 26 lines
    31 31  ```
    32 32  You can find detailed commands usage [here](doc/COMMANDS.md).
    33 33   
    34  -[**Latest version**](https://github.com/Datalux/Osintgram/releases/tag/0.9) |
     34 +[**Latest version**](https://github.com/Datalux/Osintgram/releases/tag/1.0) |
    35 35  [CHANGELOG](doc/CHANGELOG.md)
    36 36   
    37 37  ## Tools
    skipped 48 lines
  • ■ ■ ■ ■ ■ ■
    doc/CHANGELOG.md
    1 1  # Changelog
    2 2   
     3 +## [1.0](https://github.com/Datalux/Osintgram/releases/tag/1.0)
     4 +**Enhancements**
     5 +- Set itself as target (#53)
     6 +- Get others info from user (`info` command):
     7 + - Whats'App number (if avaible)
     8 + - City Name (if avaible)
     9 + - Address Street (if avaible)
     10 + - Contact phone number (if avaible)
     11 + 
     12 +**Bug fixes**
     13 +- Fix login issue (#79, #80, #81)
     14 + 
    3 15  ## [0.9](https://github.com/Datalux/Osintgram/releases/tag/0.9)
    4 16   
    5 17  **Enhancements**
    skipped 91 lines
  • ■ ■ ■ ■ ■ ■
    doc/COMMANDS.md
    skipped 67 lines
    68 68  - business email (if available)
    69 69  - HD profile picture url
    70 70  - connected Facebook page (if available)
     71 +- Whats'App number (if avaible)
     72 +- City Name (if avaible)
     73 +- Address Street (if avaible)
     74 +- Contact phone number (if avaible)
    71 75   
    72 76  ### JSON
    73 77  Can set preference to export commands output as JSON in output folder. It save output in `<target username>_<command>.JSON` file.
    skipped 43 lines
  • ■ ■ ■ ■
    main.py
    skipped 21 lines
    22 22   pc.printout("\_______ /____ >__|___| /__| \___ /|__| (____ /__|_| /\n", pc.YELLOW)
    23 23   pc.printout(" \/ \/ \/ /_____/ \/ \/ \n", pc.YELLOW)
    24 24   print('\n')
    25  - pc.printout("Version 0.9 - Developed by Giuseppe Criscione - 2019\n\n", pc.YELLOW)
     25 + pc.printout("Version 1.0 - Developed by Giuseppe Criscione\n\n", pc.YELLOW)
    26 26   pc.printout("Type 'list' to show all allowed commands\n")
    27 27   pc.printout("Type 'FILE=y' to save results to files like '<target username>_<command>.txt (deafult is disabled)'\n")
    28 28   pc.printout("Type 'FILE=n' to disable saving to files'\n")
    skipped 137 lines
  • ■ ■ ■ ■ ■ ■
    src/Osintgram.py
    skipped 441 lines
    442 442   pc.printout("Sorry! No results found :-(\n", pc.RED)
    443 443   
    444 444   def get_user_info(self):
    445  - content = requests.get("https://www.instagram.com/" + str(self.target) + "/?__a=1")
     445 + try:
     446 + endpoint = 'users/{user_id!s}/full_detail_info/'.format(**{'user_id': self.target})
     447 + content = self.api._call_api(endpoint)
    446 448  
    447  - if content.status_code == 404:
    448  - print("Oops... " + str(self.target) + " non exist, please enter a valid username.")
    449  - sys.exit(2)
     449 + data = content['user_detail']['user']
    450 450   
    451  - data = content.json()
    452  - data = data['graphql']['user']
     451 + pc.printout("[ID] ", pc.GREEN)
     452 + pc.printout(str(data['pk']) + '\n')
     453 + pc.printout("[FULL NAME] ", pc.RED)
     454 + pc.printout(str(data['full_name']) + '\n')
     455 + pc.printout("[BIOGRAPHY] ", pc.CYAN)
     456 + pc.printout(str(data['biography']) + '\n')
     457 + pc.printout("[FOLLOWED] ", pc.BLUE)
     458 + pc.printout(str(data['follower_count']) + '\n')
     459 + pc.printout("[FOLLOW] ", pc.GREEN)
     460 + pc.printout(str(data['following_count']) + '\n')
     461 + pc.printout("[BUSINESS ACCOUNT] ", pc.RED)
     462 + pc.printout(str(data['is_business']) + '\n')
     463 + if data['is_business']:
     464 + if not data['can_hide_category']:
     465 + pc.printout("[BUSINESS CATEGORY] ")
     466 + pc.printout(str(data['category']) + '\n')
     467 + pc.printout("[VERIFIED ACCOUNT] ", pc.CYAN)
     468 + pc.printout(str(data['is_verified']) + '\n')
     469 + if 'public_email' in data and data['public_email']:
     470 + pc.printout("[EMAIL] ", pc.BLUE)
     471 + pc.printout(str(data['public_email']) + '\n')
     472 + pc.printout("[HD PROFILE PIC] ", pc.GREEN)
     473 + pc.printout(str(data['hd_profile_pic_url_info']['url']) + '\n')
     474 + if 'fb_page_call_to_action_id' in data and data['fb_page_call_to_action_id']:
     475 + pc.printout("[FB PAGE] ", pc.RED)
     476 + pc.printout(str(data['connected_fb_page']) + '\n')
     477 + if 'whatsapp_number' in data and data['whatsapp_number']:
     478 + pc.printout("[WHATSAPP NUMBER] ", pc.GREEN)
     479 + pc.printout(str(data['whatsapp_number']) + '\n')
     480 + if 'city_name' in data and data['city_name']:
     481 + pc.printout("[CITY] ", pc.YELLOW)
     482 + pc.printout(str(data['city_name']) + '\n')
     483 + if 'address_street' in data and data['address_street']:
     484 + pc.printout("[ADDRESS STREET] ", pc.RED)
     485 + pc.printout(str(data['address_street']) + '\n')
     486 + if 'contact_phone_number' in data and data['contact_phone_number']:
     487 + pc.printout("[CONTACT PHONE NUMBER] ", pc.CYAN)
     488 + pc.printout(str(data['contact_phone_number']) + '\n')
    453 489   
    454  - pc.printout("[ID] ", pc.GREEN)
    455  - pc.printout(str(data['id']) + '\n')
    456  - pc.printout("[FULL NAME] ", pc.RED)
    457  - pc.printout(str(data['full_name']) + '\n')
    458  - pc.printout("[BIOGRAPHY] ", pc.CYAN)
    459  - pc.printout(str(data['biography']) + '\n')
    460  - pc.printout("[FOLLOWED] ", pc.BLUE)
    461  - pc.printout(str(data['edge_followed_by']['count']) + '\n')
    462  - pc.printout("[FOLLOW] ", pc.GREEN)
    463  - pc.printout(str(data['edge_follow']['count']) + '\n')
    464  - pc.printout("[BUSINESS ACCOUNT] ", pc.RED)
    465  - pc.printout(str(data['is_business_account']) + '\n')
    466  - if data['is_business_account']:
    467  - pc.printout("[BUSINESS CATEGORY] ")
    468  - pc.printout(str(data['business_category_name']) + '\n')
    469  - pc.printout("[VERIFIED ACCOUNT] ", pc.CYAN)
    470  - pc.printout(str(data['is_verified']) + '\n')
    471  - if 'business_email' in data:
    472  - pc.printout("[BUSINESS EMAIL] ", pc.BLUE)
    473  - pc.printout(str(data['business_email']) + '\n')
    474  - pc.printout("[HD PROFILE PIC] ", pc.GREEN)
    475  - pc.printout(str(data['profile_pic_url_hd']) + '\n')
    476  - if data['connected_fb_page']:
    477  - pc.printout("[FB PAGE] ", pc.RED)
    478  - pc.printout(str(data['connected_fb_page']) + '\n')
     490 + if self.jsonDump:
     491 + user = {
     492 + 'id': data['pk'],
     493 + 'full_name': data['full_name'],
     494 + 'biography': data['biography'],
     495 + 'edge_followed_by': data['follower_count'],
     496 + 'edge_follow': data['following_count'],
     497 + 'is_business_account': data['is_business_account'],
     498 + 'is_verified': data['is_business'],
     499 + 'profile_pic_url_hd': data['hd_profile_pic_url_info']['url']
     500 + }
     501 + if 'public_email' in data and data['public_email']:
     502 + user['email'] = data['public_email']
     503 + if 'fb_page_call_to_action_id' in data and data['fb_page_call_to_action_id']:
     504 + user['connected_fb_page'] = data['fb_page_call_to_action_id']
     505 + if 'whatsapp_number' in data and data['whatsapp_number']:
     506 + user['whatsapp_number'] = data['whatsapp_number']
     507 + if 'city_name' in data and data['city_name']:
     508 + user['city_name'] = data['city_name']
     509 + if 'address_street' in data and data['address_street']:
     510 + user['address_street'] = data['address_street']
     511 + if 'contact_phone_number' in data and data['contact_phone_number']:
     512 + user['contact_phone_number'] = data['contact_phone_number']
    479 513   
    480  - if self.jsonDump:
    481  - user = {
    482  - 'id': data['id'],
    483  - 'full_name': data['full_name'],
    484  - 'biography': data['biography'],
    485  - 'edge_followed_by': data['edge_followed_by']['count'],
    486  - 'edge_follow': data['edge_follow']['count'],
    487  - 'is_business_account': data['is_business_account'],
    488  - 'is_verified': data['is_verified'],
    489  - 'profile_pic_url_hd': data['profile_pic_url_hd']
    490  - }
    491  - if 'business_email' in data:
    492  - user['business_email'] = data['business_email']
    493  - if data['connected_fb_page']:
    494  - user['connected_fb_page'] = data['connected_fb_page']
     514 + json_file_name = "output/" + self.target + "_info.json"
     515 + with open(json_file_name, 'w') as f:
     516 + json.dump(user, f)
    495 517   
    496  - json_file_name = "output/" + self.target + "_info.json"
    497  - with open(json_file_name, 'w') as f:
    498  - json.dump(user, f)
     518 + except ClientError as e:
     519 + pc.printout("Oops... " + str(self.target) + " non exist, please enter a valid username.", pc.RED)
     520 + pc.printout("\n")
     521 + exit(2)
    499 522   
    500 523   def get_total_likes(self):
    501 524   if self.check_private_profile():
    skipped 319 lines
    821 844   pc.printout("\nWoohoo! We downloaded " + str(counter) + " photos (saved in output/ folder) \n", pc.GREEN)
    822 845   
    823 846   def get_user_propic(self):
    824  - content = requests.get("https://www.instagram.com/" + str(self.target) + "/?__a=1")
    825 847   
    826  - if content.status_code == 404:
    827  - print("Oops... " + str(self.target) + " non exist, please enter a valid username.")
    828  - sys.exit(2)
     848 + try:
     849 + endpoint = 'users/{user_id!s}/full_detail_info/'.format(**{'user_id': self.target})
     850 + content = self.api._call_api(endpoint)
    829 851   
    830  - data = content.json()
     852 + data = content['user_detail']['user']
    831 853   
    832  - uurl = data["graphql"]["user"]
    833  - if "profile_pic_url_hd" in uurl:
    834  - URL = data["graphql"]["user"]["profile_pic_url_hd"]
    835  - else:
    836  - URL = data["graphql"]["user"]["profile_pic_url"]
     854 + if "hd_profile_pic_url_info" in data:
     855 + URL = data["hd_profile_pic_url_info"]['url']
     856 + else:
     857 + #get better quality photo
     858 + items = len(data['hd_profile_pic_versions'])
     859 + URL = data["hd_profile_pic_versions"][items-1]['url']
    837 860   
    838  - if URL != "":
    839  - end = "output/" + self.target + "_propic.jpg"
    840  - urllib.request.urlretrieve(URL, end)
    841  - pc.printout("Target propic saved in output folder\n", pc.GREEN)
     861 + if URL != "":
     862 + end = "output/" + self.target + "_propic.jpg"
     863 + urllib.request.urlretrieve(URL, end)
     864 + pc.printout("Target propic saved in output folder\n", pc.GREEN)
    842 865   
    843  - else:
    844  - pc.printout("Sorry! No results found :-(\n", pc.RED)
     866 + else:
     867 + pc.printout("Sorry! No results found :-(\n", pc.RED)
     868 +
     869 + except ClientError as e:
     870 + print(e)
     871 + print("An error occured... exit")
     872 + exit(2)
    845 873   
    846 874   def get_user_stories(self):
    847 875   if self.check_private_profile():
    skipped 98 lines
    946 974   pc.printout("Sorry! No results found :-(\n", pc.RED)
    947 975   
    948 976   def get_user(self, username):
    949  - content = requests.get("https://www.instagram.com/" + username + "/?__a=1")
     977 + try:
     978 + endpoint = 'users/{user_id!s}/full_detail_info/'.format(**{'user_id': self.target})
     979 + content = self.api._call_api(endpoint)
    950 980   
    951  - if content.status_code == 404:
    952  - print("Oops... " + str(self.target) + " non exist, please enter a valid username.")
    953  - sys.exit(2)
     981 + if self.writeFile:
     982 + file_name = "output/" + self.target + "_user_id.txt"
     983 + file = open(file_name, "w")
     984 + file.write(str(content['user_detail']['user']['pk']))
     985 + file.close()
    954 986   
    955  - data = content.json()
     987 + user = dict()
     988 + user['id'] = content['user_detail']['user']['pk']
     989 + user['is_private'] = content['user_detail']['user']['is_private']
    956 990   
    957  - if self.writeFile:
    958  - file_name = "output/" + self.target + "_user_id.txt"
    959  - file = open(file_name, "w")
    960  - file.write(str(data['graphql']['user']['id']))
    961  - file.close()
     991 + return user
     992 + except ClientError as e:
     993 + pc.printout("Oops... " + str(self.target) + " non exist, please enter a valid username.", pc.RED)
     994 + pc.printout("\n")
     995 + exit(2)
    962 996   
    963  - user = dict()
    964  - user['id'] = data['graphql']['user']['id']
    965  - user['is_private'] = data['graphql']['user']['is_private']
    966 997  
    967  - return user
    968 998   
    969 999   def set_write_file(self, flag):
    970 1000   if flag:
    skipped 53 lines
    1024 1054   #pc.printout('ClientError {0!s} (Code: {1:d}, Response: {2!s})'.format(e.msg, e.code, e.error_response), pc.RED)
    1025 1055   error = json.loads(e.error_response)
    1026 1056   pc.printout(error['message'], pc.RED)
     1057 + pc.printout(": ", pc.RED)
     1058 + pc.printout(e.msg, pc.RED)
    1027 1059   pc.printout("\n")
    1028 1060   if 'challenge' in error:
    1029 1061   print("Please follow this link to complete the challenge: " + error['challenge']['url'])
    skipped 17 lines
    1047 1079   # print('SAVED: {0!s}'.format(new_settings_file))
    1048 1080   
    1049 1081   def check_following(self):
     1082 + if self.target_id == self.api.authenticated_user_id:
     1083 + return True
    1050 1084   endpoint = 'users/{user_id!s}/full_detail_info/'.format(**{'user_id': self.target_id})
    1051 1085   return self.api._call_api(endpoint)['user_detail']['user']['friendship_status']['following']
    1052 1086   
    skipped 123 lines
Please wait...
Page is in error, reload to recover