Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Bayesian filtering applied to comment spam.
When CAPTCHA can't cut it anymore, Akismet and Disqus are not an option and the weasels are closing in it's time to look at how the problem is tackled for the biggest spam target of all time: email. Statistical analysis of word frequency in individual messages proved to be simple, fast and reliable given enough training data.
The trick to using a tool designed for emails on comment spam is to generate email messages on the fly using comment data. Custom email headers allow us to feed bogofilter any field we deem relevant. Training is done from the Django admin, moderation with a custom moderation class and the app is highly configurable.
if you don't have a custom comments app <http://django-contrib-comments.readthedocs.org/en/latest/custom.html>
__,
make one
in your custom comments app subclass your model from bogofilter.models.BogofilterComment (it's a proxy model that will not add any new fields)
subclass your form from bogofilter.forms.BogofilterCommentForm
register <http://django-contrib-comments.readthedocs.org/en/latest/moderation.html>
__
bogofilter.moderation.BogofilterCommentModerator or a subclass of it
for the model that your comments are attached to. You can do this in
that app's models.py file with something like this (assuming the
target model is Entry):
.. code:: python
if Entry not in moderator._registry:
moderator.register(Entry, BogofilterCommentModerator)
in admin.py you probably want to change the fields order in your custom admin model. Use bogofilter.admin.bogo_status as a field for list_display. Register your admin model subclassed from bogofilter.admin.BogofilterCommentsAdmin like this:
.. code:: python
admin.site.unregister(BogofilterComment)
admin.site.register(MyComment, MyCommentAdmin)
from the admin, train bogofilter with a batch of wanted (ham) and unwanted (spam) comments. 100 of each is a good start. After this filter by "Unsure" and mark those accordingly. Next filter by 'Mismatches'. The assumption is that your ham comments are public, while the spam ones are not. Fix any conflict between bogofilter's status and your public status by marking the comments as spam or ham.
you can pass command line arguments to bogofilter through the BOGOFILTER_ARGS variable in settings.py:
.. code:: python
BOGOFILTER_ARGS = ['-o', '0.7'] # lower the spam_cutoff from the default 0.95
if you have use bogofilter for more than one thing in the same account, you'll want to specify a directory other than the default ~/.bogofilter:
.. code:: python
BOGOFILTER_ARGS = ['-d', './bogofilter_test_dir', '-o', '0.7']
Django <https://www.djangoproject.com/>
__django-contrib-comments <https://github.com/django/django-contrib-comments>
__bogofilter <http://bogofilter.sourceforge.net/>
__.. code:: sh
python setup.py test
The test suite is shamelessly taken from django-contrib-comments and converted to use the 'bogofilter' app wherever possible.
Tested with python-2.7.6, python-3.3.4, django-1.6.2, django-contrib-comments-1.5 and bogofilter-1.2.4 .
author: Stefan Talpalaru stefantalpalaru@yahoo.com
homepage: https://github.com/stefantalpalaru/django-bogofilter
FAQs
Bayesian spam filtering for django_comments using bogofilter
We found that django-bogofilter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.