Пример #1
0
    def __init__(self, name, call, session, local_address, local_port, remote_address, remote_port, bistream_enabled = False, pcap = None):
        logger.debug("{!s} __init__".format(self))
        connection.__init__(self, 'udp')

        self._call = call
        self._name = name
        self._pcap = pcap
        self._session = session

        # Bind to free random port for incoming RTP traffic
        self.bind(local_address, local_port)
        self.connect(remote_address, remote_port)

        # The address and port of the remote host
        self.remote.host = remote_address
        self.remote.port = remote_port

        self._bistream = []
        self._bistream_enabled = bistream_enabled

        # Send byte buffer
        self.__sendBuffer = b''

        # ToDo:
        # Report incident
        # ToDo:
        #i = incident("dionaea.modules.python.sip.rtp")
        #i.con = self
        #i.dumpfile = self.__streamDumpFileIn
        #i.report()

        logger.info("Created RTP channel on ports :{} <-> :{}".format(
            self.local.port, self.remote.port))
Пример #2
0
    def __init__(self, proto='tcp'):
        logger.debug("http test")
        connection.__init__(self,proto)
        self.state = 'HEADER'
        self.rwchunksize = 64*1024
        self._out.speed.limit = 16*1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0
        max_request_size = 32768

        try:
            if 'max-request-size' in g_dionaea.config()['modules']['python']['http']:
                # try to convert value to int
                max_request_size = int(
                    g_dionaea.config()['modules']['python']['http']['max-request-size'])
            else:
                logger.info(
                    "Value for 'max-request-size' not found, using default value.")
        except:
            logger.warning(
                "Error while converting 'max-request-size' to an integer value. Using default value.")

        self.max_request_size = max_request_size * 1024
Пример #3
0
    def __init__(self, name, call, session, local_address, local_port, remote_address, remote_port, bistream_enabled = False, pcap = None):
        logger.debug("{!s} __init__".format(self))
        connection.__init__(self, 'udp')

        self._call = call
        self._name = name
        self._pcap = pcap
        self._session = session

        # Bind to free random port for incoming RTP traffic
        self.bind(local_address, local_port)
        self.connect(remote_address, remote_port)

        # The address and port of the remote host
        self.remote.host = remote_address
        self.remote.port = remote_port

        self._bistream = []
        self._bistream_enabled = bistream_enabled

        # Send byte buffer
        self.__sendBuffer = b''

        # ToDo:
        # Report incident
        # ToDo:
        #i = incident("dionaea.modules.python.sip.rtp")
        #i.con = self
        #i.dumpfile = self.__streamDumpFileIn
        #i.report()

        logger.info("Created RTP channel on ports :{} <-> :{}".format(
            self.local.port, self.remote.port))
Пример #4
0
    def __init__(self, proto="tcp"):
        logger.debug("http test")
        connection.__init__(self, proto)
        self.state = STATE_HEADER
        self.header = None
        self.rwchunksize = 64 * 1024
        self._out.speed.limit = 16 * 1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0

        self.headers = []
        self.max_request_size = 32768 * 1024
        self.download_dir = None
        self.download_suffix = ".tmp"
        self._default_headers = [("Content-Type", "{content_type}"),
                                 ("Content-Length", "{content_length}"),
                                 ("Connection", "{connection}")]
        self.default_headers = Headers(self._default_headers)
        self.root = None
        self.global_template = None
        self.file_template = None
        self.template_autoindex = None
        self.template_error_pages = None
        self.template_file_extension = ".j2"
        self.template_values = {}
Пример #5
0
    def __init__(self, proto='tcp'):
        logger.debug("http test")
        connection.__init__(self, proto)
        self.state = 'HEADER'
        self.rwchunksize = 64 * 1024
        self._out.speed.limit = 16 * 1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0
        max_request_size = 32768

        try:
            if 'max-request-size' in g_dionaea.config(
            )['modules']['python']['http']:
                # try to convert value to int
                max_request_size = int(g_dionaea.config()['modules']['python']
                                       ['http']['max-request-size'])
            else:
                logger.info(
                    "Value for 'max-request-size' not found, using default value."
                )
        except:
            logger.warning(
                "Error while converting 'max-request-size' to an integer value. Using default value."
            )

        self.max_request_size = max_request_size * 1024
