Created
March 22, 2020 12:53
-
-
Save drov0/d186eaa425866652c733c7f0fb1998e1 to your computer and use it in GitHub Desktop.
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
require('dotenv').config(); | |
const steem = require('steem'); | |
steem.api.setOptions({url: 'https://api.steemit.com'}); | |
const dsteem = require('dsteem'); | |
const client = new dsteem.Client('https://api.steemit.com'); | |
let excluded = [ | |
"poloniex", | |
"cjsdns", | |
"sigizzang", | |
"sct.wallet", | |
"virus707", | |
"pacemaker", | |
"sct.voter", | |
"sct.bank", | |
"goku1", | |
"joe767676", | |
"stablewon", | |
"imadev", | |
"stevoperon", | |
"friendlystranger", | |
"richwings", | |
"sj-jeong", | |
"jaydih", | |
"wisdomandjustice", | |
"omit", | |
"geos", | |
"we-together", | |
"photoholic", | |
"steemhunt", | |
"talkative-bk", | |
"rhodium", | |
"dobartim", | |
"razer7", | |
"dodoim", | |
"flysky", | |
"remain", | |
"coreabeforekorea", | |
"sct.krwp", | |
"goodnewworld", | |
"double-u", | |
"bukio", | |
"cyberrn", | |
"sonki999", | |
"spinbunny", | |
"steemex", | |
"francium", | |
"sjgod4018", | |
"lucky2015", | |
"jayplayco", | |
"fur2002ks", | |
"cancerdoctor", | |
"walktoheaven", | |
"coininstant", | |
"brent1042", | |
"bencana0523", | |
"smallpusher", | |
"glory7", | |
"ppomppu", | |
"vingroup", | |
"freegon", | |
"happybelly", | |
"stimp1024", | |
"truce", | |
"steemzzang", | |
"jsg", | |
"lichtblick", | |
"inchonbitcoin", | |
"ssc-token", | |
"cjh", | |
"veronicalee", | |
"uzgo", | |
"kibumh", | |
"btcmillennial", | |
"labradorpuppies", | |
"cnfund", | |
"floridasnail", | |
"rakkasan84", | |
"cool191", | |
"honusurf", | |
"ricky.gold", | |
"ilovemylife", | |
"loveecho", | |
"djusti", | |
"john371911", | |
"mehta", | |
"opixer", | |
"happyworkingmom", | |
"koyuh8", | |
"tradingideas", | |
"windowglass", | |
"ksc", | |
"ioioioioi", | |
"skuld2000", | |
"justyy", | |
"seo-boss", | |
"twinpapa", | |
"sandisk", | |
"kwonjs77", | |
"kimseun", | |
"happyberrysboy", | |
"cmp2020-pb", | |
"jewel-lover", | |
"donekim", | |
"greece-lover", | |
"sct", | |
"smy", | |
"gallop", | |
"sindong", | |
"thegreatgatsby", | |
"j-car", | |
"isaaclab", | |
"wonsama", | |
"naha", | |
"jjy", | |
"goodhello", | |
"trevonjb", | |
"lhy", | |
"zzings", | |
"remlaps1", | |
"aidasfg7", | |
"ediya", | |
"kanadaramagi123", | |
"nexgen", | |
"tabris", | |
"sindoja", | |
"spoke", | |
"project7", | |
"kopasi.sct", | |
"ayogom", | |
"wondumyungga", | |
"dongsuh", | |
"machellin", | |
"sun510", | |
"corn113", | |
"newiz", | |
"holic7", | |
"parisfoodhunter", | |
"realmankwon", | |
"menerva", | |
"hodolbak", | |
"electrodo", | |
"ys1302", | |
"buk-translate", | |
"bongje", | |
"rynow", | |
"solnamu", | |
"fenrir78", | |
"ringit", | |
"lighthil", | |
"seraphim502", | |
"mooninwater", | |
"kgbinternational", | |
"gustavomonraz", | |
"shenchensucc", | |
"yoon", | |
"jacobyu", | |
"jademont", | |
"ultranew", | |
"bigwave", | |
"soosoo", | |
"docker", | |
"sct.curator", | |
"tworld", | |
"devsup", | |
"edgarare1", | |
"jaykayw", | |
"hyokhyok", | |
"freedompoint", | |
"banguri", | |
"juancar347", | |
"kcc", | |
"triplea.bot", | |
"tailcock", | |
"jungjunghoon", | |
"infidel1258", | |
"maiyude", | |
"honeybeerbear", | |
"kingbit", | |
"jungch98", | |
"deer3", | |
"atomy1", | |
"epitt925", | |
"relaxkim", | |
"venti", | |
"funtraveller", | |
"skymin", | |
"dmsqlc0303", | |
"softmetal", | |
"dorian-lee", | |
"cmp2020", | |
"angelslake", | |
"alexaventuria", | |
"wordit", | |
"gmarket", | |
"jack8831", | |
"mrspointm", | |
"feelsogood", | |
"foreveraverage", | |
"kibaek", | |
"totopapa", | |
"isi3", | |
"kstop1", | |
"vip", | |
"storysharing", | |
"hhusaini", | |
"sklara", | |
"balticbadger", | |
"tshering-tamang", | |
"mrpointp", | |
"sasaadrian", | |
"kbaek81", | |
"angelina6688", | |
"abdullar", | |
"yinyangboobookat", | |
"maikuraki", | |
"jianan", | |
"aellly", | |
"proxy.token", | |
"steemflower", | |
"jjm13", | |
"levycore", | |
"firealiean", | |
"peterpa", | |
"lucky2", | |
"travelwithus", | |
"cub1", | |
"yellowbird", | |
"ravenkim", | |
"sunny1124", | |
"dr-frankenstein", | |
"soufiani", | |
"autorent", | |
"xiaoshancun", | |
"cheva", | |
"yann03", | |
"sweetpapa", | |
"goplayer", | |
"gfriend96", | |
"wongshiying", | |
"thebigsweed", | |
"iieeiieeii", | |
"tkdgjs79", | |
"banjjakism", | |
"huangzuomin", | |
"farm-mom", | |
"akiroq", | |
"travelnepal", | |
"kdtkaren", | |
"kungdel", | |
"reportup", | |
"matildah", | |
"blacklux", | |
"dappinvestor", | |
"kopasi", | |
"anroja", | |
"sgbonus", | |
"lupafilotaxia", | |
"dakeshi", | |
"dftba", | |
"stepbie", | |
"mimistar", | |
"sleepcat", | |
"remlaps-lite", | |
"chapchop", | |
"ricko66", | |
"eps", | |
"scottcbusiness", | |
"lucky222", | |
"cn-malaysia", | |
"deusjudo", | |
"kakakk", | |
"abduhawab", | |
"dailystats", | |
"zzan.hmy", | |
"steemchiller", | |
"ryanhkr", | |
"remlaps", | |
"lotusfleur", | |
"backdm", | |
"devyleona", | |
"daydayup", | |
"bulsik", | |
"tuckerjtruman", | |
"lifeskills-tv", | |
"norwegiansteem", | |
"yanirauseche", | |
"newbijohn", | |
"trueimagine", | |
"zzan.witnesses", | |
"brewcitygardener", | |
"wira8788", | |
"dailyke20", | |
"tinker-bell", | |
"pizzafamily", | |
"don-thomas", | |
"knight4sky", | |
"rainingfall", | |
"dailychina", | |
"chetanpadliya", | |
"akinome", | |
"lovelyyeon", | |
"zzan.atomy", | |
"palja", | |
"ksheva1", | |
"fadetoblack", | |
"autoway", | |
]; | |
function get_account_history(username, index) | |
{ | |
return new Promise(async resolve => { | |
let limit = 10000 | |
if (index < 10000) | |
limit = index | |
let data = await client.database.call("get_account_history", [username, index, limit]).catch(async (err) => { | |
console.log("get_account history error, retrying"); | |
console.log(err) | |
return resolve(await get_account_history(username, index)); | |
}); | |
return resolve(data); | |
}); | |
} | |
function get_all_tx_until_hive(username) | |
{ | |
return new Promise(async resolve => { | |
let all_ops = []; | |
let index = 99999999999999; | |
let data = await get_account_history(username, index); | |
data = data.reverse() | |
do | |
{ | |
for (let i = 0; i < data.length; i++) | |
{ | |
let ops = data[i][1].op; | |
// We don't care of history before the hive announcement | |
if (data[i][1].block < 41743883 ) | |
break; | |
if (ops[0] === "account_witness_vote") | |
{ | |
if (ops[1].account === username) | |
all_ops.push(ops) | |
} else if (ops[0] === "account_witness_proxy") { | |
if (ops[1].account === username) | |
all_ops.push(ops) | |
} | |
} | |
if (index === 99999999999999) | |
index = data[0][0]; | |
else | |
index -= 10000; | |
console.log("getting data for "+username+ " index : "+ index); | |
if (data[data.length -1 ][1].block < 41743883 || data.length !== 10001) | |
break; | |
data = await get_account_history(username, index); | |
} while (data[data.length -1 ][1].block > 41743883 && data.length === 10001); | |
return resolve({all_ops}); | |
}); | |
} | |
function find_last_proxy(username) | |
{ | |
return new Promise(async resolve => { | |
let proxy = ""; | |
let index = 99999999999999; | |
let data = await get_account_history(username, index); | |
data = data.reverse(); | |
do | |
{ | |
for (let i = 0; i < data.length; i++) | |
{ | |
let ops = data[i][1].op; | |
if (ops[0] === "account_witness_proxy") { | |
if (ops[1].account === username && ops[1].proxy !== "") | |
proxy = ops[1].proxy; | |
break; | |
} | |
} | |
if (index === 99999999999999) | |
index = data[0][0]; | |
else | |
index -= 10000; | |
console.log("getting data for "+username+ " index : "+ index); | |
if (proxy !== "" || data.length !== 10001) | |
break; | |
data = await get_account_history(username, index); | |
} while (data.length === 10001); | |
return resolve(proxy); | |
}); | |
} | |
function get_accounts(accs) { | |
return new Promise(resolve => { | |
steem.api.getAccounts(accs, function (err, response) { | |
return resolve(response) | |
}); | |
}); | |
} | |
async function run() { | |
let voters = ["justyy",'coininstant','honusurf','twirllinks','sampraise','cwcost','dev365','foreveraverage','friendlystranger','pippo84','juanmolina','javirid','bidesign','m-yasir','rakkasan84','vidafitnessfeliz','smallpusher','farm-mom','mfblack','nardiazst','razer7','stevoperon','lichtblick','thebigsweed','antonio.vlasov','lotusfleur','travelwithus','martbarras','freedomteam2019','skeenee','hone.heke','thettinaung','wisekricket','bible.facts','bible.study','jaydih','begood2me','ityp','dftba','virus707','rynow','scottcbusiness','greece-lover','juancar347','lesmann','nachomolina','electrodo','oldstone','we-together','photoholic','slowwalker','wisdomandjustice','malia.mancianti','mauialohabella','kdtkaren','robinmmthompson','firealien','firealiean','me-we','cristo','team-mexico','kiwisteem','teamxpro','dhanagc','tailcock','tfq86','hermeticgenetics','numberofthingz','dzoji','boyacun123','amayphin','alexaventuria','dominikboecker','dappinvestor','kapitanrosomak','itsonursezer','karega','walktoheaven','julisavio','fadetoblack','cool191','goodnewworld','coinchaos','btcmillennial','happyworkingmom','davemccoy','hugo1954','eps','asimpleman','footballfacts','footballpedia','jieshao','uplus','brewcitygardener','john371911','devsup','epscu','tshering-tamang','freedompoint','akiroq','infidel1258','proffit','brent1042','don-thomas','don-t','luke-barth','ayogom','kaonashi6686','steemian258','glory7','relaxkim','islamkhan','mehta','muru','cultus-forex','deusjudo','tovaga75','proxy.token','steemchiller','yinyangboobookat','project7','ilovemylife','dmitri13','remlaps','in2itiveart','starworld','cpt-sparrow','bdlatif','coml','instructor2121','killuminatic','wendyth16','dr-frankenstein','karbon','truce','lifeskills-tv','jayplayco','joe.public','ravenkim','rosepac','labradorpuppies','tyramisoux','emiliomorles','yanirauseche','loganxart','ricko66','bukio','maiyude','carlosluistoro','spinbunny','trevonjb','ricky.gold','test45','gustavomonraz','tuckerjtruman','balticbadger','mdosev','awasthih','soufiani','stimialiti','zzan.witnesses','enjoykarma','scarletreaper','stimp1024','stimp-bank','kirbyjr1977','oac','daudimitch','ale.dri','edgarare1','lupafilotaxia','yasien','brutledge','brokendreams','cryptotracer','lightroom','bayron','justinsunsteemy','kaz2305'] | |
const puppets = [ | |
"goodguy24", | |
"aheadofslow", | |
"night11pm", | |
"hunger365", | |
"waitforyou1", | |
"cloudysun", | |
"jumphigh", | |
"coronashallgo", | |
"paintingclub", | |
"bostonawesome", | |
"toke2049", | |
"flyingfly1", | |
"agirl10000", | |
"eastooowest", | |
"car2001", | |
"nicetry001", | |
"high46", | |
"paintingclub", | |
"respect888", | |
"happylife123", | |
]; | |
voters = voters.concat(puppets); | |
let account_details = await get_accounts(excluded); | |
let bad_actors = []; | |
// get a list of all who still vote socks without proxy to process the rest faster | |
for (let i = 0; i < account_details.length; i++) { | |
if (account_details[i].proxy !== "") | |
continue; | |
let socks_voted_for = account_details[i].witness_votes.filter(value => -1 !== puppets.indexOf(value)); | |
if (socks_voted_for.length >= 2) { | |
bad_actors.push(account_details[i].name) | |
} | |
} | |
let actual_errors = []; | |
let sneaky_proxy = []; | |
// replay actions til announcement | |
for (let i = 0; i < excluded.length; i++) { | |
let account = account_details.filter(el => el.name === excluded[i])[0]; | |
// If he is still voting for puppets, no need to investigate | |
if (bad_actors.indexOf(excluded[i]) !== -1) | |
continue; | |
let ops = await get_all_tx_until_hive(excluded[i]); | |
ops = ops.all_ops; | |
let proxy_ops_count = 0; | |
for (let k = 0; k < ops.length; k++) | |
{ | |
if (ops[k][0] === "account_witness_vote") | |
{ | |
if (ops[k][1].approve === false) { | |
account.witness_votes.push(ops[k][1].witness) | |
} else { | |
account.witness_votes.splice(account.witness_votes.indexOf(ops[k][1].witness), 1) | |
} | |
} else if (ops[k][0] === "account_witness_proxy") { | |
account.proxy = ops[k][1].proxy; | |
proxy_ops_count++; | |
} | |
} | |
let socks_voted_for = account.witness_votes.filter(value => -1 !== puppets.indexOf(value)); | |
if (socks_voted_for.length < 2 && voters.indexOf(account.proxy) === -1) { | |
// Means he cleared his proxy after the announcement, needs to dig more to get who he was proxying to | |
if (proxy_ops_count >= 1 && account.proxy === "") | |
sneaky_proxy.push(account.name); | |
else | |
actual_errors.push(account.name) | |
} | |
} | |
console.log("actual errors"); | |
console.log(actual_errors); | |
console.log("sneaky proxies, aka people who's only proxy operation is a clean proxy, so we can't tell who they previously proxied to, investigate using the investigate_sneaky_proxy function") | |
console.log(sneaky_proxy) | |
} | |
async function investigate_sneaky_proxy() { | |
let accounts = [ 'cnfund', | |
'cool191', | |
'seo-boss', | |
'funtraveller', | |
'softmetal', | |
'jianan', | |
'wongshiying', | |
'anroja']; | |
for (let i = 0; i < accounts.length; i++) { | |
let proxy = await find_last_proxy(accounts[i]); | |
console.log(`${accounts[i]} was proxying to ${proxy}`) | |
} | |
} | |
//investigate_sneaky_proxy() | |
run(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment