fourfifty
Fourfifty is an email traffic simulator (for now) and an email rate_limiter (soon™️). It works on probabilistic data structures, bloom filter built and can show top senders by missed addresses.
Status: week 1 of 2(?). The traffic simulator, the exact baseline and the Bloom filter is built. Count-Min sketch and HyperLogLog come next.
Try it
pip install -e ".[plot]" # [plot] is optional, only needed for --plot
fourfifty # 10-minute simulation, prints traffic tables
fourfifty --duration 300 --seed 7
fourfifty --plot # also saves total.png and recipients.png
python -m pytest # run the tests
TOTAL MAIL TRAFFIC BY EVENT TYPE
--------------------------------
type events share
--------------------------------
normal 14,969 52.5%
harvest 7,554 26.5%
promo 6,000 21.0%
--------------------------------
total 28,523
TOP SENDERS BY DIFFERENT RECIPIENTS
--------------------------------------------
sender recipients
--------------------------------------------
bot@harvest.example 7,249
news@letter.example 6,000
user4943@sender4943.example 102
user19103@sender19103.example 54
user2816@sender2816.example 43
TOP SENDERS BY MAIL TO NONEXISTENT ADDRESSES
--------------------------------------------
sender misses
--------------------------------------------
bot@harvest.example 11,909
The harvester and newsletter are the busiest senders, which makes this a challenge for the rate limiter, since it cant go off bursts alone.
What's in it
A traffic simulator with hidden attacks (fourfifty/simulator.py)
Real mail corpus has no answer key of which event is which. A simnulation does, so for the rate_limtier to be scored, traffic needs to be simulated.
Features:
- 10,000 senders from a pool of 20,000 mailboxes, Zipf-weighted activity
- every sender has a personal circle of recipients (Pareto-sized, capped at 85% of the pool)
- traffic types:
- normal: normal email activity
- harvest: guesses addresses. around one in five of them are real.
- retry: a random 3% of normal mail, scheduled out to be sent 5 minutes after
- promo: a newsletter activity burst
- reproducible
- IPs from
198.18.0.0/15(RFC 2544 benchmarking range) and.exampledomains
An exact baseline (fourfifty/baseline.py)
the answer key for the rate_limiter
emails_per_sender: what Count-Min will estimaterecipients_per_sender: what HyperLogLog will estimatevalid_mboxes: what the Bloom filter will approximate
A Bloom filter (fourfifty/bloom.py)
answers wether an address is real or not. works quick but has false positives.
bytearraybit storage, SHA-256 and double hashing forkpositions- no false negatives
- false positive rate with m = 10,000 bits, k = 7, 1,000 items: 0.84% measured vs 0.82% expected from theory
What the traffic looks like
The harvesting is steady, as expected. the promotion bursts at minutes 3 to 5. and retries start at minute 5
HyperLogLog will catch the gap between normal senders and bulk senders, but it wont differentiate between promo and harvest. thats why bloom is needed.
Roadmap
- Count-Min sketch (emails per sender)
- HyperLogLog (different recipients per sender)
- scoring harness: sketches vs exact baseline
- more attack types: compromised accounts & bots
Metadata
Release files for fourfifty 0.1.1
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 |
|---|---|---|---|---|
| fourfifty-0.1.1.tar.gz | 10.8 kB | Without provenance | Details for fourfifty-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fourfifty-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for fourfifty-0.1.1-py3-none-any.whl |
Total release size: 19.5 kB
Release files / fourfifty-0.1.1.tar.gz
| Download URL | fourfifty-0.1.1.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba25b3087b53f84209606ceb5127d2f072eb3abd2bcc2ad56e782a72ef84a2e2
|
|
BLAKE2b-256 checksum How to use checksums |
2a4e1fb180b106ed137469f678185403cc2a4dff127024866f644ff0a6ee8e69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / fourfifty-0.1.1-py3-none-any.whl
| Download URL | fourfifty-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52a16dbfd58d1abd96a17a787efb34a8f7cabc4af850ae3ae483af8c4355428c
|
|
BLAKE2b-256 checksum How to use checksums |
27602d44ce3b8c138af145c189733cce693e3bf712ed9500305e568277e56bb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Security for fourfifty 0.1.1
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.