Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
8chanAnon authored Aug 30, 2024
1 parent 6bfbb4d commit c82781a
Show file tree
Hide file tree
Showing 4 changed files with 1,658 additions and 0 deletions.
187 changes: 187 additions & 0 deletions install/inspector.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<!DOCTYPE html><html><head>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta charset='utf-8'>

<title>Inspector</title>

<style type='text/css'>

body {
padding: 0 0.5vw; text-align: center;
font-size: 16px; line-height: 19px; font-family: 'times new roman', serif;
color: steelblue; background-color: lemonchiffon;
}

input {
height: 19px; padding: 2px 6px 1px; outline: none; margin: 0;
font-size: 13px; font-family: helvetica, sans-serif;
border: 1px solid peru; border-radius: 4px;
color: slateblue; background-color: transparent;
}

button {
width: auto; height: auto; margin: 1px 0; padding: 2px 8px 1px 8px;
line-height: 17px; font-size: 13px; font-family: helvetica, sans-serif;
outline: none; border: 1px solid peru; border-radius: 5px;
color: slateblue; background-color: moccasin;
}

button:hover:not(:active) {
background-color: gainsboro;
}

textarea {
width: 100%; padding: 4px 8px;
box-sizing: border-box; resize: none; margin: 0;
font-size: 14px; line-height: 17px; font-family: monospace;
overflow: auto; word-break: break-all; white-space: pre-wrap;
caret-color: maroon; border: 2px solid burlywood; border-radius: 6px;
outline: none; color: mediumblue; background-color: snow;
}

p {
margin: 8px;
}

::selection {
color: yellow; background-color: orchid;
}

r_ { color: crimson; }
g_ { color: seagreen; }
b_ { color: blue; }

</style></head><body onload="javascript:init()">

<h2 style="margin:0 0 10px"><r_>Inspector</r_></h2>

<div style="padding:5px;background-color:pink">
<button onclick="javascript:open_sock()">Websocket</button> &nbsp;
<button onclick="javascript:open_window(0)">Open window</button> &nbsp;
<button onclick="javascript:open_window(1)">Open with iframe</button> &nbsp;
<button onclick="javascript:inspect()">Inspect</button> &nbsp;
<button onclick="javascript:print('')">Clear</button>
</div><p></p>
Name:&nbsp; <input type=text style="width:70px" value="boss"> &nbsp;&nbsp;
Target:&nbsp; <input type=text style="width:calc(100% - 290px);min-width:220px;max-width:730px">
<p></p>
<textarea style="height:calc(100vh - 130px)" disabled></textarea>
<div id="inspect" style="display:none"></div>

<script>

var host, sock, win;
var text = document.querySelector ("textarea");
var line = document.querySelectorAll ("input");
var boss = line [0]; line = line [1];

//https://thetvapp.to/tv/nba-tv-live-stream
//https://goku.sx/movie/watch-the-holiday-proposal-plan-104005

var init = function ()
{
host = "/"; print (""); show (0);
window.onmessage = function (e) { print (": " + e.data); }

if (location.hostname != "localhost")
{
var a = location.search, b = a[1], c = a.indexOf (b, 2) + 1;
if (b == "$" || b == "@") if (c) host = "/" + a.substr (0, c);
}
}

var show = function (mode)
{
var x = document.querySelector ("button");
x.style.color = x.style.borderColor = mode ? "mediumvioletred" : "forestgreen";
}

var open_sock = function ()
{
if (sock) { sock.close(); return; }

sock = location.origin.replace ("http", "ws") + host + "?" + boss.value.trim();
print ("<connecting>"); sock = new WebSocket (sock);

sock.onopen = function( ) { print ("<websocket opened>"); show (1); }
sock.onclose = function( ) { print ("<websocket closed>"); show (0); sock = null; }
sock.onerror = function( ) { print ("<websocket error>"); }
sock.onmessage = function(e) { print (e.data); }
}

var open_window = async (mode) =>
{
win = line.value.trim(); if (!mode || !win) { win = window.open (win); return; }

win = '<!DOCTYPE html><html><body' +
' style="padding:0;margin:0;overflow:hidden"><iframe' +
' style="position:absolute;border:none;outline:none;width:100%;height:100%"' +
' sandbox="allow-scripts allow-same-origin allow-forms"' +
' src="' + win + '"></iframe></body></html>';

await fetch (host + "~wanna_scratch=iframe$.htm", { method: 'POST', body: win });

win = window.open (host + "~iframe$.htm");
}

var inspect = function ()
{
var a = win, b, c; if (!a || a.closed) { print ("> no window"); return; }

try { if (b = a.document.body, c = b.children[0], c.nodeName == "IFRAME")
{ a = c.contentWindow; b = c.contentDocument.body; }
} catch { print ("> not allowed"); return; }

console.log (a); console.log (b); print ("> see devtools");

c = document.getElementById ("inspect"); c.innerHTML = "";
c.setAttribute ("title", line.value); c.appendChild (b.cloneNode (true));
}

var print = function (msg)
{
if (typeof (msg) != "string") return;
if (msg) text.value += msg + "\n"; else text.value = "";
text.scrollTop = text.scrollHeight;
}

/* <!--

function crap (...args)
{
var m, n, p, q, r = window.top; if (r.opener) r = r.opener;

function dom()
{
p = m.attributes; q = "# " + m.nodeName + " :";
for (n = 0; n < p.length; n++) q += " - " + p [n].name; return (q);
}

function send()
{
if (m == undefined) m = "undefined"; else try
{
if (typeof (m) == "object") if (Array.isArray (m)) m = "[ " + m.join (" | ") + " ]"; else
if (m instanceof Element) m = dom(); else m = "object " + JSON.stringify (m, null, 2); else
if (typeof (m) != "string") m = m.toString();
}
catch { m = "<?>"; }

if (m.length > 3000) m = m.substr (0, 3000) + "\n<snip>"; r.postMessage (m, "*");
}

for (m of args) send();
}

Method for HTML file:
<script id="websock" title="boss|?@@?|test" src="/?@@websock.js" onload="crap ('okay')"></script>

Method for Javascript file:
var mysock = document.createElement ("SCRIPT");
mysock.id = "websock"; mysock.title = "boss|?@@?|test"; mysock.src = "/?@@websock.js";
mysock.onload = function() { crap ("okay"); }
document.body.appendChild (mysock);

--> */

</script></body></html>
Loading

0 comments on commit c82781a

Please sign in to comment.