Lines 4-52javascript
4${c}`;qt.writeFileSync(n,v)}catch{}},file:n}}$n.exports={log:wu,err:Ru,dumpRequest:Uu,createResponseDumper:Pu,clearDumpDir:Lu}});var Y=F((sh,jn)=>{jn.exports={options:{usePureJavaScript:!1}}});var Jn=F((oh,Xn)=>{var Ba={};Xn.exports=Ba;var Wn={};Ba.encode=function(e,t,a){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(a!==void 0&&typeof a!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(e instanceof Uint8Array))r=Ou(e,t);else{var n=0,s=t.length,i=t.charAt(0),o=[0];for(n=0;n<e.length;++n){for(var u=0,l=e[n];u<o.length;++u)l+=o[u]<<8,o[u]=l% ...
5`)}return r};Ba.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var a=Wn[t];if(!a){a=Wn[t]=[];for(var r=0;r<t.length;++r)a[t.charCodeAt(r)]=r}e=e.replace(/\s/g,"");for(var n=t.length,s=t.charAt(0),i=[0],r=0;r<e.length;r++){var o=a[e.charCodeAt(r)];if(o===void 0)return;for(var u=0,l=o;u<i.length;++u)l+=i[u]*n,i[u]=l&255,l>>=8;for(;l>0;)i.push(l&255),l>>=8}for(var f=0;e[f]===s&&f<e.length-1;++f)i.push(0);return typeof Buffer<"u"?Buffer.from(i.reverse()):new Uint8Array(i.reverse() ...
6`,a=a.substr(t));return r+=a,r};E.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",a,r,n,s,i=0;i<e.length;)a=Nt[e.charCodeAt(i++)-43],r=Nt[e.charCodeAt(i++)-43],n=Nt[e.charCodeAt(i++)-43],s=Nt[e.charCodeAt(i++)-43],t+=String.fromCharCode(a<<2|r>>4),n!==64&&(t+=String.fromCharCode((r&15)<<4|n>>2),s!==64&&(t+=String.fromCharCode((n&3)<<6|s)));return t};E.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};E.decodeUtf8=function(e){return decodeURIComponent(escape(e))};E.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:ei.encode,decode:ei.decode}};E.binary. ...
7`,a=a.substr(t));return r+=a,r};E.binary.base64.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/4)
8`);for(var n="",s=0;s<t*a;++s)n+=" ";switch(r+=n+"Tag: ",e.tagClass){case U.Class.UNIVERSAL:r+="Universal:";break;case U.Class.APPLICATION:r+="Application:";break;case U.Class.CONTEXT_SPECIFIC:r+="Context-Specific:";break;case U.Class.PRIVATE:r+="Private:";break}if(e.tagClass===U.Class.UNIVERSAL)switch(r+=e.type,e.type){case U.Type.NONE:r+=" (None)";break;case U.Type.BOOLEAN:r+=" (Boolean)";break;case U.Type.INTEGER:r+=" (Integer)";break;case U.Type.BITSTRING:r+=" (Bit string)";break;case U.Type.OCTETSTRING:r+=" (Octet string)";break;case U.Type.NULL:r+=" (Null)";break;case U.Type.OID:r+=" (Ob ...
9`,r+=n+"Constructed: "+e.constructed+`
10`,e.composed){for(var i=0,o="",s=0;s<e.value.length;++s)e.value[s]!==void 0&&(i+=1,o+=U.prettyPrint(e.value[s],t+1,a),s+1<e.value.length&&(o+=","));r+=n
11`,r;if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=Wr(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=Wr(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=Wr(r)),
12`),a+=Xr.util.encode64(e.body,t.maxline||64)+`\r
13`,a+="-----END "+e.type+`-----\r
14`,a};mi.decode=function(e){for(var t=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/
15`;for(var s=0,i=-1,n=0;n<t.length;++n,++s)if(s>65&&i!==-1){var o=t[i];o===","?(++i,t=t.substr(0,i)+`\r
16 `+t.substr(i)):t=t.substr(0,i)+`\r
17`+o+t.substr(i+1),s=n-i-1,i=-1,++n}else(t[n]===" "||t[n]===" "||t[n]===",")&&(i=n);return t}function Yu(e){return e.replace(/^\s+/,"")}});var Ar=F((mh,xi)=>{var pe=Y();qr();La();re();xi.exports=pe.des=pe.des||{};pe.des.startEncrypting=function(e,t,a,r){var n=Jr({key:e,output:a,decrypt:!1,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};pe.des.createEncryptionCipher=function(e,t){return Jr({key:e,output:null,decrypt:!1,mode:t})};pe.des.startDecrypting=function(e,t,a,r){var n=Jr({key:e,output:a,decrypt:!0,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};pe.des.createDecryptionCipher=fu ...
18`;s+="Encryption: "+n+`\r
20`;var i=Ce.util.createBuffer();vr(i,r),Et(i,e.e),Et(i,e.n);var o=Ce.util.encode64(i.bytes(),64),u=Math.floor(o.length/66)+1;s+="Public-Lines: "+u+`\r
21`,s+=o;var l=Ce.util.createBuffer();Et(l,e.d),Et(l,e.p),Et(l,e.q),Et(l,e.qInv);var f;if(!t)f=Ce.util.encode64(l.bytes(),64);else{var c=l.length()+16-1;c-=c%16;var g=va(l.bytes());g.truncate(g.length()-c+l.length()),l.putBuffer(g);var v=Ce.util.createBuffer();v.putBuffer(va("\0\0\0\0",t)),v.putBuffer(va("
23`,s+=f;var S=va("putty-private-key-file-mac-key",t),I=Ce.util.createBuffer();vr(I,r),vr(I,n),vr(I,a),I.putInt32(i.length()),I.putBuffer(i),I.putInt32(l.length()),I.putBuffer(l);var
24Private-MAC: `+B.digest().toHex()+`\r
25`,s};ma.publicKeyToOpenSSH=function(e,t){var a="ssh-rsa";t=t||"";var r=Ce.util.createBuffer();return vr(r,a),Et(r,e.e),Et(r,e.n),a+" "+Ce.util.encode64(r.bytes())+" "+t};ma.privateKeyToOpenSSH=function(e,
26`);u=c.pop()||"";for(let g of c){let v=g.trim();if(!v||!v.startsWith("data:"))continue;let y=v.slice(5).trim();if(y!=="[DONE]"){process.env.DEBUG_MITM&&Ea(`[SSE in] ${y.slice(0,200)}`);try{let x=JSON.parse(y),S=a(x,r);if(S!=null){let I=Array.isArray(S)?S:[S];for(let B of I){if(process.env.DEBUG_MITM){let b=B.length||B.byteLength||0;Ea(`[write binary frame] (${b}B) first 20B: ${Array.from(B.slice(0,20)).join(",")}`)}t.write(Buffer.from(B))}}}catch{}}}}try{let l=a(null,r);if(l!=null){let f=Array.isArray(l)?l:[l];for(let c of f)t.write(c)}}catch{}t.end()}async function Mc(e,t,a,r){let n={"Content ...
27`);o=f.pop()||"";for(let c of f){let g=c.trim();if(!g||!g.startsWith("data:"))continue;let v=g.slice(5).trim();if(v!=="[DONE]"){process.env.DEBUG_MITM&&Ea
29`),n.end()),s?(t.headersSent||t.writeHead(200,{"Content-Type":"text/event-stream"}),t.end(`data: ${JSON.stringify({error:{message:i.message}})}\r
31`)):(t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:i.message,type:"mitm_error"}})))}}_o.exports={intercept:Yc}});var Ro=F((np,wo)=>{var{err:$c}=Gt(),{fetchRouter:jc,pipeSSE:Wc}=xa(),Xc={"/chat/completions":"/v1/chat/completions","/v1/messages":"/v1/messages","/responses":"/v1/responses"};function Jc(e){for(let[t,a]of Object.entries(Xc))if(e.includes(t))return a;return"/v1/chat/completions"}async function Zc(e,t,a,r){try{let n=JSON.parse(a.toString());n.model=r;let s=Jc(e.url),i=await jc(n,s,e.headers);await Wc(i,t)}catch(n){$c(`[copilo ...
32`)}catch{}}var od=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let a=t;for(let r=0;r<8;r++)a=a&1?3988292384^a>>>1:a>>>1;e[t]=a}return e})();function ko(e){let t=4294967295;for(let a=0;a<e.length;a++)t=t>>>8^od[(t^e[a])&255];return(t^4294967295)>>>0}function ud(e){return{modelId:e||null,toolCallInit:{},hasToolCalls:!1,finishSent:!1,usage:null,inThink:!1,thinkBuf:""}}function Uo(e,t){if(!e)return{thinking:null,text:null};let a=e;t.inThink&&t.thinkBuf&&(a=t.thinkBuf+a,t.thinkBuf="",t.inThink=!1);let r=/<thinking>|<think>/i,n=a.match(r);if(!n)return{thinking:null,text:a};let s=n[0].toLo ...
33`);t.push({role:"tool",tool_call_id:n.toolUseId||"",content:s})}let r=(e.content||"").trim();return(r||a.length===0)&&t.push({role:"user",content:r}),t}function fd(e){let t=e.toolUses||[];return t.length>0?{role:"assistant"
34 $proc = Start-Process powershell -ArgumentList @(
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
app/src/mitm/server.jsView on unpkg · L24 HighChild Process
Package source references child process execution.
app/src/mitm/server.jsView on unpkg · L32 35 '-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass',
36 '-WindowStyle','Hidden','-EncodedCommand','${t}'
37 ) -Verb RunAs -Wait -PassThru -WindowStyle Hidden;
38 if ($proc.ExitCode -ne 0) { throw "Elevated command exited with code $($proc.ExitCode)" }
39 `;return new Promise((r,n)=>{qo(`powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command ${zo(a)}`,{windowsHide:!0},(s,i,o)=>{if(s){let u=o||s.message;u.includes("canceled by the user")||u.includes("operation was canceled")?n(new Error("User canceled UAC prompt")):n(new Error(u))}else r(i)})})}Qo.exports={isAdmin:Go,runElevatedPowerShell:Ed,quotePs:zo}});var ru=F((dp,tu)=>{var{exec:lp,spawn:$o,execSync:Or}=require("child_process"),_e=require("fs"),xd=require("path"),fp=require("os"),{log:Sa,err:Sd}=Gt(),{TOOL_HOSTS:Kt}=Mo(),{runElevatedPowerShell:jo,isAdmin:cp}=Yo();function W ...
40`),s.stdin.end())})}async function Zo(e){bt||(Xo?await Vr("dscacheutil -flushcache && killall -HUP mDNSResponder",e):await Vr("resolvectl flush-caches 2>/dev/null || true",e))}function wn(e=null){try{let t=_e.readFileSync(Ze,"utf8");return e?t.includes
43`;Wo(Ze,n,o),await jo("ipconfig /flushdns | Out-Null")}else{let s=_e.readFileSync(Ze,"utf8").replace(/[\r\n\s]+$/g,""),i=r.map(l=>`127.0.0.1 ${l}`).join(`
46`.replace(/'/g,"'\\''");await Vr(`printf '%s' '${u}' | tee ${Ze} > /dev/null`,t),await Zo(t)}Sa(`\u{1F310} DNS ${e}: \u2705 added ${r.join(", ")}`)}catch(n){let s=n.message?.includes("incorrect password")?"Wrong sudo password":`Failed to add DNS entry: ${n.message}`;throw new Error(s)}}async function eu(e,t){let a=Kt[e];if(!a)throw new Error(`Unknown tool: ${e}`);let r=a.filter(n=>wn(n));if(r.length===0){Sa(`\u{1F310} DNS ${e}: already inactive`);return}try{if(bt){let n=_e.readFileSync(Ze,"utf8"),i=n.split(/\r?\n/).filter(o=>!r.some(u=>o.includes(u))).join(`\r
47`).replace(/[\r\n\s]+$/g,"")+`\r
48`;Wo(Ze,n,i),await jo("ipconfig /flushdns | Out-Null")}else{let o=(_e.readFileSync(Ze,"utf8").split(/\r?\n/).filter(u=>!r.some(l=>u.includes(l))).join(`
49`).replace(/[\r\n\s]+$/g,"")+`
50`).replace(/'/g,"'\\''");await Vr(`printf '%s' '${o}' | tee ${Ze} > /dev/null`,t),await Zo(t)}Sa(`\u{1F310} DNS ${e}: \u2705 removed ${r.join(", ")}`)}catch(n){let s=n.message?.includes("incorrect password")?"Wrong sudo password":`Failed to remove DNS entry: ${n.message}`;throw new Error(s)}}async function Bd(e){for(let t of Object.keys(Kt))try{await eu(t,e)}catch(a){Sd(`DNS ${t}: failed to remove \u2014 ${a.message}`)}}function bd(){try{if(!_e.existsSync(Ze))return;let e=Object.values(Kt).flat(),t=_e.readFileSync(Ze,"utf8"),a=bt?`\r
52`,n=t.split(/\r?\n/).filter(s=>!e.some(i=>s.includes(i))).join(a).replace(/[\r\n\s]+$/g,"")+a;if(n===t)return;if(_e.writeFileSync(Ze,n,"utf8"),bt)try{Or("ipconfig /flushdns",{windowsHide:!0,stdio:"ignore"})}catch{}else if(Xo)try{Or("dscacheutil -flushcache && killall -HUP mDNSResponder",{stdio:"ignore"})}catch{}else try{Or("resolvectl flush-caches 2>/dev/null || true",{stdio:"ignore"})}catch{}}catch{}}tu.exports={TOOL_HOSTS:Kt,addDNSEntry:Ad,removeDNSEntry:eu,removeAllDNSEntries:Bd,removeAllDNSEntriesSync:bd,execWithPassword:Vr,isSudoAvailable:Ta,canRunSudoWithoutPassword:Jo,isSudoPasswordRequ ...
Long lines were clipped for display.