throwaway 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Throwaway
2
+
3
+ This is a very simple Ruby gem which validates that email addresses are not from a disposable email address provider. The list of providers is simply hardcoded, so no network time is required. I'll try and keep it up to date, but such an endeavour is pretty impossible. Catching the most common providers does help with fraud prevention etc though.
4
+
5
+
6
+ ## Usage
7
+
8
+ ### Query
9
+
10
+ Throwaway.is_throwaway?(email)
11
+ => true/false
12
+
13
+ ### Validator
14
+
15
+ validates :email, :throwaway => false
16
+
17
+ Default message: *is from a disposable email provider*
18
+
19
+ validates :email, :throwaway => false, :message => "emails from disposable providers are not allowed here. Sorry."
20
+
21
+ If, for some bizarre reason, you want to validate that address *are* from a throwaway provider, you can do that too.
22
+
23
+ validates :email, :throwaway => true
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/lib/providers.yml ADDED
@@ -0,0 +1,261 @@
1
+ providers:
2
+ - '0-mail.com'
3
+ - '0815.ru'
4
+ - '0clickemail.com'
5
+ - '10minutemail.com'
6
+ - '20minutemail.com'
7
+ - '2prong.com'
8
+ - '30minutemail.com'
9
+ - '3d-painting.com'
10
+ - '4warding.com'
11
+ - '4warding.net'
12
+ - '4warding.org'
13
+ - '60minutemail.com'
14
+ - 'amilegit.com'
15
+ - 'anonbox.net'
16
+ - 'anonymbox.com'
17
+ - 'antispam.de'
18
+ - 'beefmilk.com'
19
+ - 'binkmail.com'
20
+ - 'bio-muesli.net'
21
+ - 'bobmail.info'
22
+ - 'bofthew.com'
23
+ - 'brefmail.com'
24
+ - 'bsnow.net'
25
+ - 'bugmenot.com'
26
+ - 'bumpymail.com'
27
+ - 'cosmorph.com'
28
+ - 'courrieltemporaire.com'
29
+ - 'cubiclink.com'
30
+ - 'curryworld.de'
31
+ - 'cust.in'
32
+ - 'dacoolest.com'
33
+ - 'dandikmail.com'
34
+ - 'dayrep.com'
35
+ - 'deadaddress.com'
36
+ - 'despam.it'
37
+ - 'devnullmail.com'
38
+ - 'discardmail.com'
39
+ - 'discardmail.de'
40
+ - 'disposemail.com'
41
+ - 'dispostable.com'
42
+ - 'dodgeit.com'
43
+ - 'dodgit.com'
44
+ - 'dodgit.org'
45
+ - 'donemail.ru'
46
+ - 'dontreg.com'
47
+ - 'dontsendmespam.de'
48
+ - 'dump-email.info'
49
+ - 'dumpyemail.com'
50
+ - 'e4ward.com'
51
+ - 'email60.com'
52
+ - 'emailigo.de'
53
+ - 'emailinfive.com'
54
+ - 'emailmiser.com'
55
+ - 'emailsensei.com'
56
+ - 'emailtemporario.com.br'
57
+ - 'emailwarden.com'
58
+ - 'emailx.at.hm'
59
+ - 'fakeinbox.com'
60
+ - 'fakeinformation.com'
61
+ - 'fastacura.com'
62
+ - 'filzmail.com'
63
+ - 'fizmail.com'
64
+ - 'fr33mail.info'
65
+ - 'get1mail.com'
66
+ - 'get2mail.fr'
67
+ - 'getonemail.com'
68
+ - 'getonemail.net'
69
+ - 'gishpuppy.com'
70
+ - 'great-host.in'
71
+ - 'guerillamail.com'
72
+ - 'guerrillamail.com'
73
+ - 'guerrillamailblock.com'
74
+ - 'h.mintemail.com'
75
+ - 'haltospam.com'
76
+ - 'hochsitze.com'
77
+ - 'hotpop.com'
78
+ - 'hulapla.de'
79
+ - 'ieatspam.eu'
80
+ - 'ieatspam.info'
81
+ - 'imails.info'
82
+ - 'incognitomail.com'
83
+ - 'incognitomail.net'
84
+ - 'incognitomail.org'
85
+ - 'insorg-mail.info'
86
+ - 'ipoo.org'
87
+ - 'jetable.com'
88
+ - 'jetable.net'
89
+ - 'jetable.org'
90
+ - 'jnxjn.com'
91
+ - 'junk1e.com'
92
+ - 'keepmymail.com'
93
+ - 'kir.ch.tc'
94
+ - 'klzlk.com'
95
+ - 'kulturbetrieb.info'
96
+ - 'lhsdv.com'
97
+ - 'litedrop.com'
98
+ - 'lol.ovpn.to'
99
+ - 'lookugly.com'
100
+ - 'lopl.co.cc'
101
+ - 'm4ilweb.info'
102
+ - 'mail-temporaire.fr'
103
+ - 'mail.by'
104
+ - 'mail4trash.com'
105
+ - 'mailcatch.com'
106
+ - 'maileater.com'
107
+ - 'mailexpire.com'
108
+ - 'mailin8r.com'
109
+ - 'mailinator.com'
110
+ - 'mailinator.net'
111
+ - 'mailinator2.com'
112
+ - 'mailme.ir'
113
+ - 'mailme.lv'
114
+ - 'mailmetrash.com'
115
+ - 'mailnator.com'
116
+ - 'mailnesia.com'
117
+ - 'mailnull.com'
118
+ - 'mailslite.com'
119
+ - 'mailzilla.org'
120
+ - 'mbx.cc'
121
+ - 'meltmail.com'
122
+ - 'messagebeamer.de'
123
+ - 'mierdamail.com'
124
+ - 'mintemail.com'
125
+ - 'moburl.com'
126
+ - 'monemail.fr.nf'
127
+ - 'msa.minsmail.com'
128
+ - 'mt2009.com'
129
+ - 'mypartyclip.de'
130
+ - 'myphantomemail.com'
131
+ - 'mytrashmail.com'
132
+ - 'nepwk.com'
133
+ - 'no-spam.ws'
134
+ - 'nobulk.com'
135
+ - 'noclickemail.com'
136
+ - 'nogmailspam.info'
137
+ - 'nomail2me.com'
138
+ - 'nomorespamemails.com'
139
+ - 'nospam4.us'
140
+ - 'nospamfor.us'
141
+ - 'nospamthanks.info'
142
+ - 'notmailinator.com'
143
+ - 'nowmymail.com'
144
+ - 'nus.edu.sg'
145
+ - 'nwldx.com'
146
+ - 'onewaymail.com'
147
+ - 'online.ms'
148
+ - 'ovpn.to'
149
+ - 'owlpic.com'
150
+ - 'pjjkp.com'
151
+ - 'politikerclub.de'
152
+ - 'pookmail.com'
153
+ - 'prtnx.com'
154
+ - 'qq.com'
155
+ - 'quickinbox.com'
156
+ - 'recode.me'
157
+ - 'regbypass.com'
158
+ - 'rmqkr.net'
159
+ - 'rppkn.com'
160
+ - 'rtrtr.com'
161
+ - 's0ny.net'
162
+ - 'safe-mail.net'
163
+ - 'safetymail.info'
164
+ - 'safetypost.de'
165
+ - 'sandelf.de'
166
+ - 'saynotospams.com'
167
+ - 'selfdestructingmail.com'
168
+ - 'sendspamhere.com'
169
+ - 'sharklasers.com'
170
+ - 'shitmail.me'
171
+ - 'skeefmail.com'
172
+ - 'slopsbox.com'
173
+ - 'smellfear.com'
174
+ - 'snakemail.com'
175
+ - 'sofimail.com'
176
+ - 'sofort-mail.de'
177
+ - 'sogetthis.com'
178
+ - 'spam.la'
179
+ - 'spam.su'
180
+ - 'spamavert.com'
181
+ - 'spambob.net'
182
+ - 'spambob.org'
183
+ - 'spambog.com'
184
+ - 'spambog.de'
185
+ - 'spambog.ru'
186
+ - 'spambox.info'
187
+ - 'spambox.irishspringrealty.com'
188
+ - 'spambox.us'
189
+ - 'spamcero.com'
190
+ - 'spamday.com'
191
+ - 'spamfree24.com'
192
+ - 'spamfree24.de'
193
+ - 'spamfree24.eu'
194
+ - 'spamfree24.info'
195
+ - 'spamfree24.net'
196
+ - 'spamfree24.org'
197
+ - 'spamgourmet.com'
198
+ - 'spamherelots.com'
199
+ - 'spamhole.com'
200
+ - 'spamify.com'
201
+ - 'spaminator.de'
202
+ - 'spamkill.info'
203
+ - 'spaml.com'
204
+ - 'spaml.de'
205
+ - 'spammotel.com'
206
+ - 'spamobox.com'
207
+ - 'spamspot.com'
208
+ - 'spamthis.co.uk'
209
+ - 'spamthisplease.com'
210
+ - 'supergreatmail.com'
211
+ - 'supermailer.jp'
212
+ - 'suremail.info'
213
+ - 'teewars.org'
214
+ - 'teleworm.com'
215
+ - 'teleworm.us'
216
+ - 'tempalias.com'
217
+ - 'tempe-mail.com'
218
+ - 'tempemail.biz'
219
+ - 'tempemail.com'
220
+ - 'tempemail.net'
221
+ - 'tempinbox.co.uk'
222
+ - 'tempinbox.com'
223
+ - 'tempmail.it'
224
+ - 'tempmail2.com'
225
+ - 'tempomail.fr'
226
+ - 'temporarioemail.com.br'
227
+ - 'temporaryemail.net'
228
+ - 'temporaryinbox.com'
229
+ - 'thanksnospam.info'
230
+ - 'thankyou2010.com'
231
+ - 'thisisnotmyrealemail.com'
232
+ - 'throwawayemailaddress.com'
233
+ - 'tmailinator.com'
234
+ - 'tradermail.info'
235
+ - 'trash-amil.com'
236
+ - 'trash-mail.com'
237
+ - 'trash-mail.de'
238
+ - 'trash2009.com'
239
+ - 'trashemail.de'
240
+ - 'trashmail.at'
241
+ - 'trashmail.com'
242
+ - 'trashmail.net'
243
+ - 'trashmail.ws'
244
+ - 'trashmailer.com'
245
+ - 'trashymail.com'
246
+ - 'trashymail.net'
247
+ - 'trillianpro.com'
248
+ - 'tyldd.com'
249
+ - 'uggsrock.com'
250
+ - 'veryrealemail.com'
251
+ - 'webm4il.info'
252
+ - 'wegwerfemail.de'
253
+ - 'wh4f.org'
254
+ - 'whyspam.me'
255
+ - 'willselfdestruct.com'
256
+ - 'wuzupmail.net'
257
+ - 'yopmail.com'
258
+ - 'yuurok.com'
259
+ - 'zehnminutenmail.de'
260
+ - 'zippymail.info'
261
+ - 'zoaxe.com'
data/lib/throwaway.rb ADDED
@@ -0,0 +1,17 @@
1
+ curdir = File.dirname(__FILE__)
2
+ Dir["#{curdir}/throwaway/**/*.rb"].each { |f| require f }
3
+
4
+ require 'yaml'
5
+
6
+ module Throwaway
7
+ class << self
8
+ def root
9
+ File.expand_path '../..', __FILE__
10
+ end
11
+
12
+ def is_throwaway?(email)
13
+ providers = YAML.load_file("#{Throwaway.root}/lib/providers.yml")['providers']
14
+ providers.include?(email.split("@").last)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ require "throwaway/version"
2
+
3
+ class ThrowawayValidator < ActiveModel::EachValidator
4
+ def validate_each(record, attribute, value)
5
+ result = Throwaway.is_throwaway?(value)
6
+
7
+ record.errors[attribute] << (options[:message] || "is not from a disposable email provider.") if options[:with].nil? and !result
8
+ record.errors[attribute] << (options[:message] || "is from a disposable email provider.") if !options[:with].nil? and result
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Throwaway
2
+ VERSION = "1.1.0"
3
+ end
@@ -0,0 +1,16 @@
1
+ begin
2
+ require 'simplecov';
3
+ SimpleCov.start do
4
+ add_group "Lib", 'lib'
5
+ end
6
+ rescue LoadError
7
+ end
8
+
9
+ begin; require 'turn'; rescue LoadError; end
10
+
11
+ require 'rspec'
12
+ require 'active_model'
13
+
14
+ $:.push File.expand_path("../../lib", __FILE__)
15
+ require 'throwaway'
16
+ require 'mocha/api'
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Throwaway do
4
+ describe "#is_throwaway?" do
5
+ before(:each) do
6
+ yaml_text = <<-EOF
7
+ providers:
8
+ - 'woof.com'
9
+ EOF
10
+ yaml = YAML.load(yaml_text)
11
+ filepath = "#{Throwaway.root}/lib/providers.yml"
12
+ YAML.expects(:load_file).with(filepath).returns(yaml)
13
+ end
14
+
15
+ it "should return true when included in providers.yml" do
16
+ Throwaway.is_throwaway?("bark@woof.com").should be_true
17
+ end
18
+
19
+ it "should return false when not included in providers.yml" do
20
+ Throwaway.is_throwaway?("bark@woof.com").should be_true
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ class ExampleValidatingIsNotThrowaway
4
+ include ActiveModel::Validations
5
+ attr_accessor :email
6
+ validates :email, :throwaway => false
7
+ end
8
+
9
+ class ExampleValidatingIsThrowaway
10
+ include ActiveModel::Validations
11
+ attr_accessor :email
12
+ validates :email, :throwaway => true
13
+ end
14
+
15
+ describe ThrowawayValidator do
16
+ context "validating IS NOT a throwaway" do
17
+ let(:record) { ExampleValidatingIsNotThrowaway.new }
18
+
19
+ it "should mark record with a throwaway email as invalid." do
20
+ email = "woof@bark.com"
21
+ Throwaway.expects(:is_throwaway?).with(email).at_least_once.returns(true)
22
+
23
+ record.email = email
24
+
25
+ record.should_not be_valid
26
+ record.errors[:email].should_not be_empty
27
+ end
28
+
29
+ it "should not mark a record with a non-throwaway method as invalid." do
30
+ email = "woof@bark.com"
31
+ Throwaway.expects(:is_throwaway?).with(email).at_least_once.returns(false)
32
+
33
+ record.email = email
34
+
35
+ record.should be_valid
36
+ record.errors[:email].should be_empty
37
+ end
38
+ end
39
+
40
+ context "validating IS a throwaway" do
41
+ let(:record) { ExampleValidatingIsThrowaway.new }
42
+
43
+ it "should mark record with a throwaway email as valid." do
44
+ email = "woof@bark.com"
45
+ Throwaway.expects(:is_throwaway?).with(email).at_least_once.returns(true)
46
+
47
+ record.email = email
48
+
49
+ record.should be_valid
50
+ record.errors[:email].should be_empty
51
+ end
52
+
53
+ it "should mark a record with a non-throwaway method as invalid." do
54
+ email = "woof@bark.com"
55
+ Throwaway.expects(:is_throwaway?).with(email).at_least_once.returns(false)
56
+
57
+ record.email = email
58
+
59
+ record.should_not be_valid
60
+ record.errors[:email].should_not be_empty
61
+ end
62
+ end
63
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: throwaway
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 1
8
+ - 0
9
+ version: 1.1.0
10
+ platform: ruby
11
+ authors:
12
+ - William Hamilton
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-06-21 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: activemodel
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: mocha
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ type: :runtime
55
+ version_requirements: *id003
56
+ description: Validates email addresses are not from a throwaway account provider.
57
+ email:
58
+ - whamilton42@gmail.com
59
+ executables: []
60
+
61
+ extensions: []
62
+
63
+ extra_rdoc_files: []
64
+
65
+ files:
66
+ - lib/providers.yml
67
+ - lib/throwaway/throwaway_validator.rb
68
+ - lib/throwaway/version.rb
69
+ - lib/throwaway.rb
70
+ - Rakefile
71
+ - README.md
72
+ has_rdoc: true
73
+ homepage: https://github.com/whamilton42/throwaway
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options: []
78
+
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project:
98
+ rubygems_version: 1.3.6
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Anti-disposable-email validator
102
+ test_files:
103
+ - spec/spec_helper.rb
104
+ - spec/throwaway_spec.rb
105
+ - spec/throwaway_validator_spec.rb