# Réseaux



### Connaitre les IP d'un réseau:

```bash
$ arp -a
livebox.home (192.168.1.1) at 40:65:a3:c3:81:32 on en0 ifscope [ethernet]
ds916.home (192.168.1.7) at 0:11:32:5b:32:aa on en0 ifscope [ethernet]
ds414.home (192.168.1.8) at d8:fe:e3:2f:7c:c5 on en0 ifscope [ethernet]
ne-3241-t200022615817dc.home (192.168.1.11) at 0:22:61:58:17:dc on en0 ifscope [ethernet]
atv4.home (192.168.1.15) at c8:69:cd:39:71:a5 on en0 ifscope [ethernet]
hdhr-1231b9b9.home (192.168.1.16) at 0:18:dd:23:1b:9b on en0 ifscope [ethernet]
ds414-1.home (192.168.1.18) at 0:11:32:28:59:45 on en0 ifscope [ethernet]
samsung.home (192.168.1.20) at 64:1c:ae:58:54:e0 on en0 ifscope [ethernet]
silverbook.home (192.168.1.24) at f4:f:24:30:f9:e0 on en0 ifscope permanent [ethernet]
tl-wpa4220.home (192.168.1.28) at c:80:63:75:1e:52 on en0 ifscope [ethernet]
un-gout-de-pomme.home (192.168.1.35) at b8:5d:a:85:b4:bc on en0 ifscope [ethernet]
hl-2250dn.home (192.168.1.69) at 0:1b:a9:5a:4e:42 on en0 ifscope [ethernet]
xigmanas.home (192.168.1.250) at 1c:fd:8:70:20:f7 on en0 ifscope [ethernet]
? (192.168.1.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]
? (224.0.0.251) at 1:0:5e:0:0:fb on en0 ifscope permanent [ethernet]
broadcasthost (255.255.255.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]
```

### Trouver les devices sur un réseau:

https://www.blackmoreops.com/2015/12/31/use-arp-scan-to-find-hidden-devices-in-your-network/

https://github.com/royhills/arp-scan

https://github.com/royhills/arp-scan/wiki/arp-scan-User-Guide

```bash
$ sudo arp-scan --interface=en0 --localnet
Interface: en0, type: EN10MB, MAC: 50:ed:3c:1f:98:06, IPv4: 192.168.129.54
Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan)

523 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.10.0: 256 hosts scanned in 1.880 seconds (136.17 hosts/sec). 0 responded

```



### nmap:

```bash
$ nmap 192.168.1.0/24
Starting Nmap 7.90 ( https://nmap.org ) at 2020-10-04 08:10 CEST
Nmap scan report for livebox.home (192.168.1.1)
Host is up (0.0086s latency).
Not shown: 992 filtered ports
PORT    STATE  SERVICE
53/tcp  open   domain
80/tcp  open   http
113/tcp closed ident
135/tcp closed msrpc
139/tcp open   netbios-ssn
443/tcp open   https
445/tcp open   microsoft-ds
631/tcp open   ipp

Nmap scan report for ds916.home (192.168.1.7)
Host is up (0.0048s latency).
Not shown: 984 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
80/tcp   open  http
139/tcp  open  netbios-ssn
161/tcp  open  snmp
443/tcp  open  https
445/tcp  open  microsoft-ds
515/tcp  open  printer
548/tcp  open  afp
631/tcp  open  ipp
873/tcp  open  rsync
3001/tcp open  nessus
3260/tcp open  iscsi
3261/tcp open  winshadow
3689/tcp open  rendezvous
5510/tcp open  secureidprop

Nmap scan report for ds414.home (192.168.1.8)
Host is up (0.062s latency).
Not shown: 992 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
139/tcp  open  netbios-ssn
161/tcp  open  snmp
443/tcp  open  https
445/tcp  open  microsoft-ds
873/tcp  open  rsync
5357/tcp open  wsdapi

Nmap scan report for ne-3241-t200022615817dc.home (192.168.1.11)
Host is up (0.011s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
80/tcp   open  http
514/tcp  open  shell
8080/tcp open  http-proxy

Nmap scan report for atv4.home (192.168.1.15)
Host is up (0.0043s latency).
Not shown: 994 closed ports
PORT      STATE SERVICE
5000/tcp  open  upnp
7000/tcp  open  afs3-fileserver
7100/tcp  open  font-service
49152/tcp open  unknown
49153/tcp open  unknown
62078/tcp open  iphone-sync

Nmap scan report for hdhr-1231b9b9.home (192.168.1.16)
Host is up (0.0044s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE
80/tcp   open  http
554/tcp  open  rtsp
5004/tcp open  avt-profile-1
8888/tcp open  sun-answerbook

Nmap scan report for ds414-1.home (192.168.1.18)
Host is up (0.014s latency).
Not shown: 991 closed ports
PORT      STATE SERVICE
22/tcp    open  ssh
80/tcp    open  http
139/tcp   open  netbios-ssn
161/tcp   open  snmp
443/tcp   open  https
445/tcp   open  microsoft-ds
873/tcp   open  rsync
5357/tcp  open  wsdapi
49160/tcp open  unknown

Nmap scan report for silverbook.home (192.168.1.24)
Host is up (0.012s latency).
Not shown: 992 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
88/tcp   open  kerberos-sec
443/tcp  open  https
445/tcp  open  microsoft-ds
3031/tcp open  eppc
3306/tcp open  mysql
5900/tcp open  vnc

Nmap scan report for tl-wpa4220.home (192.168.1.28)
Host is up (0.011s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE
80/tcp open  http

Nmap scan report for hl-2250dn.home (192.168.1.69)
Host is up (0.0023s latency).
Not shown: 994 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
23/tcp   open  telnet
80/tcp   open  http
515/tcp  open  printer
631/tcp  open  ipp
9100/tcp open  jetdirect

Nmap scan report for xigmanas.home (192.168.1.250)
Host is up (0.0011s latency).
All 1000 scanned ports on xigmanas.home (192.168.1.250) are closed

Nmap done: 256 IP addresses (11 hosts up) scanned in 28.04 seconds

```



#### Analysez un réseau et découvrez quels serveurs et périphériques sont opérationnels:

```bash
$ nmap -sP 192.168.1.0/24
Starting Nmap 7.90 ( https://nmap.org ) at 2020-10-04 08:17 CEST
Nmap scan report for livebox.home (192.168.1.1)
Host is up (0.0018s latency).
Nmap scan report for ds916.home (192.168.1.7)
Host is up (0.0033s latency).
Nmap scan report for ds414.home (192.168.1.8)
Host is up (0.0095s latency).
Nmap scan report for ne-3241-t200022615817dc.home (192.168.1.11)
Host is up (0.035s latency).
Nmap scan report for atv4.home (192.168.1.15)
Host is up (0.014s latency).
Nmap scan report for hdhr-1231b9b9.home (192.168.1.16)
Host is up (0.0050s latency).
Nmap scan report for ds414-1.home (192.168.1.18)
Host is up (0.0068s latency).
Nmap scan report for samsung.home (192.168.1.20)
Host is up (0.0093s latency).
Nmap scan report for silverbook.home (192.168.1.24)
Host is up (0.0017s latency).
Nmap scan report for tl-wpa4220.home (192.168.1.28)
Host is up (0.0096s latency).
Nmap scan report for hl-2250dn.home (192.168.1.69)
Host is up (0.0024s latency).
Nmap scan report for xigmanas.home (192.168.1.250)
Host is up (0.0018s latency).
Nmap done: 256 IP addresses (12 hosts up) scanned in 8.13 seconds
```



#### Scannez tous vos appareils / ordinateurs pour les ports ouverts:

```bash
$ nmap -T5 192.168.1.0/24
Starting Nmap 7.90 ( https://nmap.org ) at 2020-10-04 08:23 CEST
Warning: 192.168.1.15 giving up on port because retransmission cap hit (2).
Warning: 192.168.1.24 giving up on port because retransmission cap hit (2).
Nmap scan report for livebox.home (192.168.1.1)
Host is up (0.0032s latency).
Not shown: 992 filtered ports
PORT    STATE  SERVICE
53/tcp  open   domain
80/tcp  open   http
113/tcp closed ident
135/tcp closed msrpc
139/tcp open   netbios-ssn
443/tcp open   https
445/tcp open   microsoft-ds
631/tcp open   ipp

Nmap scan report for ds916.home (192.168.1.7)
Host is up (0.0055s latency).
Not shown: 984 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
80/tcp   open  http
139/tcp  open  netbios-ssn
161/tcp  open  snmp
443/tcp  open  https
445/tcp  open  microsoft-ds
515/tcp  open  printer
548/tcp  open  afp
631/tcp  open  ipp
873/tcp  open  rsync
3001/tcp open  nessus
3260/tcp open  iscsi
3261/tcp open  winshadow
3689/tcp open  rendezvous
5510/tcp open  secureidprop

Nmap scan report for ds414.home (192.168.1.8)
Host is up (0.0063s latency).
Not shown: 992 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
139/tcp  open  netbios-ssn
161/tcp  open  snmp
443/tcp  open  https
445/tcp  open  microsoft-ds
873/tcp  open  rsync
5357/tcp open  wsdapi

Nmap scan report for ne-3241-t200022615817dc.home (192.168.1.11)
Host is up (0.011s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
80/tcp   open  http
514/tcp  open  shell
8080/tcp open  http-proxy

Nmap scan report for atv4.home (192.168.1.15)
Host is up (0.0060s latency).
Not shown: 991 closed ports
PORT      STATE    SERVICE
873/tcp   filtered rsync
993/tcp   filtered imaps
3013/tcp  filtered gilatskysurfer
5000/tcp  open     upnp
7000/tcp  open     afs3-fileserver
7100/tcp  open     font-service
49152/tcp open     unknown
49153/tcp open     unknown
62078/tcp open     iphone-sync

Nmap scan report for hdhr-1231b9b9.home (192.168.1.16)
Host is up (0.0052s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE
80/tcp   open  http
554/tcp  open  rtsp
5004/tcp open  avt-profile-1
8888/tcp open  sun-answerbook

Nmap scan report for ds414-1.home (192.168.1.18)
Host is up (0.0071s latency).
Not shown: 991 closed ports
PORT      STATE SERVICE
22/tcp    open  ssh
80/tcp    open  http
139/tcp   open  netbios-ssn
161/tcp   open  snmp
443/tcp   open  https
445/tcp   open  microsoft-ds
873/tcp   open  rsync
5357/tcp  open  wsdapi
49160/tcp open  unknown

Nmap scan report for silverbook.home (192.168.1.24)
Host is up (0.00014s latency).
Not shown: 976 closed ports
PORT      STATE    SERVICE
22/tcp    open     ssh
80/tcp    open     http
88/tcp    open     kerberos-sec
443/tcp   open     https
445/tcp   open     microsoft-ds
1011/tcp  filtered unknown
1050/tcp  filtered java-or-OTGfileshare
1075/tcp  filtered rdrmshc
2809/tcp  filtered corbaloc
3031/tcp  open     eppc
3306/tcp  open     mysql
3546/tcp  filtered unknown
3689/tcp  filtered rendezvous
5033/tcp  filtered jtnetd-server
5730/tcp  filtered unieng
5900/tcp  open     vnc
5950/tcp  filtered unknown
8402/tcp  filtered abarsd
9071/tcp  filtered unknown
9418/tcp  filtered git
13782/tcp filtered netbackup
16001/tcp filtered fmsascon
32777/tcp filtered sometimes-rpc17
41511/tcp filtered unknown

Nmap scan report for tl-wpa4220.home (192.168.1.28)
Host is up (0.0057s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE
80/tcp open  http

Nmap scan report for hl-2250dn.home (192.168.1.69)
Host is up (0.0019s latency).
Not shown: 994 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
23/tcp   open  telnet
80/tcp   open  http
515/tcp  open  printer
631/tcp  open  ipp
9100/tcp open  jetdirect

Nmap scan report for xigmanas.home (192.168.1.250)
Host is up (0.0014s latency).
All 1000 scanned ports on xigmanas.home (192.168.1.250) are closed

Nmap done: 256 IP addresses (11 hosts up) scanned in 16.16 seconds
```



[plus de commandes](https://www.cyberciti.biz/networking/nmap-command-examples-tutorials/)

