password_crack 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 438c1ac74cac67713666df037eaac5221f1b62ec
4
- data.tar.gz: aa48743195612fd3545856c3f170ed08b8a588b1
3
+ metadata.gz: a58eab8d603925fc5a6dda9597e6b6d19db7766d
4
+ data.tar.gz: fd470347101fc9833b777647c9c1c55154e04b25
5
5
  SHA512:
6
- metadata.gz: c7b59e8435e3d30a4c65a983e3c1627597a27bfb717e0315fe8ebc2747834715c94768ac2b95c4e208631bf3b7cabac376e113c59aa6fc6c288567f8ad9cb02e
7
- data.tar.gz: 11e58146ac0f035037630d32b4de3cb668cb1d4c825885809e765b5047cfdbf81c81a62a5e75f20724897a725cfe07c23e7f62992cfa4d16d33e9ff810719ef8
6
+ metadata.gz: 368353bb7e431c1d5d40aeb91d2a7d9d5a9c9da74dc9da640faa1af08e0f0da18a731321993975e88de13c870d3fb1897cd1b6107e7fa06a7e06982c72d0f217
7
+ data.tar.gz: d2475711de8b574d15a1c411cb66098b480e885717a1097ec90bed76de0fd34fb38ecc9d75d8924a054791446b63d270fc6e6344f24ef099b9a0a7ba0e75c4a5
data/README.md CHANGED
@@ -40,16 +40,20 @@ please see this:[https://github.com/masamitsu-murase/seven_zip_ruby/issues/11](h
40
40
 
41
41
 
42
42
  ```ruby
43
- md5Password = 'e10adc3949ba59abbe56e057f20f883e'
44
- cracker = PasswordCrack::Md5Cracker.new
45
- dict_name = 'week_password_sample'
46
- #all dict names:see https://github.com/luaxlou/week_password/tree/master/dicts
47
- result = cracker.crack md5Password,dict_name
48
- expect(result).to eq('123456')
49
-
50
- md516Password = '49ba59abbe56e057'
51
- result = cracker.crack md516Password,dict_name
52
- expect(result).to eq('123456')
43
+ md5Password = 'e10adc3949ba59abbe56e057f20f883e'
44
+ cracker = PasswordCrack::Md5Cracker.new
45
+ dict_name = 'week_password_sample' #all dict names:see https://github.com/luaxlou/week_password/tree/master/dicts
46
+ result = cracker.crack md5Password,dict_name
47
+ expect(result).to eq('123456')
48
+
49
+ md516Password = '49ba59abbe56e057'
50
+ result = cracker.crack md516Password,dict_name
51
+ expect(result).to eq('123456')
52
+
53
+
54
+ dict_name = 'number_1_to_6'
55
+ result = cracker.crack md5Password,dict_name
56
+ expect(result).to eq('123456')
53
57
 
54
58
  ```
55
59
 
@@ -27,6 +27,7 @@ module PasswordCrack
27
27
 
28
28
  def check_is_week password
29
29
 
30
+
30
31
  p = PasswordChecker.new
31
32
 
32
33
  return p.check password
@@ -42,6 +43,7 @@ module PasswordCrack
42
43
 
43
44
  def check password
44
45
 
46
+ return 'number_1_to_6' if password.scan(/^\d{1,6}$/).length >0
45
47
 
46
48
  result = check_by_dict password,'week_password_sample'
47
49
 
@@ -73,13 +75,18 @@ module PasswordCrack
73
75
  class Md5Cracker
74
76
 
75
77
 
78
+
76
79
  #all dict names:see https://github.com/luaxlou/week_password/tree/master/dicts
77
80
  def crack md5Password,dict_name='week_password_sample'
78
81
 
82
+ return '' if(md5Password == 'd41d8cd98f00b204e9800998ecf8427e')
83
+
79
84
  iMd516 = (md5Password.length==16)
80
85
 
81
86
  d = Dict.new dict_name,'md5'
82
87
 
88
+
89
+
83
90
  File.open(d.create).each_line() do |l|
84
91
 
85
92
  (md5,pass) = l.split "\t"
@@ -136,15 +143,22 @@ module PasswordCrack
136
143
 
137
144
  def load
138
145
  return if(Time.now.to_i - local_timestamp < 10 *60)
139
-
146
+
140
147
 
141
148
  if local_timestamp < server_timestamp
142
149
 
143
150
  download_and_unpack
144
151
 
152
+ else
153
+
154
+ write dict_timestamp_pathname,Time.now.to_i.to_s
155
+
156
+
157
+
145
158
  end
146
159
 
147
160
 
161
+
148
162
  end
149
163
 
150
164
  def create
@@ -196,17 +210,21 @@ module PasswordCrack
196
210
  end
197
211
 
198
212
  def local_timestamp
199
- t = read dict_timestamp_pathname
200
213
 
201
- return 0 if ( !t)
214
+ return @l_t.to_i if @l_t
215
+ @l_t = read dict_timestamp_pathname
216
+
217
+ return 0 if ( !@l_t)
202
218
 
203
- t.to_i
219
+ @l_t.to_i
204
220
 
205
221
  end
206
222
 
223
+
207
224
  def server_timestamp
208
- t =download dict_timestamp_download_url
209
- t.to_i
225
+ return @t if @t
226
+ @t =download dict_timestamp_download_url
227
+ @t.to_i
210
228
  end
211
229
 
212
230
  def download_and_unpack
@@ -1,3 +1,3 @@
1
1
  module PasswordCrack
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: password_crack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - luax
@@ -106,7 +106,6 @@ files:
106
106
  - ".gitignore"
107
107
  - ".rspec"
108
108
  - ".travis.yml"
109
- - CODE_OF_CONDUCT.md
110
109
  - Gemfile
111
110
  - LICENSE.txt
112
111
  - README.md
@@ -1,13 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)