BMF(1)

๐Ÿ’– BMF(1) โ€” like, the manual page, bestie ๐Ÿ’–

okay so you opened man 1 bmf and you're here now, and honestly? iconic choice. this is the BMF(1) page and i'm gonna walk you through it like we're texting at 2am. grab a snack. ๐Ÿ“


โœจ NAME โœจ

bmf โ€” the efficient Bayesian mail filter. yes bestie, Bayesian. it's giving statistics major. ๐Ÿ‘‘


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

bmf [-t] [-n] [-s] [-N] [-S] [-f fmt] [-d db] [-i file] [-k n] [-m type] [-p]
    [-v] [-V] [-h]

๐ŸŒธ DESCRIPTION ๐ŸŒธ

so bmf is a Bayesian mail filter, fr fr. in its normal mode of operation it takes an email message or literally any other text on standard input, does a statistical check against lists of "good" and "spam" words, registers the new data, and returns a status code telling you whether or not the message is spam. that's the whole vibe check.

BMF is written with fast, zero-copy algorithms, coded directly in C, and tuned for speed. no cap. it aims to be faster, smaller, and more versatile than similar applications. main character energy, honestly. ๐Ÿ’…

bmf supports both mbox and maildir mail storage formats. and it will automatically process multiple messages within an mbox file separately โ€” like, one at a time, no crumbs left behind. โœจ


๐ŸŽ€ OPTIONS ๐ŸŽ€

Without command-line options, bmf processes the input, registers it as either "good" or "spam", and returns the appropriate error code. The wordlist directory and nonexistent wordfiles are created if absent. (yes, it just does that. self-sufficient queen. ๐Ÿซถ)

  • -t โ€” Test to see if the input is spam. The word lists are not updated. A report is written to stdout showing the final score and the tokens with the highest deviation form a mean of 0.5. (look, don't touch, just look. ๐Ÿ’…)
  • -n โ€” Register the input as non-spam. good vibes only.
  • -s โ€” Register the input as spam. ๐Ÿšซ
  • -N โ€” Register the input as non-spam and undo a prior registration as spam. it's giving redemption arc.
  • -S โ€” Register the input as spam and undo a prior registration as non-spam. plot twist. ๐Ÿ˜ญ
  • -f fmt โ€” Specify database format. Valid formats are text, db, and mysql. Text is always valid. The others may not be available if the corresponding option was not enabled at compile time. The default is db if available, else text.
  • -d db โ€” Specify database or directory for loading and saving word lists. The default is ~/.bmf in text mode.
  • -i file โ€” Use file for input instead of stdin. no pipe required, we're fancy now.
  • -k n โ€” Specify the number of extrema (keepers) to use in the Bayes calculation. The default is 15.
  • -m fmt โ€” Specify mail storage format. Valid formats are mbox and maildir. The default is to automatically detect the mail storage format. > This option is deprecated. (we don't talk about her anymore ๐Ÿ™ˆ)
  • -p โ€” Copy the input to the output (passthrough) and insert spam headers in the style of SpamAssassin. An X-Spam-Status header is always inserted with processing details. The contents of this header always begin with either "Yes" or "No". If the input is judged to be spam, the header X-Spam-Flag: YES is also inserted. the receipts. ๐Ÿงพโœจ
  • -v โ€” Be more verbose. > This option is not well supported yet. (she's trying her best okay ๐Ÿ˜ญ)
  • -V โ€” Display version information.
  • -h โ€” Display usage information. help me help you, bestie.

๐Ÿ”ฅ THEORY OF OPERATION ๐Ÿ”ฅ

bmf treats its input as a bag of tokens. Each token is checked against "good" and "bad" wordlists, which maintain counts of the numbers of times it has occurred in non-spam and spam mails. These numbers are used to compute the probability that a mail in which the token occurs is spam. After probabilities for all input tokens have been computed, a fixed number of the probabilities that deviate furthest from average are combined using Bayes's theorem on conditional probabilities. math ate. ๐Ÿงฎ๐Ÿ’…

While this method sounds crude compared to the more usual pattern-matching approach, it turns out to be extremely effective. Paul Graham's paper A Plan For Spam: http://www.paulgraham.com/spam.html is recommended reading. (homework era but make it fun ๐Ÿ“š)

bmf improves on Paul's proposal by doing smarter lexical analysis. In particular, hostnames and IP addresses are not discarded, and certain types of MTA information are discarded (such as message ids and dates).

MIME and other attachments are not decoded. Experience from watching the token streams suggests that spam with enclosures invariably gives itself away through cues in the headers and non-enclosure parts. Nonetheless, I would like to add the ability to decode quoted-printable and perhaps base64 encodings for textual attachments. (future update wishlist, manifesting โœจ)


๐Ÿซถ INTEGRATION WITH OTHER TOOLS ๐Ÿซถ

Please see the /usr/share/doc/bmf/README.gz for samples and suggestions. go read it, it's lowkey good.


โญ RETURN VALUES โญ

  • In passthrough mode: zero for success, nonzero for failure.
  • In non-passthrough mode: 0 for spam; 1 for non-spam; 2 for I/O or other errors.

memorize these, they're literally the whole plot. ๐Ÿ“–


๐ŸŒˆ FILES ๐ŸŒˆ

  • ~/.bmf/goodlist.txt โ€” List of good tokens for text mode.
  • ~/.bmf/spamlist.txt โ€” List of bad tokens for text mode.
  • ~/.bmf/goodlist.db โ€” List of good tokens for libdb mode.
  • ~/.bmf/spamlist.db โ€” List of bad tokens for libdb mode.

๐Ÿ’€ BUGS ๐Ÿ’€

Only one copy of bmf(1) instance can access the database (see options -d and -f). In Procmail recipes, ensure sequential access with a lock file:
:0 fw: bmf.lock
| bmf -p
  • The lexer does not recognize multiline headers. ๐Ÿ™ˆ
  • The lexer does not recognize MIME attachments. ๐Ÿ™ˆ
  • Content-Transfer-Encoding is not decoded. ๐Ÿ™ˆ

not me listing all the flaws but she's still perfect to me. ๐Ÿ’œ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Tom Marshall <tommy@tig-grr.com>.

The Bayes algorithm is from bogofilter by Eric S. Raymond <esr@thyrsus.com>. bogofilter can be found at the bogofilter project page: http://bogofilter.sourceforge.net/.


and that's the whole page bestie!! this was BMF(1) โ€” you made it to the end, so proud of you, go filter some spam and slay the day away. periodt. ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐ŸŒธ๐Ÿ’…

๐Ÿ“ฆ where this page comes from