zymtom

Skidpaste scraper

Sep 3rd, 2014
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.90 KB | None | 0 0
  1. import re
  2. import requests
  3. scraped = []
  4. postdata = {'archive_showMore':"asd"}
  5. cookie = {'__cfduid':'d16bf414ae86f6164895e75be36be2c7d1409791061228',
  6. 'cf_clearance':'eb76c50b00b6b1811f491e5648a2d12bbfec8811-1409790665-900',
  7. 'PHPSESSID':'ef65604d1e74a36527b77503c3cf8963'
  8. }
  9. headers = {
  10.     'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.102 Safari/537.36'
  11. }
  12. run = True
  13. print "[+] Started scraping"
  14. f = open('workfile', 'w')
  15. first = True
  16. cf_clearence = ""
  17.  
  18. def in_array(array, compare0):
  19.     exist = False
  20.     for i in range(0, len(array)):
  21.         if compare0[0] in array[i][0]:
  22.             exist = True
  23.             break
  24.     return exist
  25. false = False
  26. while run == True:
  27.     try:
  28.         if first == True:
  29.             r = requests.post("http://skidpaste.org/paste.cgi", headers=headers, cookies=cookie)
  30.             if("Please turn JavaScript on and reload the page." in r):
  31.                 raise Exception("I\'m a skid")
  32.             else:
  33.                 print "[+] Wurk c:"
  34.                 first = False
  35.         else:
  36.             r = requests.post("http://skidpaste.org/paste.cgi", headers=headers, cookies=cookie, data=postdata)
  37.     except Exception:
  38.         print "[-] no wurk :c"
  39.         nowurk = True
  40.         while(nowurk == True):
  41.             try:
  42.                 if first == True:
  43.                     r = requests.post("http://skidpaste.org/paste.cgi", headers=headers, cookies=cookie)
  44.                     if("Please turn JavaScript on and reload the page." in r):
  45.                         print"[-] No wurk :C"
  46.                     else:
  47.                         print "[+] Wurk c:"
  48.                         nowurk = False
  49.                         first = False
  50.                 else:
  51.                     r = requests.post("http://skidpaste.org/paste.cgi", headers=headers, cookies=cookie, data=postdata)
  52.             except Exception:
  53.                 print "[-] no wurk :c"
  54.     regex = re.compile('<a href=(?:"|\')([a-zA-z0-9]{8})(?:"|\')>.*<\/a>')
  55.     reg = regex.findall(r.text)
  56.     for captures in reg:
  57.         if in_array(scraped, captures[0]) == False:
  58.             scraped.insert(len(scraped)+1, captures)
  59.             print "[+] Found paste: " + captures
  60. print "[-] Stopped scraping"
Advertisement
Add Comment
Please, Sign In to add comment