Projects STRLCPY Osintgram Commits eb4b52e4
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    src/CommandFather.py
    skipped 18 lines
    19 19   stream = open(self.path, 'r')
    20 20   self.config = yaml.safe_load(stream)
    21 21   self.options_values = self.config['options']
    22  - self.osintgram = api
    23 22   
    24 23   def get_options(self):
    25 24   return self.config['options']
     25 + 
     26 + def get_option(self, option_key):
     27 + return self.options_values[option_key]
     28 + 
    26 29   
    27 30   def options(self):
    28 31   t = PrettyTable(['Option', 'Value'])
    skipped 19 lines
    48 51   except IndexError:
    49 52   utils.print_error("Value not in range (1-" + str(i-1) + ")")
    50 53   
     54 + def exit(self):
     55 + self.status.release()
  • ■ ■ ■ ■ ■ ■
    src/OsintgramStatus.py
    skipped 2 lines
    3 3   
    4 4  class OsintgramStatus:
    5 5   
     6 + __default_commands_ = [
     7 + 'help',
     8 + 'exit'
     9 + ]
     10 + 
    6 11   def __init__(self):
    7 12   self.command_mode = False
    8 13   self.setted_subcommand = False
    skipped 12 lines
    21 26   stream = open(self.get_path(), 'r')
    22 27   setup = yaml.safe_load(stream)
    23 28   self.commands = setup['commands']
     29 + if self.commands is not None:
     30 + self.commands.extend(self.__default_commands_)
    24 31   
    25 32   def get_target(self):
    26 33   return self.target
    skipped 48 lines
  • ■ ■ ■ ■ ■
    src/commands/followers/run.py
    skipped 8 lines
    9 9  import sys
    10 10  import time
    11 11   
    12  -from src import CommandFather as CommandFather
     12 +from src.CommandFather import CommandFather
    13 13   
    14 14   
    15  -class Command():
     15 +class Command(CommandFather):
    16 16   
    17 17   def __init__(self, status, api):
    18  - # super().__init__(status, api)
    19  - self.commands = []
    20  - self.path = status.get_path()
     18 + super().__init__(status)
    21 19   self.status = status
    22  - stream = open(self.path, 'r')
    23  - self.config = yaml.safe_load(stream)
    24  - self.options_values = self.config['options']
     20 + stream = open(status.get_path(), 'r')
    25 21   self.osintgram = api
    26 22   
    27  - def get_options(self):
    28  - return self.config['options']
    29  - 
    30  - def options(self):
    31  - t = PrettyTable(['Option', 'Value'])
    32  - for key, value in self.options_values.items():
    33  - t.add_row([key, str(value)])
    34  - print(t)
    35  - 
    36  - def set(self):
    37  - i = 1
    38  - for key, value in self.options_values.items():
    39  - print(str(i) + ". " + key)
    40  - i = i + 1
    41  - try:
    42  - index = input("Choose option: ")
    43  - key = list(self.options_values.keys())[int(index) - 1]
    44  - v = input("[" + key + "] Choose a value: ")
    45  - self.options_values[key] = v
    46  - print(self.options_values)
    47  - 
    48  - except ValueError:
    49  - utils.print_error("Not a number")
    50  - 
    51  - except IndexError:
    52  - utils.print_error("Value not in range (1-" + str(i-1) + ")")
    53  - 
    54 23   def run(self):
    55 24   if self.osintgram.check_private_profile():
    56 25   return
    skipped 9 lines
    66 35   
    67 36   next_max_id = data.get('next_max_id')
    68 37   while next_max_id:
    69  - if(int(self.options_values['output_limit']) > 0 and len(followers) > int(self.options_values['output_limit'])):
     38 + if(int(super().get_option('output_limit')) > 0 and len(followers) > int(super().get_option('output_limit'))):
    70 39   break
    71 40   
    72  - if(int(self.options_values['delay']) > 0):
    73  - time.sleep(int(self.options_values['delay']))
     41 + if(int(super().get_option('delay')) > 0):
     42 + time.sleep(int(super().get_option('delay')))
    74 43   
    75 44   sys.stdout.write("\rCatched %i followers" % len(followers))
    76 45   sys.stdout.flush()
    77 46   results = self.osintgram.get_api().user_followers(str(self.osintgram.target_id), rank_token=rank_token, max_id=next_max_id)
    78 47   followers.extend(results.get('users', []))
    79 48   next_max_id = results.get('next_max_id')
    80  - sys.stdout.write("\rCatched %i followers" % len(followers))
     49 + sys.stdout.write("\rCatched %i followers\n" % len(followers))
    81 50   sys.stdout.flush()
    82 51   
    83 52   data = []
    skipped 5 lines
    89 58   }
    90 59   data.append(u)
    91 60   
    92  - # utils.print_in_table(data, ['ID', 'Username', 'Full Name'], ['id', 'username', 'full_name'])
    93 61   self.status.print_output(data, ['ID', 'Username', 'Full Name'], ['id', 'username', 'full_name'])
    94 62   
Please wait...
Page is in error, reload to recover