Script ssh-run

Script types: portrule
Categories: intrusive
Download: https://svn.nmap.org/nmap/scripts/ssh-run.nse

Script Summary

Runs remote command on ssh server and returns command output.

Script Arguments

ssh-run.username

Username to authenticate as

ssh-run.cmd

Command to run on remote server

ssh-run.password

Password to use if using password authentication

ssh-run.privatekey

Privatekeyfile to use if using publickey authentication

ssh-run.passphrase

Passphrase for privatekey if using publickey authentication

Example Usage

nmap -p 22 --script=ssh-run \
--script-args="ssh-run.cmd=ls -l /, ssh-run.username=myusername, ssh-run.password=mypassword" <target>

Script Output

22/tcp open  ssh
| ssh-run:
|   output:
|     total 91
|     drwxr-xr-x   2 root root  4096 Jun  5 11:56 bin
|     drwxr-xr-x   4 root root  3072 Jun  5 12:42 boot
|     drwxrwxr-x   2 root root  4096 Jun 22  2017 cdrom
|     drwxr-xr-x  20 root root  4060 Jun 23 10:26 dev
|     drwxr-xr-x 127 root root 12288 Jun  5 11:56 etc
|     drwxr-xr-x   3 root root  4096 Jun 22  2017 home
....
|_    drwxr-xr-x  13 root root  4096 Jul 20  2016 var

Requires


Author:

  • Devin Bjelland

License: Same as Nmap--See https://nmap.org/book/man-legal.html