Metadata-Version: 2.1
Name: pcapgen
Version: 0.7
Summary: Module to generate PCAPs from any input file. This is a modified version of PGT tool which wasdeveloped earlier by, Andrewg Felinemenace.
Home-page: https://pypi.org/project/python-pcapgen/
Author: Sujit Ghosal
Author-email: synack@outlook.com
License: BSD
Keywords: pcapgen pcap wireshark pgt http imap smtp ftp protocol
Platform: UNKNOWN
Classifier: Environment :: Console
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 2.7
Classifier: Development Status :: 4 - Beta
Classifier: Topic :: Utilities
Classifier: Topic :: Internet
Classifier: Topic :: System :: Networking
Classifier: Intended Audience :: Developers
Description-Content-Type: text/markdown
Requires-Dist: python-magic (>=0.4.15)
Requires-Dist: scapy (>=2.4.0)

Pcapgen PCAP Generation Suite
=================================

# pgtlib
-----------------------------------------
pgtlib is a wrapper built on top of Scapy to provide additional flexibility to create custom TCP client<->server packet captures. This module would also provide functionality to prefix 3-way TCP Handshake and close established connections gracefully.

#### pgtlib usage
Let's say over TCP/5555, you would like to send "----> hey from client\n" from client and server echoes back with a response message saying, "<---- ack data\n". Let's construct a packet based on this:

```python
from pcapgen.pgtlib import *

fHandle = PCAP('/tmp/tcp.pcap')             # PCAP Output Filename
conn = fHandle.tcp_conn_to_server(5555)     # Assign dest port as TCP/5555
conn.to_server('----> hey from client\n')   # Client message to server
conn.to_client('<---- ack data\n')          # Server message to client
conn.finish()                               # Construct FIN
fHandle.close()                             # Close file handle
print('[*]Done.')
```

# pft
-----------------------------------------
PCAP Fix Tool (pft, in short) is a wrapper on top of scapy. This utility helps in resolving broken TCP communications, changing endpoint directions and ports etc. This tool takes the C Arrays input of any TCP stream, appends the missing TCP 3-Way handshakes along with adding the necessary FIN TCP flags to terminate the established TCP communication gracefully.

#### pft usage
* Open faulty pcap and navigate to the faulty TCP stream index that you want to correct.
* View data as 'C Arrays' and export the output to any flat file e.g. /tmp/raw
* $python pft.py -p 1337 -w /tmp/raw
* This would geneate raw.pcap (currently supports PCAP format only) which would have TCP/1337 as destination port along with the end-to-end PDU data intact.

# pgt
-----------------------------------------
PCAP Genation Tool (pgt) is wrapper built on top of scapy again which generates simulated HTTP,FTP and Email (SMTP/IMAP) protocols data along with several encoding types i.e. base64, deflate, gzip etc.

#### pgt usage
```bash
$python pgt.py ~/Desktop/sample.docx # Generates HTTP(GET/POST), FTP(active and passive), SMTP and IMAP PCAPs.
```

### External dependencies
- scapy [pip install scapy]
- python-magic [pip install python-magic]

### Credits
* Major credit goes to Andrewg Felinemenace for developing this excellent utility. Those scripts can be found [here](https://github.com/andrewg-felinemenace/PCAP-Generation-Tools)
* Mine is just an add-on with some minor fixes on top of it. :)


