-
Notifications
You must be signed in to change notification settings - Fork 5
/
deepestScan-alert.js
28 lines (28 loc) · 1.61 KB
/
deepestScan-alert.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
let doc=eval("document"),
f=["CSEC","avmnite-02h","I.I.I.I","run4theh111z","w0r1d_d43m0n"];
export let main=ns=>{
let theme=ns.ui.getTheme();
let css=`<style id="scanCSS">.sc{white-space:pre;color:${theme.secondary};line-height:1.1;font-size:12px}.sc .s{cursor:pointer;text-decoration:underline;color:${theme.secondary}}.sc .f{color:${theme.errordark}}.sc .r{color:${theme.primary}}.sc .r.f{color:${theme.infolight}}.sc .s::before{content:"◉";color:${theme.errordark}}.sc .r::before{color:${theme.successdark}}</style>`;
doc.getElementById("scanCSS")&&doc.getElementById("scanCSS")["remove"]();
doc.head.insertAdjacentHTML('beforeend',css);
let s=["home"],p=[""],r={home:"home"}, fName=x=>`<a class="s${f.includes(x)?" f":""}${ns.hasRootAccess(x)?" r":""}">${x}</a>`;
let tcommand=x=>{
let tIn=doc.getElementById("terminal-input");
tIn.value=x;
tIn[Object.keys(tIn)[1]].onChange({target:tIn});
tIn[Object.keys(tIn)[1]].onKeyDown({keyCode:13,preventDefault:()=>0});
};
let addSc=(x=s[0],p1=["\n"],o=p1.join("")+fName(x))=>{
for (let i=0;i<s.length;i++){
if (p[i]!=x) continue;
let p2=p1.slice();
p2[p2.length-1]=p2[p2.push(p.slice(i+1).includes(p[i])?"├>":"└>")-2].replace("├>","│ ").replace("└>"," ");
o+=addSc(s[i],p2);
}
return o;
};
for (let i=0,j;i<s.length;i++)for(j of ns.scan(s[i]))if(!s.includes(j))s.push(j),p.push(s[i]),r[j]=r[s[i]]+";connect "+j;
ns.alert(`<div class="sc new">${addSc().trimStart()}</div>`);
doc.querySelectorAll(".sc.new .s").forEach(q=>q.addEventListener('click',()=>tcommand(r[q.childNodes[0].nodeValue])));
doc.querySelector(".sc.new").classList["remove"]("new");
};