Пример #6
0
 def __init__(self, peer=None):
     logger.debug("nfqmirror connection %s %s" %
                  (peer.remote.host, peer.local.host))
     connection.__init__(self, peer.transport)
     self.bind(peer.local.host, 0)
     self.connect(peer.remote.host, peer.local.port)
     self.peer = peer
Пример #7
0
 def __init__(self,
              server='localhost',
              port=5222,
              username=None,
              password=None,
              resource=None,
              muc=None,
              channels=None):
     if channels is None:
         channels = []
     connection.__init__(self, 'tls')
     self.server = username.split('@')[1]
     self.port = port
     self.username = username.split('@')[0]
     self.password = password
     self.state = "connecting"
     self.__nsmap__ = __nsmap__
     self.parser = xmppparser(self)
     self.muc = muc
     self.xmlroot = None
     self.element = None
     self.elements = []
     self.timeouts.reconnect = 10.0
     self.timeouts.handshake = 10.0
     self.channels = channels
     self.resource = resource
     self.joined = 0
     self.me = '%s@%s/%s' % (self.username, self.server, self.resource)
     self.timeouts.idle = 10 * 60  # default to 10 minutes idle timeout
     self.ids = {}
     logger.info("I am %s" % username + '/' + resource)
Пример #8
0
    def __init__(self, proto="tcp"):
        logger.debug("http test")
        connection.__init__(self, proto)
        self.state = STATE_HEADER
        self.header = None
        self.rwchunksize = 64*1024
        self._out.speed.limit = 16*1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0

        self.headers = []
        self.max_request_size = 32768 * 1024
        self.download_dir = None
        self.download_suffix = ".tmp"
        self._default_headers = [
            ("Content-Type", "{content_type}"),
            ("Content-Length", "{content_length}"),
            ("Connection", "{connection}")
        ]
        self.default_headers = Headers(self._default_headers)
        self.root = None
        self.global_template = None
        self.file_template = None
        self.soap_enabled = False
        self.template_autoindex = None
        self.template_error_pages = None
        self.template_file_extension = ".j2"
        self.template_values = {}
Пример #9
0
 def __init__(self, peer=None):
     logger.debug("nfqmirror connection %s %s" %
                  ( peer.remote.host, peer.local.host))
     connection.__init__(self,peer.transport)
     self.bind(peer.local.host,0)
     self.connect(peer.remote.host,peer.local.port)
     self.peer = peer
Пример #10
0
    def __init__(self, proto='udp'):
        connection.__init__(self, proto)
        self.state = 'HEADER'
        self.rwchunksize = 64 * 1024
        self._out.speed.limit = 16 * 1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0
        max_request_size = 32768
        self.personalities = ''
        self.loaded = ''

        try:
            if 'max-request-size' in g_dionaea.config(
            )['modules']['python']['upnp']:
                # try to convert value to int
                max_request_size = int(g_dionaea.config()['modules']['python']
                                       ['upnp']['max-request-size'])
            else:
                logger.info(
                    "Value for 'max-request-size' not found, using default value."
                )
        except:
            logger.warning(
                "Error while converting 'max-request-size' to an integer value. Using default value."
            )

        self.max_request_size = max_request_size * 1024

        # load the UPnP device personalities from dionaea.conf file
        try:
            if 'personalities-enable' in g_dionaea.config(
            )['modules']['python']['upnp']:
                loaded = g_dionaea.config(
                )['modules']['python']['upnp']['personalities-enable']
                self.personalities = g_dionaea.config()['modules']['python'][
                    'upnp']['personalities'][loaded]['cache']
                self.personalities += g_dionaea.config(
                )['modules']['python']['upnp']['personalities'][loaded]['st']
                self.personalities += g_dionaea.config(
                )['modules']['python']['upnp']['personalities'][loaded]['usn']
                self.personalities += g_dionaea.config()['modules']['python'][
                    'upnp']['personalities'][loaded]['server']
                self.personalities += g_dionaea.config()['modules']['python'][
                    'upnp']['personalities'][loaded]['location']
                self.personalities += g_dionaea.config(
                )['modules']['python']['upnp']['personalities'][loaded]['opt']

                logger.info(
                    "loading emulated UPnP device with personalities: '" +
                    loaded + "'")
            else:
                logger.info(
                    "Value for 'personalities' not found, using default value."
                )
        except:
            logger.warning(
                "Error while retrieve 'personalities'. Using default value.")
