Created
December 18, 2017 07:06
-
-
Save mylamour/0a5a9e0d6582376a146a283ad5f70428 to your computer and use it in GitHub Desktop.
Note: Baidu webshell detect isn't a good tools.
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 fs = require("fs"); | |
var request = require("request"); | |
filepath = ''; | |
var upload = { method: 'POST', | |
url: 'https://scanner.baidu.com/enqueue', | |
formData: | |
{ archive: | |
{ value: fs.createReadStream(filepath) , | |
options: | |
{ filename: filepath, | |
contentType: null } } } }; | |
request(upload, function (error, response, body) { | |
if (error) throw new Error(error); | |
body = JSON.parse(body); | |
if (body.error == false) { | |
var detectres = { | |
method: 'GET', | |
url: body.url | |
}; | |
request(detectres, function (error, response, body) { | |
if (error) throw new Error(error); | |
return body; | |
}); | |
}else{ | |
return null; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment