Projects STRLCPY Osintgram Commits f1dbbb4e
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    src/CommandFather.py
    skipped 5 lines
    6 6  from src import utils as utils
    7 7  import json
    8 8  import sys
     9 +import os
    9 10  import time
    10 11   
    11 12   
    skipped 12 lines
    24 25   
    25 26   def get_option(self, option_key):
    26 27   return self.options_values[option_key]
    27  - 
    28 28   
    29 29   def options(self):
    30 30   t = PrettyTable(['Option', 'Value'])
    skipped 26 lines
    57 57   
    58 58   def exit(self):
    59 59   self.status.release()
     60 + 
     61 + def help(self):
     62 + print(self.config['description'])
     63 + 
     64 + def create_folder_if_not_exists(self):
     65 + if not os.path.isdir(self.get_option('output_path')):
     66 + os.makedirs(self.get_option('output_path'))
  • ■ ■ ■ ■ ■
    src/commands/photos/run.py
    skipped 38 lines
    39 39   next_max_id = results.get('next_max_id')
    40 40   
    41 41   try:
    42  - if not os.path.isdir(super().get_option('output_path')):
    43  - os.makedirs(super().get_option('output_path'))
     42 + super().create_folder_if_not_exists()
    44 43   
    45 44   for item in data:
    46 45   if(int(super().get_option('output_limit')) > 0 and counter == int(super().get_option('output_limit'))):
    skipped 34 lines
  • ■ ■ ■ ■ ■ ■
    src/commands/propic/config.yaml
     1 +---
     2 +name: "propic"
     3 +description: "Download target's profile photo"
     4 +commands:
     5 + - run
     6 +options:
     7 + output_path: "output"
     8 +
  • ■ ■ ■ ■ ■ ■
    src/commands/propic/run.py
     1 +from prettytable import PrettyTable
     2 +from src import printcolors as pc
     3 +import sys
     4 +import time
     5 +import urllib
     6 +from instagram_private_api import ClientError
     7 + 
     8 + 
     9 +from src.CommandFather import CommandFather
     10 + 
     11 + 
     12 +class Command(CommandFather):
     13 + 
     14 + def __init__(self, status, api):
     15 + super().__init__(status)
     16 + self.status = status
     17 + self.osintgram = api
     18 + 
     19 + def run(self):
     20 + try:
     21 + super().create_folder_if_not_exists()
     22 +
     23 + endpoint = 'users/{user_id!s}/full_detail_info/'.format(**{'user_id': self.osintgram.target_id})
     24 + content = self.osintgram.get_api()._call_api(endpoint)
     25 + 
     26 + data = content['user_detail']['user']
     27 + 
     28 + if "hd_profile_pic_url_info" in data:
     29 + URL = data["hd_profile_pic_url_info"]['url']
     30 + else:
     31 + #get better quality photo
     32 + items = len(data['hd_profile_pic_versions'])
     33 + URL = data["hd_profile_pic_versions"][items-1]['url']
     34 + 
     35 + if URL != "":
     36 + end = super().get_option('output_path') + "/" + self.osintgram.target + "_propic.jpg"
     37 + urllib.request.urlretrieve(URL, end)
     38 + pc.printout("Target propic saved in output folder\n", pc.GREEN)
     39 + 
     40 + else:
     41 + pc.printout("Sorry! No results found :-(\n", pc.RED)
     42 +
     43 + except ClientError as e:
     44 + error = json.loads(e.error_response)
     45 + print(error['message'])
     46 + print(error['error_title'])
     47 + self.status.release()
     48 + 
  • ■ ■ ■ ■ ■
    src/setup.yaml
    skipped 11 lines
    12 12   - hashtags
    13 13   - help
    14 14   - photos
     15 + - propic
Please wait...
Page is in error, reload to recover