Пример #11
0
	def __init__(self, con=None):
		connection.__init__(self,'tcp')
		cmdexe.__init__(self, self.send)
		self.timeouts.listen = 10
		self.timeouts.connecting = 5
		self.timeouts.idle = 1
		self.timeouts.sustain = 15
		self._in.accounting.limit = 1024
Пример #12
0
 def __init__(self):
     """Class constructor. Note that the state property must be a TftpState
     object."""
     self.options = None
     self.state = TftpState()
     self.dups = 0
     self.errors = 0
     connection.__init__(self, 'udp')
Пример #13
0
 def __init__(self):
     """Class constructor. Note that the state property must be a TftpState
     object."""
     self.options = None
     self.state = TftpState()
     self.dups = 0
     self.errors = 0
     connection.__init__(self, 'udp')
Пример #14
0
 def __init__(self):
     connection.__init__(self, "tcp")
     self.buf = b''
     self.pending_packet_type = None
     self.state = self.IDLE
     self.firmware_revision = 1
     self.hostname = ""
     self.vendor_name = ""
Пример #15
0
 def __init__(self):
     connection.__init__(self, "tcp")
     self.config = None
     self.state = ""
     self.regex_statement = re.compile(
         b"""([A-Za-z0-9_.]+\(.*?\)+|\(.*?\)+|"(?:[^"]|\"|"")*"+|'[^'](?:|\'|'')*'+|`(?:[^`]|``)*`+|[^ ,]+|,)"""
     )
     self.download_dir = None
     self.download_suffix = ".tmp"
Пример #16
0
 def __init__(self):
     connection.__init__(self, "tcp")
     self.config = None
     self.state = ""
     self.regex_statement = re.compile(
         b"""([A-Za-z0-9_.]+\(.*?\)+|\(.*?\)+|"(?:[^"]|\"|"")*"+|'[^'](?:|\'|'')*'+|`(?:[^`]|``)*`+|[^ ,]+|,)"""
     )
     self.download_dir = None
     self.download_suffix = ".tmp"
Пример #17
0
    def __init__(self, proto = None):
        logger.debug("{!s} __init__".format(self))

        connection.__init__(self, proto)

        self.personality = g_sipconfig.get_personality_by_address(self.local.host)

        logger.info("SIP Session created with personality '{}'".format(self.personality))
        self._auth = None
        self._state = None
Пример #18
0
	def __init__(self, server, port, ident, secret):
		logger.debug('hpclient init')
		connection.__init__(self, 'tcp')
		self.unpacker = FeedUnpack()
		self.ident, self.secret = ident.encode('latin1'), secret.encode('latin1')

		self.connect(server, port)
		self.timeouts.reconnect = 10.0
		self.sendfiles = []
		self.filehandle = None
Пример #19
0
 def __init__(self):
     connection.__init__(self, "tcp")
     self.state = {
         'lastcmd': None,
         'readcount': 0,
         'stop': False,
     }
     self.buf = b''
     self.outbuf = None
     self.fids = {}
     self.printer = b''  # spoolss file "queue"
Пример #20
0
 def __init__(self, proto='tcp'):
     connection.__init__(self, proto)
     logger.debug("ftp test")
     self.state = self.UNAUTH
     self.user = '******'
     self.dtp = None
     self.cwd = '/'
     self.basedir = '/tmp/ranz'
     self.dtp = None
     self.dtf = None
     self.limits = {}  #{ '_out' : 8192 }
Пример #21
0
 def __init__ (self):
     connection.__init__(self,"tcp")
     self.state = {
         'lastcmd': None,
         'readcount': 0,
         'stop': False,
     }
     self.buf = b''
     self.outbuf = None
     self.fids = {}
     self.printer = b'' # spoolss file "queue"
Пример #22
0
    def __init__(self, proto = None, config=None):
        logger.debug("{!s} __init__".format(self))

        connection.__init__(self, proto)
        self.config = SipConfig(config=config)

        self.personality = self.config.get_personality_by_address(self.local.host)

        logger.info("SIP Session created with personality '{}'".format(self.personality))
        self._auth = None
        self._state = None
