コード例 #1
0
def java_pyi(idic, user, sshkey):

    # Parse the config file and unpack user options from autoset menu
    config = src.core.config.get_config()

    web_clone = menus.autoset_file_menu()
    print green("\nCreating custom SET automation file...")
    autofile = autoset.java_app_pyinject(idic["ip"], web_clone)
    print green("Custom SET automation file created.\n")

    # Attempts to establish an SSH conection to the instance
    while True:
        try:
            sleep(2)
            print yellow("Attempting to establish a connection to %s" % idic["ip"])
            fabfunky.conn_est(idic["ip"], user, sshkey)
            break
        except Exception:
            print red("Instance is still initializing...")
            pass

    # Check apache status within local config file and if set to ON uploads the local config
    apache_status = apache_conf(config["set_config"])

    if apache_status == 'ON':

        if user == 'root':
            rfile = '/%s/set_config' % user
        else:
            rfile = '/home/%s/set_config' % user

        #uploads local SET config file
        fabfunky.file_upload(idic["ip"], user, config["set_config"], rfile, sshkey)
        fabfunky.move(idic["ip"], user, rfile, "/usr/share/set/config/", sshkey)

        print green("\nStarting Apache....")
        fabfunky.apache_start(idic["ip"], user, sshkey)
        print green("Apache Started...")

    else:
        pass

    # Checks to see if the user wants an interactive shell or connect via ssh manually
    interactive = menus.inter_shell_menu()

    if interactive is False:

        print green("\nLaunching SET...")
        set_auto(idic["ip"], user, autofile, sshkey)
        print green("\nSET Launched Java Applet (PyInjector)..... browse to http://%s to test") % idic["ip"]

    elif interactive is True:

        print green("\nLaunching SET...")
        screen = set_auto(idic["ip"], user, autofile, sshkey)

        screen = screen.strip().split()
        sleep(2)
        if '.SET' in screen[5]:
            print screen[5]
            cmd = 'sudo screen -r %s' % screen[5]
            print red("\nDropping into a SSH shell....")
            print green("SET Launched Java Applet (PyInjector)..... browse to http://%s to test") % idic["ip"]
            print yellow("\nRemember if you want to disconnect from the screen session hit CTRL+A+D to detatch and exit...\n")
            sleep(2)
            fabfunky.interactive_shell(idic["ip"], user, cmd, sshkey)
        else:
            cmd = None
            print red("\nDropping into a SSH shell....\n")
            print red("No screen session returned.")
            fabfunky.interactive_shell(idic["ip"], user, cmd, sshkey)
コード例 #2
0
ファイル: setsolo.py プロジェクト: bostonlink/cloudPWN
def se_launch(idic, user, sshkey):

    # Parse the config file and unpack user options from autoset menu
    config = src.core.config.get_config()

    while True:
        try:
            sleep(2)
            print yellow("Attempting to establish a connection to %s" % idic["ip"])
            fabfunky.conn_est(idic["ip"], user, sshkey)
            break
        except Exception:
            print red("Instance is still initializing...")
            pass

    apache_status = apache_conf(config["set_config"])

    if apache_status == 'ON':

        if user == 'root':
            rfile = '/%s/set_config' % user
        else:
            rfile = '/home/%s/set_config' % user

        #uploads local SET config file
        fabfunky.file_upload(idic["ip"], user, config["set_config"], rfile, sshkey)
        fabfunky.move(idic["ip"], user, rfile, "/usr/share/set/config/", sshkey)
        print green("\nStarting Apache....")
        fabfunky.apache_start(idic["ip"], user, sshkey)
        print green("Apache Started...")

    else:
        pass

    interactive = menus.inter_shell_menu()

    if interactive is False:

        print green("\nLaunching SET...")
        set_launch(idic["ip"], user, sshkey)
        print green("\nSET Launched on %s") % idic["ip"]

    elif interactive is True:

        print green("\nLaunching SET...")
        screen = set_launch(idic["ip"], user, sshkey)
        print green("\nSET Launched on %s") % idic["ip"]

        screen = screen.strip().split()
        sleep(2)
        if '.SET' in screen[5]:
            print screen[5]
            cmd = 'sudo screen -r %s' % screen[5]
            print red("\nDropping into a SSH session....")
            print green("SET Launched %s") % idic["ip"]
            print yellow("\nRemember if you want to disconnect from the screen session hit CTRL+A+D to detatch and exit...\n")
            sleep(2)
            fabfunky.interactive_shell(idic["ip"], user, cmd, sshkey)
        else:
            cmd = None
            print red("\nDropping into a SSH session....\n")
            print red("No screen session returned.")
            fabfunky.interactive_shell(idic["ip"], user, cmd, sshkey)
コード例 #3
0
ファイル: setsolo.py プロジェクト: gamehacker/cloudPWN
def se_launch(idic, user, sshkey):

    # Parse the config file and unpack user options from autoset menu
    config = src.core.config.get_config()

    while True:
        try:
            sleep(2)
            print yellow("Attempting to establish a connection to %s" %
                         idic["ip"])
            fabfunky.conn_est(idic["ip"], user, sshkey)
            break
        except Exception:
            print red("Instance is still initializing...")
            pass

    apache_status = apache_conf(config["set_config"])

    if apache_status == 'ON':

        if user == 'root':
            rfile = '/%s/set_config' % user
        else:
            rfile = '/home/%s/set_config' % user

        #uploads local SET config file
        fabfunky.file_upload(idic["ip"], user, config["set_config"], rfile,
                             sshkey)
        fabfunky.move(idic["ip"], user, rfile, "/usr/share/set/config/",
                      sshkey)
        print green("\nStarting Apache....")
        fabfunky.apache_start(idic["ip"], user, sshkey)
        print green("Apache Started...")

    else:
        pass

    interactive = menus.inter_shell_menu()

    if interactive is False:

        print green("\nLaunching SET...")
        set_launch(idic["ip"], user, sshkey)
        print green("\nSET Launched on %s") % idic["ip"]

    elif interactive is True:

        print green("\nLaunching SET...")
        screen = set_launch(idic["ip"], user, sshkey)
        print green("\nSET Launched on %s") % idic["ip"]

        screen = screen.strip().split()
        sleep(2)
        if '.SET' in screen[5]:
            print screen[5]
            cmd = 'sudo screen -r %s' % screen[5]
            print red("\nDropping into a SSH session....")
            print green("SET Launched %s") % idic["ip"]
            print yellow(
                "\nRemember if you want to disconnect from the screen session hit CTRL+A+D to detatch and exit...\n"
            )
            sleep(2)
            fabfunky.interactive_shell(idic["ip"], user, cmd, sshkey)
        else:
            cmd = None
            print red("\nDropping into a SSH session....\n")
            print red("No screen session returned.")
            fabfunky.interactive_shell(idic["ip"], user, cmd, sshkey)