nicehash 向け、PC自爆ツール運用開始
とりあえず、自分が正常かどうかをチェックして、自爆するスクリプト。まぁ、マイナーソフトが動けていない状態だったら、自爆スクリプト自体動かないと思うわけだが(w再起動後、自動ログインして、自動で nicehash 動かす設定にしていないと、意味がないので、念のため。Rebooter.js の、以下の部分を適宜修正ください。BTCaddr="xxxxxxxxxxxxxxxxxxxxx";myRig[0]="worker";使い方cscript //nologo rebooter.jsRebooter.jsvar activeRigs = [];var activeRigs0 = [];var failRigs = []; var maxRigs = 0;var failCount = 0;var maxRigArray = []; var BTCaddr="BTCaddr";var myRig=["worker"];BTCaddr="xxxxxxxxxxxxxxxxxxxxx";myRig[0]="worker"; function CheckFailRig(max, curRig){ failRigs = []; for( var i = 0; i < max.length; i++) { var name = max[i]; var found = 0; for( var j = 0; j < curRig.length; j++) { if( name == curRig[j]) { found = 1; } } if( found == 0) { failRigs.push(name); } }} var netError = 0; function GetRigs(){ try { // 「ServerXMLHTTP」オブジェクト生成 var http = new ActiveXObject("Msxml2.ServerXMLHTTP"); // 要求初期化 http.open("GET", "https://api.nicehash.com/api?method=stats.provider.workers&addr="+BTCaddr, false); // 要求 http.send(); // 応答結果表示// WScript.Echo(http.status + ":" + http.statusText);// WScript.Echo(http.getAllResponseHeaders());// WScript.Echo(http.responseText); var json = eval("(" + http.responseText + ")"); var result = json["result"]; var workers = result["workers"]; var sum = 0; var rig = []; for( var i = 0; i < workers.length; i++) { var stat0 = workers[i]; var name = stat0[0]; var found = 0; for( var j = 0; j < rig.length; j++) { if( name == rig[j]) { found = 1; } } if( found == 0) { rig.push(name); }// WScript.Echo(name); } rig.sort(); activeRigs = rig; netError = 0; } catch (e) { // エラーの場合 WScript.Echo("Error(" + (e.number & 0xFFFF) + "):" + e.message); netError = 1;} } var msgBody = ""; function MakeMsgbody(){ var d = new Date(); var str = d.getMonth()+1; str = "DATE=" + str; str += "/" + d.getDate() + "," + d.getHours() + ":" + d.getMinutes(); str += "\r\nACTIVE:"; for( var i = 0; i < activeRigs.length; i++) { str += "," + activeRigs[i]; } str += "\r\nFAIL:"; for( var i = 0; i < failRigs.length; i++) { str += "," + failRigs[i]; } str += "\r\n"; msgBody = str;} var failCnt = 0;WScript.Sleep(600 * 1000); while (1){ GetRigs(); CheckFailRig(myRig, activeRigs); WScript.Echo(failRigs[0]); if( (netError == 0) && (failRigs.length != 0)) { failCnt++ WScript.Echo("FAILED:"+failRigs); if( failCnt > 3) { var WshShell = WScript.CreateObject("WScript.Shell"); WshShell.Run("shutdown /r /f /t 10"); } WScript.Sleep(60 * 1000); } else { failCnt = 0; WScript.Echo("ACTIVE:"+activeRigs); WScript.Sleep(600 * 1000); }}