Пример #23
0
    def __init__(self, proto="tcp"):
        connection.__init__(self, proto)
        self.download_dir = None
        self.root = None

        self.pjl_response_regexes = []
        self.pjl_responses = dict(pjl_default_responses.items())

        self.state = self.STATE_INIT
        self.pjl_program_delimiter = None
        self.pcl_file_handle = None
Пример #24
0
 def __init__ (self, proto='tcp'):
     connection.__init__(self, proto)
     logger.debug("ftp test")
     self.state = self.UNAUTH
     self.user = '******'
     self.dtp = None
     self.cwd = '/'
     self.basedir = '/tmp/ranz'
     self.dtp = None
     self.dtf = None
     self.limits = {}#{ '_out' : 8192 }
Пример #25
0
	def __init__(self, server, port, ident, secret):
		logger.debug('hpclient init')
		connection.__init__(self, 'tcp')
		self.unpacker = FeedUnpack()
		self.ident, self.secret = ident.encode('latin1'), secret.encode('latin1')

		self.connect(server, port)
		self.timeouts.reconnect = 10.0
		self.sendfiles = []
		self.msgqueue = []
		self.filehandle = None
		self.connected = False
Пример #26
0
 def __init__(self, proto='tcp'):
     connection.__init__(self, proto)
     logger.debug("ftp test")
     self.state = self.UNAUTH
     self.user = '******'
     self.cwd = '/'
     self.basedir = None
     self.dtp = None
     self.dtf = None
     self.limits = {}  # { '_out' : 8192 }
     # Copy default response messages
     self.response_msgs = dict(RESPONSE.items())
Пример #27
0
 def __init__(self, proto='tcp'):
     connection.__init__(self, proto)
     logger.debug("ftp test")
     self.state = self.UNAUTH
     self.user = '******'
     self.cwd = '/'
     self.basedir = None
     self.dtp = None
     self.dtf = None
     self.limits = {}  # { '_out' : 8192 }
     # Copy default response messages
     self.response_msgs = dict(RESPONSE.items())
Пример #28
0
    def __init__ (self, proto="tcp", config=None):
        connection.__init__(self,"tcp")
        self.state = {
            'lastcmd': None,
            'readcount': 0,
            'stop': False,
        }
        self.buf = b''
        self.buf2 = b''  # ms17-010 SMB_COM_TRANSACTION2
        self.outbuf = None
        self.fids = {}
        self.printer = b'' # spoolss file "queue"

        self.config = None
Пример #29
0
	def __init__(self, proto='udp'):
		connection.__init__(self,proto)
		self.state = 'HEADER'
		self.rwchunksize = 64*1024
		self._out.speed.limit = 16*1024
		self.env = None
		self.boundary = None
		self.fp_tmp = None
		self.cur_length = 0
		self.personalities = ''
		self.loaded = ''
		self.root = ""

		# 32MB
		self.max_request_size = 32768 * 1024
Пример #30
0
    def __init__(self, proto='udp'):
        connection.__init__(self, proto)
        self.state = 'HEADER'
        self.rwchunksize = 64 * 1024
        self._out.speed.limit = 16 * 1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0
        self.personalities = ''
        self.loaded = ''
        self.root = ""

        # 32MB
        self.max_request_size = 32768 * 1024
Пример #31
0
 def __init__(self, proto='tcp'):
     connection.__init__(self, proto)
     logger.debug("ftp test")
     self.state = self.UNAUTH
     self.user = '******'
     self.dtp = None
     self.cwd = '/'
     self.basedir = '/tmp/ranz'
     self.dtp = None
     self.dtf = None
     self.limits = {}  # { '_out' : 8192 }
     # Copy default response messages
     self._response_msgs = dict(RESPONSE.items())
     msgs = g_dionaea.config()["modules"]["python"]["ftp"].get("response_messages", {})
     self._response_msgs.update(msgs)
Пример #32
0
 def __init__(self, proto='tcp'):
     connection.__init__(self, proto)
     logger.debug("ftp test")
     self.state = self.UNAUTH
     self.user = '******'
     self.dtp = None
     self.cwd = '/'
     self.basedir = '/tmp/ranz'
     self.dtp = None
     self.dtf = None
     self.limits = {}  # { '_out' : 8192 }
     # Copy default response messages
     self._response_msgs = dict(RESPONSE.items())
     msgs = g_dionaea.config()["modules"]["python"]["ftp"].get(
         "response_messages", {})
     self._response_msgs.update(msgs)
