Advertisement
FlyFar

Cookie Reading Python

Feb 15th, 2023
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | Cybersecurity | 0 0
  1. #!/usr/bin/python
  2.  
  3. import os
  4.  
  5. # Hello world python program
  6. print "Content-Type: text/html;charset=utf-8";
  7. print
  8.  
  9. handler = {}
  10. if 'HTTP_COOKIE' in os.environ:
  11.     cookies = os.environ['HTTP_COOKIE']
  12.     cookies = cookies.split('; ')
  13.  
  14.     for cookie in cookies:
  15.         cookie = cookie.split('=')
  16.         handler[cookie[0]] = cookie[1]
  17.  
  18. for k in handler:
  19.     print k + " = " + handler[k] + "<br>
Tags: python Cookie
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement