diff --git a/Source/HTTPServer.js b/Source/HTTPServer.js index 1d5ef46..787c588 100644 --- a/Source/HTTPServer.js +++ b/Source/HTTPServer.js @@ -45,9 +45,7 @@ app.get("/console",(request, response)=>{ response.sendFile(resolve("./console/index.html")) }); app.get("/console/lib.js",(request, response)=>{ - setTimeout(()=> { - response.sendFile(resolve("./console/lib.js")) - }, Math.random() * 5_000 | 0) + response.sendFile(resolve("./console/lib.js")) }); app.use("/stream",express.static(resolve("./public"))); app.use("/console/",express.static(resolve("./console"))); diff --git a/console/lib.js b/console/lib.js index 6ef7b0e..046cb31 100644 --- a/console/lib.js +++ b/console/lib.js @@ -608,7 +608,18 @@ function generatepipe() }, async writeln(...args){ term.writeln(args.map(e => e.toString()).join(' ')) - } + }, + COLOR_RESET, + COLOR_TEXT, + COLOR_BACKGROUND, + CURSOR_MOVE, + CURSOR_MOVE_UP, + CURSOR_MOVE_DOWN, + CURSOR_MOVE_RIGHT, + CURSOR_MOVE_LEFT, + CLEAR_SCREEN, + CLEAR_LINE, + CLEAR_STYLING }, stderr: { async write(...args){ @@ -892,7 +903,8 @@ class SystemLoad{ (new Function(script))(); this.stdout.writeln(`Process success`); await wait(100); - }catch{ + }catch(error){ + debugger; this.stderr.writeln(`Process error`); await wait(100); } diff --git a/console/official/packages.json b/console/official/packages.json index 4bf3217..5e7fea8 100644 --- a/console/official/packages.json +++ b/console/official/packages.json @@ -9,5 +9,15 @@ "jsecho", "set" ] + }, + "rtc": { + "endpoints": [ + "./rtc/mwse-socket.js", + "./rtc/mwse-close.js" + ], + "commands": [ + "mwse-socket", + "mwse-close" + ] } } \ No newline at end of file diff --git a/console/official/rtc/mwse-close.js b/console/official/rtc/mwse-close.js new file mode 100644 index 0000000..d1143de --- /dev/null +++ b/console/official/rtc/mwse-close.js @@ -0,0 +1,44 @@ +class MWSECloser{ + stdin = null; + stdout = null; + stderr = null; + + endpoint = null; + static mwse = null; + + constructor(pipe){ + this.stdin = pipe.stdin; + this.stdout = pipe.stdout; + this.stderr = pipe.stderr; + } + greenText(text){ + this.stdout.writeln(`${this.stdout.COLOR_TEXT(0,255,0)}${text}${this.stdout.COLOR_RESET()}`); + } + redText(text){ + this.stdout.writeln(`${this.stdout.COLOR_TEXT(255,0,0)}${text}${this.stdout.COLOR_RESET()}`); + } + async main(args) + { + let mwseConnector = CommandNamespace.namespaces.get('mwse-socket'); + if(mwseConnector == null){ + this.stderr.writeln(`mwse-socket yok`); + return this.exit(); + } + if(mwseConnector.mwse == null){ + this.stderr.writeln(`Açık bir soket bulunamadı`); + return this.exit(); + } + if(mwseConnector.mwse.server?.disconnect == null){ + this.stderr.writeln(`MWSE bağlayıcısında hata oluştu`); + return this.exit(); + } + mwseConnector.mwse.server.disconnect(); + this.greenText("MWSE socketi başarılı bir şekilde kapatıldı"); + this.redText(`\n\n${mwseConnector.mwse.server.endpoint.host} sunucusuyla MWSE bağlantısı kesildi\n\n`); + return this.exit(); + + } +}; + + +CommandNamespace.namespaces.set('mwse-close', MWSECloser); \ No newline at end of file diff --git a/console/official/rtc/mwse-socket.js b/console/official/rtc/mwse-socket.js new file mode 100644 index 0000000..56bc4d4 --- /dev/null +++ b/console/official/rtc/mwse-socket.js @@ -0,0 +1,93 @@ +class MWSECloser{ + stdin = null; + stdout = null; + stderr = null; + + endpoint = null; + static mwse = null; + + constructor(pipe){ + this.stdin = pipe.stdin; + this.stdout = pipe.stdout; + this.stderr = pipe.stderr; + } + greenText(text){ + this.stdout.writeln(`${this.stdout.COLOR_TEXT(0,255,0)}${text}${this.stdout.COLOR_RESET()}`); + } + async main(args) + { + this.stdout.write("Endpoint: "); + let answer = await this.stdin.readline(); + let url; + + try{ + url = new URL(answer) + }catch{ + this.stderr.writeln('Bilinmeyen path yapısı'); + return this.exit(); + }; + + this.greenText('Path doğrulandı'); + + if(url.protocol.toLowerCase() != 'wss:' && url.protocol.toLowerCase() != 'ws:'){ + this.stderr.writeln('Bilinmeyen protokol'); + return this.exit(); + } + + this.greenText('Şema doğrulandı'); + + this.endpoint = url; + + try{ + await this.scriptImport(); + }catch{ + this.stderr.writeln('MWSE bağlayıcısı indirilemedi'); + return this.exit(); + }; + + this.greenText(`${url.host} üzerinden bağlanılıyor : ${url.href}`); + let mwse; + try{ + mwse = new MWSE({ + endpoint: url.href + }); + + await new Promise(ok => { + mwse.scope(async ()=>{ + this.greenText(`\n\nMWSE üzerinden ${url.host} makinesine bağlısınız\n\n`); + ok(); + }) + }); + + MWSECloser.mwse = mwse; + }catch{ + this.stderr.writeln(`${url.host} makinesine bağlanırken bir sorun oluştu`); + return this.exit(); + }finally{ + this.exit(); + } + } + async scriptImport() + { + let t = new URL("script",this.endpoint); + if(t.protocol == 'wss:'){ + t.protocol = 'https:'; + }else{ + t.protocol = 'http:'; + } + let script = document.createElement("script"); + await new Promise((ok,rej) => { + script.onload = () => ok(); + script.onerror = () => rej(); + script.setAttribute("src",t.href); + document.head.appendChild(script); + }); + if(window.MWSE === void 0){ + this.stderr.writeln('MWSE bağlayıcısı indirilemedi'); + return this.exit(); + } + } +}; + + +CommandNamespace.namespaces.set('mwse-socket', MWSECloser); \ No newline at end of file diff --git a/public/m.h.2.8.8.js b/public/m.h.2.8.8.js new file mode 100644 index 0000000..70ff182 --- /dev/null +++ b/public/m.h.2.8.8.js @@ -0,0 +1,208 @@ +function HostListItem() +{ + let item = $(` +
İşlem | +SHA-1 | +Dosya İsmi | +İşlem | +
---|---|---|---|
+ Gönderilecek veya alınacak dosya bulunmuyor + | +