Guest User

Untitled

a guest
Oct 22nd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. from shlex import split
  2. import requests
  3. from bs4 import BeautifulSoup
  4. import re
  5. import mechanize
  6. import urllib
  7. with open("Myaccount.txt") as f:
  8. for line in f:
  9. parts = line.split(':')
  10. print parts[0]
  11. br = mechanize.Browser()
  12. br.set_handle_robots(False)
  13. br.addheaders = [("User-agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36")]
  14. sign_in = br.open("https://website.com/login/")
  15. br.select_form(nr = 0)
  16. br["username"] = parts[0]
  17. br["password"] = parts[1]
  18. logged_in = br.submit()
  19. logincheck = logged_in.read()
  20. print "logincheck"
  21. cookies = br._ua_handlers['_cookies'].cookiejar
  22. payload = {'action':'info',
  23. 'action':'info',
  24. 'api_key':'something'
  25. }
  26.  
  27. with open("cookie.txt", "w") as text_file:
  28. text_file.write("%s" % cookies)
  29. payload = {'action':'info',
  30. 'action':'info',
  31. 'api_key':'something'
  32. }
  33. text_file.close()
  34.  
  35. with open("cookie.txt", "r") as text_file:
  36. for line in text_file:
  37. yup = line
  38. payload = {'action':'info',
  39. 'action':'info',
  40. 'api_key':'something'
  41. }
  42. print yup
  43. r = requests.post("https://website.com",data = payload, cookies =yup)
Add Comment
Please, Sign In to add comment