def run_xmlrpcserver(pipe_conn, port): server = xmlrpc.server.SimpleXMLRPCServer(('', port), requestHandler=_RequestHandler, allow_none=True) server.register_introspection_functions() server.register_instance(XMLRPCServer(pipe_conn)) server.serve_forever()
def main(): """Main.""" winutils.exit_if_admin() script_name = os.path.basename(sys.argv[0]) # in case it is full path script_name_no_ext = os.path.splitext(script_name)[0] log_filename = "%s.log" % (script_name_no_ext, ) format = ("%(asctime)s %(name)s %(levelname)s : %(message)s") logging.basicConfig(format=format, filename=log_filename, filemode='w', level=logging.DEBUG) c = wmi.WMI() for iface in c.Win32_NetworkAdapterConfiguration(IPEnabled=True): print("Local IP address: %s DNS %r" % (iface.IPAddress, iface.DNSDomain)) print("Starting PTS ...") pts = PyPTSWithXmlRpcCallback() print("OK") print("Serving on port {} ...".format(SERVER_PORT)) server = xmlrpc.server.SimpleXMLRPCServer(("", SERVER_PORT), allow_none=True) server.register_instance(pts) server.register_introspection_functions() server.serve_forever()
def main(): yara_object = YaraObject("yaraconnector") yara_object.set_feed_info(name="Yara", summary="Scan binaries collected by Carbon Black with Yara.", tech_data="There are no requirements to share any data with Carbon Black to use this feed.", provider_url="http://plusvic.github.io/yara/", icon_path="yara-logo.png", display_name="Yara") yara_object.start() #rpc interface to the rpcinterface in cbrprcinterface.py server = SimpleXMLRPCServer(('0.0.0.0', 9002), requestHandler=RequestHandler) server.register_introspection_functions() server.register_instance(yara_object) try: # Run the server's main loop server.serve_forever() except BaseException as bae: logger.debug("Yara eror {}".format(str(e))) finally: yara_object.stop()
def main(): """Main.""" winutils.exit_if_admin() script_name = os.path.basename(sys.argv[0]) # in case it is full path script_name_no_ext = os.path.splitext(script_name)[0] log_filename = "%s.log" % (script_name_no_ext,) format = ("%(asctime)s %(name)s %(levelname)s : %(message)s") logging.basicConfig(format=format, filename=log_filename, filemode='w', level=logging.DEBUG) print("Starting PTS ...") pts = PyPTSWithXmlRpcCallback() print("OK") print("Serving on port {} ...".format(SERVER_PORT)) server = xmlrpc.server.SimpleXMLRPCServer(("", SERVER_PORT), allow_none=True) server.register_instance(pts) server.register_introspection_functions() server.serve_forever()
def setup(host, port): manager = Meter.Manager() server = xmlrpc.server.SimpleXMLRPCServer((host, port), requestHandler=RequestHandler, logRequests=False) server.register_introspection_functions() for method in (manager.login, manager.get_job, manager.submit_reading, manager.get_status): server.register_function(method) return manager, server
def setup(host, port): manager = Meter.Manager() server = xmlrpc.server.SimpleXMLRPCServer((host, port), requestHandler=RequestHandler, logRequests=False) server.register_introspection_functions() for method in (manager.login, manager.get_job, manager.submit_reading, manager.get_status): server.register_function(method) return manager, server
def start_service(host, port, bv): info("Starting service on {}:{}".format(host, port)) server = xmlrpc.server.SimpleXMLRPCServer( (host, port), requestHandler=BinjaGefRequestHandler, logRequests=False, allow_none=True) server.register_introspection_functions() server.register_instance(Gef(server, bv)) dbg("Registered {} functions.".format(len(server.system_listMethods()))) while True: if hasattr(server, "shutdown") and server.shutdown == True: break server.handle_request() return
args.affinity = list(range(MAX_CPUS)) else: args.affinity = [] # Create the directory for writing raw outputs if args.output is not None: os.makedirs(args.output, exist_ok=True) # Return parsed and verified arguments return args # Need to synchronize with the sender before starting experiment server = xmlrpc.server.SimpleXMLRPCServer(("0.0.0.0", COMM_PORT), logRequests=False) server.register_introspection_functions() server_thread = threading.Thread(target=server.serve_forever, daemon=True) # Event objects to synchronize sender and receiver __sender_ready = threading.Event() __receiver_ready = threading.Event() __sender_done = threading.Event() # Stores the results from the receiver __results = {} # Functions to query/set synchronization events def mark_sender_ready(): __sender_ready.set() return True
def run_xmlrpcserver(pipe_conn, port): server = xmlrpc.server.SimpleXMLRPCServer( ('', port), requestHandler=_RequestHandler, allow_none=True) server.register_introspection_functions() server.register_instance(XMLRPCServer(pipe_conn)) server.serve_forever()
# create an SSL context self.context = ssl.SSLContext(ssl_version) self.context.load_cert_chain(certfile=certfile, keyfile=keyfile) xmlrpc.server.SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding) # call TCPServer constructor socketserver.TCPServer.__init__(self, addr, requestHandler, bind_and_activate) if fcntl is not None and hasattr(fcntl, 'FD_CLOEXEC'): flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD) flags |= fcntl.FD_CLOEXEC fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags) def get_request(self): newsocket, fromaddr = self.socket.accept() # create a server-side SSL socket sslsocket = self.context.wrap_socket(newsocket, server_side=True) return sslsocket, fromaddr def browser_function(url): browsercmd="iexplore.exe -k "+url #browsercmd="firefox "+url os.system(browsercmd) server = SecureXMLRPCServer(('localhost', 8000), 'cert.pem') server.register_introspection_functions() server.register_function(browser_function, 'browse') server.serve_forever()