Skip to main content

MiTM over TCP to intercept and manipulate flow

Project description

p4lantir

PyPI - Version PyPI - License Python Version from PEP 621 TOML


p4lantir is a simple tool to perform Man-in-the-Middle over TCP using ARP spoofing, allowing to intercept, drop, forward and see TCP flows.

This project is intended to be relatively simple, making simple future contributions for new features/bug fix.

[!CAUTION] This ethical hacking project is intended for educational purposes and awareness training sessions only. I decline all responsability about the usage of this project.


Installation

  • Install the system dependencies (arpspoof, iptables)
  • Create python virtual environnement
  • Install the package

Setup instructions :

Debian-based systems

sudo apt install dsniff iptables

python3 -m venv venv
source venv/bin/activate

pip install p4lantir

Archlinux

pacman -S dsniff iptables

python3 -m venv venv
source venv/bin/activate

pip install p4lantir

Note : the package can also be downloaded from the release and installed using the .whl file and pip.

Usage

[!WARNING] You need to run the script as root due to arpspoof and iptables. You should open a shell as root, activate the venv and then use p4lantir.

usage: p4lantir [-h] --host-1 HOST_1 --host-2 HOST_2 [--gateway GATEWAY] -i INTERFACE -l LPORT [--pport PPORT] [--debug]

Man-in-the-Middle over TCP terminal app.

options:
  -h, --help            show this help message and exit
  --host-1 HOST_1       First host to spoof, must be the host instanciating the connection
  --host-2 HOST_2       Second host to spoof
  --gateway GATEWAY     Gateway IP
  -i, --interface INTERFACE
                        Interface to perform arp spoofing
  -l, --lport LPORT     Port to listen for MITM attack
  --pport PPORT         Internal port used for proxy.
  --debug               Enable debug mode.

Examples

Client/server in the same localhost

Let say that a client at IP C connect to a remote server at IP R, both in the same LAN. You need to know the name of the interface that connects you this LAN (let call this iface. Then your command should look like :

p4lantir --host-1 [replace with C] \
         --host-2 [replace with R] \
         -i [replace with iface] \
         -lport [server's listening port]

About the listening port, if you intend to intercept SMTP you may choose 25, 80 for HTTP, and so on ...

Client/server on a different LAN

If the client is in the same LAN as you and the server is not in your LAN, then you have to add another parameter : the gateway IP. p4lantir will then spoof the gateway IP and open a connection to the server.

p4lantir --host-1 [replace with C] \
         --host-2 [replace with R] \
         --gateway [replace with gw's IP]
         -i [replace with iface] \
         -lport [server's listening port]

Contributing

All contributions are welcome !

Please see CONTRIBUTING.md for more details.

License

This project is under the GPL-v3 license, please see LICENSE.TXT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

p4lantir-1.0.1a0.tar.gz (141.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

p4lantir-1.0.1a0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file p4lantir-1.0.1a0.tar.gz.

File metadata

  • Download URL: p4lantir-1.0.1a0.tar.gz
  • Upload date:
  • Size: 141.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for p4lantir-1.0.1a0.tar.gz
Algorithm Hash digest
SHA256 1589776459381b516ee277d5e0f9b590fb7ce8523ce45a14e0599efd2f83b11f
MD5 a50d2107a62e60402b9377610ff18552
BLAKE2b-256 6f117a9069b99262f5d6e38c6911aec156dd41cd4a7b7b4b1550327e67ce9391

See more details on using hashes here.

Provenance

The following attestation bundles were made for p4lantir-1.0.1a0.tar.gz:

Publisher: upload-to-pypi.yml on acmo0/p4lantir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file p4lantir-1.0.1a0-py3-none-any.whl.

File metadata

  • Download URL: p4lantir-1.0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for p4lantir-1.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 61dd90773259fd1b75192aa725281f3d24302e54f66542927af5865e63a61aec
MD5 16a6215a28ac73c4fdf35ef163ebc4f1
BLAKE2b-256 dec0a8fc36ca72a68f12f0434c67fbc384ff6bfdbcb24718945e979f2d8c0db9

See more details on using hashes here.

Provenance

The following attestation bundles were made for p4lantir-1.0.1a0-py3-none-any.whl:

Publisher: upload-to-pypi.yml on acmo0/p4lantir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page