@@ -196,7 +196,7 @@ def connect(opts={})
196
196
197
197
# Prefer the config file's pool setting
198
198
nopts [ 'pool' ] ||= 75
199
-
199
+
200
200
# Prefer the config file's wait_timeout setting too
201
201
nopts [ 'wait_timeout' ] ||= 300
202
202
@@ -346,7 +346,7 @@ def update_all_module_details
346
346
self . modules_caching = true
347
347
348
348
::ActiveRecord ::Base . connection_pool . with_connection {
349
-
349
+
350
350
refresh = [ ]
351
351
skipped = [ ]
352
352
@@ -460,16 +460,16 @@ def module_to_details_hash(m)
460
460
461
461
res [ :description ] = m . description . to_s . strip
462
462
463
- m . arch . map { |x |
464
- bits << [ :arch , { :name => x . to_s } ]
463
+ m . arch . map { |x |
464
+ bits << [ :arch , { :name => x . to_s } ]
465
465
}
466
466
467
- m . platform . platforms . map { |x |
468
- bits << [ :platform , { :name => x . to_s . split ( '::' ) . last . downcase } ]
467
+ m . platform . platforms . map { |x |
468
+ bits << [ :platform , { :name => x . to_s . split ( '::' ) . last . downcase } ]
469
469
}
470
470
471
- m . author . map { |x |
472
- bits << [ :author , { :name => x . to_s } ]
471
+ m . author . map { |x |
472
+ bits << [ :author , { :name => x . to_s } ]
473
473
}
474
474
475
475
m . references . map do |r |
@@ -500,14 +500,14 @@ def module_to_details_hash(m)
500
500
# Some modules are a combination, which means they are actually aggressive
501
501
res [ :stance ] = m . stance . to_s . index ( "aggressive" ) ? "aggressive" : "passive"
502
502
503
-
503
+
504
504
m . class . mixins . each do |x |
505
505
bits << [ :mixin , { :name => x . to_s } ]
506
506
end
507
507
end
508
508
509
509
if ( m . type == "auxiliary" )
510
-
510
+
511
511
m . actions . each_index do |i |
512
512
bits << [ :action , { :name => m . actions [ i ] . name . to_s } ]
513
513
end
@@ -523,9 +523,9 @@ def module_to_details_hash(m)
523
523
524
524
res
525
525
end
526
-
527
-
528
-
526
+
527
+
528
+
529
529
#
530
530
# This provides a standard set of search filters for every module.
531
531
# The search terms are in the form of:
@@ -562,7 +562,7 @@ def search_modules(search_string, inclusive=false)
562
562
end
563
563
564
564
::ActiveRecord ::Base . connection_pool . with_connection {
565
-
565
+
566
566
where_q = [ ]
567
567
where_v = [ ]
568
568
@@ -572,7 +572,7 @@ def search_modules(search_string, inclusive=false)
572
572
case kt
573
573
when 'text'
574
574
xv = "%#{ kv } %"
575
- where_q << ' ( ' +
575
+ where_q << ' ( ' +
576
576
'module_details.fullname ILIKE ? OR module_details.name ILIKE ? OR module_details.description ILIKE ? OR ' +
577
577
'module_authors.name ILIKE ? OR module_actions.name ILIKE ? OR module_archs.name ILIKE ? OR ' +
578
578
'module_targets.name ILIKE ? OR module_platforms.name ILIKE ? ' +
@@ -594,7 +594,7 @@ def search_modules(search_string, inclusive=false)
594
594
# TODO
595
595
when 'type'
596
596
where_q << ' ( module_details.mtype = ? ) '
597
- where_v << [ kv ]
597
+ where_v << [ kv ]
598
598
when 'app'
599
599
where_q << ' ( module_details.stance = ? )'
600
600
where_v << [ ( kv == "client" ) ? "passive" : "active" ]
@@ -604,11 +604,11 @@ def search_modules(search_string, inclusive=false)
604
604
when 'cve' , 'bid' , 'osvdb' , 'edb'
605
605
where_q << ' ( module_refs.name = ? )'
606
606
where_v << [ kt . upcase + '-' + kv ]
607
-
607
+
608
608
end
609
609
end
610
610
end
611
-
611
+
612
612
qry = Mdm ::ModuleDetail . select ( "DISTINCT(module_details.*)" ) .
613
613
joins (
614
614
"LEFT OUTER JOIN module_authors ON module_details.id = module_authors.module_detail_id " +
@@ -629,4 +629,3 @@ def search_modules(search_string, inclusive=false)
629
629
630
630
end
631
631
end
632
-
0 commit comments