Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VERSION = 'Offer Bot V1.0';
- USERNAME = 'dirtysocks';PASSWORD = 'carlo88';
- //USERNAME = 'tempuser12345';PASSWORD = 'tempuser12345';
- BOTUID = NORMALUID = 442; // this here shit means that both variables are equal to that number at the end.
- ADMIN_UID = NOTIFY_UID = 43 //1844103; // both variables equal to 442.
- TRIGGER = '!ofrr'; // this specifies the trigger for regex command handling below
- client = require('request'); // this here shit loads up the request module into client variable
- _ = require('lodash') // really useful utility functions
- CookieJar = client.jar();
- url="https://just-dice.com";
- request = {'url': url, 'jar': CookieJar,'form': {'username': USERNAME, 'password': PASSWORD}}; // this tells request module to hit just dice
- vanities(); // this shit jumps to function vanities.. which gives us generic info about our computer
- CMD = '/msg '; // this is a string variable
- CALCTRIGGER = TRIGGER + ' calc'; // this changes the trigger so that it points to the calculator function later on.
- // THIS SHIT HERE IS CALLED REGULAR EXPRESSIONS .. HARDEST SHIT TO LEARN IN ALL THIS SHITTY MCSHIT
- CalcRegex = new RegExp( '^' + CALCTRIGGER + ' *([-+]?[0-9\\.]*)\\%? ([-+*x\^<>#%/]) *([-+]?[0-9\\.]*)', 'i' );
- OTHER_TRIGGER_RE = new RegExp( '^' + TRIGGER + ' +(\\w+)', 'i' );
- bets = ponghit = show_all_my_bets = 0;
- bet_profit_threshold = bet_stake_threshold = 5; // these are normal variables
- degen_name = []; degen_profit = []; // these are "arrays"
- parseDate();
- // add this to the top so its accessable below
- var nodemailer = require('nodemailer')
- var transporter = nodemailer.createTransport({
- host: 'smtp.gmail.com',
- port: 465,
- secure: true,
- auth: {
- type: 'OAuth2',
- clientId: '',
- clientSecret: ''
- }
- });
- // this is a stupid logo for intro .. supposed to look like "Tiger"
- logo=`\x1b[45m░░░░░░░░░░░░░░░░░░░░░\x1b[40m
- \x1b[44m░▒▓██▓▒░░░░░░░░░░░░░░\x1b[40m
- \x1b[42m░░░▓▓░░▀░░▓▓▒░▓░░░▒▒░\x1b[40m
- \x1b[44m░░░▓▓░░▓░▓░░░░░█░▓░░░\x1b[40m
- \x1b[42m░░░▓▓░░▓░▓░░▓░▓░░▓░░░\x1b[40m
- \x1b[44m░░░▓▓░░▓░░▓▓▒░░▓░▓░░░
- ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ \x1b[44m
- ▒▒▒▒▒▒` + VERSION + `▒▒▒▒▒▒ \x1b[44m
- ░░░░░░░░░░░░░░░░░░░░░░░░░ \x1b[0m`;
- intro='\n\x1b[96m' + logo + '\x1b[97m' + nodemodules + '\n\x1b[92m' + nodecpu + '\n\x1b[0m' + globaldate + ' .. :: .. ' + globaltime + '\n\x1b[92m' + nodeenv + '\n\x1b[93m' + nodemem + '\r'; // here's the info scored from vanities function
- //console.log(intro); // this displays logo and vanity bullshit to console
- /* log-in procedure; sends auth through POST, checks if returned
- cookies indicate success (contains auth hash) and then spawns the bot */
- client.post( request,
- function(e, r, b)
- {
- if( !e )
- {
- var cookies = CookieJar.getCookieString( request.url );
- if( cookies.match(/hash=/) )
- bot( cookies );
- else
- {
- console.log( 'Failed to log in. Username and password correct?' );
- process.exit( 0 );
- }
- }
- else
- {
- console.log('Error: ', e); // every time you see "console.log" .. it means that text display is happening to console
- // and by console.. that means your screen.
- process.exit( 1 );
- }
- } );
- // bot
- function bot(cookies)
- {
- console.log(`\n\n\x1b[96mConnected and authenticated at ` + url + ` \x1b[0m`);
- enabled = true; // this is a true/false/null flag
- // THESE "socket.on" things ARE WEBSOCKETS THAT U NEED TO HOOK UP TO .. SOME ARE 100% NECESSARY IN ORDER TO INTERFACE WITH JD.
- // in nodeJS .. socket.io-client handles this websocket protocol for you.. you just have to tell it what to do.
- // this socket is absolutely necessary.. it loads up the websocket driver
- socket = require( 'socket.io-client' )( request.url, {'transports': ['websocket'],
- 'extraHeaders': {'origin': request.url, 'cookie': cookies}} );
- // this socket is necessary to start the shit
- socket.on('init', function(d) {
- console.log(`\x1b[93m Bot Logged in as ${d.username} (UID ${d.uid}).\n Account balance is ${d.balance}. \n \x1b[0m`); csrf = d.csrf; BALANCE = d.balance; CHECKBOTUID = d.uid; NEWS = d.news; console.log('\x1b[7mNEWS:\x1b[0m ' + NEWS + '\n'); last_idle_time = new Date().getTime();
- if (CHECKBOTUID != BOTUID) {BOTUID = CHECKBOTUID;}
- currentUID = NOTIFY_UID; console.log('\x1b[96m\x1b[5mStartup Notification sent to UID ' + NOTIFY_UID + '. . . This IS Sparta !\x1b[0m');
- emit = VERSION + " Starting . . . "; setTimeout(outputemit, 1000); });
- socket.on( 'news', function(news) { show_news(news); } );
- // this socket is necessary for chat .. because it IS chat !
- socket.on('chat', function(m, d) { incoming_chat(m, d);});
- socket.on('set_hash', function(hash) {
- console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m Reconnecting on Server restart, as requested by Server.\x1b[0m');
- websocket.close();
- bot(cookie); });
- socket.on('balance', function(data) {
- BALANCE = data;
- console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m Balance Changed to : ' + BALANCE + '\x1b[0m');
- last_idle_time = new Date().getTime(); });
- socket.on('disconnect', function() {
- console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m Ignoring disconnect request from Server, updating activity timer instead.\x1b[0m');
- last_idle_time = new Date().getTime(); });
- socket.on('error', function(err) {
- console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m We just caught a GURU-Meditation Error: ', err, ' \x1b[0m');
- setTimeout(function(){process.exit(0);},5000); });
- socket.on('login_error', function(err) {
- console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m We just caught a Login Error: ', err, ' \x1b[0m');
- setTimeout(function(){process.exit(0);},5000); });
- socket.on('jderror', function(err) {
- console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m We just caught a JD Error: ', err, ' \x1b[0m');
- last_idle_time = new Date().getTime(); });
- socket.on('getver', function(key) {
- console.log('\x1b[7mPONG:\x1b[0m', '\x1b[95m Server asked for Bot Version, updating activity timer. ', '\x1b[0m\x1b[7m:PING\x1b[0m');
- last_idle_time = new Date().getTime();
- websocket.emit('version', csrf, key, VERSION); });
- socket.on('pong', function()
- {ponghit++
- if (ponghit>7) // this counts the pong hits from websocket @ jd server .. to see if just-dice is alive
- {
- console.log('\x1b[7mPING:\x1b[0m', '\x1b[95m Server is alive, updating activity timer. \x1b[0m', '\x1b[7m:PONG\x1b[0m' );
- last_idle_time = new Date().getTime();
- ponghit=0;
- }
- });
- // this triggers for every bet the server tells us about; they're not all ours
- // with this socket 'request' .. jd basically feeds us wager data every 2 seconds ..this data includes other info as seen below
- socket.on('result', function(result)
- {bets++;
- if (bets>99) // this counts the bets to see if just-dice is alive
- {
- last_idle_time = new Date().getTime();
- console.log('\x1b[7mPING:\x1b[0m', '\x1b[91m Wagers active, updating activity timer.\x1b[0m ', '\x1b[7m:PONG\x1b[0m');
- bets = 0;
- }
- // this here sitewhatever = shit is just here for fun/descriptions .. not used in this bot
- sitebankroll = result.bankroll;
- sitebets = result.stats.bets;
- sitecommission = result.stats.taken;
- sitecommissionpending = result.stats.commission - sitecommission;
- sitelosses = result.stats.losses;
- siteluck = result.stats.luck / sitebets;
- sitemaxprofit = result.stats.max_profit;
- sitewagered = result.stats.wagered;
- sitewins = result.stats.wins;
- siteprofit = 0-result.stats.profit;
- var this_profit = parseFloat(result.this_profit); // the rest of this shit is also not used by this bot
- if (degen_profit[result.uid] === undefined)
- degen_profit[result.uid] = 0;
- degen_profit[result.uid] += this_profit;
- degen_name[result.uid] = result.name;
- if ((show_all_my_bets && result.uid == BOTUID) || this_profit >= bet_profit_threshold || result.bet >= bet_stake_threshold)
- {
- if (result.win == true) {var winloss = '\x1b[92m';} else var winloss = '\x1b[91m';
- console.log(winloss + '\x1b[7mWAGER:\x1b[0m', result.name, winloss,
- 'bet', (result.bet * 1).toFixed(8),
- 'on', result.high ? 'HIGH' : 'LOW',
- 'at', result.chance + '%',
- 'and', result.win ? 'WON;' : 'LOST;', '\x1b[0m',
- 'Profit', result.this_profit,
- '- Total Profit', tidy(degen_profit[result.uid]));
- }
- if (result.balance !== undefined)
- console.log('BALANCE:', result.balance);
- max_profit = result.max_profit;
- if (result.uid == BOTUID) {balance = result.balance;}
- });
- socket.on('staked', function(dat) // this here socket handles stake info
- {
- var ourstake = dat.stake_pft ? '; your share = ' + tidy(dat.stake_share) + '; your total = ' + tidy(dat.stake_pft) + '' : '';
- console.log('\x1b[30m\x1b[47m: STAKED : we just staked', tidy(dat.stake), '(total =', tidy(dat.total) + ourstake + ')\x1b[0m'); staketotal = tidy(dat.total);
- last_idle_time = new Date().getTime();
- });
- socket.on('tip', function(tipfrom, tipname, tipamount, tipcomment, tipignored, tippriv) // this socket displays tips from 0.1 clam and higher
- {
- console.log('\x1b[92mTip Received : ', tipfrom, tipname, tipamount, tipcomment, tipignored, tippriv, '\x1b[0m');
- last_idle_time = new Date().getTime();
- });
- }
- function show_news(news)
- {
- console.log('NEWS:', news);
- }
- // manage chat input (from server)
- function incoming_chat( m, d )
- {
- // incoming public m,d looks like this --> (10000) <Nickname> test 2018-03-03T04:10:47.872Z
- // incoming private m,d looks like this --> [ (10000) <Nickname> → (10101) <Nickname2> ] test undefined
- // regular expression "regex" bullshit again.. the hardest thing you'll have to learn a little of ..
- var poop = m.match(/^\((\d+)\) \*? ?\<(.+)\> (.+)/);
- // regex for PUBLIC messages, groups public shit into parameters under poop.
- // i.e., ... poop[1] = UID, poop[2] = nickname, poop[3] = incoming chat text
- if (m.indexOf("→") != -1) // checks to see if m string is a private message
- {public_chat = false; // set false flag for public_chat, as we are in private message - flag unimplemented in this bot.
- var moop = m.slice(2,m.indexOf("→"))+m.slice(m.indexOf("]")+2);
- // moop KLUDGE translates private format to public format for insertion into poop regex.
- var poop = moop.match(/^\((\d+)\) \*? ?\<(.+)\> (.+)/);
- // toss the processed poop into same public regex as above, because otherwise we'd need two extra regexes .. maybe.
- // also, regex is a bitch. fuck regex. i love you, regex.
- if (poop != null) // here we handle both priv possibilities, incoming and outgoing.
- {
- if (poop[1] != BOTUID) {console.log(`\x1b[93m: PRIV FROM `+ poop[1] + ` : <` + poop[2] + `> ` + poop[3] + `\x1b[0m`);}
- else{console.log(`\x1b[92m: REPLY SENT BY BOT : <` + poop[2] + `> ` + poop[3] + `\x1b[0m`);}
- }
- }
- if (poop === null) // regex for poop falls through here if it doesn't match normal text or priv msg
- {
- if (m.indexOf("→") == -1) {
- //console.log(`\x1b[95m${m}\x1b[0m`);
- } // display the fallthrough (INFO lines, etc)
- return;
- }
- // poop[1] = UID, poop[2] = nickname, poop[3] = incoming chat text
- if (poop != null) {currentUID=DISPLAY_UID=UID=poop[1];}
- // kludgey as shit in-place string timezone manipulation of "d" timestamp from just-dice public chat..
- if (typeof d != 'undefined') // (date/time) aka 'd' .. will become undefined on private message, so we check here.
- {
- var BaseTime = d.replace(/(^.+T|\..+Z$)/g, ''); // time outputs to 00:00:00 format after this regex
- var BaseHour = BaseTime.slice(0, 2);
- var BaseMinSec = BaseTime.slice(2, 8);
- var ZoneHour = BaseHour - globalzone; // - - 3 is workaround +3 for finland + daylight BS .. while "- 5" is TIME-ZONE FIX for UTC-5 unless daylight BS happens .. re: 16:00:00 becomes 11:00:00 .. globalzone in parseDate() includes invert fix for the prior double negative here.
- var RealHour = ZoneHour; // necessary copy to RealHour .. for fallthrough purposes
- if (ZoneHour < 0) {var RealHour = ZoneHour+24;}
- // trap for rollforward to 24 hour military time .. ex: -2:00:00 restored to 22:00:00
- // add to negative ZoneHour value to push it forward into 24h domain
- if (ZoneHour > 23) {var RealHour = ZoneHour-24;}
- // trap for rollback to 24 hour military time .. ex: 24:30:00 restored to 00:30:00
- // subtract from ZoneHour 24+ to roll it back into 24h domain
- var RealTime = RealHour + BaseMinSec; // combine the TIME-ZONE HOUR and ROLLOVER FIXES with the remainder of the original string
- if (RealHour >= 0 && RealHour <= 9) // trigger for leading zero recovery for 0-9 .. ex: 9:00:00 restored to 09:00:00
- {var RealTime = '0' + RealHour + BaseMinSec;} // TIME-ZONE HOUR FIX removes leading zero @ string, here we add it back, if needed.
- console.log(`[` + RealTime + `] -${DISPLAY_UID}- <${poop[2]}> ${poop[3]}`);
- poopnick = poop[2] + ',';
- if (poop[2].length > 15) // here, for faucet reminder, we trap impossible nicknames that SOMEHOW fall through here, due to pastes like :: 04:32:00 <system> (1111111) <whheee> auto-muted for 3 minutes [this is just a test of bot faucet trap who where gallon]
- {
- poopnick = (poop[2].replace(">", ",")).slice(0,poop[2].indexOf(">")+1);
- }
- pooplow = poop[3].toLowerCase();
- }
- // actual application
- let msg = poop[3]
- //splits it into cmd and rest
- const cmdReg = /^\s*!(?:[a-zA-z]+)\s(\w+)\s?(.*)$/
- let cmdMatch = msg.match(cmdReg);
- if( cmdMatch ) // these are commands
- {
- let cmd = cmdMatch[1] ? cmdMatch[1].toLowerCase() : cmdMatch[2]
- let rest = !cmdMatch[1] ? "" : _.trim(cmdMatch[2])
- if( cmd == 'quit' && poop[1] == ADMIN_UID )
- { enabled = false;
- throw "stop execution";
- }
- if( cmd == 'enable' && poop[1] == ADMIN_UID )
- { enabled = true;
- socket.emit( 'chat', csrf, `/msg ` + NOTIFY_UID + ` Offer-Bot Enabled`);
- }
- if( cmd == 'disable' && poop[1] == ADMIN_UID )
- { enabled = false;
- socket.emit( 'chat', csrf, `/msg ` + NOTIFY_UID + ` Offer-Bot Disabled`);
- }
- if( cmd == 'help' && enabled == true )
- {
- displayHelp(poop[1], rest)
- }
- if( cmd == 'textual' && enabled == true ) {emit = ' This is Sparta !! '; outputemit();}
- //example to get the email
- if(cmd == 'email' && enabled == true) {
- // get the email, its just in the rest var
- let email = rest
- }
- //example to accept multiple entrys 2 in this case
- if(cmd == 'test' && enabled == true) {
- // example being !dr someNewCommand2 text email
- let newReg = /^(.*)\s(.*)$/
- let newMatch = rest.match(newReg);
- if(newMatch) {
- let name = newMatch[1]
- let email = newMatch[2]
- if( /(.+)@(.+){2,}\.(.+){2,}/.test(email) ){
- //semi verified real address, send er off!
- sendEmail(email)
- // then respond on the client
- let msg = `Thanks for Providing Your Contact Info: name = ${name} email = ${email} test email sent`
- sayChat(currentUID, msg)
- } else {
- sayChat(currentUID, 'Invalid email address!!')
- }
- } else {
- sayChat(currentUID, "Improper use of test command!")
- }
- }
- }
- }
- function sayChat(uid, msg) {
- socket.emit('chat', csrf, `/msg ${uid} ${msg} `)
- }
- function displayHelp (uid, specificCmd) {
- let msg = ''
- if(specificCmd) {
- switch (specificCmd) {
- case "cashback-details":
- msg = "info about cashback"
- break
- case "videos-details":
- msg = "info about videos"
- break
- case "surveys-details":
- msg = "info about surveys"
- break
- case "cashback":
- msg = `!ofr cashback 'text' 'email'`
- break
- case "videos":
- msg = "help info for the videos command"
- break
- case "surveys":
- msg = "help info for the surveys command"
- break
- default:
- msg = "That command does not exist"
- break
- }
- } else {
- msg = 'cashback | videos | surveys'
- }
- sayChat(uid, msg)
- }
- function sendEmail(emailAddress) {
- transporter.sendMail({
- from: 'dochousepoker@gmail.com',
- to: emailAddress,
- subject: 'Message',
- text: 'I hope this message gets through!',
- auth: {
- user: 'dochousepoker@gmail.com',
- refreshToken: '1/1Pm5E8AoMx6avhkTpC0YklWvMbva6Kj09-4ggkr2mmg',
- accessToken: 'ya29.Glt_BX6CXALYEQQZUBd0NVBvy7FodK6G5ucE8D-1upvMQ-yn8zc19qEyTlZeiTUUmFCsuyrnFygCd77WGQAOsKp5r5DupPYkluvUGF_O-qK59GG1hIQMGGIWYZ3i',
- expires: 1484314697598
- }
- });
- }
- function parseDate()
- {
- dateParts = (new Date().toString()).split(" ");
- // dateParts[0]=dayname, [1]=month, [2]=daynumber, [3]=year, [4]=localtime
- // timezone = dateParts[6] + ' ' + dateParts[7] + ' ' + dateParts[8];
- // GMT-0400 (Eastern Daylight Time) - GMT+0300 (FLE Daylight Time)
- var GMT = parseInt(dateParts[5].slice(dateParts[5].indexOf("T")+1,dateParts[5].indexOf("T")+4));
- globalzone = 0 - GMT; // invert GMT for double-negative timezone / daylight setting elsewhere
- globaldate = dateParts[0] + ', ' + dateParts[2] + ' ' + dateParts[1] + ' ' + dateParts[3] + ' - ' + dateParts[4];
- globaltime = dateParts[5] + ' ' + dateParts[6] + ' ' + dateParts[7] + ' ' + dateParts[8];
- }
- function outputemit(){socket.emit('chat', csrf, CMD + currentUID + ' ' + emit);} // this thing handles most output to chat
- function tidy(val, fixed)
- {
- if (fixed === undefined) fixed=4;
- if (typeof(val) == 'number') val = val.toFixed(fixed);
- return val;
- }
- function vanities() // the bullshit below isnt really needed but whatever ... it's pretty to look at as the bot starts .. display fluff
- {
- if (process.platform.indexOf("win") != -1)
- {
- envuname = process.env.USERNAME;
- envcpu = process.env.PROCESSOR_ARCHITECTURE;
- envcpuid = process.env.PROCESSOR_IDENTIFIER;
- envcompname = process.env.COMPUTERNAME;
- envcores = process.env.NUMBER_OF_PROCESSORS;
- }
- else
- { // forced default IDs when we're using node outside of mighty Windows, because fuck Linux, fuck MacOS, fuck em all !
- envuname = process.env.USER; envcpu = "ARM Cortex A9"; envcpuid = "ARMv7 Processor rev 0 (v7l)";
- envcompname = "Merlin"; envcores = 2;
- }
- memrss = process.memoryUsage().rss; memheaptotal = process.memoryUsage().heapTotal;
- memheapused = process.memoryUsage().heapUsed; memmanagedobjects = process.memoryUsage().external;
- nodejs = process.version; chromeversion = process.versions.v8;
- opensslversion = process.versions.openssl; zlibversion = process.versions.zlib;
- if (process.version.indexOf("v0.") != -1)
- {
- cputimeuser = '(unavailable)'; cputimesystem = '(unavailable)'; cputime = '(unavailable)';
- }
- else
- {
- cputimeuser = (process.cpuUsage().user/1E6).toFixed(3);
- cputimesystem = (process.cpuUsage().system/1E6).toFixed(3);
- cputime = (cputimeuser - - cputimesystem).toFixed(3);
- }
- nodecpu = 'Running on Node.js ' + nodejs + ' at ' + process.platform + ' for roughly ' + cputime + ' seconds of CPUTime so far,\n . . . with usercode consuming ' + cputimeuser + ' seconds,\n . . . and systemcode consuming ' + cputimesystem + ' seconds.';
- nodeenv = 'The host for this session is a user named ' + envuname + ', directing a computer named ' + envcompname + ',\n . . . sporting a ' + envcores + '-core ' + envcpu + '-class ' + envcpuid + ' CPU !';
- nodemem = 'Memstats (in bytes): RSS - ' + memrss + ' .. V8 heapTotal - ' + memheaptotal + '\n .. V8 heapUsed - ' + memheapused + ' .. V8 C++ managed objects - ' + memmanagedobjects;
- nodemodules = 'Chrome V8 engine ' + chromeversion + ' .. OpenSSL ' + opensslversion + ' .. Zlib ' + zlibversion;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement