Exemplo n.º 1
0
	def __init__( self, stream, handler, queue_dict, base_shell, ignore_messages = set(['X']), prompt_templ = "=|{stream}]> ~ ") :
		# print( ShellcodeSubShell )
		SimpleSubShell.__init__( self, stream, handler, queue_dict, base_shell, ignore_messages, prompt_templ )
		self.shellcode_buffer = ''

		self.download = None
		self.uplaod = None

		self.message_function = _response_manager
Exemplo n.º 2
0
 def __init__(self,
              stream,
              handler,
              queue_dict,
              base_shell,
              ignore_messages=set(['X']),
              prompt_templ=" (-){stream}(+)> "):
     SimpleSubShell.__init__(self, stream, handler, queue_dict, base_shell,
                             ignore_messages, prompt_templ)
     self.updatePrompt()
Exemplo n.º 3
0
 def __init__(self,
              stream,
              handler,
              queue_dict,
              base_shell,
              ignore_messages=set(['X']),
              prompt_templ="[{stream}]> "):
     # print( ShellcodeSubShell )
     SimpleSubShell.__init__(self, stream, handler, queue_dict, base_shell,
                             ignore_messages, prompt_templ)
     self.shellcode_buffer = ''
Exemplo n.º 4
0
 def __init__(self,
              stream,
              handler,
              queue_dict,
              base_shell,
              ignore_messages=set(['X']),
              prompt_templ=" (>{stream}<) |-> "):
     SimpleSubShell.__init__(self, stream, handler, queue_dict, base_shell,
                             ignore_messages, prompt_templ)
     self.updatePrompt()
     self.message_function = message_handle
     self.sysinfo = False
Exemplo n.º 5
0
    def __init__(self,
                 stream,
                 handler,
                 queue_dict,
                 base_shell,
                 ignore_messages=set(['X']),
                 prompt_templ=" ExampleSubShell Stream:[{stream}]==> "):
        SimpleSubShell.__init__(self, stream, handler, queue_dict, base_shell,
                                ignore_messages, prompt_templ)
        """A method that uses the `prompt_templ` argument
		to reformat the prompt
		(in case the `format()` {tags} have changed)"""
        self.updatePrompt()
Exemplo n.º 6
0
	def do_download( self, line ) :
		# cmd, args, line = self.parseline(line)
		if not line :
			self.help_download()
			return

		args = line.split()
		remote = args[0]

		if len(args) == 1 :
			local = remote.split('/')[-1]
		else :
			local = args[1]

		self.download = local
		comm = 'D:' + remote
		SimpleSubShell.default( self, comm )
Exemplo n.º 7
0
    def __init__(self,
                 stream,
                 handler,
                 queue_dict,
                 base_shell,
                 ignore_messages=set(),
                 prompt_templ="{stream} < "):
        SimpleSubShell.__init__(self, stream, handler, queue_dict, base_shell,
                                ignore_messages, prompt_templ)
        """A method that uses the `prompt_templ` argument
		to reformat the prompt
		(in case the `format()` {tags} have changed)"""
        self.updatePrompt()

        def meterpreter_send(message, instance):
            if message in ignore_messages: return
            print("[+] Received from Agent {")
            print("[!] '%s'" % message.encode('hex'))
            send_len = instance.proxy.send(message)
            instance.stats['incoming'] += len(message)
            print("[+] Message Delivered to Handler! (%d bytes)}" % send_len)

        print("Creating Proxy socket")
        self.proxy = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.proxy.connect(("127.0.0.1", 4444))  # Metasploits Handler
        print("Connected to meterpreter handler socket!")

        self.stats = {
            'incoming': 0,
            'outgoing': 0,
            'handler': None,
        }

        self.message_function = meterpreter_send
        sleep(0.1)
        self.proxy_thread = threading.Thread(target=meterpreter_proxy,
                                             args=(self.proxy, self))
        self.proxy_thread.daemon = True
        self.proxy_thread.start()

        self.pinger_thread = threading.Thread(target=self.ping_meterpreter)
        self.pinger_thread.daemon = True
        self.pinger_thread.start()
Exemplo n.º 8
0
	def do_upload( self, line ) :

		if not line :
			self.help_upload()
			return

		args = line.split()
		local = args[0]
		try :
			f = open(local,'rb')
			content = f.read()
			f.close()
		except :
			print(( "Could not open '%s' file" % local ))
			return
		if len(args) == 1 :
			remote = local.split('/')[-1]
		else :
			remote = args[1]
		self.upload = local
		comm = ('U:%s:' % remote) + content
		SimpleSubShell.default( self, comm )
Exemplo n.º 9
0
 def __init__(self,
              stream,
              handler,
              queue_dict,
              base_shell,
              ignore_messages=set(['X']),
              prompt_templ="[{stream}] {intent_str} "):
     # print ShellcodeSubShell
     SimpleSubShell.__init__(self, stream, handler, queue_dict, base_shell,
                             ignore_messages, prompt_templ)
     self.indentation = False
     self.python_buffer = ''
     self.file_buffer = ''
     # self.use_rawinput = False
     self.updatePrompt()
     self.special_commands = {
         'storage': self.showStorage,
         'pyload': self.loadFile,
         'show': self.showBuffer,
         'clear': self.clearBuffer,
         'send': self.sendFileBuffer,
         'append': self.appendFileBuffer,
     }