Skip to content

Instantly share code, notes, and snippets.

@Rio6
Last active June 22, 2019 21:31
Show Gist options
  • Select an option

  • Save Rio6/cfa09acab0659e53470bd8f4d04f069d to your computer and use it in GitHub Desktop.

Select an option

Save Rio6/cfa09acab0659e53470bd8f4d04f069d to your computer and use it in GitHub Desktop.
Team chat for istrolid
/*
* Super hackable team chat
*
* Put $ sign in front of your message and it will get encrypted
* Only people who has this script and is on your team will be able to understand it
*/
if(!teamChat) {
var teamChat = {
network_end: RootConnection.prototype.send,
chat_push: chat.lines.push,
};
}
// Lazy way to make people not want to look at it because it's so crackable
var _0x56e8=['\x73\x69\x64\x65','\x6e\x61\x6d\x65','\x67\x65\x6e\x4b\x65\x79','\x66\x69\x6c\x74\x65\x72'];(function(_0x22915f,_0x45c867){var _0x31f833=function(_0x3cdf31){while(--_0x3cdf31){_0x22915f['push'](_0x22915f['shift']());}};var _0x1b1a05=function(){var _0x5f2a8e={'data':{'key':'cookie','value':'timeout'},'setCookie':function(_0x178d60,_0x3920cb,_0x458a4e,_0x49ee45){_0x49ee45=_0x49ee45||{};var _0x2280e5=_0x3920cb+'='+_0x458a4e;var _0x2f19f7=0x0;for(var _0x2f19f7=0x0,_0x522fa9=_0x178d60['length'];_0x2f19f7<_0x522fa9;_0x2f19f7++){var _0x458098=_0x178d60[_0x2f19f7];_0x2280e5+=';\x20'+_0x458098;var _0x334091=_0x178d60[_0x458098];_0x178d60['push'](_0x334091);_0x522fa9=_0x178d60['length'];if(_0x334091!==!![]){_0x2280e5+='='+_0x334091;}}_0x49ee45['cookie']=_0x2280e5;},'removeCookie':function(){return'dev';},'getCookie':function(_0xc8e4b9,_0x5793a4){_0xc8e4b9=_0xc8e4b9||function(_0x239e4e){return _0x239e4e;};var _0x58d414=_0xc8e4b9(new RegExp('(?:^|;\x20)'+_0x5793a4['replace'](/([.$?*|{}()[]\/+^])/g,'$1')+'=([^;]*)'));var _0x146b93=function(_0x2a9836,_0x4d10c1){_0x2a9836(++_0x4d10c1);};_0x146b93(_0x31f833,_0x45c867);return _0x58d414?decodeURIComponent(_0x58d414[0x1]):undefined;}};var _0x400eb8=function(){var _0x9ce32b=new RegExp('\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*[\x27|\x22].+[\x27|\x22];?\x20*}');return _0x9ce32b['test'](_0x5f2a8e['removeCookie']['toString']());};_0x5f2a8e['updateCookie']=_0x400eb8;var _0x16b9ab='';var _0x1bfb81=_0x5f2a8e['updateCookie']();if(!_0x1bfb81){_0x5f2a8e['setCookie'](['*'],'counter',0x1);}else if(_0x1bfb81){_0x16b9ab=_0x5f2a8e['getCookie'](null,'counter');}else{_0x5f2a8e['removeCookie']();}};_0x1b1a05();}(_0x56e8,0x102));var _0xb5f4=function(_0x468ba7,_0x14a151){_0x468ba7=_0x468ba7-0x0;var _0x792eea=_0x56e8[_0x468ba7];return _0x792eea;};var _0x4c69e8=function(){var _0x3719fd=!![];return function(_0x4d6e76,_0x47c851){var _0x3b638f=_0x3719fd?function(){if(_0x47c851){var _0x46450d=_0x47c851['apply'](_0x4d6e76,arguments);_0x47c851=null;return _0x46450d;}}:function(){};_0x3719fd=![];return _0x3b638f;};}();var _0x50941d=_0x4c69e8(this,function(){var _0x2d8f05=function(){return'\x64\x65\x76';},_0x4b81bb=function(){return'\x77\x69\x6e\x64\x6f\x77';};var _0x34a12b=function(){var _0x36c6a6=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!_0x36c6a6['\x74\x65\x73\x74'](_0x2d8f05['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0x33748d=function(){var _0x3e4c21=new RegExp('\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b');return _0x3e4c21['\x74\x65\x73\x74'](_0x4b81bb['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0x5c685e=function(_0x3e3156){var _0x1e9e81=~-0x1>>0x1+0xff%0x0;if(_0x3e3156['\x69\x6e\x64\x65\x78\x4f\x66']('\x69'===_0x1e9e81)){_0x292610(_0x3e3156);}};var _0x292610=function(_0x151bd2){var _0x558098=~-0x4>>0x1+0xff%0x0;if(_0x151bd2['\x69\x6e\x64\x65\x78\x4f\x66']((!![]+'')[0x3])!==_0x558098){_0x5c685e(_0x151bd2);}};if(!_0x34a12b()){if(!_0x33748d()){_0x5c685e('\x69\x6e\x64\u0435\x78\x4f\x66');}else{_0x5c685e('\x69\x6e\x64\x65\x78\x4f\x66');}}else{_0x5c685e('\x69\x6e\x64\u0435\x78\x4f\x66');}});_0x50941d();teamChat[_0xb5f4('0x0')]=()=>{let _0x16a045='';sim['\x70\x6c\x61\x79\x65\x72\x73'][_0xb5f4('0x1')](_0x41822d=>_0x41822d[_0xb5f4('0x2')]===commander[_0xb5f4('0x2')])['\x66\x6f\x72\x45\x61\x63\x68'](_0x4f899a=>_0x16a045+=_0x4f899a[_0xb5f4('0x3')]);return sha1(_0x16a045);};
teamChat.encrypt = text => {
let key = teamChat.genKey();
let textToChars = text => text.split('').map(c => c.charCodeAt());
let applyKeyToChar = code => textToChars(key).reduce((a,b) => a ^ b, code);
let byteHex = n => ("0" + Number(n).toString(16)).substr(-2);
return escape(text).split('')
.map(textToChars)
.map(applyKeyToChar)
.map(byteHex)
.join('');
};
teamChat.decrypt = text => {
let key = teamChat.genKey();
let textToChars = text => text.split('').map(c => c.charCodeAt());
let applyKeyToChar = code => textToChars(key).reduce((a,b) => a ^ b, code);
return "<" + commander.side + "> " + unescape(text.match(/.{1,2}/g)
.map(hex => parseInt(hex, 16))
.map(applyKeyToChar)
.map(charCode => String.fromCharCode(charCode))
.join(''));
};
RootConnection.prototype.send = function() {
if(commander.side) {
let prefix = commander.side.substring(0, 1) + '$';
if(arguments[0] === "message" && arguments[1].channel && arguments[1].text[0] === '$') {
arguments[1].text = prefix + teamChat.encrypt(arguments[1].text.substring(1));
}
}
return teamChat.network_end.apply(this, arguments);
}
chat.lines.push = function() {
if(commander.side) {
let prefix = commander.side.substring(0, 1) + '$';
if(arguments[0].channel && arguments[0].text.startsWith(prefix)) {
arguments[0].text = teamChat.decrypt(arguments[0].text.substring(2));
}
}
return teamChat.chat_push.apply(this, arguments);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment