Advertisement
Guest User

Untitled

a guest
May 13th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. local https = require('ssl.https')
  2. https.TIMEOUT= 15
  3.  
  4. local private_raw_url="https://pastebin.com/raw/YOURPAGE" -- Change raw link
  5. local user_name, user_password = "USER", "PASS" -- and user with password
  6.  
  7. local request_body = "submit_hidden=submit_hidden&user_name=".. user_name .. "&user_password=" .. user_password .. "&submit=Login"
  8.  
  9. local resp = {}
  10. local res, code, headers, status = https.request ( {
  11. method = 'POST',
  12. url = "https://pastebin.com/login",
  13. headers = {
  14. Host = "pastebin.com",
  15. ["Content-Type"] = "application/x-www-form-urlencoded",
  16. ["Content-Length"] = string.len(request_body),
  17. Connection = "keep-alive",
  18. },
  19. source = ltn12.source.string(request_body),
  20. sink = ltn12.sink.table(resp),
  21. protocol = "tlsv1",
  22. verify = "none",
  23. verifyext = {"lsec_continue", "lsec_ignore_purpose"},
  24. options = { "all", "no_sslv2", "no_sslv3" }
  25. } )
  26. if not headers['set-cookie']:find('pastebin_user') then
  27. print('bad login')
  28. return
  29. end
  30. resp={}
  31. local cookie = headers['set-cookie'] or ''
  32. local cookie1, cookie2, cookie3 = cookie:match("(__cfduid=%w+; ).*(PHPSESSID=%w+; ).*(pastebin_user=%w+; )" )
  33. if cookie1 and cookie2 and cookie3 then
  34. cookie = cookie1 .. cookie2 .. cookie3
  35. body, code, headers= https.request{
  36. url = private_raw_url ,
  37. headers = {
  38. --Host = "pastebin.com",
  39. ['Cookie'] = cookie,
  40. ['Connection'] = 'keep-alive'
  41. },
  42. sink = ltn12.sink.table(resp)
  43. }
  44.  
  45. if code~=200 then return end
  46.  
  47. print( table.concat(resp) )
  48. else
  49. print("error match cookies!" )
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement