-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathextract.js
More file actions
1 lines (1 loc) · 5.95 KB
/
Copy pathextract.js
File metadata and controls
1 lines (1 loc) · 5.95 KB
1
javascript:(async()=>{const r=/(?<=(\"|%27|`))\/[a-zA-Z0-9_?&=\/\-#\.]*(?=(\"|'|%60))/g,e=new Set,t=document.getElementsByTagName("script"),n=t=>{const a=t.matchAll(r);for(const t of a)e.add(t[0])};await Promise.all(Array.from(t).map(async t=>{try{t.src?n(await(await fetch(t.src)).text()):n(t.innerHTML)}catch(t){console.warn("Script fetch error:",t)}})),n(document.documentElement.outerHTML);const d=location.origin,paths=[...e];const categorizeEndpoints=paths=>{const categories={apis:[],js:[],html:[],css:[],json:[],xml:[],images:[],other:[]};return paths.forEach(p=>{if(p.match(/\.js$/i))categories.js.push(p);else if(p.match(/\.html?$/i))categories.html.push(p);else if(p.match(/\.css$/i))categories.css.push(p);else if(p.match(/\.json$/i))categories.json.push(p);else if(p.match(/\.xml$/i))categories.xml.push(p);else if(p.match(/\.(png|jpg|jpeg|gif|svg|webp|ico)$/i))categories.images.push(p);else if(p.match(/^\/api\//i)||p.match(/^\/v\d+\//i))categories.apis.push(p);else categories.other.push(p)}),categories},cats=categorizeEndpoints(paths),win=window.open("","_blank","width=1200,height=700,scrollbars=yes");if(!win)return alert("Popup blocked. Please allow popups.");const style='<style>*{margin:0;padding:0;box-sizing:border-box}body{background:#0f0f0f;color:#e0e0e0;font-family:monospace;padding:20px}h2{color:#4fc3f7;margin-bottom:5px}p{color:#888;margin-bottom:15px}button,input{margin:5px;padding:10px;background:#222;color:#e0e0e0;border:1px solid #4fc3f7;cursor:pointer;font-family:monospace}button:hover{background:#333}input{width:300px}.tab-btn{background:#1a1a1a;color:#aaa;padding:10px 15px;margin:3px}.tab-btn.active{background:#4fc3f7;color:#000;font-weight:bold}.tab-content{display:none;margin-top:15px;max-height:700px;overflow-y:auto}.tab-content.active{display:block}ul{list-style:none;padding:0}li{padding:8px;margin:2px 0;background:#1a1a1a;border-left:3px solid #4fc3f7}li a{color:#4fc3f7;text-decoration:none;display:block}li a:hover{color:#81d4fa;text-decoration:underline}.footer{margin-top:20px;padding-top:15px;border-top:1px solid #333;color:#666}</style>';const html='<html><head><title>Endpoint Extractor - Rezy Dev</title>'+style+'</head><body><h2>Endpoint Extractor</h2><p>Found '+paths.length+' endpoints</p><div><button id=cpbtn>Copy</button><button id=dlbtn>Download</button><input id=filt placeholder="Filter endpoints..."></div><div style="margin-top:15px"><button class="tab-btn active" data-tab="all">All ('+paths.length+')</button>'+(cats.apis.length?'<button class="tab-btn" data-tab="apis">APIs ('+cats.apis.length+')</button>':'')+(cats.js.length?'<button class="tab-btn" data-tab="js">JS ('+cats.js.length+')</button>':'')+(cats.html.length?'<button class="tab-btn" data-tab="html">HTML ('+cats.html.length+')</button>':'')+(cats.css.length?'<button class="tab-btn" data-tab="css">CSS ('+cats.css.length+')</button>':'')+(cats.json.length?'<button class="tab-btn" data-tab="json">JSON ('+cats.json.length+')</button>':'')+(cats.xml.length?'<button class="tab-btn" data-tab="xml">XML ('+cats.xml.length+')</button>':'')+(cats.images.length?'<button class="tab-btn" data-tab="images">Images ('+cats.images.length+')</button>':'')+(cats.other.length?'<button class="tab-btn" data-tab="other">Other ('+cats.other.length+')</button>':'')+'</div><div id="tab-all" class="tab-content active"><ul id=list-all></ul></div><div id="tab-apis" class="tab-content"><ul id=list-apis></ul></div><div id="tab-js" class="tab-content"><ul id=list-js></ul></div><div id="tab-html" class="tab-content"><ul id=list-html></ul></div><div id="tab-css" class="tab-content"><ul id=list-css></ul></div><div id="tab-json" class="tab-content"><ul id=list-json></ul></div><div id="tab-xml" class="tab-content"><ul id=list-xml></ul></div><div id="tab-images" class="tab-content"><ul id=list-images></ul></div><div id="tab-other" class="tab-content"><ul id=list-other></ul></div><div class="footer">Built with ❤️ by <a href="https://rezydev.com/" target="_blank" style="color:#4fc3f7">Rezy Dev</a></div></body></html>';win.document.write(html);win.document.close();const populateList=(id,items)=>{const ul=win.document.getElementById(id);items.forEach(p=>{const li=win.document.createElement("li");const a=win.document.createElement("a");a.href=d+p;a.target="_blank";a.textContent=p;li.appendChild(a);ul.appendChild(li)})};populateList("list-all",paths);populateList("list-apis",cats.apis);populateList("list-js",cats.js);populateList("list-html",cats.html);populateList("list-css",cats.css);populateList("list-json",cats.json);populateList("list-xml",cats.xml);populateList("list-images",cats.images);populateList("list-other",cats.other);win.document.querySelectorAll(".tab-btn").forEach(b=>b.onclick=function(){win.document.querySelectorAll(".tab-content").forEach(t=>t.classList.remove("active"));win.document.querySelectorAll(".tab-btn").forEach(t=>t.classList.remove("active"));win.document.getElementById("tab-"+b.getAttribute("data-tab")).classList.add("active");b.classList.add("active")});win.document.getElementById("cpbtn").onclick=function(){const ul=win.document.querySelector(".tab-content.active ul");const items=Array.from(ul.querySelectorAll("li a")).map(a=>a.textContent).join("\n");const ta=win.document.createElement("textarea");ta.value=items;win.document.body.appendChild(ta);ta.select();win.document.execCommand("copy");win.document.body.removeChild(ta);win.alert("Copied!")};win.document.getElementById("dlbtn").onclick=function(){const ul=win.document.querySelector(".tab-content.active ul");const items=Array.from(ul.querySelectorAll("li a")).map(a=>a.textContent).join("\n");const b=new Blob([items],{type:"text/plain"}),u=URL.createObjectURL(b),a=win.document.createElement("a");a.href=u;a.download="endpoints.txt";a.click();URL.revokeObjectURL(u)};win.document.getElementById("filt").oninput=function(){const f=this.value.toLowerCase();const ul=win.document.querySelector(".tab-content.active ul");ul.querySelectorAll("li").forEach(li=>{const txt=li.textContent.toLowerCase();li.style.display=txt.includes(f)?"block":"none"})}})();