Advertisement
Guest User

Untitled

a guest
Mar 15th, 2018
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.03 KB | None | 0 0
  1. VERSION = 'Offer Bot V1.0';
  2.  
  3.  
  4. USERNAME = 'dirtysocks';PASSWORD = 'carlo88';
  5. //USERNAME = 'tempuser12345';PASSWORD = 'tempuser12345';
  6. BOTUID = NORMALUID = 442; // this here shit means that both variables are equal to that number at the end.
  7. ADMIN_UID = NOTIFY_UID = 43 //1844103; // both variables equal to 442.
  8. TRIGGER = '!ofrr'; // this specifies the trigger for regex command handling below
  9.  
  10. client = require('request'); // this here shit loads up the request module into client variable
  11. _ = require('lodash') // really useful utility functions
  12. CookieJar = client.jar();
  13. url="https://just-dice.com";
  14.  
  15. request = {'url': url, 'jar': CookieJar,'form': {'username': USERNAME, 'password': PASSWORD}}; // this tells request module to hit just dice
  16.  
  17. vanities(); // this shit jumps to function vanities.. which gives us generic info about our computer
  18.  
  19. CMD = '/msg '; // this is a string variable
  20.  
  21. CALCTRIGGER = TRIGGER + ' calc'; // this changes the trigger so that it points to the calculator function later on.
  22. // THIS SHIT HERE IS CALLED REGULAR EXPRESSIONS .. HARDEST SHIT TO LEARN IN ALL THIS SHITTY MCSHIT
  23. CalcRegex = new RegExp( '^' + CALCTRIGGER + ' *([-+]?[0-9\\.]*)\\%? ([-+*x\^<>#%/]) *([-+]?[0-9\\.]*)', 'i' );
  24. OTHER_TRIGGER_RE = new RegExp( '^' + TRIGGER + ' +(\\w+)', 'i' );
  25. bets = ponghit = show_all_my_bets = 0;
  26. bet_profit_threshold = bet_stake_threshold = 5; // these are normal variables
  27. degen_name = []; degen_profit = []; // these are "arrays"
  28.  
  29. parseDate();
  30.  
  31.  
  32. // add this to the top so its accessable below
  33. var nodemailer = require('nodemailer')
  34. var transporter = nodemailer.createTransport({
  35. host: 'smtp.gmail.com',
  36. port: 465,
  37. secure: true,
  38. auth: {
  39. type: 'OAuth2',
  40. clientId: '',
  41. clientSecret: ''
  42. }
  43. });
  44.  
  45.  
  46.  
  47.  
  48. // this is a stupid logo for intro .. supposed to look like "Tiger"
  49. logo=`\x1b[45m░░░░░░░░░░░░░░░░░░░░░\x1b[40m
  50. \x1b[44m░▒▓██▓▒░░░░░░░░░░░░░░\x1b[40m
  51. \x1b[42m░░░▓▓░░▀░░▓▓▒░▓░░░▒▒░\x1b[40m
  52. \x1b[44m░░░▓▓░░▓░▓░░░░░█░▓░░░\x1b[40m
  53. \x1b[42m░░░▓▓░░▓░▓░░▓░▓░░▓░░░\x1b[40m
  54. \x1b[44m░░░▓▓░░▓░░▓▓▒░░▓░▓░░░
  55. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  56. ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ \x1b[44m
  57. ▒▒▒▒▒▒` + VERSION + `▒▒▒▒▒▒ \x1b[44m
  58. ░░░░░░░░░░░░░░░░░░░░░░░░░ \x1b[0m`;
  59. 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
  60.  
  61. //console.log(intro); // this displays logo and vanity bullshit to console
  62.  
  63. /* log-in procedure; sends auth through POST, checks if returned
  64. cookies indicate success (contains auth hash) and then spawns the bot */
  65. client.post( request,
  66. function(e, r, b)
  67. {
  68. if( !e )
  69. {
  70. var cookies = CookieJar.getCookieString( request.url );
  71. if( cookies.match(/hash=/) )
  72. bot( cookies );
  73. else
  74. {
  75. console.log( 'Failed to log in. Username and password correct?' );
  76. process.exit( 0 );
  77. }
  78. }
  79. else
  80. {
  81. console.log('Error: ', e); // every time you see "console.log" .. it means that text display is happening to console
  82. // and by console.. that means your screen.
  83. process.exit( 1 );
  84. }
  85. } );
  86.  
  87. // bot
  88. function bot(cookies)
  89. {
  90. console.log(`\n\n\x1b[96mConnected and authenticated at ` + url + ` \x1b[0m`);
  91.  
  92. enabled = true; // this is a true/false/null flag
  93.  
  94. // THESE "socket.on" things ARE WEBSOCKETS THAT U NEED TO HOOK UP TO .. SOME ARE 100% NECESSARY IN ORDER TO INTERFACE WITH JD.
  95. // in nodeJS .. socket.io-client handles this websocket protocol for you.. you just have to tell it what to do.
  96.  
  97. // this socket is absolutely necessary.. it loads up the websocket driver
  98. socket = require( 'socket.io-client' )( request.url, {'transports': ['websocket'],
  99. 'extraHeaders': {'origin': request.url, 'cookie': cookies}} );
  100.  
  101. // this socket is necessary to start the shit
  102. socket.on('init', function(d) {
  103. 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();
  104.  
  105. if (CHECKBOTUID != BOTUID) {BOTUID = CHECKBOTUID;}
  106. currentUID = NOTIFY_UID; console.log('\x1b[96m\x1b[5mStartup Notification sent to UID ' + NOTIFY_UID + '. . . This IS Sparta !\x1b[0m');
  107. emit = VERSION + " Starting . . . "; setTimeout(outputemit, 1000); });
  108.  
  109. socket.on( 'news', function(news) { show_news(news); } );
  110.  
  111. // this socket is necessary for chat .. because it IS chat !
  112. socket.on('chat', function(m, d) { incoming_chat(m, d);});
  113.  
  114. socket.on('set_hash', function(hash) {
  115. console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m Reconnecting on Server restart, as requested by Server.\x1b[0m');
  116. websocket.close();
  117. bot(cookie); });
  118.  
  119. socket.on('balance', function(data) {
  120. BALANCE = data;
  121. console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m Balance Changed to : ' + BALANCE + '\x1b[0m');
  122. last_idle_time = new Date().getTime(); });
  123.  
  124. socket.on('disconnect', function() {
  125. console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m Ignoring disconnect request from Server, updating activity timer instead.\x1b[0m');
  126. last_idle_time = new Date().getTime(); });
  127.  
  128. socket.on('error', function(err) {
  129. console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m We just caught a GURU-Meditation Error: ', err, ' \x1b[0m');
  130. setTimeout(function(){process.exit(0);},5000); });
  131.  
  132. socket.on('login_error', function(err) {
  133. console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m We just caught a Login Error: ', err, ' \x1b[0m');
  134. setTimeout(function(){process.exit(0);},5000); });
  135.  
  136. socket.on('jderror', function(err) {
  137. console.log('\x1b[7mHALP:\x1b[0m', '\x1b[95m We just caught a JD Error: ', err, ' \x1b[0m');
  138. last_idle_time = new Date().getTime(); });
  139.  
  140. socket.on('getver', function(key) {
  141. console.log('\x1b[7mPONG:\x1b[0m', '\x1b[95m Server asked for Bot Version, updating activity timer. ', '\x1b[0m\x1b[7m:PING\x1b[0m');
  142. last_idle_time = new Date().getTime();
  143. websocket.emit('version', csrf, key, VERSION); });
  144.  
  145. socket.on('pong', function()
  146. {ponghit++
  147.  
  148. if (ponghit>7) // this counts the pong hits from websocket @ jd server .. to see if just-dice is alive
  149. {
  150. console.log('\x1b[7mPING:\x1b[0m', '\x1b[95m Server is alive, updating activity timer. \x1b[0m', '\x1b[7m:PONG\x1b[0m' );
  151. last_idle_time = new Date().getTime();
  152. ponghit=0;
  153. }
  154. });
  155.  
  156. // this triggers for every bet the server tells us about; they're not all ours
  157. // with this socket 'request' .. jd basically feeds us wager data every 2 seconds ..this data includes other info as seen below
  158. socket.on('result', function(result)
  159. {bets++;
  160.  
  161. if (bets>99) // this counts the bets to see if just-dice is alive
  162. {
  163. last_idle_time = new Date().getTime();
  164. console.log('\x1b[7mPING:\x1b[0m', '\x1b[91m Wagers active, updating activity timer.\x1b[0m ', '\x1b[7m:PONG\x1b[0m');
  165. bets = 0;
  166. }
  167.  
  168. // this here sitewhatever = shit is just here for fun/descriptions .. not used in this bot
  169. sitebankroll = result.bankroll;
  170. sitebets = result.stats.bets;
  171. sitecommission = result.stats.taken;
  172. sitecommissionpending = result.stats.commission - sitecommission;
  173. sitelosses = result.stats.losses;
  174. siteluck = result.stats.luck / sitebets;
  175. sitemaxprofit = result.stats.max_profit;
  176. sitewagered = result.stats.wagered;
  177. sitewins = result.stats.wins;
  178. siteprofit = 0-result.stats.profit;
  179.  
  180. var this_profit = parseFloat(result.this_profit); // the rest of this shit is also not used by this bot
  181.  
  182. if (degen_profit[result.uid] === undefined)
  183. degen_profit[result.uid] = 0;
  184.  
  185. degen_profit[result.uid] += this_profit;
  186. degen_name[result.uid] = result.name;
  187. if ((show_all_my_bets && result.uid == BOTUID) || this_profit >= bet_profit_threshold || result.bet >= bet_stake_threshold)
  188. {
  189. if (result.win == true) {var winloss = '\x1b[92m';} else var winloss = '\x1b[91m';
  190.  
  191. console.log(winloss + '\x1b[7mWAGER:\x1b[0m', result.name, winloss,
  192. 'bet', (result.bet * 1).toFixed(8),
  193. 'on', result.high ? 'HIGH' : 'LOW',
  194. 'at', result.chance + '%',
  195. 'and', result.win ? 'WON;' : 'LOST;', '\x1b[0m',
  196. 'Profit', result.this_profit,
  197. '- Total Profit', tidy(degen_profit[result.uid]));
  198. }
  199.  
  200. if (result.balance !== undefined)
  201. console.log('BALANCE:', result.balance);
  202.  
  203. max_profit = result.max_profit;
  204. if (result.uid == BOTUID) {balance = result.balance;}
  205. });
  206.  
  207. socket.on('staked', function(dat) // this here socket handles stake info
  208. {
  209. var ourstake = dat.stake_pft ? '; your share = ' + tidy(dat.stake_share) + '; your total = ' + tidy(dat.stake_pft) + '' : '';
  210. console.log('\x1b[30m\x1b[47m: STAKED : we just staked', tidy(dat.stake), '(total =', tidy(dat.total) + ourstake + ')\x1b[0m'); staketotal = tidy(dat.total);
  211. last_idle_time = new Date().getTime();
  212. });
  213.  
  214. socket.on('tip', function(tipfrom, tipname, tipamount, tipcomment, tipignored, tippriv) // this socket displays tips from 0.1 clam and higher
  215. {
  216. console.log('\x1b[92mTip Received : ', tipfrom, tipname, tipamount, tipcomment, tipignored, tippriv, '\x1b[0m');
  217. last_idle_time = new Date().getTime();
  218. });
  219.  
  220. }
  221.  
  222. function show_news(news)
  223. {
  224. console.log('NEWS:', news);
  225. }
  226.  
  227. // manage chat input (from server)
  228. function incoming_chat( m, d )
  229. {
  230. // incoming public m,d looks like this --> (10000) <Nickname> test 2018-03-03T04:10:47.872Z
  231. // incoming private m,d looks like this --> [ (10000) <Nickname> → (10101) <Nickname2> ] test undefined
  232.  
  233. // regular expression "regex" bullshit again.. the hardest thing you'll have to learn a little of ..
  234. var poop = m.match(/^\((\d+)\) \*? ?\<(.+)\> (.+)/);
  235. // regex for PUBLIC messages, groups public shit into parameters under poop.
  236. // i.e., ... poop[1] = UID, poop[2] = nickname, poop[3] = incoming chat text
  237.  
  238. if (m.indexOf("→") != -1) // checks to see if m string is a private message
  239. {public_chat = false; // set false flag for public_chat, as we are in private message - flag unimplemented in this bot.
  240.  
  241. var moop = m.slice(2,m.indexOf("→"))+m.slice(m.indexOf("]")+2);
  242. // moop KLUDGE translates private format to public format for insertion into poop regex.
  243. var poop = moop.match(/^\((\d+)\) \*? ?\<(.+)\> (.+)/);
  244. // toss the processed poop into same public regex as above, because otherwise we'd need two extra regexes .. maybe.
  245. // also, regex is a bitch. fuck regex. i love you, regex.
  246.  
  247. if (poop != null) // here we handle both priv possibilities, incoming and outgoing.
  248. {
  249. if (poop[1] != BOTUID) {console.log(`\x1b[93m: PRIV FROM `+ poop[1] + ` : <` + poop[2] + `> ` + poop[3] + `\x1b[0m`);}
  250. else{console.log(`\x1b[92m: REPLY SENT BY BOT : <` + poop[2] + `> ` + poop[3] + `\x1b[0m`);}
  251. }
  252. }
  253.  
  254. if (poop === null) // regex for poop falls through here if it doesn't match normal text or priv msg
  255. {
  256. if (m.indexOf("→") == -1) {
  257. //console.log(`\x1b[95m${m}\x1b[0m`);
  258. } // display the fallthrough (INFO lines, etc)
  259. return;
  260. }
  261.  
  262.  
  263. // poop[1] = UID, poop[2] = nickname, poop[3] = incoming chat text
  264. if (poop != null) {currentUID=DISPLAY_UID=UID=poop[1];}
  265.  
  266. // kludgey as shit in-place string timezone manipulation of "d" timestamp from just-dice public chat..
  267. if (typeof d != 'undefined') // (date/time) aka 'd' .. will become undefined on private message, so we check here.
  268. {
  269. var BaseTime = d.replace(/(^.+T|\..+Z$)/g, ''); // time outputs to 00:00:00 format after this regex
  270. var BaseHour = BaseTime.slice(0, 2);
  271. var BaseMinSec = BaseTime.slice(2, 8);
  272.  
  273. 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.
  274.  
  275. var RealHour = ZoneHour; // necessary copy to RealHour .. for fallthrough purposes
  276. if (ZoneHour < 0) {var RealHour = ZoneHour+24;}
  277. // trap for rollforward to 24 hour military time .. ex: -2:00:00 restored to 22:00:00
  278. // add to negative ZoneHour value to push it forward into 24h domain
  279. if (ZoneHour > 23) {var RealHour = ZoneHour-24;}
  280. // trap for rollback to 24 hour military time .. ex: 24:30:00 restored to 00:30:00
  281. // subtract from ZoneHour 24+ to roll it back into 24h domain
  282.  
  283. var RealTime = RealHour + BaseMinSec; // combine the TIME-ZONE HOUR and ROLLOVER FIXES with the remainder of the original string
  284.  
  285. if (RealHour >= 0 && RealHour <= 9) // trigger for leading zero recovery for 0-9 .. ex: 9:00:00 restored to 09:00:00
  286. {var RealTime = '0' + RealHour + BaseMinSec;} // TIME-ZONE HOUR FIX removes leading zero @ string, here we add it back, if needed.
  287.  
  288. console.log(`[` + RealTime + `] -${DISPLAY_UID}- <${poop[2]}> ${poop[3]}`);
  289.  
  290. poopnick = poop[2] + ',';
  291. 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]
  292. {
  293. poopnick = (poop[2].replace(">", ",")).slice(0,poop[2].indexOf(">")+1);
  294. }
  295.  
  296. pooplow = poop[3].toLowerCase();
  297. }
  298.  
  299. // actual application
  300. let msg = poop[3]
  301. //splits it into cmd and rest
  302. const cmdReg = /^\s*!(?:[a-zA-z]+)\s(\w+)\s?(.*)$/
  303. let cmdMatch = msg.match(cmdReg);
  304.  
  305. if( cmdMatch ) // these are commands
  306. {
  307. let cmd = cmdMatch[1] ? cmdMatch[1].toLowerCase() : cmdMatch[2]
  308. let rest = !cmdMatch[1] ? "" : _.trim(cmdMatch[2])
  309.  
  310.  
  311. if( cmd == 'quit' && poop[1] == ADMIN_UID )
  312. { enabled = false;
  313. throw "stop execution";
  314. }
  315.  
  316. if( cmd == 'enable' && poop[1] == ADMIN_UID )
  317. { enabled = true;
  318. socket.emit( 'chat', csrf, `/msg ` + NOTIFY_UID + ` Offer-Bot Enabled`);
  319. }
  320.  
  321. if( cmd == 'disable' && poop[1] == ADMIN_UID )
  322. { enabled = false;
  323. socket.emit( 'chat', csrf, `/msg ` + NOTIFY_UID + ` Offer-Bot Disabled`);
  324. }
  325.  
  326. if( cmd == 'help' && enabled == true )
  327. {
  328. displayHelp(poop[1], rest)
  329. }
  330.  
  331. if( cmd == 'textual' && enabled == true ) {emit = ' This is Sparta !! '; outputemit();}
  332.  
  333. //example to get the email
  334. if(cmd == 'email' && enabled == true) {
  335. // get the email, its just in the rest var
  336. let email = rest
  337. }
  338.  
  339. //example to accept multiple entrys 2 in this case
  340. if(cmd == 'test' && enabled == true) {
  341. // example being !dr someNewCommand2 text email
  342. let newReg = /^(.*)\s(.*)$/
  343. let newMatch = rest.match(newReg);
  344.  
  345. if(newMatch) {
  346. let name = newMatch[1]
  347. let email = newMatch[2]
  348.  
  349. if( /(.+)@(.+){2,}\.(.+){2,}/.test(email) ){
  350. //semi verified real address, send er off!
  351. sendEmail(email)
  352. // then respond on the client
  353. let msg = `Thanks for Providing Your Contact Info: name = ${name} email = ${email} test email sent`
  354. sayChat(currentUID, msg)
  355. } else {
  356. sayChat(currentUID, 'Invalid email address!!')
  357. }
  358. } else {
  359. sayChat(currentUID, "Improper use of test command!")
  360. }
  361. }
  362.  
  363. }
  364. }
  365.  
  366.  
  367. function sayChat(uid, msg) {
  368. socket.emit('chat', csrf, `/msg ${uid} ${msg} `)
  369. }
  370.  
  371. function displayHelp (uid, specificCmd) {
  372. let msg = ''
  373. if(specificCmd) {
  374. switch (specificCmd) {
  375. case "cashback-details":
  376. msg = "info about cashback"
  377. break
  378. case "videos-details":
  379. msg = "info about videos"
  380. break
  381. case "surveys-details":
  382. msg = "info about surveys"
  383. break
  384. case "cashback":
  385. msg = `!ofr cashback 'text' 'email'`
  386. break
  387. case "videos":
  388. msg = "help info for the videos command"
  389. break
  390. case "surveys":
  391. msg = "help info for the surveys command"
  392. break
  393. default:
  394. msg = "That command does not exist"
  395. break
  396.  
  397. }
  398.  
  399. } else {
  400. msg = 'cashback | videos | surveys'
  401.  
  402. }
  403. sayChat(uid, msg)
  404. }
  405.  
  406.  
  407.  
  408.  
  409. function sendEmail(emailAddress) {
  410.  
  411. transporter.sendMail({
  412. from: 'dochousepoker@gmail.com',
  413. to: emailAddress,
  414. subject: 'Message',
  415. text: 'I hope this message gets through!',
  416. auth: {
  417. user: 'dochousepoker@gmail.com',
  418. refreshToken: '1/1Pm5E8AoMx6avhkTpC0YklWvMbva6Kj09-4ggkr2mmg',
  419. accessToken: 'ya29.Glt_BX6CXALYEQQZUBd0NVBvy7FodK6G5ucE8D-1upvMQ-yn8zc19qEyTlZeiTUUmFCsuyrnFygCd77WGQAOsKp5r5DupPYkluvUGF_O-qK59GG1hIQMGGIWYZ3i',
  420. expires: 1484314697598
  421. }
  422. });
  423.  
  424. }
  425.  
  426. function parseDate()
  427. {
  428. dateParts = (new Date().toString()).split(" ");
  429. // dateParts[0]=dayname, [1]=month, [2]=daynumber, [3]=year, [4]=localtime
  430. // timezone = dateParts[6] + ' ' + dateParts[7] + ' ' + dateParts[8];
  431.  
  432. // GMT-0400 (Eastern Daylight Time) - GMT+0300 (FLE Daylight Time)
  433.  
  434. var GMT = parseInt(dateParts[5].slice(dateParts[5].indexOf("T")+1,dateParts[5].indexOf("T")+4));
  435.  
  436. globalzone = 0 - GMT; // invert GMT for double-negative timezone / daylight setting elsewhere
  437. globaldate = dateParts[0] + ', ' + dateParts[2] + ' ' + dateParts[1] + ' ' + dateParts[3] + ' - ' + dateParts[4];
  438. globaltime = dateParts[5] + ' ' + dateParts[6] + ' ' + dateParts[7] + ' ' + dateParts[8];
  439. }
  440.  
  441. function outputemit(){socket.emit('chat', csrf, CMD + currentUID + ' ' + emit);} // this thing handles most output to chat
  442.  
  443. function tidy(val, fixed)
  444. {
  445. if (fixed === undefined) fixed=4;
  446. if (typeof(val) == 'number') val = val.toFixed(fixed);
  447. return val;
  448. }
  449.  
  450. function vanities() // the bullshit below isnt really needed but whatever ... it's pretty to look at as the bot starts .. display fluff
  451. {
  452. if (process.platform.indexOf("win") != -1)
  453. {
  454. envuname = process.env.USERNAME;
  455. envcpu = process.env.PROCESSOR_ARCHITECTURE;
  456. envcpuid = process.env.PROCESSOR_IDENTIFIER;
  457. envcompname = process.env.COMPUTERNAME;
  458. envcores = process.env.NUMBER_OF_PROCESSORS;
  459. }
  460. else
  461. { // forced default IDs when we're using node outside of mighty Windows, because fuck Linux, fuck MacOS, fuck em all !
  462. envuname = process.env.USER; envcpu = "ARM Cortex A9"; envcpuid = "ARMv7 Processor rev 0 (v7l)";
  463. envcompname = "Merlin"; envcores = 2;
  464. }
  465.  
  466. memrss = process.memoryUsage().rss; memheaptotal = process.memoryUsage().heapTotal;
  467. memheapused = process.memoryUsage().heapUsed; memmanagedobjects = process.memoryUsage().external;
  468. nodejs = process.version; chromeversion = process.versions.v8;
  469. opensslversion = process.versions.openssl; zlibversion = process.versions.zlib;
  470.  
  471. if (process.version.indexOf("v0.") != -1)
  472. {
  473. cputimeuser = '(unavailable)'; cputimesystem = '(unavailable)'; cputime = '(unavailable)';
  474. }
  475. else
  476. {
  477. cputimeuser = (process.cpuUsage().user/1E6).toFixed(3);
  478. cputimesystem = (process.cpuUsage().system/1E6).toFixed(3);
  479. cputime = (cputimeuser - - cputimesystem).toFixed(3);
  480. }
  481.  
  482. 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.';
  483. 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 !';
  484. nodemem = 'Memstats (in bytes): RSS - ' + memrss + ' .. V8 heapTotal - ' + memheaptotal + '\n .. V8 heapUsed - ' + memheapused + ' .. V8 C++ managed objects - ' + memmanagedobjects;
  485. nodemodules = 'Chrome V8 engine ' + chromeversion + ' .. OpenSSL ' + opensslversion + ' .. Zlib ' + zlibversion;
  486. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement