Giter Site home page Giter Site logo

firewall-log-pcap-injection's Introduction

PCAP CSV log generator

Use

This tool recieves a PCAP and several input parameters and stores output in CSV format to the file specified as OUTPUT, as follows:

positional arguments: inputfile Input PCAP filename.

optional arguments:

  • -h, --help // show this help message and exit
  • -o OUTPUT, --output OUTPUT // Output CSV filename.
  • -t TARGET_START_TIME, --target-start-time TARGET_START_TIME // Date and time of initial event.
  • -n, --no-response // Ignore response.
  • -s, --syn-only // Filter out all TCP packets that do not establish a connection. This will ignore all TCP packets that have combinations of flags different than SYN.
  • -r REPLACE_IP [REPLACE_IP ...], --replace-ip REPLACE_IP [REPLACE_IP ...] // Specify IP address replacement. Can specify either individual addresses, such as 10.0.1.10:192.168.1.10, or ranges of IP addresses with subnet bits, such as 10.0.1.0:192.168.1.0/24. Multiple pairs can be replaced using multiple -r args.
  • -i IGNORE_IP [IGNORE_IP ...], --ignore-ip IGNORE_IP [IGNORE_IP ...] // Specify IP address or range to ignore. Can specify either individual addresses, ranges such as 10.0.1.15-10.0.1.255, or subnets, such as 10.0.1.0/24.

Examples

$ python3 ./src/generate-log.py ./data/sample.pcap --output ./data/sample.csv --target-start-time 2022-05-09T16:27:05.966627 -r 192.168.65.0:192.168.1.0/24 -r 10.0.2.15:192.168.2.15 -r 10.0.2.3:192.168.2.3

This example opens sample.pcap and stores results into sample.csv. Timestamp of the first record is set to 2022-05-09T16:27:05.966627 and all other records are pushed in time accordingly. In adittion, IP addresses are replaced as follows:

  • IP addresses from IP subnet 192.168.65.0/24 are replaced with corresponding addresses from IP subnet 192.168.1.0/24
  • IP address 10.0.2.15 is replaced with IP address 192.168.2.15
  • IP address 10.0.2.3 is replaced with IP address 192.168.2.3
$ python3 ./src/generate-log.py ./data/sample.pcap --output ./data/sample-ignored.csv --target-start-time 2022-05-09T16:27:05.966627 -r 192.168.65.0:192.168.1.0/24 -r 10.0.2.15:192.168.2.15 -r 10.0.2.3:192.168.2.3 -i 10.0.2.2 -i 192.168.65.1-192.168.65.30 -i 192.168.65.35-192.168.65.254

This example performs the same operations as the previous, with the distinction that it also ignores a part of the communication. Concretely, communications involving the following IP addresses will not be added into the CSV log:

  • IP address 10.0.2.2
  • IP adresses between address 192.168.65.1 and address 192.168.65.30
  • IP adresses between address 192.168.65.35 and address 192.168.65.254
$ python3 ./src/generate-log.py ./data/sample.pcap --output ./data/sample-ignored.csv --target-start-time 2022-05-09T16:27:05.966627 -r 192.168.65.0:192.168.1.0/24 -r 10.0.2.15:192.168.2.15 -r 10.0.2.3:192.168.2.3 -i 10.0.2.2 -i 192.168.65.1-192.168.65.30 -i 192.168.65.35-192.168.65.254 -n

In addition to performing all of the operations from the precious example, this example also ignores response packets. For example, if A performs a ping over B, and then B responds to the ping, only the first packet will appear in the generated CSV log.

firewall-log-pcap-injection's People

Contributors

ivan-ikl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.