Пример #33
0
    def __init__(self, proto, call_id, session, invite_message):
        logger.debug("{!s} __init__".format(self))

        logger.debug("SipCall {} session {} ".format(self, session))
        connection.__init__(self, proto)
        # Store incoming information of the remote host

        self.__session = session
        self.__state = SipCall.SESSION_SETUP
        self.__msg = invite_message
        # list of messages
        self._msg_stack = []

        self.__call_id = invite_message.headers.get(b"call-id").value
        self._call_id = call_id
        self._rtp_streams = {}

        self.local.host = self.__session.local.host
        self.local.port = self.__session.local.port

        self.remote.host = self.__session.remote.host
        self.remote.port = self.__session.remote.port

        user = self.__msg.headers.get(b"to").get_raw().uri.user

        self._user = g_sipconfig.get_user_by_username(
            self.__session.personality, user)

        # fake a connection entry
        i = incident("dionaea.connection.udp.connect")
        i.con = self
        i.report()

        global _SipCall_sustain_timeout

        # Global timers
        self._timers = {
            "idle":
            pyev.Timer(60.0, 60.0, g_default_loop, self.__handle_timeout_idle),
            "invite_handler":
            pyev.Timer(5.0, 0.0, g_default_loop, self.__handle_invite),
        }

        self._timers["idle"].start()
Пример #34
0
	def __init__(self, proto, call_id, session, invite_message):
		logger.debug("{!s} __init__".format(self))

		logger.debug("SipCall {} session {} ".format(self, session))
		connection.__init__(self, proto)
		# Store incoming information of the remote host

		self.__session = session
		self.__state = SipCall.SESSION_SETUP
		self.__msg = invite_message
		# list of messages
		self._msg_stack = []

		self.__call_id = invite_message.headers.get(b"call-id").value
		self._call_id = call_id
		self._rtp_streams = {}

		self.local.host = self.__session.local.host
		self.local.port = self.__session.local.port

		self.remote.host = self.__session.remote.host
		self.remote.port = self.__session.remote.port

		user = self.__msg.headers.get(b"to").get_raw().uri.user

		self._user = g_sipconfig.get_user_by_username(
			self.__session.personality,
			user
		)

		# fake a connection entry
		i = incident("dionaea.connection.udp.connect")
		i.con = self
		i.report()

		global _SipCall_sustain_timeout

		# Global timers
		self._timers = {
			"idle": pyev.Timer(60.0, 60.0, g_default_loop, self.__handle_timeout_idle),
			"invite_handler": pyev.Timer(5.0, 0.0, g_default_loop, self.__handle_invite),
		}

		self._timers["idle"].start()
Пример #35
0
    def __init__(self, proto="tcp"):
        logger.debug("http test")
        connection.__init__(self, proto)
        self.state = 'HEADER'
        self.rwchunksize = 64 * 1024
        self._out.speed.limit = 16 * 1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0

        self.headers = []
        self.max_request_size = 32768 * 1024
        self.download_dir = None
        self.download_suffix = ".tmp"
        self._default_headers = [("Content-Type", "{content_type}"),
                                 ("Content-Length", "{content_length}"),
                                 ("Connection", "{connection}")]
        self.default_headers = Headers(self._default_headers)
        self.root = None
