Files
inzerosight/dist/firefox/content.js
2026-09-14 14:49:28 -07:00

56 lines
16 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(){"use strict";const I={3:{unifier:"­",0:"",1:"",2:""},6:{unifier:"",0:"",1:"",2:"­",3:"",4:"",5:""},8:{unifier:"",0:"",1:"",2:"­",3:"",4:"",5:"",6:"",7:"\uFEFF"},encodeString:(s,e=3)=>Array.from(s,a=>a.codePointAt(0).toString(e).split("").map(p=>I[e][p]).join("")).join(I[e].unifier),encodeNumberArray:(s,e=3)=>s.map(a=>a.toString(e).split("").map(p=>I[e][p]).join("")).join(I[e].unifier),decodeToString:(s,e=3)=>s.split(I[e].unifier).map(a=>String.fromCodePoint(parseInt(Array.from(a).map(p=>Object.keys(I[e]).find(b=>I[e][b]===p)).join(""),e))).join(""),decodeToNumberArray:(s,e=3)=>s.split(I[e].unifier).map(a=>parseInt(Array.from(a).map(p=>Object.keys(I[e]).find(b=>I[e][b]===p)).join(""),e))};function J(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var N,H;function Q(){if(H)return N;H=1;function s(e={}){const a=e.bits||16,p=e.rounds||22,b=e.rightRotations||7,d=e.leftRotations||2,l=2**a,o=l-1,i=(c,n)=>c>>n|c<<a-n&o,h=(c,n)=>c<<n&o|c>>a-n,g=(c,n,t)=>(c=i(c,b),c=c+n&o,c^=t,n=h(n,d),n^=c,[c,n]),y=(c,n,t)=>(n^=c,n=i(n,d),c^=t,c=c-n&o,c=h(c,b),[c,n]);function E(c,n){let t=c[0],u=c[1],r=n[0],m=n.slice(1);[u,t]=g(u,t,r);for(let w=0;w<p-1;w++){const k=w%m.length;[m[k],r]=g(m[k],r,w),[u,t]=g(u,t,r)}return[t,u]}function A(c,n){let t=c[0],u=c[1],r=n[0],m=n.slice(1);for(let w=0;w<p-1;w++){const k=w%m.length;[m[k],r]=g(m[k],r,w)}for(let w=0;w<p;w++){const k=(p-2-w)%m.length;[u,t]=y(u,t,r),[m[k],r]=y(m[k],r,p-2-w)}return[t,u]}function f(c){return(n,t)=>{const u=c([n/l|0,n&o],t);return u[0]*l+u[1]}}return{encrypt:f(E),decrypt:f(A),encryptRaw:E,decryptRaw:A}}return N=s,N}var Z=Q();const L=J(Z);var D,M;function z(){if(M)return D;M=1;const s="Input must be an string, Buffer or Uint8Array";function e(l){let o;if(l instanceof Uint8Array)o=l;else if(typeof l=="string")o=new TextEncoder().encode(l);else throw new Error(s);return o}function a(l){return Array.prototype.map.call(l,function(o){return(o<16?"0":"")+o.toString(16)}).join("")}function p(l){return(4294967296+l).toString(16).substring(1)}function b(l,o,i){let h=`
`+l+" = ";for(let g=0;g<o.length;g+=2){if(i===32)h+=p(o[g]).toUpperCase(),h+=" ",h+=p(o[g+1]).toUpperCase();else if(i===64)h+=p(o[g+1]).toUpperCase(),h+=p(o[g]).toUpperCase();else throw new Error("Invalid size "+i);g%6===4?h+=`
`+new Array(l.length+4).join(" "):g<o.length-2&&(h+=" ")}console.log(h)}function d(l,o,i){let h=new Date().getTime();const g=new Uint8Array(o);for(let E=0;E<o;E++)g[E]=E%256;const y=new Date().getTime();console.log("Generated random input in "+(y-h)+"ms"),h=y;for(let E=0;E<i;E++){const A=l(g),f=new Date().getTime(),c=f-h;h=f,console.log("Hashed in "+c+"ms: "+A.substring(0,20)+"..."),console.log(Math.round(o/(1<<20)/(c/1e3)*100)/100+" MB PER SECOND")}}return D={normalizeInput:e,toHex:a,debugPrint:b,testSpeed:d},D}var U,G;function ee(){if(G)return U;G=1;const s=z();function e(t,u,r){const m=t[u]+t[r];let w=t[u+1]+t[r+1];m>=4294967296&&w++,t[u]=m,t[u+1]=w}function a(t,u,r,m){let w=t[u]+r;r<0&&(w+=4294967296);let k=t[u+1]+m;w>=4294967296&&k++,t[u]=w,t[u+1]=k}function p(t,u){return t[u]^t[u+1]<<8^t[u+2]<<16^t[u+3]<<24}function b(t,u,r,m,w,k){const be=h[w],he=h[w+1],ge=h[k],me=h[k+1];e(i,t,u),a(i,t,be,he);let S=i[m]^i[t],T=i[m+1]^i[t+1];i[m]=T,i[m+1]=S,e(i,r,m),S=i[u]^i[r],T=i[u+1]^i[r+1],i[u]=S>>>24^T<<8,i[u+1]=T>>>24^S<<8,e(i,t,u),a(i,t,ge,me),S=i[m]^i[t],T=i[m+1]^i[t+1],i[m]=S>>>16^T<<16,i[m+1]=T>>>16^S<<16,e(i,r,m),S=i[u]^i[r],T=i[u+1]^i[r+1],i[u]=T>>>31^S<<1,i[u+1]=S>>>31^T<<1}const d=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),l=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],o=new Uint8Array(l.map(function(t){return t*2})),i=new Uint32Array(32),h=new Uint32Array(32);function g(t,u){let r=0;for(r=0;r<16;r++)i[r]=t.h[r],i[r+16]=d[r];for(i[24]=i[24]^t.t,i[25]=i[25]^t.t/4294967296,u&&(i[28]=~i[28],i[29]=~i[29]),r=0;r<32;r++)h[r]=p(t.b,4*r);for(r=0;r<12;r++)b(0,8,16,24,o[r*16+0],o[r*16+1]),b(2,10,18,26,o[r*16+2],o[r*16+3]),b(4,12,20,28,o[r*16+4],o[r*16+5]),b(6,14,22,30,o[r*16+6],o[r*16+7]),b(0,10,20,30,o[r*16+8],o[r*16+9]),b(2,12,22,24,o[r*16+10],o[r*16+11]),b(4,14,16,26,o[r*16+12],o[r*16+13]),b(6,8,18,28,o[r*16+14],o[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^i[r]^i[r+16]}const y=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function E(t,u,r,m){if(t===0||t>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(u&&u.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(r&&r.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(m&&m.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const w={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:t};y.fill(0),y[0]=t,u&&(y[1]=u.length),y[2]=1,y[3]=1,r&&y.set(r,32),m&&y.set(m,48);for(let k=0;k<16;k++)w.h[k]=d[k]^p(y,k*4);return u&&(A(w,u),w.c=128),w}function A(t,u){for(let r=0;r<u.length;r++)t.c===128&&(t.t+=t.c,g(t,!1),t.c=0),t.b[t.c++]=u[r]}function f(t){for(t.t+=t.c;t.c<128;)t.b[t.c++]=0;g(t,!0);const u=new Uint8Array(t.outlen);for(let r=0;r<t.outlen;r++)u[r]=t.h[r>>2]>>8*(r&3);return u}function c(t,u,r,m,w){r=r||64,t=s.normalizeInput(t),m&&(m=s.normalizeInput(m)),w&&(w=s.normalizeInput(w));const k=E(r,u,m,w);return A(k,t),f(k)}function n(t,u,r,m,w){const k=c(t,u,r,m,w);return s.toHex(k)}return U={blake2b:c,blake2bHex:n,blake2bInit:E,blake2bUpdate:A,blake2bFinal:f},U}var B,q;function te(){if(q)return B;q=1;const s=z();function e(f,c){return f[c]^f[c+1]<<8^f[c+2]<<16^f[c+3]<<24}function a(f,c,n,t,u,r){l[f]=l[f]+l[c]+u,l[t]=p(l[t]^l[f],16),l[n]=l[n]+l[t],l[c]=p(l[c]^l[n],12),l[f]=l[f]+l[c]+r,l[t]=p(l[t]^l[f],8),l[n]=l[n]+l[t],l[c]=p(l[c]^l[n],7)}function p(f,c){return f>>>c^f<<32-c}const b=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),d=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),l=new Uint32Array(16),o=new Uint32Array(16);function i(f,c){let n=0;for(n=0;n<8;n++)l[n]=f.h[n],l[n+8]=b[n];for(l[12]^=f.t,l[13]^=f.t/4294967296,c&&(l[14]=~l[14]),n=0;n<16;n++)o[n]=e(f.b,4*n);for(n=0;n<10;n++)a(0,4,8,12,o[d[n*16+0]],o[d[n*16+1]]),a(1,5,9,13,o[d[n*16+2]],o[d[n*16+3]]),a(2,6,10,14,o[d[n*16+4]],o[d[n*16+5]]),a(3,7,11,15,o[d[n*16+6]],o[d[n*16+7]]),a(0,5,10,15,o[d[n*16+8]],o[d[n*16+9]]),a(1,6,11,12,o[d[n*16+10]],o[d[n*16+11]]),a(2,7,8,13,o[d[n*16+12]],o[d[n*16+13]]),a(3,4,9,14,o[d[n*16+14]],o[d[n*16+15]]);for(n=0;n<8;n++)f.h[n]^=l[n]^l[n+8]}function h(f,c){if(!(f>0&&f<=32))throw new Error("Incorrect output length, should be in [1, 32]");const n=c?c.length:0;if(c&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");const t={h:new Uint32Array(b),b:new Uint8Array(64),c:0,t:0,outlen:f};return t.h[0]^=16842752^n<<8^f,n>0&&(g(t,c),t.c=64),t}function g(f,c){for(let n=0;n<c.length;n++)f.c===64&&(f.t+=f.c,i(f,!1),f.c=0),f.b[f.c++]=c[n]}function y(f){for(f.t+=f.c;f.c<64;)f.b[f.c++]=0;i(f,!0);const c=new Uint8Array(f.outlen);for(let n=0;n<f.outlen;n++)c[n]=f.h[n>>2]>>8*(n&3)&255;return c}function E(f,c,n){n=n||32,f=s.normalizeInput(f);const t=h(n,c);return g(t,f),y(t)}function A(f,c,n){const t=E(f,c,n);return s.toHex(t)}return B={blake2s:E,blake2sHex:A,blake2sInit:h,blake2sUpdate:g,blake2sFinal:y},B}var _,V;function ne(){if(V)return _;V=1;const s=ee(),e=te();return _={blake2b:s.blake2b,blake2bHex:s.blake2bHex,blake2bInit:s.blake2bInit,blake2bUpdate:s.blake2bUpdate,blake2bFinal:s.blake2bFinal,blake2s:e.blake2s,blake2sHex:e.blake2sHex,blake2sInit:e.blake2sInit,blake2sUpdate:e.blake2sUpdate,blake2sFinal:e.blake2sFinal},_}var W=ne();const re=L({bits:24,rounds:23,rightRotations:8,leftRotations:3});function oe(s){const e=W.blake2bHex(s,null,12);return[parseInt(e.slice(0,6),16),parseInt(e.slice(6,12),16),parseInt(e.slice(12,18),16),parseInt(e.slice(18,24),16)]}function ie(s,e){if(!s||s.length===0)return"";const a=s[0];return s.slice(1).map((b,d)=>{const l=a*16777216+(d&16777215),o=re.encrypt(l,e),i=(b^o)>>>0;try{return String.fromCodePoint(i)}catch{return""}}).join("")}const se=L();function le(s){const e=W.blake2bHex(s,null,8);return[parseInt(e.slice(0,4),16),parseInt(e.slice(4,8),16),parseInt(e.slice(8,12),16),parseInt(e.slice(12,16),16)]}function ce(s,e){return s.map(a=>{try{return String.fromCodePoint(se.decrypt(a,e))}catch{return""}}).join("")}const O="­",x={3:"­",6:"­",8:"­"},X={1:"SPECK48_96CTR",2:"SPECK32_64ECB (insecure)"};Object.fromEntries(Object.entries(X).map(([s,e])=>[e,+s]));function ae(s){if(!s.includes(O))return null;const e=Object.keys(x).find(d=>s.includes(x[d]));if(!e)return null;const a=s.indexOf(x[e]),p=s.slice(a+x[e].length),b=I[e].unifier+I[e][0];if(p.startsWith(b)){const l=Array.from(p.slice(b.length,b.length+3)).map(g=>Object.keys(I[e]).find(y=>I[e][y]===g)).join(""),o=X[parseInt(l,e)],i=p.slice(b.length+3),h=x[e].length+b.length+3;return{base:e,cipher:o,payload:i,sigIdx:a,sigLen:h}}return{base:e,cipher:"PLAIN",payload:p,sigIdx:a,sigLen:x[e].length}}function K(s,e,a){const p=new Set(Object.values(I[e]));let b=a;for(;b<s.length&&p.has(s[b]);)b++;return b}let R,v;const C=new Set;function ue(){if(R)return;R=document.createElement("div"),R.id="in0-host",v=R.attachShadow({mode:"open"});const s=document.createElement("style");s.textContent=`
.in0-wrap {
position: fixed;
pointer-events: auto;
z-index: 2147483647;
display: flex;
flex-direction: column;
align-items: center;
font-family: system-ui, -apple-system, sans-serif;
transition: opacity 0.1s ease;
}
.in0-btn {
background: #18191c;
color: #fff;
border: 1px solid #3a3b40;
border-radius: 4px;
font-size: 11px;
font-weight: 600;
padding: 4px 10px;
cursor: pointer;
box-shadow: 0 4px 12px rgba(0,0,0,0.5);
position: relative;
white-space: nowrap;
}
.in0-btn:hover {
border-color: #00b4d8;
box-shadow: 0 0 8px rgba(0,180,216,0.4);
}
.in0-badge {
position: absolute;
top: -6px;
right: -6px;
width: 15px;
height: 15px;
border-radius: 50%;
background: #00b4d8;
color: #fff;
font-size: 10px;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.in0-arrow {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 6px solid #18191c;
margin-top: -1px;
}
`,v.appendChild(s),(document.body||document.documentElement).appendChild(R)}function fe(s,e,a,p,b){for(const g of C)if(g.node===s&&g.start===a)return;ue();const d=document.createElement("div");d.className="in0-wrap";const l=document.createElement("button");l.className="in0-btn",l.textContent=e.cipher==="PLAIN"?"Decode":"Decrypt";const o=document.createElement("span");o.className="in0-badge",o.textContent="Ø",l.appendChild(o);const i=document.createElement("div");i.className="in0-arrow",d.appendChild(l),d.appendChild(i),v.appendChild(d);const h={wrap:d,node:s,start:a,endNode:p,end:b};C.add(h),l.onclick=()=>de(h,e),$(h)}function $(s){const{wrap:e,node:a,start:p,endNode:b,end:d}=s;if(!a.isConnected||!b.isConnected){e.remove(),C.delete(s);return}const l=a.parentElement;if(!l||l.checkVisibility&&!l.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0})){e.style.display="none";return}const o=document.createRange();try{o.setStart(a,p),o.setEnd(b,Math.min(d,b.nodeValue.length))}catch{e.remove(),C.delete(s);return}let i=o.getBoundingClientRect();if(!i.width&&!i.height&&(i=l.getBoundingClientRect()),!i.width&&!i.height){e.style.display="none";return}if(i.bottom<0||i.top>window.innerHeight||i.right<0||i.left>window.innerWidth){e.style.display="none";return}let h=l;for(;h&&h!==document.body&&h!==document.documentElement;){const E=window.getComputedStyle(h);if(E.overflow!=="visible"||E.overflowX!=="visible"||E.overflowY!=="visible"){const A=h.getBoundingClientRect();if(i.bottom<A.top||i.top>A.bottom||i.right<A.left||i.left>A.right){e.style.display="none";return}}h=h.parentElement}e.style.display="flex";const g=i.left+(i.width||0)/2,y=i.top;e.style.left=`${g-e.offsetWidth/2}px`,e.style.top=`${y-e.offsetHeight-2}px`}function de(s,e){const{wrap:a,node:p,start:b,endNode:d,end:l}=s,o=document.createRange();o.setStart(p,b),o.setEnd(d,l);const i=o.toString().slice(e.sigLen);let h="";if(e.cipher==="PLAIN")try{h=I.decodeToString(i,e.base)}catch(g){console.error(g)}else{const g=prompt(`inØsight: enter password (${e.cipher}):`);if(!g)return;try{const y=I.decodeToNumberArray(i,e.base);e.cipher==="SPECK48_96CTR"?h=ie(y,oe(g)):e.cipher==="SPECK32_64ECB (insecure)"&&(h=ce(y,le(g)))}catch(y){console.error(y)}if(!h){alert("Decryption failed.");return}}if(h){o.deleteContents();const g=document.createElement("span");g.className="inzerosight-decoded",g.style.color="#00b4d8",g.style.fontWeight="600",g.textContent=` ${h} `,o.insertNode(g),a.remove(),C.delete(s)}}function pe(s,e,a){let p=s,b=K(s.nodeValue,e,a);for(;b===p.nodeValue.length;){let d=p.nextSibling,l=!1;for(;(d==null?void 0:d.nodeType)===Node.ELEMENT_NODE&&d.tagName==="WBR";)l=!0,d=d.nextSibling;if(!l||(d==null?void 0:d.nodeType)!==Node.TEXT_NODE)break;const o=K(d.nodeValue,e,0);if(!o)break;p=d,b=o}return{endNode:p,end:b}}function j(s){if(!s||s.nodeType!==Node.TEXT_NODE)return;const e=s.nodeValue;if(!e||!e.includes(O))return;let a=0;for(;a<e.length;){const p=e.slice(a),b=ae(p);if(!b)break;const d=a+b.sigIdx,{endNode:l,end:o}=pe(s,b.base,d+b.sigLen);fe(s,b,d,l,o),a=l===s?o+1:e.length}}function Y(s){if(!s)return;const e={SCRIPT:1,STYLE:1,TEXTAREA:1,INPUT:1,NOSCRIPT:1,"IN0-HOST":1},a=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:b=>{var d;return e[(d=b.parentElement)==null?void 0:d.tagName]?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let p;for(;p=a.nextNode();)j(p)}Y(document.body);let F;function P(){F||C.size===0||(F=requestAnimationFrame(()=>{F=null,C.forEach($)}))}new MutationObserver(s=>{var e;for(const a of[...C])(!a.node.isConnected||!((e=a.node.nodeValue)!=null&&e.startsWith(O,a.start)))&&(a.wrap.remove(),C.delete(a));for(const a of s)if(a.type==="characterData")j(a.target);else for(const p of a.addedNodes)p.nodeType===Node.TEXT_NODE?j(p):p.nodeType===Node.ELEMENT_NODE&&p.id!=="in0-host"&&Y(p);P()}).observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0}),window.addEventListener("scroll",P,{capture:!0,passive:!0}),window.addEventListener("resize",P,{passive:!0})})();