spamchronic 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/spamchronic +4 -1
- data/lib/mailpot/mail.rb +6 -1
- data/lib/mailpot/models.rb +33 -0
- data/lib/mailpot/smtp.rb +1 -5
- data/lib/mailpot.rb +0 -1
- metadata +15 -14
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/bin/spamchronic
CHANGED
@@ -2,8 +2,10 @@
|
|
2
2
|
require "rubygems"
|
3
3
|
require "bundler/setup"
|
4
4
|
require 'mailpot'
|
5
|
+
require 'socket'
|
6
|
+
|
5
7
|
Mailpot::Configuration.config do
|
6
|
-
parameter :smtp_ip, :smtp_port, :verbose, :daemon, :key_file, :banner
|
8
|
+
parameter :smtp_ip, :smtp_port, :verbose, :daemon, :key_file, :banner, :domain
|
7
9
|
end
|
8
10
|
|
9
11
|
Mailpot::Configuration.config do
|
@@ -13,6 +15,7 @@ require 'mailpot'
|
|
13
15
|
daemon true
|
14
16
|
key_file '/etc/mailpot/keys.yml'
|
15
17
|
banner '{host} ESMTP'
|
18
|
+
domain Socket.gethostbyname(Socket.gethostname).first
|
16
19
|
end
|
17
20
|
|
18
21
|
|
data/lib/mailpot/mail.rb
CHANGED
@@ -60,8 +60,13 @@ module_function
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def forward_probe(msg)
|
63
|
+
r = Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+?\.[a-zA-Z.]*\b/)
|
64
|
+
sender = msg[:sender]
|
65
|
+
sender = sender.scan(r)
|
66
|
+
recipient = msg[:recipients].to_s
|
67
|
+
recipient = recipient.scan(r)
|
63
68
|
Net::SMTP.start('localhost') do | smtp|
|
64
|
-
smtp.send_message msg[:source],
|
69
|
+
smtp.send_message msg[:source], sender, recipient
|
65
70
|
end
|
66
71
|
end
|
67
72
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'active_record'
|
4
|
+
|
5
|
+
class Email < ActiveRecord::Base
|
6
|
+
belongs_to :sender
|
7
|
+
has_one :body
|
8
|
+
has_and_belongs_to_many :recipient
|
9
|
+
has_many :link, :through => :body
|
10
|
+
end
|
11
|
+
|
12
|
+
class Recipient < ActiveRecord::Base
|
13
|
+
has_and_belongs_to_many :email
|
14
|
+
end
|
15
|
+
|
16
|
+
class Sender < ActiveRecord::Base
|
17
|
+
has_many :email
|
18
|
+
end
|
19
|
+
|
20
|
+
class Body < ActiveRecord::Base
|
21
|
+
belongs_to :email
|
22
|
+
has_and_belongs_to_many :link
|
23
|
+
has_many :part
|
24
|
+
end
|
25
|
+
|
26
|
+
class Link < ActiveRecord::Base
|
27
|
+
has_and_belongs_to_many :body
|
28
|
+
end
|
29
|
+
|
30
|
+
class Part < ActiveRecord::Base
|
31
|
+
belongs_to :body
|
32
|
+
end
|
33
|
+
|
data/lib/mailpot/smtp.rb
CHANGED
@@ -23,11 +23,7 @@ class Mailpot::Smtp < EventMachine::Protocols::SmtpServer
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def get_server_domain
|
26
|
-
|
27
|
-
Socket.gethostbyname(Socket.gethostname).first
|
28
|
-
rescue Exception => e
|
29
|
-
puts e.inspect
|
30
|
-
end
|
26
|
+
Mailpot::Configuration.domain
|
31
27
|
end
|
32
28
|
|
33
29
|
def receive_sender(sender)
|
data/lib/mailpot.rb
CHANGED
@@ -19,7 +19,6 @@ module_function
|
|
19
19
|
EventMachine.start_server Mailpot::Configuration.smtp_ip, Mailpot::Configuration.smtp_port, Smtp
|
20
20
|
puts "==> smtp://#{Mailpot::Configuration.smtp_ip}:#{Mailpot::Configuration.smtp_port}"
|
21
21
|
end
|
22
|
-
puts "Daemon #{Mailpot::Configuration.daemon}"
|
23
22
|
if Mailpot::Configuration.daemon === true
|
24
23
|
EventMachine.next_tick do
|
25
24
|
puts "*** Mailpot now runs as a daemon by default"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spamchronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-19 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &68980260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *68980260
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: eventmachine
|
27
|
-
requirement: &
|
27
|
+
requirement: &68979620 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.12'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *68979620
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: aws-sdk
|
38
|
-
requirement: &
|
38
|
+
requirement: &68979040 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *68979040
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mail
|
49
|
-
requirement: &
|
49
|
+
requirement: &68978340 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *68978340
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &68977700 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *68977700
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdoc
|
71
|
-
requirement: &
|
71
|
+
requirement: &68961510 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *68961510
|
80
80
|
description: ! " MailPot is a simple SMTP server honeypot that will catch emails
|
81
81
|
and store\n them in S3 and then pop a message into SQS for later processing\n"
|
82
82
|
email: mjezorek@gmail.com
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- VERSION
|
93
93
|
- bin/spamchronic
|
94
94
|
- lib/mailpot.rb
|
95
|
+
- lib/mailpot/models.rb
|
95
96
|
- lib/mailpot/events.rb
|
96
97
|
- lib/mailpot/mail.rb
|
97
98
|
- lib/mailpot/smtp.rb
|