I.khaksari
I.khaksari

Reputation: 29

How to do Deep Packet Inspection before forwarding it

I need to do a dpi task on all packets entering an ubuntu server and then forward them to their destination in my local network. The server is gateway and NAT machine of local network.

I'm writing the app in and I don't know how to process every packet and then forward them.

Upvotes: 1

Views: 3666

Answers (2)

Edzi
Edzi

Reputation: 1

You can use nfstream python package

   from nfstream import NFStreamer
   my_awesome_streamer = NFStreamer(source="facebook.pcap") # or network interface (source="eth0")
   for flow in my_awesome_streamer:
       print(flow)  # print it, append to pandas Dataframe or whatever you want :)!

Upvotes: 0

Kyrol
Kyrol

Reputation: 3607

If I understand well, you need to create a program to catch (from live or passing pcap) packets, perform DPI and then classify them by application protocol, isn't it ?

First of all I suggest you to read this.

Then, you can use many Python libraries:

  1. Wireshark API
  2. Pcapy
  3. Scapy

IMHO it depends at what level you need to have the fine-grained. Maybe you are looking for something close to dpkt module.

Upvotes: 2

Related Questions