Advertisement
ajithkp560

Website Cookie Grabber

Jun 4th, 2012
1,077
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.20 KB | None | 0 0
  1. #if u like this application share with your friends
  2. #visit www.teamopenfire.com for TeamOpenFire's Security tools and tutorials
  3. #visit my personal blog: www.suckthetech.blogspot.com
  4. import cookielib
  5. import urllib2
  6. from urllib2 import Request, build_opener, HTTPCookieProcessor, HTTPHandler
  7. import socket
  8. import httplib
  9.  
  10. try:
  11.     print "\t################################################################"
  12.     print "\t#                                        www.teamopenfire.com  #"
  13.     print "\t#       ###############      ########       ############       #"
  14.     print "\t#       #             #     ##      ##      #          #       #"
  15.     print "\t#       ######   ######     ##      ##      #   ########       #"
  16.     print "\t#            #   #          ##      ##      #   #              #"
  17.     print "\t#            #   #          ##      ##      #   #####          #"
  18.     print "\t#            #   #          ##      ##      #   #####          #"
  19.     print "\t#            #   #          ##      ##      #   #              #"
  20.     print "\t#            #   #          ##      ##      #   #              #"
  21.     print "\t#            #####    [#]    ########   [#] #####              #"
  22.     print "\t#                                               Cookie Grabber #"
  23.     print "\t#                                            coded by Ajith KP #"
  24.     print "\t#                          Greets to Coded32 and T.O.F members #"
  25.     print "\t################################################################"
  26.     try:
  27.         site=raw_input("URL [include http:// | https://]: ")
  28.         check = site
  29.         check = check.replace("http://","")
  30.         check = check.replace("https://","")
  31.        
  32.         print ("\tChecking website " + check + "...")
  33.         conn = httplib.HTTPConnection(check)
  34.         conn.connect()
  35.         print "\t[$] Yes... Server is Online."
  36.     except (httplib.HTTPResponse, socket.error) as Exit:
  37.         print("\t [!] Oops Error occured")
  38.         raw_input("\t [!] Possible problems: Server offline, Invalid URL,Internet offline")      
  39.         exit()
  40.        
  41.     except(IOError):
  42.         print "URL not found"
  43.  
  44.     print "\nTrying To Capture Cookies..."
  45.  
  46.        
  47.     cookiez = cookielib.CookieJar()
  48.     opener = build_opener(HTTPCookieProcessor(cookiez), HTTPHandler())
  49.     opener.addheaders = [
  50.         ('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13'),
  51.         ('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'),
  52.         ('Accept-Language', 'en-gb,en;q=0.5'),
  53.         ('Accept-Encoding', 'gzip,deflate'),
  54.         ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'),
  55.         ('Keep-Alive', '115'),
  56.         ('Connection', 'keep-alive'),
  57.         ('Cache-Control', 'max-age=0'),
  58.         ('Referer', site),
  59.         ]
  60.    
  61.     req = Request(site)
  62.     cookievalue = opener.open(req)
  63.     html = cookievalue.read()
  64.     print "\n\nCookies Loaded are: \n\n"
  65.     for cookie in cookiez:
  66.         print "\t\n[+]",cookie
  67. except (KeyboardInterrupt, SystemExit):
  68.     print "\n\t[!] Session cancelled"
  69. except (socket.error):
  70.     print "\t\n[!] Session Cancelled; Error occured. Check internet settings"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement