@@ -536,8 +536,8 @@ def check_lines
536
536
# RM#8498 for discussion, starting at comment #16:
537
537
#
538
538
# https://dev.metasploit.com/redmine/issues/8498#note-16
539
- if ln =~ /(?<!\. )datastore\[ ["'][^"']+["']\] \s *= (?![=~>])/
540
- info ( "datastore is modified in code: #{ ln } " , idx )
539
+ if ln =~ /(?<!\. )datastore\[ ["'][^"']+["']\] \s *(=|<<) (?![=~>])/
540
+ info ( "datastore is modified in code with ' #{ Regexp . last_match ( 1 ) } ' : #{ ln } " , idx )
541
541
end
542
542
543
543
# do not read Set-Cookie header (ignore commented lines)
@@ -549,6 +549,10 @@ def check_lines
549
549
if ln =~ /^\s *Rank\s *=\s */ and @source =~ /<\s Msf::Auxiliary/
550
550
warn ( "Auxiliary modules have no 'Rank': #{ ln } " , idx )
551
551
end
552
+
553
+ if ln =~ /^\s *def\s +(?:[^\( \) ]*[A-Z]+[^\( \) ]*)(?:\( .*\) )?$/
554
+ warn ( "Please use snake case on method names: #{ ln } " , idx )
555
+ end
552
556
end
553
557
end
554
558
@@ -586,6 +590,19 @@ def check_udp_sock_get
586
590
end
587
591
end
588
592
593
+ # At one point in time, somebody committed a module with a bad metasploit.com URL
594
+ # in the header -- http//metasploit.com/download rather than http://metasploit.com/download.
595
+ # This module then got copied and committed 20+ times and is used in numerous other places.
596
+ # This ensures that this stops.
597
+ def check_invalid_url_scheme
598
+ test = @source . scan ( /^#.+http\/ \/ metasploit.com/ )
599
+ unless test . empty?
600
+ test . each { |item |
601
+ info ( "Invalid URL: #{ item } " )
602
+ }
603
+ end
604
+ end
605
+
589
606
private
590
607
591
608
def load_file ( file )
@@ -634,6 +651,7 @@ def run_checks(full_filepath)
634
651
tidy . check_newline_eof
635
652
tidy . check_sock_get
636
653
tidy . check_udp_sock_get
654
+ tidy . check_invalid_url_scheme
637
655
return tidy
638
656
end
639
657
0 commit comments