spamtrap 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/spamtrap/controller.rb +6 -10
- data/lib/spamtrap/helper.rb +11 -0
- data/lib/spamtrap/version.rb +4 -4
- data/test/controller_test.rb +0 -6
- data/test/test_helper.rb +1 -9
- metadata +36 -59
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ad55c17c774c1af60996ec3e3047783838c87e48
|
4
|
+
data.tar.gz: d475693c3fc540fadc0526d5f5a408384bdef3ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7463b9b3ec741001edb8cea2ab2396f944f5a3828b6890456e28e57c50dadd411204558633b1f541c0cde5a8589245128686aaf8da35e53053a3db7f79a72d8c
|
7
|
+
data.tar.gz: 2ef9e38e71737eb405981ac44bb569bc8b4e534b6fa8ca04111929a06624cbadd822b29091ba2d81617b429a297af9eeef8c31d75bc6e47df6e1802803c2f7d9
|
data/lib/spamtrap/controller.rb
CHANGED
@@ -1,17 +1,13 @@
|
|
1
1
|
module Spamtrap::Controller
|
2
|
-
|
2
|
+
|
3
3
|
def self.included(base)
|
4
4
|
base.extend ActsAsMethods
|
5
5
|
end
|
6
|
-
|
6
|
+
|
7
7
|
module ActsAsMethods
|
8
|
-
def spamtrap(
|
9
|
-
|
10
|
-
|
11
|
-
before_filter(:only => actions) do |controller|
|
12
|
-
if block_given?
|
13
|
-
controller.instance_eval(&block)
|
14
|
-
end
|
8
|
+
def spamtrap(honeypot = 'spamtrap', options = {}, &block)
|
9
|
+
before_filter(options) do |controller|
|
10
|
+
controller.instance_eval(&block) if block_given?
|
15
11
|
controller.instance_eval do
|
16
12
|
if params[honeypot].present?
|
17
13
|
Rails.logger.warn "Spamtrap triggered by #{request.remote_ip}."
|
@@ -21,7 +17,7 @@ module Spamtrap::Controller
|
|
21
17
|
end
|
22
18
|
end
|
23
19
|
end
|
24
|
-
|
20
|
+
|
25
21
|
end
|
26
22
|
|
27
23
|
ActionController::Base.send :include, Spamtrap::Controller
|
data/lib/spamtrap/helper.rb
CHANGED
@@ -3,4 +3,15 @@ class ActionView::Helpers::FormBuilder
|
|
3
3
|
options.reverse_merge!({:class => 'spamtrap'})
|
4
4
|
@template.text_area_tag(parameter, nil, options)
|
5
5
|
end
|
6
|
+
|
7
|
+
# # def nonce(method, tag_value, options = {})
|
8
|
+
# def cryptographic_nonce(options = {})
|
9
|
+
# # @template.hidden_field(@object_name, method, tag_value, objectify_options(options))
|
10
|
+
# now, random = Time.now.to_i, SecureRandom.hex
|
11
|
+
# # OpenSSL::HMAC.hexdigest()
|
12
|
+
# cryptographic_nonce = Digest::MD5.hexdigest([timestamp, Rails.application.config.secret_key_base].join(':'))
|
13
|
+
# @template.hidden_field(@object_name, :timestamp, now, objectify_options(options)) +
|
14
|
+
# @template.hidden_field(@object_name, :random, random, objectify_options(options)) +
|
15
|
+
# @template.hidden_field(@object_name, :spinner, cryptographic_nonce(now), objectify_options(options))
|
16
|
+
# end
|
6
17
|
end
|
data/lib/spamtrap/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Spamtrap
|
2
|
-
|
3
|
-
VERSION = '0.0
|
4
|
-
|
5
|
-
end
|
2
|
+
|
3
|
+
VERSION = '0.1.0'
|
4
|
+
|
5
|
+
end
|
data/test/controller_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,12 +1,4 @@
|
|
1
|
-
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
-
$: << File.join(File.dirname(__FILE__))
|
3
|
-
|
4
1
|
require 'rubygems'
|
5
|
-
require 'test/unit'
|
6
|
-
# require 'active_support'
|
7
2
|
require 'action_controller'
|
8
|
-
|
9
|
-
# require 'action_view'
|
10
|
-
# require 'active_record'
|
11
|
-
# require 'ruby-debug'
|
3
|
+
require 'test/unit'
|
12
4
|
require 'spamtrap'
|
metadata
CHANGED
@@ -1,89 +1,66 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: spamtrap
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Cedric Howe
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 5
|
28
|
-
segments:
|
29
|
-
- 2
|
30
|
-
- 3
|
31
|
-
version: "2.3"
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
32
14
|
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
33
20
|
type: :runtime
|
34
21
|
prerelease: false
|
35
|
-
|
36
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Create bogus form fields (honeypots) that will be filled-in by spambots.
|
28
|
+
When submitted, the form data will be discarded while still returning a 200 response.
|
37
29
|
email: cedric@freezerbox.com
|
38
30
|
executables: []
|
39
|
-
|
40
31
|
extensions: []
|
41
|
-
|
42
32
|
extra_rdoc_files: []
|
43
|
-
|
44
|
-
|
33
|
+
files:
|
34
|
+
- lib/spamtrap.rb
|
45
35
|
- lib/spamtrap/controller.rb
|
46
36
|
- lib/spamtrap/helper.rb
|
47
37
|
- lib/spamtrap/version.rb
|
48
|
-
- lib/spamtrap.rb
|
49
38
|
- test/controller_test.rb
|
50
39
|
- test/test_helper.rb
|
51
|
-
has_rdoc: true
|
52
40
|
homepage: http://github.com/cedric/spamtrap/
|
53
|
-
licenses:
|
54
|
-
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
55
44
|
post_install_message:
|
56
45
|
rdoc_options: []
|
57
|
-
|
58
|
-
require_paths:
|
46
|
+
require_paths:
|
59
47
|
- lib
|
60
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
-
|
62
|
-
requirements:
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
63
50
|
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
version: "0"
|
69
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
|
-
requirements:
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
72
55
|
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 23
|
75
|
-
segments:
|
76
|
-
- 1
|
77
|
-
- 3
|
78
|
-
- 6
|
56
|
+
- !ruby/object:Gem::Version
|
79
57
|
version: 1.3.6
|
80
58
|
requirements: []
|
81
|
-
|
82
|
-
|
83
|
-
rubygems_version: 1.6.2
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.2.2
|
84
61
|
signing_key:
|
85
|
-
specification_version:
|
62
|
+
specification_version: 4
|
86
63
|
summary: Simple spamtrap for spambots.
|
87
|
-
test_files:
|
64
|
+
test_files:
|
88
65
|
- test/controller_test.rb
|
89
66
|
- test/test_helper.rb
|