@@ -366,7 +366,9 @@ def update_all_module_details
366
366
ActiveRecord ::Base . connection_pool . with_connection do
367
367
368
368
refresh = [ ]
369
- skipped = [ ]
369
+ skip_reference_name_set_by_module_type = Hash . new { |hash , module_type |
370
+ hash [ module_type ] = Set . new
371
+ }
370
372
371
373
Mdm ::Module ::Detail . find_each do |md |
372
374
@@ -385,7 +387,8 @@ def update_all_module_details
385
387
next
386
388
end
387
389
388
- skipped << [ md . mtype , md . refname ]
390
+ skip_reference_name_set = skip_reference_name_set_by_module_type [ md . mtype ]
391
+ skip_reference_name_set . add ( md . refname )
389
392
end
390
393
391
394
refresh . each { |md | md . destroy }
@@ -398,8 +401,10 @@ def update_all_module_details
398
401
[ 'encoder' , framework . encoders ] ,
399
402
[ 'nop' , framework . nops ]
400
403
] . each do |mt |
404
+ skip_reference_name_set = skip_reference_name_set_by_module_type [ mt [ 0 ] ]
405
+
401
406
mt [ 1 ] . keys . sort . each do |mn |
402
- next if skip? ( skipped , [ mt [ 0 ] , mn ] )
407
+ next if skip_reference_name_set . include? mn
403
408
obj = mt [ 1 ] . create ( mn )
404
409
next if not obj
405
410
begin
@@ -419,10 +424,6 @@ def update_all_module_details
419
424
self . framework . cache_thread = nil
420
425
end
421
426
422
- def skip? ( skipped , entry )
423
- skipped . include? ( entry )
424
- end
425
-
426
427
# Creates an Mdm::Module::Detail from a module instance.
427
428
#
428
429
# @param module_instance [Msf::Module] a metasploit module instance.
0 commit comments