Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local https = require('ssl.https')
- https.TIMEOUT= 15
- local private_raw_url="https://pastebin.com/raw/YOURPAGE" -- Change raw link
- local user_name, user_password = "USER", "PASS" -- and user with password
- local request_body = "submit_hidden=submit_hidden&user_name=".. user_name .. "&user_password=" .. user_password .. "&submit=Login"
- local resp = {}
- local res, code, headers, status = https.request ( {
- method = 'POST',
- url = "https://pastebin.com/login",
- headers = {
- Host = "pastebin.com",
- ["Content-Type"] = "application/x-www-form-urlencoded",
- ["Content-Length"] = string.len(request_body),
- Connection = "keep-alive",
- },
- source = ltn12.source.string(request_body),
- sink = ltn12.sink.table(resp),
- protocol = "tlsv1",
- verify = "none",
- verifyext = {"lsec_continue", "lsec_ignore_purpose"},
- options = { "all", "no_sslv2", "no_sslv3" }
- } )
- if not headers['set-cookie']:find('pastebin_user') then
- print('bad login')
- return
- end
- resp={}
- local cookie = headers['set-cookie'] or ''
- local cookie1, cookie2, cookie3 = cookie:match("(__cfduid=%w+; ).*(PHPSESSID=%w+; ).*(pastebin_user=%w+; )" )
- if cookie1 and cookie2 and cookie3 then
- cookie = cookie1 .. cookie2 .. cookie3
- body, code, headers= https.request{
- url = private_raw_url ,
- headers = {
- --Host = "pastebin.com",
- ['Cookie'] = cookie,
- ['Connection'] = 'keep-alive'
- },
- sink = ltn12.sink.table(resp)
- }
- if code~=200 then return end
- print( table.concat(resp) )
- else
- print("error match cookies!" )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement