Pcapgen PCAP Generation Suite
pgtlib
pgtlib is a wrapper built on top of Scapy/Kamene 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.
Usage
Let's say over TCP/5555, you would want to send "----> hey from client\n" from client and server echoes back with a response message saying, "<---- ACK\n". Let's construct a packet based on this:
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('----> From Client\r\n') # Client message to server
conn.to_client('<---- From Server\r\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/kamene. 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.
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/kamene again which generates simulated HTTP,FTP and Email (SMTP/IMAP) protocols data along with several encoding types i.e. base64, deflate, gzip etc.
Usage
$python pgt.py ~/Desktop/sample.docx # Generates HTTP(GET/POST), FTP(active and passive), SMTP and IMAP PCAPs.
External dependencies
- kamene [pip3 install kamene]
- python-magic [pip3 install python-magic]
Credits
- Major credit goes to Andrewg Felinemenace for developing this excellent utility. Those scripts can be found here
- Mine is just an add-on with some minor fixes on top of it. :)
Metadata
Release files for pcapgen 0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pcapgen-0.8.tar.gz | 11.4 kB | Without provenance | Details for pcapgen-0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pcapgen-0.8-py3-none-any.whl | Python 3 | none | any | Details for pcapgen-0.8-py3-none-any.whl |
Total release size: 22.7 kB
Release files / pcapgen-0.8.tar.gz
| Download URL | pcapgen-0.8.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31d2a925a40e53ce06b9791460830577e3b272ebf30f0a4dd3e746d1c753aab5
|
|
BLAKE2b-256 checksum How to use checksums |
c5ad25a1b9488f5a4a77b2fc677d272d24716b23ced7be3c87ca9cc5985c05f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.4
|
Release files / pcapgen-0.8-py3-none-any.whl
| Download URL | pcapgen-0.8-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26487c27751d5692d16c52392b4dca59f2f216ec9d3bec6ff861fe9b6090b799
|
|
BLAKE2b-256 checksum How to use checksums |
a49a88e24fe0335b3aca71362078ebb33cf710261888b8d26f87c28c52ab7dd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.4
|
Security for pcapgen 0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.