Some python scrips for demonstrating chap protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python2
  2. import uuid
  3. from xmlrpc.server import SimpleXMLRPCServer
  4. from xmlrpc.server import SimpleXMLRPCRequestHandler
  5. # Restrict to a particular path.
  6. class RequestHandler(SimpleXMLRPCRequestHandler):
  7. rpc_paths = ('/RPC2',)
  8. # Create server
  9. server = SimpleXMLRPCServer(("localhost", 8000),
  10. requestHandler=RequestHandler)
  11. server.register_introspection_functions()
  12. # Register an instance; all the methods of the instance are
  13. # published as XML-RPC methods
  14. class CHAP:
  15. def __init__(self):
  16. self.key = 0;
  17. def init(self):
  18. self.key = str( uuid.uuid4() )
  19. return self.key
  20. server.register_instance(CHAP())
  21. # Run the server's main loop
  22. server.serve_forever()