Example #1
0
	def __init__(self, divLogger, config_dict, decodersDict):
		self.shellcmds = []
		self.bindport_closed = False
		self.divLogger = divLogger
		self.config_dict = config_dict
		self.shellcode_manager = shellcode_mgr_core.shell_mgr(decodersDict, divLogger['shellcode'], config_dict)
		self.log_obj = amun_logging.amun_logging("bindport", divLogger['download'])
		self.shellemu = shellemulator.shellemulator(divLogger['shellemulator'])
		self.shellInfo = self.shellemu.getShellInfoLine()
Example #2
0
	def __init__(self, divLogger, config_dict, decodersDict):
		self.shellcmds = []
		self.bindport_closed = False
		self.divLogger = divLogger
		self.config_dict = config_dict
		self.shellcode_manager = shellcode_mgr_core.shell_mgr(decodersDict, divLogger['shellcode'], config_dict)
		self.log_obj = amun_logging.amun_logging("bindport", divLogger['download'])
		self.shellemu = shellemulator.shellemulator(divLogger['shellemulator'])
		self.shellInfo = self.shellemu.getShellInfoLine()
Example #3
0
	def __init__(self, item, currDownl, currentSockets, divLogger, event_dict, config_dict, display_shell, authkey, decodersDict):
		asyncore.dispatcher.__init__(self)
		self.log_obj = amun_logging.amun_logging("connback_download", divLogger['download'])
		self.connection_closed = False
		self.shellcode_manager = shellcode_mgr_core.shell_mgr(decodersDict, divLogger['shellcode'], config_dict)
		self.currentDownloads = currDownl
		self.currentSockets = currentSockets
		self.event_dict = event_dict
		self.config_dict = config_dict
		self.vulnName = item['vulnname']
		self.downURL = item['displayURL']
		self.dlident = item['dlident']
		self.victimIP = item['own_host']
		self.display_shell = display_shell
		self.active = False
		self.authkey = authkey
		self.content = []
		if self.display_shell:
			if config_dict['verbose_logging']==1:
				self.log_obj.log("displaying shell to %s" % (item['host']), 12, "debug", True, True)
			self.shellemu = shellemulator.shellemulator(divLogger['shellemulator'])
			self.buffer = self.shellemu.getShellInfoLine()
		elif authkey!="None":
			self.authkey = base64.b64decode(authkey)
			self.buffer = self.authkey
		else:
			self.buffer = ''
		self._address = (item['host'], int(item['port']))
		self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
		#self.bind( (item['own_host'], 0) )
		self.set_reuse_addr()
		self.identifier = "%s%s%s%s" % (self.dlident, item['host'], item['port'], item['own_host'])
		try:
			self.connect( self._address )
			self.active = True
		except socket.error, e:
			if e[0]==111:
				if config_dict['verbose_logging']==1:
					self.log_obj.log("failed to connect: connection refused (%s)" % (item['host']), 12, "crit", True, True)
				else:
					self.log_obj.log("failed to connect: connection refused (%s)" % (item['host']), 12, "crit", False, False)
			else:
				if config_dict['verbose_logging']==1:
					self.log_obj.log("failed to connect: %s (%s)" % (e, item['host']), 12, "crit", True, True)
				else:
					self.log_obj.log("failed to connect: %s (%s)" % (e, item['host']), 12, "crit", False, False)
			### add host to refused list, block connections for 3 minutes
			if self.config_dict['block_refused'] == 1:
				item_id = str(item['host'])
				self.event_dict['refused_connections'][item_id] = int(time.time())
			### close connection
			self.active = False
			self.handle_close()
Example #4
0
 def __init__(self, item, currDownl, currentSockets, divLogger, event_dict,
              config_dict, display_shell, authkey, decodersDict):
     asyncore.dispatcher.__init__(self)
     self.log_obj = amun_logging.amun_logging("connback_download",
                                              divLogger['download'])
     self.connection_closed = False
     self.shellcode_manager = shellcode_mgr_core.shell_mgr(
         decodersDict, divLogger['shellcode'], config_dict)
     self.currentDownloads = currDownl
     self.currentSockets = currentSockets
     self.event_dict = event_dict
     self.config_dict = config_dict
     self.vulnName = item['vulnname']
     self.downURL = item['displayURL']
     self.dlident = item['dlident']
     self.victimIP = item['own_host']
     self.display_shell = display_shell
     self.active = False
     self.authkey = authkey
     self.content = []
     if self.display_shell:
         if config_dict['verbose_logging'] == 1:
             self.log_obj.log("displaying shell to %s" % (item['host']), 12,
                              "debug", True, True)
         self.shellemu = shellemulator.shellemulator(
             divLogger['shellemulator'])
         self.buffer = self.shellemu.getShellInfoLine()
     elif authkey != "None":
         self.authkey = base64.b64decode(authkey)
         self.buffer = self.authkey
     else:
         self.buffer = ''
     self._address = (item['host'], int(item['port']))
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     #self.bind( (item['own_host'], 0) )
     self.set_reuse_addr()
     self.identifier = "%s%s%s%s" % (self.dlident, item['host'],
                                     item['port'], item['own_host'])
     try:
         self.connect(self._address)
         self.active = True
     except socket.error, e:
         if e[0] == 111:
             if config_dict['verbose_logging'] == 1:
                 self.log_obj.log(
                     "failed to connect: connection refused (%s)" %
                     (item['host']), 12, "crit", True, True)
             else:
                 self.log_obj.log(
                     "failed to connect: connection refused (%s)" %
                     (item['host']), 12, "crit", False, False)
         else:
             if config_dict['verbose_logging'] == 1:
                 self.log_obj.log(
                     "failed to connect: %s (%s)" % (e, item['host']), 12,
                     "crit", True, True)
             else:
                 self.log_obj.log(
                     "failed to connect: %s (%s)" % (e, item['host']), 12,
                     "crit", False, False)
         ### add host to refused list, block connections for 3 minutes
         if self.config_dict['block_refused'] == 1:
             item_id = str(item['host'])
             self.event_dict['refused_connections'][item_id] = int(
                 time.time())
         ### close connection
         self.active = False
         self.handle_close()