fraddyrad

wp filter2022

Jul 15th, 2022
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 17.19 KB | None | 0 0
  1. //Version_JS;Version_TInjectMin;Version_CEF4Min;
  2. //1.2.0.0;1.0.0.9;78.3.0
  3. //
  4. //
  5.  
  6. function getAllGroupContacts(Contacts) {
  7.     SetConsoleMessage("GetAllGroupContacts", JSON.stringify(Contacts));
  8. }
  9.  
  10. function localStorageGetItem(item){
  11.     let aJson = localStorage.getItem(item);
  12.     SetConsoleMessage('getMyNumber', aJson.replace(/(?=:)(.*.?)(?=@)/g,''));
  13. }
  14.  
  15. function localStorageGetItemID(item){
  16.     let aNumberID = localStorage.getItem(item);
  17.     return aNumberID;
  18. }
  19.  
  20. function getMyNumber() {    
  21.     localStorage.getItem('last-wid-md') ?
  22.         localStorageGetItem('last-wid-md') :
  23.         localStorageGetItem('last-wid')
  24.        
  25.     return true;
  26. }
  27.  
  28. function getMyNumberID() {    
  29.     let numberID = 
  30.         localStorage.getItem('last-wid-md') ?
  31.         localStorageGetItemID('last-wid-md') :
  32.         localStorageGetItemID('last-wid')
  33.        
  34.     return numberID;
  35. }
  36.  
  37.  
  38. function convertImgToBase64URL(url, callback, outputFormat){
  39.     var img = new Image();
  40.     img.crossOrigin = 'Anonymous';
  41.     img.onload = function(){
  42.         var canvas = document.createElement('CANVAS'),
  43.         ctx = canvas.getContext('2d'), dataURL;
  44.         canvas.height = img.height;
  45.         canvas.width = img.width;
  46.         ctx.drawImage(img, 0, 0);
  47.         dataURL = canvas.toDataURL(outputFormat);
  48.         callback(dataURL);
  49.         canvas = null;
  50.     };
  51.     img.src = url;
  52. };
  53.  
  54. function SetConsoleMessage(jsName, resultValue) {
  55.     Obj = {
  56.         name: jsName,
  57.         result: '{"result":' + resultValue + '}'
  58.     }
  59.     console.log(JSON.stringify(Obj));
  60. }
  61.  
  62. var intervalMonitor;
  63. var isLoggedStatus = false;
  64. var gettingUnreadMessages = false;
  65.  
  66. function startMonitor(intervalSeconds = 0) {
  67.     isLoggedStatus = WAPI.isLoggedIn();
  68.    
  69.     if (intervalSeconds >= 1) {
  70.         intervalMonitor = window.setInterval(monitorUnReadMessages, intervalSeconds * 1000);
  71.     }
  72. }
  73.  
  74. function stopMonitor() {
  75.     window.clearInterval(intervalMonitor)
  76. }
  77.  
  78. function removeElementsByClass(elementClass) {
  79.     var elements = document.getElementsByClassName(elementClass);
  80.     if (typeof elements !== 'undefined' && elements.length > 0) {
  81.         for (var i = 0; i < elements.length; i++) {
  82.             elements[i].parentNode.removeChild(elements[i]);
  83.         }
  84.     }
  85. }
  86.  
  87. function moveElementsToParentParentElement(elementClass) {
  88.     var elements = document.getElementsByClassName(elementClass);
  89.     if (typeof elements !== 'undefined' && elements.length > 0) {
  90.         for (var i = 0; i < elements.length; i++) {
  91.             var element = elements[i];
  92.             element.parentNode.parentNode.appendChild(element);
  93.         }
  94.     }
  95. }
  96.  
  97. function monitorUnReadMessages() {
  98.     if (gettingUnreadMessages) return;
  99.    
  100.     gettingUnreadMessages = true;
  101.    
  102.     var currentStatus = WAPI.isLoggedIn();
  103.     if (currentStatus != isLoggedStatus) {
  104.         isLoggedStatus = WAPI.isLoggedIn();
  105.         SetConsoleMessage("OnChangeConnect", JSON.stringify(isLoggedStatus));
  106.     }
  107.  
  108.     if (isLoggedStatus) {
  109.         WAPI.getUnreadMessages(includeMe = "true", includeNotifications = "true", use_unread_count = "true");
  110.     }
  111.     gettingUnreadMessages = false;
  112. }
  113.  
  114. if (!window.Store||!window.Store.Msg) {
  115.     (function () {
  116.         function getStore(modules) {
  117.             let foundCount = 0;
  118.             let neededObjects = [
  119.                 { id: "Store", conditions: (module) => (module.default && module.default.Chat && module.default.Msg) ? module.default : null},
  120.                 { id: "Conn", conditions: (module) => (module.default && module.default.ref && module.default.refTTL) ? module.default : (module.Conn ? module.Conn : null)},
  121.                 { id: "MediaCollection", conditions: (module) => (module.default && module.default.prototype && (module.default.prototype.processFiles !== undefined||module.default.prototype.processAttachments !== undefined)) ? module.default : null },
  122.                 { id: "MediaProcess", conditions: (module) => (module.BLOB) ? module : null },
  123.                 { id: "Archive", conditions: (module) => (module.setArchive) ? module : null },
  124.                 { id: "Block", conditions: (module) => (module.blockContact && module.unblockContact) ? module : null },
  125.                 { id: "ChatUtil", conditions: (module) => (module.sendClear) ? module : null },
  126.                 { id: "GroupInvite", conditions: (module) => (module.sendQueryGroupInviteCode ) ? module : null },
  127.                 { id: "Wap", conditions: (module) => (module.createGroup) ? module : null },
  128.                 { id: "ServiceWorker", conditions: (module) => (module.default && module.default.killServiceWorker) ? module : null },
  129.                 { id: "State", conditions: (module) => (module.STATE && module.STREAM) ? module : null },
  130.                 { id: "_Presence", conditions: (module) => (module.setPresenceAvailable && module.setPresenceUnavailable) ? module : null },
  131.                 { id: "WapDelete", conditions: (module) => (module.sendConversationDelete && module.sendConversationDelete.length == 2) ? module : null },
  132.                 { id: 'FindChat', conditions: (module) => (module && module.findChat) ? module : null},            
  133.                 { id: "WapQuery", conditions: (module) => (module.default && module.default.queryExist) ? module.default : null },             
  134.                 { id: "WapQueryMD", conditions: (module) => (module.queryExist && module) ? module : null },
  135.                 { id: 'Perfil', conditions: (module) => module.__esModule === true && module.setPushname && !module.getComposeContents ? module : null},
  136.                 { id: "CryptoLib", conditions: (module) => (module.decryptE2EMedia) ? module : null },
  137.                 { id: "OpenChat", conditions: (module) => (module.default && module.default.prototype && module.default.prototype.openChat) ? module.default : null },
  138.                 { id: "UserConstructor", conditions: (module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null },
  139.                 { id: "SendTextMsgToChat", conditions: (module) => (module.sendTextMsgToChat) ? module.sendTextMsgToChat : null },
  140.                 { id: "ReadSeen", conditions: (module) => (module.sendSeen) ? module : null },
  141.                 { id: "sendDelete", conditions: (module) => (module.sendDelete) ? module.sendDelete : null },
  142.                 { id: "addAndSendMsgToChat", conditions: (module) => (module.addAndSendMsgToChat) ? module.addAndSendMsgToChat : null },
  143.                 { id: "sendMsgToChat", conditions: (module) => (module.sendMsgToChat) ? module.sendMsgToChat : null },
  144.                 { id: "Catalog", conditions: (module) => (module.Catalog) ? module.Catalog : null },
  145.                 { id: "bp", conditions: (module) => (module.default&&module.default.toString&&module.default.toString().includes('bp_unknown_version')) ? module.default : null },
  146.                 { id: "MsgKey", conditions: (module) => (module.default&&module.default.toString&&module.default.toString().includes('MsgKey error: obj is null/undefined')) ? module.default : null },
  147.                 { id: "Parser", conditions: (module) => (module.convertToTextWithoutSpecialEmojis) ? module.default : null },
  148.                 { id: "Builders", conditions: (module) => (module.TemplateMessage && module.HydratedFourRowTemplate) ? module : null },
  149.                 { id: "Me", conditions: (module) => (module.PLATFORMS && module.Conn) ? module.default : null },
  150.                 { id: "CallUtils", conditions: (module) => (module.sendCallEnd && module.parseCall) ? module : null },
  151.                 { id: "Identity", conditions: (module) => (module.queryIdentity && module.updateIdentity) ? module : null },
  152.                 { id: "MyStatus", conditions: (module) => (module.getStatus && module.setMyStatus) ? module : null },                
  153.                 { id: "ChatStates", conditions: (module) => (module.sendChatStatePaused && module.sendChatStateRecording && module.sendChatStateComposing) ? module : null },              
  154.                 { id: "GroupActions", conditions: (module) => (module.sendExitGroup && module.localExitGroup) ? module : null },
  155.                 { id: "Features", conditions: (module) => (module.FEATURE_CHANGE_EVENT && module.features) ? module : null },
  156.                 { id: "MessageUtils", conditions: (module) => (module.storeMessages && module.appendMessage) ? module : null },
  157.                 { id: "WebMessageInfo", conditions: (module) => (module.WebMessageInfo && module.WebFeatures) ? module.WebMessageInfo : null },
  158.                 { id: "createMessageKey", conditions: (module) => (module.createMessageKey && module.createDeviceSentMessage) ? module.createMessageKey : null },
  159.                 { id: "Participants", conditions: (module) => (module.addParticipants && module.removeParticipants && module.promoteParticipants && module.demoteParticipants) ? module : null },
  160.                 { id: "WidFactory", conditions: (module) => (module.isWidlike && module.createWid && module.createWidFromWidLike) ? module : null },
  161.                 { id: "Base", conditions: (module) => (module.setSubProtocol && module.binSend && module.actionNode) ? module : null },
  162.                 { id: "Versions", conditions: (module) => (module.loadProtoVersions && module.default && module.default["15"] && module.default["16"] && module.default["17"]) ? module : null },
  163.                 { id: "Sticker", conditions: (module) => (module.default && module.default.Sticker) ? module.default.Sticker : null },
  164.                 { id: "MediaUpload", conditions: (module) => (module.default && module.default.mediaUpload) ? module.default : null },
  165.                 { id: "UploadUtils", conditions: (module) => (module.default && module.default.encryptAndUpload) ? module.default : null },
  166.                 { id: 'UserPrefs', conditions: (module) => (module.getMaybeMeUser ? module : null), },
  167.                 { id: 'Vcard', conditions: (module) => (module.vcardFromContactModel ? module : null)}
  168.             ];
  169.             for (let idx in modules) {
  170.                 if ((typeof modules[idx] === "object") && (modules[idx] !== null)) {
  171.                     neededObjects.forEach((needObj) => {
  172.                         if (!needObj.conditions || needObj.foundedModule)
  173.                             return;
  174.                         let neededModule = needObj.conditions(modules[idx]);
  175.                         if (neededModule !== null) {
  176.                             foundCount++;
  177.                             needObj.foundedModule = neededModule;
  178.                         }
  179.             });
  180.  
  181.                     if (foundCount == neededObjects.length) {
  182.                         break;
  183.                     }
  184.                 }
  185.             }
  186.         let neededStore = neededObjects.find((needObj) => needObj.id === "Store");
  187.             window.Store = neededStore.foundedModule ? neededStore.foundedModule : {};
  188.             neededObjects.splice(neededObjects.indexOf(neededStore), 1);
  189.             neededObjects.forEach((needObj) => {
  190.                 if (needObj.foundedModule) {
  191.                     window.Store[needObj.id] = needObj.foundedModule;
  192.                 }
  193.             });
  194.         window.Store.Chat.modelClass.prototype.sendMessage = function (e) {
  195.         window.Store.SendTextMsgToChat(this, ...arguments);
  196.         }
  197.             return window.Store;
  198.         }
  199.         const parasite = `parasite${Date.now()}`
  200.  
  201.         if (typeof webpackJsonp === 'function') webpackJsonp([], {[parasite]: (x, y, z) => getStore(z)}, [parasite]);
  202.         else webpackChunkwhatsapp_web_client.push([[parasite], {}, function (o, e, t) {let modules = []; for (let idx in o.m) {modules.push(o(idx));}   getStore(modules);}]);
  203.        
  204.     })();
  205. }
  206.  
  207. window.WAPI = {};
  208. window._WAPI = {};
  209.  
  210. window.WAPI._serializeRawObj = (obj) => {
  211.     if (obj && obj.toJSON) {
  212.         return obj.toJSON();
  213.     }
  214.     return {}
  215. };
  216.  
  217. /**
  218.  * Serializes a chat object
  219.  *
  220.  * @param rawChat Chat object
  221.  * @returns {{}}
  222.  */
  223.  
  224. window.WAPI._serializeChatObj = (obj) => {
  225.     if (obj == undefined) {
  226.         return null;
  227.     }
  228.     return Object.assign(window.WAPI._serializeRawObj(obj), {
  229.         kind: obj.kind,
  230.         isGroup: obj.isGroup,
  231.         formattedTitle: obj.formattedTitle,
  232.         contact: obj['contact'] ? window.WAPI._serializeContactObj(obj['contact']) : null,
  233.         groupMetadata: obj["groupMetadata"] ? window.WAPI._serializeRawObj(obj["groupMetadata"]) : null,
  234.         presence: obj["presence"] ? window.WAPI._serializeRawObj(obj["presence"]) : null,
  235.         msgs: null
  236.     });
  237. };
  238.  
  239. window.WAPI._serializeContactObj = (obj) => {
  240.     if (obj == undefined) {
  241.         return null;
  242.     }
  243.    
  244.     let profilePhoto = window.Store.ProfilePicThumb._index[obj.__x_id._serialized] ? window.Store.ProfilePicThumb._index[obj.__x_id._serialized].__x_imgFull : {}
  245.    
  246.     return Object.assign(window.WAPI._serializeRawObj(obj), {
  247.         id: obj.id._serialized,
  248.         formattedName: obj.formattedName,
  249.         isHighLevelVerified: obj.isHighLevelVerified,
  250.         isMe: obj.isMe,
  251.         isMyContact: obj.isMyContact,
  252.         isPSA: obj.isPSA,
  253.         isUser: obj.isUser,
  254.         isVerified: obj.isVerified,
  255.         isWAContact: obj.isWAContact,
  256.         profilePicThumb: profilePhoto,
  257.         statusMute: obj.statusMute,
  258.         msgs: null
  259.     });
  260. };
  261.  
  262. window.WAPI._serializeMessageObj = (obj) => {
  263.     if (obj == undefined) {
  264.         return null;
  265.     }
  266.     const _chat = obj['chat'] ? WAPI._serializeChatObj(obj['chat']) : {};
  267.     if(obj.quotedMsg) obj.quotedMsgObj();
  268.     return Object.assign(window.WAPI._serializeRawObj(obj), {
  269.         id: obj.id._serialized,
  270.         //add 02/06/2020 mike -->
  271.         quotedParticipant: obj.quotedParticipant? obj.quotedParticipant._serialized ? obj.quotedParticipant._serialized : undefined : undefined,
  272.         author: obj.author? obj.author._serialized ? obj.author._serialized : undefined : undefined,
  273.         chatId: obj.chatId? obj.chatId._serialized ? obj.chatId._serialized : undefined : undefined,
  274.         to: obj.to? obj.to._serialized ? obj.to._serialized : undefined : undefined,
  275.         fromMe: obj.id.fromMe,
  276.         //add 02/06/2020 mike <--
  277.        
  278.         sender: obj["senderObj"] ? WAPI._serializeContactObj(obj["senderObj"]) : null,
  279.         timestamp: obj["t"],
  280.         content: obj["body"],
  281.         isGroupMsg: obj.isGroupMsg,
  282.         isLink: obj.isLink,
  283.         isMMS: obj.isMMS,
  284.         isMedia: obj.isMedia,
  285.         isNotification: obj.isNotification,
  286.         isPSA: obj.isPSA,
  287.         type: obj.type,
  288.         chat: _chat,
  289.         isOnline: _chat.isOnline,
  290.         lastSeen: _chat.lastSeen,
  291.         chatId: obj.id.remote,
  292.         quotedMsgObj: WAPI._serializeMessageObj(obj['_quotedMsgObj']),
  293.         mediaData: window.WAPI._serializeRawObj(obj['mediaData']),
  294.         reply: body => window.WAPI.reply(_chat.id._serialized, body, obj)
  295.     });
  296. };
  297.  
  298. window.WAPI._serializeNumberStatusObj = (obj) => {
  299.     if (obj == undefined) {
  300.         return null;
  301.     }
  302.  
  303.     return Object.assign({}, {
  304.         id: obj.jid,
  305.         status: obj.status,
  306.         isBusiness: (obj.biz === true),
  307.         canReceiveMessage: (obj.status === 200)
  308.     });
  309. };
  310.  
  311. window.WAPI._serializeNumberStatusObjMD = (obj) => {
  312.     if (obj == undefined) {
  313.         return null;
  314.     }
  315.    
  316.     let awid = false
  317.    
  318.     var _awid = ""+obj.wid+""
  319.    
  320.     if (_awid.length > 0){
  321.         awid = true
  322.     } else {
  323.         awid = false
  324.     }
  325.    
  326.     console.log('_awid: '+ awid)
  327.        
  328.     return Object.assign({}, {
  329.         id: obj.wid,
  330.         status: awid   
  331.         //isBusiness: (obj.biz === true)
  332.     });
  333. };
  334.  
  335.  
  336. /**
  337.  * New messages observable functions.
  338.  */
  339. window.WAPI._newMessagesQueue = [];
  340. window.WAPI._newMessagesBuffer = (sessionStorage.getItem('saved_msgs') != null) ? JSON.parse(sessionStorage.getItem('saved_msgs')) : [];
  341. window.WAPI._newMessagesDebouncer = null;
  342. window.WAPI._newMessagesCallbacks = [];
  343.  
  344. window.Store.Msg.off('add');
  345. sessionStorage.removeItem('saved_msgs');
  346.  
  347.  
  348. //Validar numero whatsapp 12/02/2020
  349. window.WAPI.isValidNumber = async function (phoneId) {
  350.     isValid = window.Store.WapQuery.queryExist(phoneId).then(result => {
  351.         return result.jid !== undefined;
  352.     }).catch((e) => {
  353.         return false;
  354.     });
  355.  
  356.     return isValid;
  357. };
  358.  
  359. /** 28/04/2020 - Mike
  360.  * Send location
  361.  *
  362.  * @param {string} chatId '558199999999@c.us'
  363.  * @param {string} lat latitude
  364.  * @param {string} lng longitude
  365.  * @param {string} loc Texto link para a localizacao
  366.  */
  367.  
  368.  
  369.  
  370. function SetConsoleMessageString(jsName, StringValue) {
  371.     Obj = {
  372.         name: jsName,
  373.         result: StringValue
  374.     }
  375.     console.log(JSON.stringify(Obj));
  376. }
  377.  
  378.  
  379.  
  380. window.WAPI.checkNumberStatus = async function (id, statuses) {
  381.     try {
  382.         let isMd = true
  383.         let result
  384.         try {
  385.              result = await window.Store.WapQueryMD.queryExist('+'+id);
  386.            
  387.         }
  388.         catch(e){      
  389.             isMd = false
  390.         }
  391.         result = isMd ? result : await window.Store.WapQuery.queryExist(id);//MD
  392.                
  393.         let data = isMd ? window.WAPI._serializeNumberStatusObjMD(result) :  window.WAPI._serializeNumberStatusObj(result)
  394.        
  395.         if(isMd){
  396.             SetConsoleMessage("NewCheckIsValidNumber",    JSON.stringify({ id : data.id, valid : data.status}));
  397.         }else{
  398.             statuses.push(id +";"+ data.canReceiveMessage.toString());
  399.         }
  400.      
  401.      return data;
  402.        
  403.     } catch (e) {
  404.             SetConsoleMessage("NoFound", JSON.stringify({ id : id,  valid : false}));
  405.             statuses.push(id +";"+ "false");
  406.  
  407.             return window.WAPI._serializeNumberStatusObj({
  408.                 status: e,
  409.                 jid: id
  410.             });
  411.     }
  412. };
  413.  
Add Comment
Please, Sign In to add comment