Meterpreter: How to invoke commands in a loop for each new connection



  • I want to execute commands like screenshot on a regular interval (e.g. each 5min) for each incoming connection to Meterpreter using the reverse_tcp payload until the connection gets closed by the Windows clients.

    Is there any straightforward way to realize dynamic handling of incoming connections?



  • Metasploit scripting supports Ruby, so you could build your workflow around something like...

    <ruby>
    while true
      run_single("screenshot")  
      run_single("sleep 300s") 
    end
    </ruby>
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2