Projects STRLCPY Osintgram Commits 91402905
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    Osintgram.py
    skipped 16 lines
    17 17   geolocator = Nominatim()
    18 18   user_id = None
    19 19   target_id = None
     20 + is_private = True
    20 21   target = ""
    21 22   writeFile = False
    22 23   
    skipped 1 lines
    24 25   u = self.__getUsername__()
    25 26   p = self.__getPassword__()
    26 27   self.api = InstagramAPI(u, p)
    27  - print("\nAttempt to login...\n")
     28 + print("\nAttempt to login...")
    28 29   self.api.login()
    29 30   self.setTarget(target)
    30 31   
    31 32   
    32 33   def setTarget(self, target):
    33 34   self.target = target
    34  - self.target_id = self.getUserID(target)
     35 + user = self.getUser(target)
     36 + self.target_id = user['id']
     37 + self.is_private = user['is_private']
    35 38   self.__printTargetBanner__()
    36 39   
    37 40   
    skipped 49 lines
    87 90   return sort_addresses
    88 91   
    89 92   def __printTargetBanner__(self):
    90  - pc.printout("Logged as ", pc.GREEN)
     93 + pc.printout("\nLogged as ", pc.GREEN)
    91 94   pc.printout(self.api.username, pc.CYAN)
    92 95   pc.printout(" (" + str(self.api.username_id) + ") ")
    93 96   pc.printout("target: ", pc.GREEN)
    94 97   pc.printout(str(self.target), pc.CYAN)
     98 + pc.printout(" (private: " + str(self.is_private) + ")")
    95 99   print('\n')
    96 100   
    97 101   def setWriteFile(self, bool):
    skipped 249 lines
    347 351   
    348 352   
    349 353   def getAddrs(self):
     354 + if(self.is_private):
     355 + pc.printout("Impossible to execute command: user has private profile\n", pc.RED)
     356 + return
     357 + 
    350 358   pc.printout("Searching for target address... this may take a few minutes...\n")
    351 359   addrs = self.__getAdressesTimes__(self.target_id)
    352 360   t = PrettyTable()
    skipped 18 lines
    371 379   print(t)
    372 380   
    373 381   def getFollowers(self):
     382 + if(self.is_private):
     383 + pc.printout("Impossible to execute command: user has private profile\n", pc.RED)
     384 + return
     385 + 
    374 386   pc.printout("Searching for target followers...\n")
    375 387   
    376 388   followers = self.__getTotalFollowers__(self.target_id)
    skipped 14 lines
    391 403   print(t)
    392 404   
    393 405   def getFollowings(self):
     406 + if(self.is_private):
     407 + pc.printout("Impossible to execute command: user has private profile\n", pc.RED)
     408 + return
     409 + 
    394 410   pc.printout("Searching for target followings...\n")
    395 411   
    396 412   followings = self.__getUserFollowigs__(self.target_id)
    skipped 13 lines
    410 426   
    411 427   print(t)
    412 428   
    413  - def getUserID(self, username):
     429 + def getUser(self, username):
    414 430   try:
    415 431   content = urllib.request.urlopen("https://www.instagram.com/" + username + "/?__a=1" )
    416 432   except urllib.error.HTTPError as err:
    skipped 8 lines
    425 441   file = open(file_name, "w")
    426 442   file.write(str(data['graphql']['user']['id']))
    427 443   file.close()
    428  - return data['graphql']['user']['id']
     444 + 
     445 + user = dict()
     446 + user['id'] = data['graphql']['user']['id']
     447 + user['is_private'] = data['graphql']['user']['is_private']
     448 +
     449 + return user
    429 450   
    430 451   def getUserInfo(self):
    431 452   try:
    skipped 24 lines
    456 477   pc.printout("[VERIFIED ACCOUNT] ", pc.CYAN)
    457 478   pc.printout(str(data['is_verified']) + '\n')
    458 479   
    459  - 
    460 480   def getPhotoDescription(self):
     481 + if(self.is_private):
     482 + pc.printout("Impossible to execute command: user has private profile\n", pc.RED)
     483 + return
     484 + 
    461 485   content = self.api.SendRequest2(self.target + '/?__a=1')
    462 486   data = self.api.LastJson
    463 487   dd = data['graphql']['user']['edge_owner_to_timeline_media']['edges']
    skipped 23 lines
    487 511   else:
    488 512   pc.printout("Sorry! No results found :-(\n", pc.RED)
    489 513   
     514 + def getUserPhoto(self):
     515 + if(self.is_private):
     516 + pc.printout("Impossible to execute command: user has private profile\n", pc.RED)
     517 + return
    490 518   
    491  - def getUserPhoto(self):
    492 519   limit = -1
    493 520   pc.printout("How many photos you want to download (default all): ", pc.YELLOW)
    494 521   l = input()
    skipped 61 lines
    556 583   
    557 584   pc.printout("\nWoohoo! We downloaded " + str(counter) + " photos (saved in output/ folder) \n", pc.GREEN)
    558 585   
     586 + def getCaptions(self):
     587 + if(self.is_private):
     588 + pc.printout("Impossible to execute command: user has private profile\n", pc.RED)
     589 + return
    559 590   
    560  - def getCaptions(self):
    561 591   pc.printout("Searching for target captions...\n")
    562 592  
    563 593   a = None
    skipped 52 lines
    616 646  
    617 647   return
    618 648   
     649 + def getMediaType(self):
     650 + if(self.is_private):
     651 + pc.printout("Impossible to execute command: user has private profile\n", pc.RED)
     652 + return
    619 653   
    620  - def getMediaType(self):
    621 654   pc.printout("Searching for target captions...\n")
    622 655  
    623 656   a = None
    skipped 54 lines
    678 711  
    679 712   return
    680 713  
    681  -
    682  -
    683 714   def getUserPropic(self):
    684 715   try:
    685 716   content = urllib.request.urlopen("https://www.instagram.com/" + str(self.target) + "/?__a=1" )
    skipped 20 lines
    706 737   else:
    707 738   pc.printout("Sorry! No results found :-(\n", pc.RED)
    708 739   
     740 + def getUserStories(self):
     741 + if(self.is_private):
     742 + pc.printout("Impossible to execute command: user has private profile\n", pc.RED)
     743 + return
    709 744   
    710  - def getUserStories(self):
    711 745   pc.printout("Searching for target stories...\n")
    712 746   
    713 747   endpoint = 'feed/user/{id!s}/story/'.format(**{'id': self.target_id})
    skipped 20 lines
    734 768   pc.printout(str(counter) + " target stories saved in output folder\n", pc.GREEN)
    735 769   else:
    736 770   pc.printout("Sorry! No results found :-(\n", pc.RED)
    737  -
    738 771  
    739 772   def changeTarget(self):
    740 773   pc.printout("Insert new target username: ", pc.YELLOW)
    skipped 4 lines
Please wait...
Page is in error, reload to recover