PCD15

Just for fun :)

  1. // ==UserScript==
  2. // @name PCD15
  3. // @namespace https://kcw.kddi.ne.jp
  4. // @include https://kcw.kddi.ne.jp/*
  5. // @version 1.4.5
  6. // @description Just for fun :)
  7. // @author Galac
  8. // @match https://kcw.kddi.ne.jp/*
  9. // @match https://www.chatwork.com/*
  10. // @grant none
  11. // @require https://greasyfork.org/scripts/9683-rabbit-encrypt/code/Rabbit%20encrypt.js?version=50281
  12.  
  13. // ==/UserScript==
  14.  
  15. var passphrase = '';
  16.  
  17. function encrypt(mes) {
  18. if (passphrase != '') {
  19. var encrypted = CryptoJS.Rabbit.encrypt(mes, passphrase);
  20. return "Pcd15@" + encrypted;
  21. } else {
  22. return mes;
  23. }
  24. }
  25.  
  26. function decrypt(textEncrypt) {
  27. if (passphrase != '') {
  28. try {
  29. var decrypted = CryptoJS.Rabbit.decrypt(textEncrypt, passphrase);
  30. return decrypted.toString(CryptoJS.enc.Utf8);
  31. } catch (e)
  32. {
  33. console.log("Error:" + e.message);
  34. return "Error format!";
  35. }
  36.  
  37. } else {
  38. return textEncrypt;
  39. }
  40. }
  41.  
  42.  
  43. function validUrl() { //just accept rooms, users with a filter
  44. var acceptLinks = ["rid19625982", "rid32581066","rid33506770"]; //array text of url acceptable
  45. var currentUrl = window.location.href;
  46. if (acceptLinks.length > 0){
  47. for (var i = 0; i< acceptLinks.length; i++){
  48. if (currentUrl.indexOf(acceptLinks[i]) != -1) {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. else return false;
  55. }
  56. function convert(encrypt_text){
  57. // check valid TO
  58. var value='';
  59. var valid_tag = ['[To' ,'[Reply'];
  60. for(i=0;i<valid_tag.length;i++){
  61. if (encrypt_text.indexOf(valid_tag[i]) == 0){
  62. value += encrypt_text.substr(0, encrypt_text.indexOf("\n"));
  63. value += '\n';
  64. value += encrypt(encrypt_text.substr(encrypt_text.indexOf("\n")));
  65. return value;
  66. }
  67. }
  68. if (encrypt_text.indexOf('[Quo') == 0) {
  69. console.log( encrypt_text.lastIndexOf('[/Quote]'));
  70. value += encrypt_text.substr(0, encrypt_text.lastIndexOf('[/Quote]')+8);
  71. console.log(encrypt_text.substr(encrypt_text.lastIndexOf('/Quote]')+8));
  72. value += encrypt(encrypt_text.substr(encrypt_text.lastIndexOf('/Quote]')+8));
  73. return value;
  74. }
  75. return encrypt(encrypt_text);
  76. }
  77. $(function() {
  78. //Get Passphase
  79. //var url = "https://108.61.181.151/getpp";
  80. var url = "https://yourpigeon.biz/getpp";
  81. var data = {
  82. id : '12345',
  83. pcode : '0000'
  84. }
  85. var puid = myid != null ? myid : '12345';
  86. data.id = puid;
  87. var pcodeToday = prompt("Private code today!");
  88. if (pcodeToday != null) {
  89. data.pcode = pcodeToday;
  90. }
  91.  
  92. try {
  93. //Ajax get passphase
  94. $.ajax({
  95. type: "POST",
  96. url: url,
  97. data: data,
  98. dataType: 'json',
  99. success: function (result){
  100. if (result.status == "0") {
  101. passphrase = result.data.pass_phase;
  102. }
  103. },
  104. error: function (){
  105. var winPr = window.open('http://108.61.181.151:3000/guide', '_blank');
  106. winPr.focus();
  107. }
  108. });
  109. } catch (e) {
  110. var winPr = window.open('http://108.61.181.151:3000/guide', '_blank');
  111. winPr.focus();
  112. }
  113.  
  114.  
  115. $('#_chatText').on('keydown', function(e){
  116. if (e.which == 13) {
  117. if (e.altKey) { // alt/option key is down
  118. if (validUrl()) {
  119. //if (this.value.indexOf('Pcd15@') == -1 ) {
  120. var encrT = convert(this.value);
  121. this.value = encrT;
  122. e.preventDefault();
  123. //}
  124. }
  125. }
  126. }
  127. });
  128. $("#_chatContent").on('mouseover', 'div.chatTimeLineMessageArea', function(e){
  129. if (validUrl()) {
  130. //Add title
  131. var pre =$(e.target);
  132. if (!pre.attr('dataDec')){
  133. text = pre.clone().children().remove().end().text();
  134. if (text.indexOf('Pcd15@') != -1) {
  135. var encrptVal = text.substr(text.indexOf('Pcd15@')+6);
  136. var decryptVal = decrypt(encrptVal);
  137. pre.attr('title', decryptVal);
  138. pre.attr('dataDec', 1);
  139. }
  140. }
  141. }
  142.  
  143. });
  144.  
  145. });