Skip to content

Instantly share code, notes, and snippets.

@mylamour
Created December 18, 2017 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mylamour/0a5a9e0d6582376a146a283ad5f70428 to your computer and use it in GitHub Desktop.
Save mylamour/0a5a9e0d6582376a146a283ad5f70428 to your computer and use it in GitHub Desktop.
Note: Baidu webshell detect isn't a good tools.
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