To run a command against multiple SSH servers and you want to use metasploit to do it
How:
There doesn't exist a multi_ssh_exec type aux module to run commands. Luckily ? the ssh_login module creates a command shell session for you, on successful logins. You can use the builtin sessions functionality to run a command against all your (SSH) sessions.
msf auxiliary(ssh_login) > sessions -h
Usage: sessions [options]
Active session manipulation and interaction.
OPTIONS:
-K Terminate all sessions
-c
-d
-h Help banner
-i
-k
-l List all active sessions
-q Quiet mode
-r Reset the ring buffer for the session given with -i, or all
-s
-t
-u
-v List verbose fields
Many options allow specifying session ranges using commas and dashes.
For example: sessions -s checkvm -i 1,3-5 or sessions -k 1-2,5,6
So given some sessions, you can pass a
sessions -c 'command' all
against all the sessions or a
sessions -c 'command' -i 2,4,5
against specified sessions.
Example:
No comments:
Post a Comment