snipt

Ctrl+h for KB shortcuts

Bash

nmap centos

1
2
3
4
5
# Voir tous les ports TCP ouverts sur une machine, utilisation de messages SYN, donc pas de log sur la machine cible :
nmap -F -n -sS 127.0.0.1

# Voir tous les ports UDP ouverts sur une machine :
nmap -sU 127.0.0.1
https://snipt.net/embed/ae3a46c01b364683dcf3f7e5aef3f3df/
/raw/ae3a46c01b364683dcf3f7e5aef3f3df/
ae3a46c01b364683dcf3f7e5aef3f3df
bash
Bash
5
2019-05-24T23:05:48
True
False
False
/api/public/snipt/138795/
namp-centos-18fbc7fe
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Voir tous les ports TCP ouverts sur une machine, utilisation de messages SYN, donc pas de log sur la machine cible :</span> </span><span id="L-2"><a name="L-2"></a>nmap -F -n -sS 127.0.0.1 </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Voir tous les ports UDP ouverts sur une machine :</span> </span><span id="L-5"><a name="L-5"></a>nmap -sU 127.0.0.1 </span></pre></div> </td></tr></table>
centos, nmap, security

Text only

Scan an ip range for a single open port

nmap -p80 192.168.0.0/24 -oG - | grep 80/open
https://snipt.net/embed/0135379cd243a5abea33ff7142d50a9e/
/raw/0135379cd243a5abea33ff7142d50a9e/
0135379cd243a5abea33ff7142d50a9e
text
Text only
1
2019-05-23T22:25:06
True
False
False
/api/public/snipt/45780/
scan-an-ip-range-for-a-single-open-port
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>nmap -p80 192.168.0.0/24 -oG - | grep 80/open </span></pre></div> </td></tr></table>
bash, linux, nmap, portscan

Bash

Find used/unused IPs on a given subnet

nmap -T4 -sP 172.17.226.0/24
https://snipt.net/embed/85b6102b9fa39f43da9a71c7d73dff73/
/raw/85b6102b9fa39f43da9a71c7d73dff73/
85b6102b9fa39f43da9a71c7d73dff73
bash
Bash
1
2019-05-23T23:53:46
True
False
False
/api/public/snipt/11593/
find-usedunused-ips-on-a-given-subnet
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>nmap -T4 -sP 172.17.226.0/24 </span></pre></div> </td></tr></table>
net, network, nmap, used

Bash

Find unused IPs using nmap

nmap -nvsP 192.168.200.0/24 | grep down  | awk '{print $2}' 
https://snipt.net/embed/9240c1bdb0e97cbe085c7fc141a64146/
/raw/9240c1bdb0e97cbe085c7fc141a64146/
9240c1bdb0e97cbe085c7fc141a64146
bash
Bash
1
2019-05-23T09:10:12
True
False
False
/api/public/snipt/10013/
find-unused-ips-on-a-24-using-nmap
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>nmap -nvsP 192.168.200.0/24 <span class="p">|</span> grep down <span class="p">|</span> awk <span class="s1">&#39;{print $2}&#39;</span> </span></pre></div> </td></tr></table>
ip, network, nmap

Bash

nmap self scan

1
2
3
4
# http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/security-guide/s1-server-ports.html
$ nmap -sT -O localhost
$ cat /etc/services | grep <port>
$ netstat -anp | grep <port>
https://snipt.net/embed/329e9f071b3c64cd9e86f500b55e3671/
/raw/329e9f071b3c64cd9e86f500b55e3671/
329e9f071b3c64cd9e86f500b55e3671
bash
Bash
4
2019-05-23T02:26:31
True
False
False
/api/public/snipt/7683/
nmap-self-scan
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/security-guide/s1-server-ports.html</span> </span><span id="L-2"><a name="L-2"></a>$ nmap -sT -O localhost </span><span id="L-3"><a name="L-3"></a>$ cat /etc/services <span class="p">|</span> grep &lt;port&gt; </span><span id="L-4"><a name="L-4"></a>$ netstat -anp <span class="p">|</span> grep &lt;port&gt; </span></pre></div> </td></tr></table>
nmap, security, sysadmin

Bash

Check which machines in a LAN are up

1
2
3
# This checks which machines, in the 192.168.1.0-255 IP addresses range, are up or down

nmap -nvsP 192.168.1.0/24
https://snipt.net/embed/bc8bf56dfcd46c73c85988eb2f8bb9eb/
/raw/bc8bf56dfcd46c73c85988eb2f8bb9eb/
bc8bf56dfcd46c73c85988eb2f8bb9eb
bash
Bash
3
2019-05-24T18:10:14
True
False
False
/api/public/snipt/6236/
check-which-machines-in-a-lan-are-up
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># This checks which machines, in the 192.168.1.0-255 IP addresses range, are up or down</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>nmap -nvsP 192.168.1.0/24 </span></pre></div> </td></tr></table>
bash, ip, nmap