-
Notifications
You must be signed in to change notification settings - Fork 493
/
Copy pathbruteForceAdmin.js
62 lines (51 loc) · 1.85 KB
/
bruteForceAdmin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const https = require('https')
var fs = require('fs');
var colors=require("colors/safe")
var requestUrl=(host,path)=>{
//Http Request with host and path
return new Promise((resolve, reject)=>{
const req = https.request({hostname: host, path: path, method: 'GET'}, res => {
resolve(res.statusCode);
});
req.on('error',(err)=>{
reject(err);
});
req.end();
});
}
async function scanlinks(){
fs.readFile('paths.txt', 'utf8', async function(err, data) {//getting Links from paths.txt file in current directory
if (err) throw err;
var arr=data.split("\r\n");
for(var i=0;i<arr.length;i++){
try{
var status=await requestUrl(host,arr[i])
if(status==200)
console.log(colors.green(status)+": Admin Panel Found at link "+colors.green(arr[i]));
else if(status==301 || status==302)
console.log(colors.yellow("- "+status)+": Redirected Potential Path"+colors.yellow(arr[i]));
else
console.log(colors.red("X "+status)+": Not Found "+colors.red(arr[i]));
}
catch(err){
if(err.code=="ENOTFOUND"){
console.log(colors.red("Error: "+"Wrong Host Provided or 'https://' included (Check your host or Try removing https://)"));
break;
}
else{
console.log(colors.red("Error: "+err.info));
}
}
}
});
}
/*
*****************************MAIN FUNCTION******************************************************
*/
var host=process.argv[2];
if(host!==undefined){
scanlinks();
}
else{
console.log(colors.red("Error: Please Provide Host Name(Do Not Add https://)"))
}