SHRUG is a simple Python library that lets users anonymize source and destination IP addresses in packet traces. As of the current release, SHRUG supports the following anonymization algorithms:
- Randomizer algorithm (randomizer)
- Prefix Preserving algorithm (prefAnon) [Using CryptoPAn]
- BlackMarker algorithm (blackMarker)
- Permutation algorithm (permutation)
- Truncation algorithm (truncation)
- Reverse Truncation algorithm (revTruncation)
- Install the package using pip
pip install SHRUG-anon
- Import the module and the anonymization methods
>>> from SHRUG_anon import anonalgos
- The read_from method can be used to read a .pcap or .tcpdump file
>>> input_pks = anonalgos.read_from("/path/to/pcap/tcpdump/file")
- Use one of the six anonymization algorithms on the packet capture stored in the previous step, and store the anonymized packets.
>>> anonalgos.randomizer(input_pks)
>>> anonalgos.write_to("/path/to/anonymized/packets/.pcap/.tcpdump")
- NOTE: The truncation and reverse truncation algorithms require a second parameter, i.e., the number of bits to be truncated.
>>> anonalgos.truncation(input_pks, 12)