Some python scrips for demonstrating chap protocol
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

chap-client.py 512B

1234567891011121314151617
  1. #!/usr/bin/env python2
  2. import xmlrpc.client
  3. import hashlib
  4. # connects to the XMLRPC Server
  5. s = xmlrpc.client.ServerProxy('http://localhost:8000')
  6. # initalized the login process
  7. session, key = s.init()
  8. password_hash = hashlib.sha256( ( 'Test123' + key ).encode( 'utf-8' ) ).hexdigest();
  9. # does the actual authentication
  10. print( s.auth( session, password_hash ) )
  11. # tests protected method
  12. print( s.hello( session ) )
  13. # logs out cause anything seems to be done already
  14. print( s.logout( session, password_hash ) )