Ejemplo n.º 1
0
def main():
    parser = setParserOptions()
    options = parser.parse_args()

    # Stateless client connection
    stateless_client = CTRexStatelessClient(options.user, options.server, options.port, options.pub)
    rc = stateless_client.cmd_connect()
    if rc.bad():
        return

    if options.batch:
        cont = stateless_client.run_script_file(options.batch[0])
        if not cont:
            return
        
    # console
    try:
        console = TRexConsole(stateless_client, options.acquire, options.verbose)
        console.cmdloop()
    except KeyboardInterrupt as e:
        print "\n\n*** Caught Ctrl + C... Exiting...\n\n"
        return
Ejemplo n.º 2
0
def main():
    parser = setParserOptions()
    options = parser.parse_args()

    # Stateless client connection
    stateless_client = CTRexStatelessClient(options.user, options.server, options.port, options.pub)
    rc = stateless_client.cmd_connect()
    if rc.bad():
        return

    if options.batch:
        cont = stateless_client.run_script_file(options.batch[0])
        if not cont:
            return
        
    # console
    try:
        console = TRexConsole(stateless_client, options.acquire, options.verbose)
        console.cmdloop()
    except KeyboardInterrupt as e:
        print "\n\n*** Caught Ctrl + C... Exiting...\n\n"
        return
Ejemplo n.º 3
0
def main():
    parser = setParserOptions()
    options = parser.parse_args()

    # Stateless client connection
    stateless_client = CTRexStatelessClient(options.user, options.server,
                                            options.port, options.pub,
                                            options.quiet)

    if not options.quiet:
        print "\nlogged as {0}".format(format_text(options.user, 'bold'))

    # TUI or no acquire will give us READ ONLY mode
    if options.tui or not options.acquire:
        rc = stateless_client.connect("RO")
    else:
        rc = stateless_client.connect("RW")

    # unable to connect - bye
    if rc.bad():
        rc.annotate()
        return

    # a script mode
    if options.batch:
        cont = stateless_client.run_script_file(options.batch[0])
        if not cont:
            return

    # console
    try:
        console = TRexConsole(stateless_client, options.verbose)
        if options.tui:
            console.do_tui("")
        else:
            console.cmdloop()

    except KeyboardInterrupt as e:
        print "\n\n*** Caught Ctrl + C... Exiting...\n\n"

    finally:
        stateless_client.disconnect()
Ejemplo n.º 4
0
def main():
    parser = setParserOptions()
    options = parser.parse_args()

    # Stateless client connection
    stateless_client = CTRexStatelessClient(options.user, options.server, options.port, options.pub, options.quiet)

    if not options.quiet:
        print "\nlogged as {0}".format(format_text(options.user, 'bold'))

    # TUI or no acquire will give us READ ONLY mode
    if options.tui or not options.acquire:
        rc = stateless_client.connect("RO")
    else:
        rc = stateless_client.connect("RW")

    # unable to connect - bye
    if rc.bad():
        rc.annotate()
        return


    # a script mode
    if options.batch:
        cont = stateless_client.run_script_file(options.batch[0])
        if not cont:
            return
        
    # console

    try:
        console = TRexConsole(stateless_client, options.verbose)
        if options.tui:
            console.do_tui("")
        else:
            console.start()
            
    except KeyboardInterrupt as e:
        print "\n\n*** Caught Ctrl + C... Exiting...\n\n"

    finally:
        stateless_client.disconnect()