ptj 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +84 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +96 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/etc/config.yml +23 -0
- data/lib/ptj.rb +5 -0
- data/lib/ptj/default_setup.rb +10 -0
- data/lib/ptj/environment.rb +115 -0
- data/lib/ptj/ext.rb +1 -0
- data/lib/ptj/ext/datamapper_collection.rb +74 -0
- data/lib/ptj/model.rb +65 -0
- data/lib/ptj/model/password.rb +116 -0
- data/lib/ptj/model/tag.rb +19 -0
- data/lib/ptj/model/tasks.rb +38 -0
- data/lib/ptj/parser.rb +1 -0
- data/lib/ptj/parser/fileparser.rb +24 -0
- data/lib/ptj/parser/fileparser/countpassonly.rb +27 -0
- data/lib/ptj/parser/fileparser/hashpassonlycolon.rb +26 -0
- data/lib/ptj/parser/fileparser/passhashonly.rb +26 -0
- data/lib/ptj/parser/fileparser/passonly.rb +26 -0
- data/lib/ptj/parser/fileparser/passthreecolons.rb +26 -0
- data/ptj.gemspec +120 -0
- data/scripts/analyze.rb +129 -0
- data/scripts/generate_wordlist.rb +121 -0
- data/scripts/import.rb +111 -0
- data/scripts/ptj_libpath.rb +2 -0
- data/spec/.helper.rb.swp +0 -0
- data/spec/.test_ptj.rb.swp +0 -0
- data/spec/model/password_spec.rb +46 -0
- data/spec/model/shared_behaviors.rb +23 -0
- data/spec/model/tag_spec.rb +27 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/spec_ptj.rb +16 -0
- data/tasks/db.rake +68 -0
- data/tasks/irb.rake +8 -0
- metadata +263 -0
data/spec/.helper.rb.swp
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'model/shared_behaviors'
|
2
|
+
|
3
|
+
describe PTJ::Password do
|
4
|
+
before :each do
|
5
|
+
PTJ::Model.migrate_all! unless PTJ::Model.migrated?
|
6
|
+
PTJ::Password.destroy!
|
7
|
+
end
|
8
|
+
|
9
|
+
after :each do
|
10
|
+
PTJ::Password.destroy!
|
11
|
+
end
|
12
|
+
|
13
|
+
context "basic functionality" do
|
14
|
+
before :each do
|
15
|
+
@ctime = Time.now
|
16
|
+
@obj = PTJ::Password.add_single("password", "abchash")
|
17
|
+
end
|
18
|
+
|
19
|
+
it_should_behave_like "a valid ptj model"
|
20
|
+
|
21
|
+
context "valid categorization of passwords" do
|
22
|
+
it("should have the correct upper-case letter value") { PTJ::Password.classify_passwords("Upper")[:upper].should == true }
|
23
|
+
it("should not have the correct upper-case letter value") { PTJ::Password.classify_passwords("upper")[:upper].should == false }
|
24
|
+
|
25
|
+
it("should have the correct lower-case letter value") { PTJ::Password.classify_passwords("lower")[:lower].should == true }
|
26
|
+
it("should not have the correct lower-case letter value") { PTJ::Password.classify_passwords("LOWER")[:lower].should == false }
|
27
|
+
|
28
|
+
it("should have the correct numeric value") { PTJ::Password.classify_passwords("Numeric123")[:number].should == true }
|
29
|
+
it("should not have the correct numeric value") { PTJ::Password.classify_passwords("Numeric!@#")[:number].should == false }
|
30
|
+
|
31
|
+
it("should have the correct special character value") { PTJ::Password.classify_passwords("Special!@#")[:special].should == true }
|
32
|
+
it("should not have the correctspecial character value") { PTJ::Password.classify_passwords("Special123")[:special].should == false }
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
context "valid size of passwords" do
|
37
|
+
it("should have a size of 1") { PTJ::Password.new(:password => "a").size.should == 1}
|
38
|
+
it("should have a size of 10") { PTJ::Password.new(:password => "abcdefghij").size.should == 10}
|
39
|
+
it("should have a size of 20") { PTJ::Password.new(:password => "abcdefghijklmnopqrst").size.should == 20}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
shared_examples_for "a valid ptj model" do
|
3
|
+
after :each do
|
4
|
+
@obj.destroy if @obj.saved?
|
5
|
+
end
|
6
|
+
|
7
|
+
it "should be valid" do
|
8
|
+
@obj.should be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should save without problems" do
|
12
|
+
@obj.save
|
13
|
+
@obj.should be_saved
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should be destroy-able" do
|
17
|
+
@obj.save
|
18
|
+
@obj.should be_saved
|
19
|
+
@obj.destroy
|
20
|
+
@obj.should be_destroyed
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'model/shared_behaviors'
|
2
|
+
|
3
|
+
describe PTJ::Tag do
|
4
|
+
before :all do
|
5
|
+
PTJ::Model.migrate_all! unless PTJ::Model.migrated?
|
6
|
+
PTJ::Tag.destroy!
|
7
|
+
end
|
8
|
+
|
9
|
+
after :all do
|
10
|
+
PTJ::Tag.destroy!
|
11
|
+
end
|
12
|
+
|
13
|
+
context "validity" do
|
14
|
+
before :each do
|
15
|
+
@ctime = Time.now
|
16
|
+
@obj = PTJ::Tag.new(:tag => 'foo')
|
17
|
+
end
|
18
|
+
|
19
|
+
after :each do
|
20
|
+
@obj.destroy if @obj.saved?
|
21
|
+
end
|
22
|
+
|
23
|
+
it_should_behave_like "a valid ptj model"
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'ptj'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/spec/spec_ptj.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class TestPtj < Test::Unit::TestCase
|
4
|
+
should "parse files correctly" do
|
5
|
+
flunk "gotta write this unit test. i fail."
|
6
|
+
end
|
7
|
+
|
8
|
+
should "be able to add files to the database correctly" do
|
9
|
+
flunk "gotta write this unit test. i fail."
|
10
|
+
end
|
11
|
+
|
12
|
+
should "have the external functions operate as expected" do
|
13
|
+
flunk "gotta write this unit test. i fail."
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/tasks/db.rake
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
|
2
|
+
namespace :db do
|
3
|
+
|
4
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
5
|
+
|
6
|
+
desc "Initialize the database model"
|
7
|
+
task :init => [:auto_upgrade!]
|
8
|
+
|
9
|
+
desc "Run DataMapper.auto_upgrade! (non-destructively applies model schema)"
|
10
|
+
task :auto_upgrade! do
|
11
|
+
|
12
|
+
require 'ptj/default_setup'
|
13
|
+
DataMapper.auto_upgrade!
|
14
|
+
puts "Database initialized"
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :size do
|
18
|
+
desc "Dump db record counts"
|
19
|
+
task :default do
|
20
|
+
require 'ptj/default_setup'
|
21
|
+
puts "Passwords: #{PTJ::Password.all.size}"
|
22
|
+
puts "Tags: #{PTJ::Tag.all.size}"
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Dump db record counts with debugging"
|
26
|
+
task :debug do
|
27
|
+
require 'ptj/default_setup'
|
28
|
+
time_now = Time.now
|
29
|
+
puts "Passwords: #{PTJ::Password.all.size}"
|
30
|
+
puts "Tags: #{PTJ::Tag.all.size}"
|
31
|
+
puts "Time Taken: #{Time.now - time_now} seconds."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Backup the development database"
|
36
|
+
task :backup do
|
37
|
+
require 'date'
|
38
|
+
tarfile = DateTime.now.strftime("data/data-%F.%H.%M.%S.%2N.tar.bz2")
|
39
|
+
sh "tar -cjvf #{tarfile} data/ptj.db"
|
40
|
+
puts "* Backed up data in: #{tarfile}"
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Destructively re-initialize the default db setup (no backup)"
|
44
|
+
task :reinit! => [:clobber_db, :init]
|
45
|
+
|
46
|
+
desc "Less destructively re-initialize the default db setup with a backup"
|
47
|
+
task :reinit => [:backup, :clobber, :init]
|
48
|
+
|
49
|
+
desc "Clobber the development database"
|
50
|
+
task :clobber_db do
|
51
|
+
require 'ptj/default_setup'
|
52
|
+
require 'pathname'
|
53
|
+
require 'addressable/uri'
|
54
|
+
|
55
|
+
db_conn = PTJ::Env::CONFIG['db_conn']
|
56
|
+
if( db_conn.is_a?(String) and
|
57
|
+
(u=Addressable::URI.parse(db_conn)).scheme == 'sqlite' and
|
58
|
+
(path=Pathname.new(u.path)).file? )
|
59
|
+
sh "rm -f #{path}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Run DataMapper.auto_migrate! (destructively creates model schema)"
|
64
|
+
task :auto_migrate! do
|
65
|
+
require 'ptj/default_setup'
|
66
|
+
DataMapper.auto_migrate!
|
67
|
+
end
|
68
|
+
end
|
data/tasks/irb.rake
ADDED
metadata
ADDED
@@ -0,0 +1,263 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ptj
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Josh Grunzweig
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-08-29 00:00:00 -05:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: shoulda
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.0.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: jeweler
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.6.2
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rcov
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: rspec
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 2.3.0
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: dm-core
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: dm-migrations
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: dm-types
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: "0"
|
101
|
+
type: :development
|
102
|
+
prerelease: false
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: dm-transactions
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: "0"
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: dm-aggregates
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: dm-validations
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: "0"
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: *id011
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: dm-serializer
|
139
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: "0"
|
145
|
+
type: :development
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: *id012
|
148
|
+
- !ruby/object:Gem::Dependency
|
149
|
+
name: dm-timestamps
|
150
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: "0"
|
156
|
+
type: :development
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: *id013
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: dm-sqlite-adapter
|
161
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: "0"
|
167
|
+
type: :development
|
168
|
+
prerelease: false
|
169
|
+
version_requirements: *id014
|
170
|
+
- !ruby/object:Gem::Dependency
|
171
|
+
name: dm-postgres-adapter
|
172
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: "0"
|
178
|
+
type: :development
|
179
|
+
prerelease: false
|
180
|
+
version_requirements: *id015
|
181
|
+
description: |-
|
182
|
+
An easy way to collect and analyze data about password
|
183
|
+
databases.
|
184
|
+
email: jgrunzweig@gmail.com
|
185
|
+
executables: []
|
186
|
+
|
187
|
+
extensions: []
|
188
|
+
|
189
|
+
extra_rdoc_files:
|
190
|
+
- LICENSE.txt
|
191
|
+
- README.rdoc
|
192
|
+
files:
|
193
|
+
- .document
|
194
|
+
- Gemfile
|
195
|
+
- Gemfile.lock
|
196
|
+
- LICENSE.txt
|
197
|
+
- README.rdoc
|
198
|
+
- Rakefile
|
199
|
+
- VERSION
|
200
|
+
- etc/config.yml
|
201
|
+
- lib/ptj.rb
|
202
|
+
- lib/ptj/default_setup.rb
|
203
|
+
- lib/ptj/environment.rb
|
204
|
+
- lib/ptj/ext.rb
|
205
|
+
- lib/ptj/ext/datamapper_collection.rb
|
206
|
+
- lib/ptj/model.rb
|
207
|
+
- lib/ptj/model/password.rb
|
208
|
+
- lib/ptj/model/tag.rb
|
209
|
+
- lib/ptj/model/tasks.rb
|
210
|
+
- lib/ptj/parser.rb
|
211
|
+
- lib/ptj/parser/fileparser.rb
|
212
|
+
- lib/ptj/parser/fileparser/countpassonly.rb
|
213
|
+
- lib/ptj/parser/fileparser/hashpassonlycolon.rb
|
214
|
+
- lib/ptj/parser/fileparser/passhashonly.rb
|
215
|
+
- lib/ptj/parser/fileparser/passonly.rb
|
216
|
+
- lib/ptj/parser/fileparser/passthreecolons.rb
|
217
|
+
- ptj.gemspec
|
218
|
+
- scripts/analyze.rb
|
219
|
+
- scripts/generate_wordlist.rb
|
220
|
+
- scripts/import.rb
|
221
|
+
- scripts/ptj_libpath.rb
|
222
|
+
- spec/.helper.rb.swp
|
223
|
+
- spec/.test_ptj.rb.swp
|
224
|
+
- spec/model/password_spec.rb
|
225
|
+
- spec/model/shared_behaviors.rb
|
226
|
+
- spec/model/tag_spec.rb
|
227
|
+
- spec/spec_helper.rb
|
228
|
+
- spec/spec_ptj.rb
|
229
|
+
- tasks/db.rake
|
230
|
+
- tasks/irb.rake
|
231
|
+
has_rdoc: true
|
232
|
+
homepage: http://github.com/jgrunzweig/ptj
|
233
|
+
licenses:
|
234
|
+
- MIT
|
235
|
+
post_install_message:
|
236
|
+
rdoc_options: []
|
237
|
+
|
238
|
+
require_paths:
|
239
|
+
- lib
|
240
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
241
|
+
none: false
|
242
|
+
requirements:
|
243
|
+
- - ">="
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
hash: 536136881655303577
|
246
|
+
segments:
|
247
|
+
- 0
|
248
|
+
version: "0"
|
249
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
|
+
none: false
|
251
|
+
requirements:
|
252
|
+
- - ">="
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: "0"
|
255
|
+
requirements: []
|
256
|
+
|
257
|
+
rubyforge_project:
|
258
|
+
rubygems_version: 1.6.2
|
259
|
+
signing_key:
|
260
|
+
specification_version: 3
|
261
|
+
summary: Password analysis and collection database.
|
262
|
+
test_files: []
|
263
|
+
|