Git Product home page Git Product logo

pyspamsum's Introduction

PySpamSum

https://travis-ci.org/pybee/pyspamsum.svg?branch=master

spamsum is a fuzzy hash specifically designed for hashing email messages to detect if they are SPAM. The spamsum utility includes the ability to generate the spamsum hash and check a new message against a existing set of hashes to find a match.

pyspamsum is a Python wrapper for the core API of spamsum.

The original spamsum code has been licensed under the terms of the the Perl Artistic License. It has been slightly modified

The original code is Copyright Andrew Tridgell <[email protected]> 2002. It forms part of Andrew's junkcode, and is available here:

http://www.samba.org/junkcode/#spamsum

The spamsum code in this project is derived from an updated version that was published at Linux.conf.au 2004:

http://linux.anu.edu.au/linux.conf.au/2004/papers/junkcode/spamsum

For details on spamsum itself, please see the spamsum README:

http://samba.org/ftp/unpacked/junkcode/spamsum/README

Installation

At a prompt, run:

$ python setup.py install

Usage

Once installed, here are some examples of usage:

# Import spamsum and set up some strings
>>> import spamsum
>>> s1 = "I am the very model of a modern Major-General, I've information animal and vegetable and mineral"
>>> s2 = "I am the very model of a modern Brigadier, I've information animal and vegetable and something else"
>>> s3 = "Huh? Gilbert and Who?"

# Evaluate the edit distance between two strings
>>> spamsum.edit_distance(s1, s2)
27

# Evaluate the spamsum of some strings
>>> sum1 = spamsum.spamsum(s1)
>>> sum2 = spamsum.spamsum(s2)
>>> sum3 = spamsum.spamsum(s3)
>>> print(sum1)
3:kEvyc/sFIKwYclQY4MKLFE4Igu0uLzIKygn:kE6Ai3KQ/MKOgDKZn

# Compare two spamsums. 0 = no match, 100 = perfect match.
>>> spamsum.match(sum1, sum1)
100
>>> spamsum.match(sum1, sum2)
72
>>> spamsum.match(sum1, sum3)
0

pyspamsum's People

Contributors

dpnova avatar dubbl avatar freakboy3742 avatar jea-csis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyspamsum's Issues

Spamsum similarity score issue

Hi,

First, thanks a lot for that great tool ๐Ÿ™‚

We just ran into a weird problem, I think the code is more explanatory than words:

>>> import spamsum
>>> f = open('somefile', mode='r')
>>> html = f.read()
>>> c1 = spamsum.spamsum(html)
>>> c1
'96:q66666666666666666666666666666666666666666666666666666666666666I:N'
>>> spamsum.match(c1, c1)
0

Basically, we found some spamsums that had a score of 0 for themselves. An other tool like ssdeep gave us a score of 100 on that one, so not sure what's happening?

(snippet of the ssdeep code below:

>>> import ssdeep
>>> f = open('somefile', 'r')
>>> html = f.read()
>>> c1 = ssdeep.hash(html)
>>> c1
'96:q66666666666666666666666666666666666666666666666666666666666666I:N'
>>> ssdeep.compare(c1, c1)
100

)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.