37
37
require 'msf/core'
38
38
require 'optparse'
39
39
40
-
41
40
#
42
41
# Basic prints we can't live without
43
42
#
@@ -71,7 +70,6 @@ class Disclaimer
71
70
# @return [String] The name of the tool
72
71
attr_accessor :group_name
73
72
74
-
75
73
def initialize
76
74
self . config_file = Msf ::Config . config_file
77
75
self . group_name = 'MD5Lookup'
@@ -93,23 +91,20 @@ def ack
93
91
end
94
92
end
95
93
96
-
97
94
# Saves the waiver so the warning won't show again after ack
98
95
#
99
96
# @return [void]
100
97
def save_waiver
101
98
save_setting ( 'waiver' , true )
102
99
end
103
100
104
-
105
101
# Returns true if we don't have to show the warning again
106
102
#
107
103
# @return [Boolean]
108
104
def has_waiver?
109
105
load_setting ( 'waiver' ) == 'true' ? true : false
110
106
end
111
107
112
-
113
108
private
114
109
115
110
# Saves a setting to Metasploit's config file
@@ -124,7 +119,6 @@ def save_setting(key_name, value)
124
119
ini . to_file ( self . config_file )
125
120
end
126
121
127
-
128
122
# Returns the value of a specific setting
129
123
#
130
124
# @param key_name [String] The name of the setting
@@ -177,7 +171,6 @@ def initialize(opts={})
177
171
)
178
172
end
179
173
180
-
181
174
# Returns the found cracked MD5 hash
182
175
#
183
176
# @param md5_hash [String] The MD5 hash to lookup
@@ -192,10 +185,8 @@ def lookup(md5_hash, db)
192
185
get_json_result ( res )
193
186
end
194
187
195
-
196
188
private
197
189
198
-
199
190
# Parses the cracked result from a JSON input
200
191
# @param res [Rex::Proto::Http::Response] The Rex HTTP response
201
192
# @return [String] Found cracked MD5 hash
@@ -217,7 +208,6 @@ def get_json_result(res)
217
208
218
209
end
219
210
220
-
221
211
# This class parses the user-supplied options (inputs)
222
212
class OptsConsole
223
213
@@ -275,10 +265,8 @@ def self.parse(args)
275
265
options
276
266
end
277
267
278
-
279
268
private
280
269
281
-
282
270
# Returns the parsed options from ARGV
283
271
#
284
272
# raise [OptionParser::InvalidOption] Invalid option found
@@ -317,7 +305,6 @@ def self.get_parsed_options
317
305
return parser , options
318
306
end
319
307
320
-
321
308
# Returns the actual database names based on what the user wants
322
309
#
323
310
# @param list [String] A list of user-supplied database names
@@ -339,7 +326,6 @@ def self.extract_db_names(list)
339
326
new_db_list
340
327
end
341
328
342
-
343
329
# Returns a list of all of the supported database symbols
344
330
#
345
331
# @return [Array<Symbol>] Database symbols
@@ -357,7 +343,6 @@ def self.get_database_names
357
343
end
358
344
end
359
345
360
-
361
346
# This class decides how this process works
362
347
class Driver
363
348
@@ -379,7 +364,6 @@ def initialize
379
364
end
380
365
end
381
366
382
-
383
367
# Main function
384
368
#
385
369
# @return [void]
@@ -403,18 +387,15 @@ def run
403
387
end
404
388
end
405
389
406
-
407
390
# Cleans up the output file handler if exists
408
391
#
409
392
# @return [void]
410
393
def cleanup
411
394
@output_handle . close if @output_handle
412
395
end
413
396
414
-
415
397
private
416
398
417
-
418
399
# Saves the MD5 result to file
419
400
#
420
401
# @param result [Hash] The result that contains the MD5 information
@@ -472,7 +453,6 @@ def is_md5_format?(md5_hash)
472
453
473
454
end
474
455
475
-
476
456
#
477
457
# main
478
458
#
0 commit comments