Python SocketServer.UDPServer() Examples
The following are 20
code examples of SocketServer.UDPServer().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
SocketServer
, or try the search function
.
Example #1
Source File: listener.py From pulseaudio-dlna with GNU General Public License v3.0 | 6 votes |
def run(self, ttl=None): if self.DISABLE_SSDP_LISTENER: return self.allow_reuse_address = True SocketServer.UDPServer.__init__( self, (self.host or '', self.SSDP_PORT), SSDPHandler) self.socket.setsockopt( socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, self._multicast_struct(self.SSDP_ADDRESS)) self.socket.setsockopt( socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, self.SSDP_TTL) if ttl: GObject.timeout_add(ttl * 1000, self.shutdown) setproctitle.setproctitle('ssdp_listener') self.serve_forever(self) logger.info('SSDPListener.run()')
Example #2
Source File: gamespy_natneg_server.py From dwc_network_server_emulator with GNU Affero General Public License v3.0 | 6 votes |
def __init__(self, server_address=dwc_config.get_ip_port('GameSpyNatNegServer'), RequestHandlerClass=GameSpyNatNegUDPServerHandler, bind_and_activate=True): SocketServer.UDPServer.__init__(self, server_address, RequestHandlerClass, bind_and_activate) self.session_list = {} self.natneg_preinit_session = {} self.secret_key_list = gs_utils.generate_secret_keys("gslist.cfg") self.server_manager = GameSpyServerDatabase( address=dwc_config.get_ip_port('GameSpyManager'), authkey="" ) self.server_manager.connect() self.write_queue = Queue.Queue() threading.Thread(target=self.write_queue_worker).start()
Example #3
Source File: testrun.py From honeypot with GNU General Public License v2.0 | 6 votes |
def run_udp(realport, fakeport, handler): class SingleUDPHandler(SocketServer.BaseRequestHandler): def handle(self): srcaddr, srcport = self.client_address print("Packet from {}:{}".format(srcaddr, srcport)) handler(self.request[1], self.request[0], self.client_address, fakeport) class SimpleServer(SocketServer.ThreadingMixIn, SocketServer.UDPServer): daemon_threads = True def __init__(self, server_address, RequestHandlerClass): SocketServer.UDPServer.__init__(self, server_address, RequestHandlerClass) server = SimpleServer(('127.0.0.1', realport), SingleUDPHandler) try: server.serve_forever() except KeyboardInterrupt: sys.exit(0)
Example #4
Source File: DNSListener.py From flare-fakenet-ng with Apache License 2.0 | 5 votes |
def __init__(self, server_address, config, logger, RequestHandlerClass): self.config = config self.logger = logger SocketServer.UDPServer.__init__(self, server_address, RequestHandlerClass)
Example #5
Source File: test_socketserver.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_UDPServer(self): self.run_server(SocketServer.UDPServer, SocketServer.DatagramRequestHandler, self.dgram_examine)
Example #6
Source File: test_socketserver.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_UDPServer(self): self.run_server(SocketServer.UDPServer, SocketServer.DatagramRequestHandler, self.dgram_examine)
Example #7
Source File: DNS.py From MITMf with GNU General Public License v3.0 | 5 votes |
def __init__(self, server_address, RequestHandlerClass): self.address_family = socket.AF_INET6 if DNSChef().ipv6 else socket.AF_INET SocketServer.UDPServer.__init__(self,server_address,RequestHandlerClass)
Example #8
Source File: dnschef.py From DNSChef with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, server_address, RequestHandlerClass, nametodns, nameservers, ipv6, log): self.nametodns = nametodns self.nameservers = nameservers self.ipv6 = ipv6 self.address_family = socket.AF_INET6 if self.ipv6 else socket.AF_INET self.log = log SocketServer.UDPServer.__init__(self,server_address,RequestHandlerClass)
Example #9
Source File: test_socketserver.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_UDPServer(self): self.run_server(SocketServer.UDPServer, SocketServer.DatagramRequestHandler, self.dgram_examine)
Example #10
Source File: DNS.py From piSociEty with GNU General Public License v3.0 | 5 votes |
def __init__(self, server_address, RequestHandlerClass): self.address_family = socket.AF_INET6 if DNSChef().ipv6 else socket.AF_INET SocketServer.UDPServer.__init__(self,server_address,RequestHandlerClass)
Example #11
Source File: vtest.py From vtest with Apache License 2.0 | 5 votes |
def start(self): server = SocketServer.UDPServer(("0.0.0.0", 53), DNSUDPHandler) server.serve_forever()
Example #12
Source File: test_socketserver.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_UDPServer(self): self.run_server(SocketServer.UDPServer, SocketServer.DatagramRequestHandler, self.dgram_examine)
Example #13
Source File: dnschef.py From break-fast-serial with MIT License | 5 votes |
def __init__(self, server_address, RequestHandlerClass, nametodns, nameservers, ipv6, log): self.nametodns = nametodns self.nameservers = nameservers self.ipv6 = ipv6 self.address_family = socket.AF_INET6 if self.ipv6 else socket.AF_INET self.log = log SocketServer.UDPServer.__init__(self,server_address,RequestHandlerClass)
Example #14
Source File: main.py From dnsAutoRebinding with GNU General Public License v3.0 | 5 votes |
def __init__(self,options): SocketServer.UDPServer.__init__(self, ('0.0.0.0', 53), self.sHandle) self.timeout = 3 self.options = options
Example #15
Source File: test_socketserver.py From oss-ftp with MIT License | 5 votes |
def test_UDPServer(self): self.run_server(SocketServer.UDPServer, SocketServer.DatagramRequestHandler, self.dgram_examine)
Example #16
Source File: test_socketserver.py From BinderFilter with MIT License | 5 votes |
def test_UDPServer(self): self.run_server(SocketServer.UDPServer, SocketServer.DatagramRequestHandler, self.dgram_examine)
Example #17
Source File: ggposrv.py From ggposrv with GNU General Public License v2.0 | 5 votes |
def __init__(self, server_address, MyUDPHandler): self.quarkqueue = {} SocketServer.UDPServer.__init__(self, server_address, MyUDPHandler)
Example #18
Source File: statsd_mock_server.py From designate with Apache License 2.0 | 5 votes |
def main(): args = parse_args() fd = open(args.output_fname, 'a') if args.output_fname else None StatsdMessageHandler._output_fd = fd server = SocketServer.UDPServer( (args.addr, args.port), StatsdMessageHandler, ) server.serve_forever()
Example #19
Source File: syslog_server.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def __init__(self, address): socketserver.UDPServer.__init__(self, address, RequestHandlerUdp)
Example #20
Source File: test_supervisor_logging.py From supervisor-logging with Apache License 2.0 | 4 votes |
def test_logging(self): """ Test logging. """ messages = [] class SyslogHandler(socketserver.BaseRequestHandler): """ Save received messages. """ def handle(self): messages.append(self.request[0].strip().decode()) syslog = socketserver.UDPServer(('0.0.0.0', 0), SyslogHandler) try: threading.Thread(target=syslog.serve_forever).start() env = os.environ.copy() env['SYSLOG_SERVER'] = syslog.server_address[0] env['SYSLOG_PORT'] = str(syslog.server_address[1]) env['SYSLOG_PROTO'] = 'udp' mydir = os.path.dirname(__file__) supervisor = subprocess.Popen( ['supervisord', '-c', os.path.join(mydir, 'supervisord.conf')], env=env, ) try: sleep(3) pid = subprocess.check_output( ['supervisorctl', 'pid', 'messages'] ).decode().strip() sleep(8) self.assertEqual( list(map(strip_volatile, messages)), ['<14>DATE HOST messages[{pid}]: Test {i} \n\x00'.format( pid=pid, i=i) for i in range(4)] ) finally: supervisor.terminate() finally: syslog.shutdown()