Пример #36
0
	def __init__(self, proto='udp'):
		connection.__init__(self,proto)
		self.state = 'HEADER'
		self.rwchunksize = 64*1024
		self._out.speed.limit = 16*1024
		self.env = None
		self.boundary = None
		self.fp_tmp = None
		self.cur_length = 0
		max_request_size = 32768
		self.personalities = ''
		self.loaded = ''

		try:
			if 'max-request-size' in g_dionaea.config()['modules']['python']['upnp']:
				# try to convert value to int
				max_request_size = int(g_dionaea.config()['modules']['python']['upnp']['max-request-size'])
			else:
				logger.info("Value for 'max-request-size' not found, using default value.")
		except:
			logger.warning("Error while converting 'max-request-size' to an integer value. Using default value.")

		self.max_request_size = max_request_size * 1024

		# load the UPnP device personalities from dionaea.conf file 
		try:
			if 'personalities-enable' in g_dionaea.config()['modules']['python']['upnp']:
				loaded = g_dionaea.config()['modules']['python']['upnp']['personalities-enable']
				self.personalities = g_dionaea.config()['modules']['python']['upnp']['personalities'][loaded]['cache']
				self.personalities += g_dionaea.config()['modules']['python']['upnp']['personalities'][loaded]['st']
				self.personalities += g_dionaea.config()['modules']['python']['upnp']['personalities'][loaded]['usn']
				self.personalities += g_dionaea.config()['modules']['python']['upnp']['personalities'][loaded]['server']
				self.personalities += g_dionaea.config()['modules']['python']['upnp']['personalities'][loaded]['location']
				self.personalities += g_dionaea.config()['modules']['python']['upnp']['personalities'][loaded]['opt']

				logger.info("loading emulated UPnP device with personalities: '" + loaded + "'")
			else:
				logger.info("Value for 'personalities' not found, using default value.")
		except:
			logger.warning("Error while retrieve 'personalities'. Using default value.")
Пример #37
0
    def __init__(self, proto="tcp"):
        logger.debug("http test")
        connection.__init__(self, proto)
        self.state = STATE_HEADER
        self.header: Optional[httpreq] = None
        self.rwchunksize = 64 * 1024
        self._out.speed.limit = 16 * 1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0
        self.content_length: Optional[int] = None
        self.content_type: Optional[str] = None

        self.headers = []
        self.max_request_size = 32768 * 1024
        self.download_dir = None
        self.download_suffix = ".tmp"
        self._default_headers = [("Content-Type", "{content_type}"),
                                 ("Content-Length", "{content_length}"),
                                 ("Connection", "{connection}")]
        self.default_content_type = "text/html; charset=utf-8"
        self.default_headers = Headers(self._default_headers)
        self.detect_content_type = True
        self.get_max_num_fields = 100
        self.root = None
        self.global_template = None
        self.file_template = None
        self.soap_enabled = False
        self.template_autoindex = None
        self.template_enabled = False
        self.template_error_pages = None
        self.template_file_extension = ".j2"
        self.template_values = {}

        # Use own class so we can add additional files later
        self._mimetypes = mimetypes.MimeTypes()

        self.request_form: Optional[cgi.FieldStorage] = None
Пример #38
0
    def __init__(self, proto="tcp"):
        logger.debug("http test")
        connection.__init__(self, proto)
        self.state = 'HEADER'
        self.rwchunksize = 64*1024
        self._out.speed.limit = 16*1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0

        self.headers = []
        self.max_request_size = 32768 * 1024
        self.download_dir = None
        self.download_suffix = ".tmp"
        self._default_headers = [
            ("Content-Type", "{content_type}"),
            ("Content-Length", "{content_length}"),
            ("Connection", "{connection}")
        ]
        self.default_headers = Headers(self._default_headers)
        self.root = None
Пример #39
0
	def __init__(self, server='localhost', port=5222, username=None, password=None, resource=None, muc=None, channels=[]):
		connection.__init__(self, 'tls')
		self.server = username.split('@')[1]
		self.port = port
		self.username = username.split('@')[0]
		self.password = password
		self.state = "connecting"
		self.__nsmap__ = __nsmap__
		self.parser = xmppparser(self)
		self.muc = muc
		self.xmlroot = None
		self.element = None
		self.elements = []
		self.timeouts.reconnect = 10.0
		self.timeouts.handshake = 10.0
		self.channels = channels
		self.resource = resource
		self.joined = 0
		self.me = '%s@%s/%s' % (self.username, self.server, self.resource)
		self.timeouts.idle = 10 * 60 # default to 10 minutes idle timeout
		self.ids = {}
		logger.info("I am %s" % username + '/' + resource)
Пример #40
0
 def __init__(self):
     connection.__init__(self, "tcp")
     self.buf = b""
Пример #41
0
 def __init__(self, proto=None, host=None, port=None, iface=None):
     connection.__init__(self,proto)
     if host:
         self.bind(host, port, iface)
         self.listen()
     self.peer=None
Пример #42
0
 def __init__(self, p0fpath, con):
     connection.__init__(self, 'tcp')
     self.con = con
     self.con.ref()
     self.connect(p0fpath, 0)
Пример #43
0
 def __init__(self, ftp, config=None):
     connection.__init__(self, "tcp")
     self.ftp = ftp
     self.state = "NONE"
     self.timeouts.sustain = 60
Пример #44
0
 def __init__(self, p0fpath, con):
     connection.__init__(self, 'tcp')
     self.con = con
     self.con.ref()
     self.connect(p0fpath, 0)
Пример #45
0
 def __init__(self, ftp):
     connection.__init__(self, 'tcp')
     self.ftp = ftp
     self.state = 'NONE'
     self.timeouts.sustain = 60
Пример #46
0
 def __init__ (self, ctrl=None):
     connection.__init__(self,'tcp')
     self.ctrl = ctrl
     self.mode = None
Пример #47
0
 def __init__(self, ftp):
     connection.__init__(self, 'tcp')
     self.ftp = ftp
     self.state = 'NONE'
     self.timeouts.sustain = 60
Пример #48
0
 def __init__(self):
     connection.__init__(self, "tcp")
     if bson is None:
         logger.warning("Unable to load 'bson' module. Some functions might be very limited.")
     self.config = None
     self.state = ""
Пример #49
0
    def __init__(self, proto='tcp'):
        logger.debug("http test")
        connection.__init__(self, proto)
        self.state = 'HEADER'
        self.rwchunksize = 64*1024
        self._out.speed.limit = 16*1024
        self.env = None
        self.boundary = None
        self.fp_tmp = None
        self.cur_length = 0
        max_request_size = 32768
        default_headers = [
            ("Content-Type", "{content_type}"),
            ("Content-Length", "{content_length}"),
            ("Connection", "{connection}")

        ]
        default_headers = g_dionaea.config()['modules']['python']['http'].get('default_headers', default_headers)
        global_headers = g_dionaea.config()['modules']['python']['http'].get('global_headers', [])

        self.default_headers = Headers(default_headers, global_headers=global_headers)

        headers = g_dionaea.config()['modules']['python']['http'].get('headers', [])
        self.headers = []
        for header in headers:
            self.headers.append(
                Headers(
                    header.get("headers", []),
                    global_headers=global_headers,
                    filename_pattern=header.get("filename_pattern"),
                    status_codes=header.get("status_codes")
                )
            )

        self.headers.append(
            Headers(
                [
                    ("Location", "{location}"),
                    ("Connection", "{connection}")
                ],
                global_headers=global_headers,
                status_codes=[301, 302]
            )
        )

        self.headers.append(
            Headers(
                [
                    ("Allow", "{allow}"),
                    ("Connection", "{connection}")
                ],
                global_headers=global_headers,
                methods=["options"]
            )
        )

        conf_max_request_size = g_dionaea.config()['modules']['python']['http'].get('max-request-size')
        if conf_max_request_size is None:
            logger.info("Value for 'max-request-size' not found, using default value.")
        else:
            try:
                max_request_size = int(conf_max_request_size)
            except ValueError:
                logger.warning("Error while converting 'max-request-size' to an integer value. Using default value.")

        self.max_request_size = max_request_size * 1024
Пример #50
0
 def __init__(self):
     connection.__init__(self, "tcp")
     self.buf = b''
Пример #51
0
 def __init__(self, ftp=None):
     connection.__init__(self, 'tcp')
     self.ftp = ftp
     self.timeouts.listen = 10
Пример #52
0
 def __init__(self, ctrl=None):
     connection.__init__(self, 'tcp')
     self.ctrl = ctrl
     self.mode = None
Пример #53
0
 def __init__ (self):
     connection.__init__(self,"tcp")
     smbd.__init__(self)
Пример #54
0
 def __init__(self, ftp=None):
     connection.__init__(self, 'tcp')
     self.ftp = ftp
     self.timeouts.listen = 10
Пример #55
0
 def __init__(self, proto=None):
     connection.__init__(self,proto)
     self.peer=None
Пример #56
0
 def __init__(self, proto):
     logger.debug("start blackhole")
     connection.__init__(self, proto)
Пример #57
0
 def __init__(self, ftp=None):
     connection.__init__(self, "tcp")
     self.ftp = ftp
     self.fileobj = None
     self.timeouts.listen = 10