Tehc

PMJS | By: Charsy

May 30th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. // Charsy
  2.  
  3. var pmVersion = "0.1.4";
  4.  
  5. append = src=>{
  6. var s = document.createElement('SCRIPT');
  7. s.src = src;
  8. document.body.appendChild(s);
  9. }
  10.  
  11. word_filter = [
  12. "﷽",
  13. "𒀱",
  14. "𒅃",
  15. "𒈓",
  16. "꧅"
  17. ];
  18.  
  19. filter = word=>{
  20. let regexp = new RegExp("\\b("+word_filter.join('|')+")\\b", "i");
  21. return regexp.test(word)
  22. }
  23.  
  24. append("https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"); // Using AES to encrypt/decrypt
  25.  
  26. sendPM = (t,m)=>{
  27. var msg = {a:CryptoJS.AES.encrypt(m,MPP.client.findParticipantById(t)._id.substr(0,5)).toString()};
  28. var p = MPP.client.getOwnParticipant();
  29. var arr = [];
  30. MPP.chat.receive({a:m,p:{name:"(S) "+p.name,color:p.color,_id:p._id,id:p.id},t:Date.now()});
  31. ('\0'+msg.a).match(/.{1,5}/g).forEach(a=>arr.push({n:a}));
  32. arr.push({n:MPP.client.findParticipantById(t)._id.substr(0,5)});
  33. MPP.client.sendArray([{m:'n',t:7,n:arr}]);
  34. };
  35.  
  36. receivePM = (m,i)=>{
  37. if(filter(m)) return;
  38. var a = {a:m,t:Date.now()};
  39. var p = MPP.client.findParticipantById(i);
  40. if(filter(p.name)) return;
  41. a.p = {name:"(S) "+p.name,color:p.color};
  42. MPP.chat.receive(a);
  43. };
  44.  
  45.  
  46. MPP.client.on("n",m=>{
  47. if(!m.n[0].v && m.t == 7 && m.n[m.n.length-1].n == MPP.client.getOwnParticipant()._id.substr(0,5)){
  48. var enc = "";
  49. for(var i=0; i < m.n.length-1; i++)
  50. enc += m.n[i].n;
  51. if(enc[0] !== "\0") return;
  52. var str = "";
  53. str = CryptoJS.AES.decrypt(enc.slice(1),MPP.client.getOwnParticipant()._id.substr(0,5)).toString(CryptoJS.enc.Utf8);
  54. if(str == "") str = "PMJS: Unable to decrypt!";
  55. receivePM(str,m.p);
  56. };
  57. });
  58.  
  59. console.log("%c"+
  60. "+========================+\n"
  61. +"| PMJS |\n"
  62. +"| |\n"
  63. +`| Version: ${pmVersion} |\n`
  64. +"+========================+",
  65. "color:#505050;");
  66.  
  67. // How to send a message:
  68. // sendPM('[User _id here]', '[Message here]');
Advertisement
Add Comment
Please, Sign In to add comment