Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.68 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # IMPORTANT THINGS:
  3. # Made for Python 2.7
  4. # REQUIRES BeatifulSoup4 (pip install beatifulsoup4)
  5.  
  6. import requests
  7. import re
  8. import hashlib
  9. from HTMLParser import HTMLParser
  10. from bs4 import BeautifulSoup
  11.  
  12. forumThread = "4243377-b-steam-spiele-s-bietet-mir"                                                         # Thread ID + name (ex: "4239749-cheap-steam-game-shop")
  13.  
  14. #PASSMD5 = hashlib.md5(PASSWD.encode('UTF-8')).hexdigest()
  15.  
  16. #c.post(url, data={'vb_login_username': USERNAME,'s': '','securitytoken': 'guest','do': 'login','vb_login_md5password': PASSMD5,'vb_login_md5password_utf': PASSMD5,}, headers={"Referer": "http://www.elitepvpers.com/forum/"})
  17.  
  18. print("Hello world!")                                              
  19. fullURL = "http://www.elitepvpers.com/forum/elite-gold-trading/" + forumThread + ".html"                    # Formats the URL
  20. print("Read URL as: " + fullURL + "\n")
  21.  
  22. Username = ""
  23. Password = ""
  24.  
  25. pwmd5 = hashlib.md5(Password.encode("UTF-8")).hexdigest()
  26.  
  27. print("Password hashed as: " + hashlib.md5(Password).hexdigest())
  28.  
  29. payload = {
  30.     "vb_login_username":Username,
  31.     "vb_login_password":Password,
  32.     "cookieuser":"1",
  33.     "submit":"Log in",
  34.     "s":"",
  35.     "securitytoken":"guest",
  36.     "do":"login",
  37.     "vb_login_md5password":pwmd5,
  38.     "vb_login_md5password_utf":pwmd5
  39. }
  40.  
  41. pdata = {'vb_login_username': Username,'s': '','securitytoken': 'guest','do': 'login','vb_login_md5password': pwmd5,'vb_login_md5password_utf': pwmd5,}
  42. headers = {
  43.     "Referer":"http://www.elitepvpers.com/forum/"
  44. }
  45.  
  46. with requests.Session() as s:
  47.     url = "http://www.elitepvpers.com/forum/login.php?do=login"
  48.     pwmd5 = hashlib.md5(Password.encode("UTF-8")).hexdigest()
  49.     p = s.post(url, data={'vb_login_username': Username,'s': '','securitytoken': 'guest','do': 'login','vb_login_md5password': pwmd5,'vb_login_md5password_utf': pwmd5,}, headers={"Referer": "http://www.elitepvpers.com/forum/"})
  50.     r = s.get(fullURL)
  51.     output = open("output.html", "w")
  52.     output.write(r.text.encode("ISO-8859-1", "ignore"))
  53.     output.close()
  54.  
  55. #req = requests.post(fullURL, data=payload, headers=headers)
  56.  
  57. #print(req.headers)
  58.  
  59. #output = open("output.html", "w")
  60. #output.write(req.text.encode("ISO-8859-1", "ignore"))
  61. #output.close()
  62.  
  63. HTTP = requests.get(fullURL)                                                                                # Makes a GET request to the formatted URL
  64. soup = BeautifulSoup(HTTP.text, "html.parser")
  65. posts = str(soup.find(id="posts"))
  66. regex = re.findall("\"(|\/\/|http:\/\/)www\.elitepvpers\.com\/forum\/elite-gold-trading\/(.+)\.html\"", posts)
  67. for poi in regex:
  68.     print(string.joing(poi) + "\n")
  69. #print(str(posts))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement