Skip to content
KitploitKITPLOIT
StrumentiBlog
Invia
StrumentiBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

··Feed·Contatto·Privacy·© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
Strumenti/GitHubGitHub/amlight/ofp_sniffer
Sniffing e Analisi dei PacchettiMappatura della ReteSicurezza di ReteApprendimento e Formazione
GitHubamlight/ofp_sniffer

ofp_sniffer

Un sniffer OpenFlow per aiutare la risoluzione dei problemi di rete in reti di produzione.

Vedi Repository
15121 mese faNon ancora revisionato

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi

OFP_Sniffer è uno sniffer OpenFlow utilizzabile per scopi di risoluzione dei problemi e apprendimento.

Attualmente alla versione 1.2, analizza tutti i messaggi OpenFlow 1.0, funziona con InfluxDB, Grafana e Slack. OpenFlow 1.3 sarà disponibile con la versione 1.3 di OFP_Sniffer (in uscita a breve).

Funziona direttamente dal shell Linux e analizza tutti i messaggi OpenFlow in transito o da file libpcap. Con OFP_Sniffer è possibile tracciare facilmente i messaggi OpenFlow e gli eventuali errori associati senza aprire X11 o Wireshark. OFP_Sniffer è stato scritto in Python 3.6 per supportare il deployment SDN di AmLight (www.sdn.amlight.net). AmLight SDN utilizza Internet2 FlowSpace Firewall, OESS e On.Lab ONOS, e queste app sono state testate e sono completamente supportate.

Come strumento a riga di comando, ha alcuni parametri di input:

root@kitploit:~
# ./ofp_sniffer.py -h
Usage:
 ./ofp_sniffer.py [-p min|full] [-f pcap_filter] [-F filter_file] [-i dev] [-r pcap_file]
	 -p : print all TCP/IP headers. Default: min
	 -f pcap_filter or --pcap-filter=pcap_filter: add a libpcap filter
	 -F filters_file.json or --filters-file=filters.json
	 -i interface or --interface=interface. Default: eth0
	 -r captured.pcap or --src-file=captured.pcap
	 -T topology.json or --topology-file=topology.json
	 -w file or --save-to-file=file: save output to file provided
	 -o or --print-ovs : print using ovs-ofctl format
	 -h or --help : prints this help
	 -c or --no-colors: removes colors
	 -v or --version : prints version
	 -O WARN:CRIT or --oess-fvd=WARN:CRIT: monitor OESS FVD status
	 -N or --notify-via-slack: send notifications via Slack. Param is the Slack channel
	 -S or --enable-statistics: creates statistics

A partire dalla versione 1.0, sono supportate app per gestire esigenze specifiche, come tracciare messaggi OESS FVD o creare statistiche tramite REST e integrarsi con NMS (es. Zabbix).

Maggiori informazioni: https://amlight.net/wp-content/uploads/2015/03/wpeif-2016-ofpsniffer.pdf

##################### Installazione ######################

root@kitploit:~
Requires Python 3.6
git clone https://github.com/amlight/ofp_sniffer.git
cd ofp_sniffer
pip3.6 install -r docs/requirements.txt
sudo ./ofp_sniffer.py

##################### Esempi #########################

Di seguito sono forniti alcuni esempi:

root@kitploit:~
----------------------           -------------------------
| Mininet            |           | OVS-OFCTL 2.3.0       |
| 192.168.56.101:6634| <-------> | eth1 - 192.168.56.102 |
----------------------           -------------------------

# ovs-ofctl dump-flows tcp:192.168.56.101:6634
 cookie=0x0, duration=2183.377s, table=0, n_packets=0, n_bytes=0, idle_age=2183, in_port=1,dl_vlan=2 actions=output:2

# ./ofp_sniffer.py -i eth1 -f " or port 6634"
Sniffing device eth1
2015-09-13 11:47:38.655503 192.168.56.102:37450 -> 192.168.56.101:6634 Size: 74
OpenFlow Version: 1.0(1) Type: Hello(0) Length: 8  XID: 1
1 OpenFlow Hello

2015-09-13 11:47:38.656964 192.168.56.101:6634 -> 192.168.56.102:37450 Size: 74
OpenFlow Version: 1.0(1) Type: Hello(0) Length: 8  XID: 174
174 OpenFlow Hello

2015-09-13 11:47:38.657638 192.168.56.102:37450 -> 192.168.56.101:6634 Size: 86
OpenFlow Version: 1.0(1) Type: Vendor(4) Length: 20  XID: 2
2 OpenFlow Vendor : NICIRA(0x2320)
2 OpenFlow Vendor Data:  12  2 

2015-09-13 11:47:38.657870 192.168.56.102:37450 -> 192.168.56.101:6634 Size: 74
OpenFlow Version: 1.0(1) Type: BarrierReq(18) Length: 8  XID: 3
3 OpenFlow Barrier Request

2015-09-13 11:47:38.659270 192.168.56.101:6634 -> 192.168.56.102:37450 Size: 74
OpenFlow Version: 1.0(1) Type: BarrierRes(19) Length: 8  XID: 3
3 OpenFlow Barrier Reply

root@kitploit:~
# ovs-ofctl add-flow tcp:192.168.56.101:6634 "dl_dst=10:00:00:01:20:00,dl_type=0x88bc actions=mod_vlan_vid:14,output:2"

# ./ofp_sniffer.py -i eth1 -f " or port 6634"

2015-09-13 11:49:08.171463 192.168.56.102:37451 -> 192.168.56.101:6634 Size: 154
OpenFlow Version: 1.0(1) Type: FlowMod(14) Length: 88  XID: 2
2 OpenFlow Match - wildcards: 3678439 dl_type: 0x88bc dl_dst: 10:00:00:01:20:00
2 OpenFlow Body - Cookie: 0x00 Command: Add(0) Idle/Hard Timeouts: 0/0 Priority: 32768 Buffer ID: 0xffffffff Out Port: 65535 Flags: Unknown Flag(0)
2 OpenFlow Action - Type: SetVLANID Length: 8 VLAN ID: 14 Pad: 0
2 OpenFlow Action - Type: OUTPUT Length: 8 Port: 2 Max Length: 0

# ovs-ofctl del-flows tcp:192.168.56.101:6634 "dl_type=0x88bc,dl_dst=10:00:00:01:20:00, "

2015-09-13 11:50:43.636925 192.168.56.102:37454 -> 192.168.56.101:6634 Size: 138
OpenFlow Version: 1.0(1) Type: FlowMod(14) Length: 72  XID: 2
2 OpenFlow Match - wildcards: 3678439 dl_type: 0x88bc dl_dst: 10:00:00:01:20:00
2 OpenFlow Body - Cookie: 0x00 Command: Delete(3) Idle/Hard Timeouts: 0/0 Priority: 32768 Buffer ID: 0xffffffff Out Port: 65535 Flags: Unknown Flag(0)

# ovs-ofctl add-flow tcp:192.168.56.101:6634 "dl_dst=10:00:00:01:20:00,dl_type=0x88bc actions=mod_vlan_vid:14,output:2"

2015-09-13 11:52:58.563737 192.168.56.102:37455 -> 192.168.56.101:6634 Size: 154
OpenFlow Version: 1.0(1) Type: FlowMod(14) Length: 88  XID: 2
2 OpenFlow Match - wildcards: 3678439 dl_type: 0x88bc dl_dst: 10:00:00:01:20:00
2 OpenFlow Body - Cookie: 0x00 Command: Add(0) Idle/Hard Timeouts: 0/0 Priority: 32768 Buffer ID: 0xffffffff Out Port: 65535 Flags: Unknown Flag(0)
2 OpenFlow Action - Type: SetVLANID Length: 8 VLAN ID: 14 Pad: 0
2 OpenFlow Action - Type: OUTPUT Length: 8 Port: 2 Max Length: 0

Utilizzo dei filtri:

Quando si utilizza l'opzione -F ./filters.json si hanno alcune opzioni:

"rejected_of_types": usato per selezionare quali tipi di messaggi OpenFlow NON si desiderano vedere. È possibile definire filtri diversi a seconda della versione di OpenFlow.

Filtri per Ethertype:

Se si cerca uno specifico Ethertype trasportato da messaggi PacketOut o PacketIn, è possibile escludere tutti gli altri, semplificando la visualizzazione.

Esempio:

root@kitploit:~
  "filters":{
      "ethertypes": {
          "lldp" : 0,
          "fvd"  : 0,
          "arp"  : 1,
          "others": [ "88b5" ]
      },
      "packetIn_filter": {
          "switch_dpid": "any",
          "in_port": "any"
      },
      "packetOut_filter": {
          "switch_dpid": "any",
          "out_port": "any"
      }
  }
}

Nella sezione ethertype, 1 significa filtro, 0 significa stampa. Nell'esempio fornito, i messaggi ARP non saranno visibili, mentre OESS FVD e LLDP lo saranno. È possibile aggiungere il numero esadecimale dell'Ethertype (senza lo 0x) nella sezione "others", separandoli con virgole (",").

"packetIn_filter": usato per definire quali messaggi PacketIn + LLDP si DESIDERANO vedere. È possibile definire per switch e/o per porta. Per lo switch, utilizzare il datapath_id come visto dall'applicazione in uso. Ad esempio, alcune app riempiono il campo c_id con of:dpid_id, altre con dpid:dpid_id. Per le porte, utilizzare il port_id OpenFlow, non il nome della porta. Ad esempio, su Brocade, eth1/1 == 1. Quindi usare 1 invece di eth1/1.

"packetOut_filter": usato per definire quali messaggi PacketOut + LLDP si DESIDERANO vedere. È possibile definire per switch e/o per porta. Per lo switch, utilizzare il datapath_id come visto dall'applicazione in uso. Ad esempio, alcune app riempiono il campo c_id con of:dpid_id, altre con dpid:dpid_id. Per le porte, utilizzare il port_id OpenFlow, non il nome della porta. Ad esempio, su Brocade, eth1/1 == 1. Quindi usare 1 invece di eth1/1.

Supporto per proxy OpenFlow:

Quando si utilizza un proxy OpenFlow, a seconda dell'interfaccia selezionata per lo sniffing, si vedrà una delle due possibilità:

IP_Controller <-> IP_Proxy IP_Proxy <-> IP_Switch

È difficile associare quale controller sta comunicando con quale switch. Per facilitare questa risoluzione, lo sniffer OpenFlow monitora automaticamente tutti i messaggi PacketOut + LLDP per creare un dizionario di {(IP, porta): nome_switch}. Se questo è il tuo caso, modifica il file docs/topology.json. La prossima volta che esegui lo sniffer, vedrai l'IP e tra parentesi il dispositivo dietro il proxy. Esempio:

root@kitploit:~
2015-12-16 15:37:41.563621 200.0.207.79(andes1):7801 -> 190.103.184.135:6633 Size: 157 Bytes
OpenFlow Version: 1.0(1) Type: PacketIn(10) Length: 103  XID: 0
0 PacketIn: buffer_id: 0xffffffff total_len: 85 in_port: 49 reason: OFPR_NO_MATCH(0) pad: 0
0 Ethernet: Destination MAC: ff:ff:ff:ff:ff:ff Source MAC: de:ad:be:ef:ba:11 Protocol: 0x8100
0 Ethernet: Prio: 0 CFI: 0 VID: 3720
0 LLDP: Chassis Type(1) Length: 7 SubType: 4 ID: of:cc4e249102000000
0 LLDP: Port Type(2) Length: 5 SubType: 2 ID: 2
0 LLDP: TTL(3) Length: 2 Seconds: 120
0 LLDP: END(0) Length: 0

2015-12-16 15:37:41.564414 190.103.184.133(andes1):56132 -> 190.103.187.72:6633 Size: 165 Bytes
OpenFlow Version: 1.0(1) Type: PacketIn(10) Length: 99  XID: 0
0 PacketIn: buffer_id: 0xffffffff total_len: 81 in_port: 49 reason: OFPR_NO_MATCH(0) pad: 0
0 Ethernet: Destination MAC: ff:ff:ff:ff:ff:ff Source MAC: de:ad:be:ef:ba:11 Protocol: 0x8942
0 LLDP: Chassis Type(1) Length: 7 SubType: 4 ID: of:cc4e249102000000
0 LLDP: Port Type(2) Length: 5 SubType: 2 ID: 2
0 LLDP: TTL(3) Length: 2 Seconds: 120
0 LLDP: END(0) Length: 0

Il nome (andes1) rappresenta uno switch chiamato "andes1" con DPID cc4e249126000000. Nota che il DPID mostrato nell'esempio non è lo stesso, perché viene utilizzato un messaggio PacketIn come esempio. PacketIn mostra il DPID dei vicini di "andes1".

Spero che questo codice ti sia d'aiuto.

Domande/Suggerimenti: AmLight Dev Team [email protected]

Scarica lo strumento