Git Product home page Git Product logo

antispam's Introduction

antispam

Remove spam from your IMAP account.

Do you get spam? If you don't use a spam filter (or your service provider doesn't provide one), then this can be a daily annoyance of deleting tens, hundreds, or thousands of nuisance spam emails in your inbox. Ain't nobody got time for that.

antispam is a little binary that reads in messages from your inbox and deletes the ones that are spam. Nice, eh?

How does it do this? Pretty simple: domain & email blocklists. Three massive blocklists are included in the binary to identify spam From addresses.

If you notice someone not on this list, you can add it to your configuration. See below.

Installation

$ go get -u github.com/parkr/antispam

Configuring

Configuration is via a JSON file. It has 10 possible fields, but only the first 4 are required:

{
  "Address": "mail.example.com",
  "Port": "993",
  "Username": "[email protected]",
  "Password": "myplaintextpassword"
  "UseJunk": true,
  "UseSpam": true,
  "UseFlags": false,
  "UseBlockLists": true,
}

That will log into mail.example.com:993 as [email protected] with password myplaintextpassword. Easy!

UseJunk and UseSpam will cause antispam to scan folders Junk and Spam, respectively.

UseFlags will cause any message flagged but unread to be treated as spam. The flag will be cleared before the message is deleted.

UseBlockLists uses the union of the included statik blocklist files plus BadEmailDomains and BadEmail, if present.

{
  ...
  "BadEmailDomains": ["horriblehepsebah.com", "iwillspamyou.biz"],
  "BadEmails": ["[email protected]", "[email protected]"]
}

BadEmailDomains tells antispam to delete any email from an email address at that domain.

BadEmails tells antispam to delete any email from any of the given email addresses.

Usage

$ make && ./antispam -config path/to/config.json -filter path/to/filter.json --num=50

antispam's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar lgtm-migrator avatar nkirsch avatar parkr avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

antispam's Issues

Dependabot couldn't find a Gopkg.toml for this project

Dependabot couldn't find a Gopkg.toml for this project.

Dependabot requires a Gopkg.toml to evaluate your project's current Go dependencies. It had expected to find one at the path: /Gopkg.toml.

If this isn't a Go project, or if it is a library, you may wish to disable updates for it from within Dependabot.

not able to run the go file

antispam.go:13:2: cannot find package "github.com/emersion/go-imap" in any of:
/usr/lib/go/src/pkg/github.com/emersion/go-imap (from $GOROOT)
($GOPATH not set)
antispam.go:14:2: cannot find package "github.com/emersion/go-imap/client" in any of:
/usr/lib/go/src/pkg/github.com/emersion/go-imap/client (from $GOROOT)
($GOPATH not set)

Unable to read /tmp/antispam-filter.json

$ ./antispam -config=/home/user/antispam/config.json

produced:

panic: open /tmp/antispam-filter.json: no such file or directory
unable to open file "/tmp/antispam-filter.json"
main.readConfigFile
/home/user/antispam/config.go:22
main.main
/home/user/antispam/antispam.go:104
runtime.main
/usr/local/go/src/runtime/proc.go:250
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1571
fatal error occurred
main.main.func1
/home/user/antispam/antispam.go:68
runtime.gopanic
/usr/local/go/src/runtime/panic.go:838
main.main
/home/user/antispam/antispam.go:105
runtime.main
/usr/local/go/src/runtime/proc.go:250
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1571
2022/07/17 13:12:35 Reading config...
2022/07/17 13:12:35 Reading filter file /tmp/antispam-filter.json

NO Client tried to access nonexistent namespace.

Tried using on 30k messages stored on a dreamhost account and got the following error:

panic: Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.000 secs).
unable to select folder "Spam"
main.processJunkFolder
        C:/Users/Alan/go/pkg/mod/github.com/parkr/[email protected]/junk.go:42
main.main
        C:/Users/Alan/go/pkg/mod/github.com/parkr/[email protected]/antispam.go:176
runtime.main
        C:/Program Files/Go/src/runtime/proc.go:271
runtime.goexit
        C:/Program Files/Go/src/runtime/asm_amd64.s:1695
fatal error occurred
main.main.func1
        C:/Users/Alan/go/pkg/mod/github.com/parkr/[email protected]/antispam.go:77
runtime.gopanic
        C:/Program Files/Go/src/runtime/panic.go:770
main.processJunkFolder
        C:/Users/Alan/go/pkg/mod/github.com/parkr/[email protected]/junk.go:42
main.main
        C:/Users/Alan/go/pkg/mod/github.com/parkr/[email protected]/antispam.go:176
runtime.main
        C:/Program Files/Go/src/runtime/proc.go:271
runtime.goexit
        C:/Program Files/Go/src/runtime/asm_amd64.s:1695
2024/04/23 09:53:32 Reading config...
2024/04/23 09:53:32 Read config &{imap.dreamhost.com 993 [email protected] PasSwORD! [horriblehepsebah.com iwillspamyou.biz] [[email protected] [email protected]] false true false true}
2024/04/23 09:53:32 Reading filter file .\filter.json
2024/04/23 09:53:32 Read filter &{imap.dreamhost.com 993 [email protected] PasSwORD! [horriblehepsebah.com iwillspamyou.biz] [[email protected] [email protected]] false true false true}
2024/04/23 09:53:32 Loading global blocklists...
2024/04/23 09:53:33 Connecting to server...
2024/04/23 09:53:33 Connected
dyMBiQ LOGIN "[email protected]" "PasSwORD!"
dyMBiQ OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY LITERAL+ NOTIFY SPECIAL-USE] Logged in
2024/04/23 09:53:33 Logged in
2024/04/23 09:53:33 Mailboxes:
nQlA3A LIST "" "*"
* LIST (\HasChildren) "." INBOX
* LIST (\HasNoChildren) "." INBOX.old-messages
* LIST (\HasNoChildren \Trash) "." INBOX.Trash
* LIST (\HasNoChildren \Junk) "." INBOX.Spam
* LIST (\HasNoChildren \Sent) "." INBOX.Sent
* LIST (\HasNoChildren \Drafts) "." INBOX.Drafts
nQlA3A OK List completed (0.153 + 0.000 + 0.152 secs).
2024/04/23 09:53:33 * INBOX
2024/04/23 09:53:33 * INBOX.old-messages
2024/04/23 09:53:33 * INBOX.Trash
2024/04/23 09:53:33 * INBOX.Spam
2024/04/23 09:53:33 * INBOX.Sent
2024/04/23 09:53:33 * INBOX.Pedro
2024/04/23 09:53:33 * INBOX.Drafts
G8bneg SELECT "Spam"
G8bneg NO Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.000 secs).
3twq4A LOGOUT
* BYE Logging out
3twq4A OK Logout completed (0.001 + 0.000 secs).

Not sure if there is something I am supposed to configure in the filter.json, or the config.json to specify which folders to filter.

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.