Created
June 20, 2020 23:42
-
-
Save atmoner/14f56d5d79a4bc2553c474d8f35fa028 to your computer and use it in GitHub Desktop.
dnsdumpster.js (not work, will be debug :/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require("request"); | |
var tough = require('tough-cookie'); | |
var needle = require("needle"); | |
var Cookie = tough.Cookie; | |
request.get('https://dnsdumpster.com/', (error, response, body) => { | |
var cookie = Cookie.parse(response.headers['set-cookie'][0]); | |
returnCookie = cookie.cookieString(); | |
var finalCookie = returnCookie.split('='); | |
var cookieFinal = finalCookie[1]; | |
console.log(cookieFinal); | |
// any character that is not a word character or whitespace | |
//const regex = /<input[^>]*name=\"csrfmiddlewaretoken\"[^>]*value=\"([^\"]*)\"/g; | |
//console.log(response.body.search(regex)); | |
var i; | |
var csrf_token = ''; | |
for (i = 2417; i < 2481; i++) { | |
csrf_token += response.body.charAt(i); | |
} | |
console.log(csrf_token+':'+cookieFinal); | |
var options = { | |
headers: { 'Referer': 'dnsdumpster.com', 'Cookie': "csrftoken="+csrf_token+";" } | |
} | |
needle.post('https://dnsdumpster.com/', { csrfmiddlewaretoken: csrf_token, targetip: 'magento.com' }, options, function(err, resp) { | |
// you can pass params as a string or as an object. | |
console.log(resp) | |
}); | |
/* const j = request.jar(); | |
const cookieeee = request.cookie('csrftoken='+csrf_token); | |
j.setCookie(cookieeee,'dnsdumpster.com'); | |
console.log(j); | |
request.post({url:'https://dnsdumpster.com/', jar: j, form: {'csrfmiddlewaretoken':csrf_token,'targetip':'magento.com'},'headers':{'Referer':'dnsdumpster.com'}}, function(err,httpResponse,body){ | |
console.log(body); | |
})*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment