GithubHelp home page GithubHelp logo

elektito / pcap-generation-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andrewg-felinemenace/pcap-generation-tools

0.0 2.0 0.0 92 KB

PGT allows you to generate pcaps using python without touching the network in any way. It is dependent upon scapy.

Python 100.00%

pcap-generation-tools's Introduction

pcap generation tools
--------------------

0. Requirements
1. Using pgt
2. Using pft
3. Using pftlib from python

--[ 0. Requirements

The pgt tools require python 2.6, python-magic and scapy (I used version 2.1.0).

--[ 1. Using pgt

Using pgt is relatively straight forward:

# Generate the file we want to simulate captures for

$ echo '<html><head><title>evil exploit</title></head><body>t</body></html>' > evil.html

# Ask it to generate the pcaps for us

$ python pgt.py evil.html 
[*] Doing FTP
[*] output/evil.html/FTP_upload_active.pcap...
[*] output/evil.html/FTP_upload_passive.pcap...
[*] output/evil.html/FTP_download_active.pcap...
[*] output/evil.html/FTP_download_passive.pcap...
[*] Doing Email
[*] output/evil.html/POP3_base64.pcap...
[*] output/evil.html/POP3_7or8bit.pcap...
[*] output/evil.html/POP3_quopri.pcap...
[*] output/evil.html/IMAP_base64.pcap...
[*] output/evil.html/IMAP_7or8bit.pcap...
[*] output/evil.html/IMAP_quopri.pcap...
[*] output/evil.html/SMTP_base64.pcap...
[*] output/evil.html/SMTP_7or8bit.pcap...
[*] output/evil.html/SMTP_quopri.pcap...
[*] Doing HTTP
[*] output/evil.html/HTTP_GET_raw_raw.pcap ...
[*] output/evil.html/HTTP_GET_raw_chunked.pcap ...
[*] output/evil.html/HTTP_GET_gzip_raw.pcap ...
[*] output/evil.html/HTTP_GET_gzip_chunked.pcap ...
[*] output/evil.html/HTTP_GET_deflate_raw.pcap ...
[*] output/evil.html/HTTP_GET_deflate_chunked.pcap ...
[*] output/evil.html/HTTP_POST_raw_raw.pcap ...
[*] output/evil.html/HTTP_POST_raw_chunked.pcap ...
[*] output/evil.html/HTTP_POST_gzip_raw.pcap ...
[*] output/evil.html/HTTP_POST_gzip_chunked.pcap ...
[*] output/evil.html/HTTP_POST_deflate_raw.pcap ...
[*] output/evil.html/HTTP_POST_deflate_chunked.pcap ...

And that's it, it's generated a bunch of pcaps for us, and applied a bunch of
common encoding.

--[ 2. Using pft

pft can create brand new pcaps from a file. This is very useful when the 
pcap you have been given doesn't have TCP handshake / socket shutdown, 
bad checksums, missing ack's, etc.

To prepare the input file, use wireshark on the bad pcap, locate the tcp stream
you would like to rebuild, right click on it, select "follow this tcp stream",
then display it as C arrays. Click the save as button, and save the C arrays
somewhere. 

Then run fgt.py as:

$ python fgt.py -w --port <destination port> carrays

and it will generate a carrays.pcap for you.

--[ 3. Using pgtlib from python

Using pgtlib via python is relatively straight forward:


>>> from pgtlib import * 			# Import functions/classes
>>> pcap = PCAP('output.pcap')			# create a new pcap file
>>> conn = pcap.tcp_conn_to_server(8481) 	# create a new tcp stream to port 8481
						# and write it to the above pcap 
>>> conn.to_server("from client to server")	# send some data to the server 
>>> conn.to_client("from server to client")	# send some data to the client
>>> conn.finish()				# perform the fin/ack shutdown 
						# sequence
>>> pcap.close()				# close the pcap file


pcap-generation-tools's People

Contributors

andrewg-felinemenace avatar elektito avatar

Watchers

 avatar James Cloos 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.