File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed
lib/msf/ui/console/command_dispatcher Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -1499,6 +1499,10 @@ def cmd_db_export(*args)
1499
1499
}
1500
1500
end
1501
1501
1502
+ def find_nmap_path
1503
+ Rex ::FileUtils . find_full_path ( "nmap" ) || Rex ::FileUtils . find_full_path ( "nmap.exe" )
1504
+ end
1505
+
1502
1506
#
1503
1507
# Import Nmap data from a file
1504
1508
#
@@ -1524,11 +1528,8 @@ def cmd_db_nmap(*args)
1524
1528
end
1525
1529
end
1526
1530
1527
- nmap =
1528
- Rex ::FileUtils . find_full_path ( "nmap" ) ||
1529
- Rex ::FileUtils . find_full_path ( "nmap.exe" )
1530
-
1531
- if ( not nmap )
1531
+ nmap = find_nmap_path
1532
+ unless nmap
1532
1533
print_error ( "The nmap executable could not be found" )
1533
1534
return
1534
1535
end
@@ -1578,9 +1579,11 @@ def cmd_db_nmap(*args)
1578
1579
end
1579
1580
1580
1581
def cmd_db_nmap_help
1581
- nmap =
1582
- Rex ::FileUtils . find_full_path ( 'nmap' ) ||
1583
- Rex ::FileUtils . find_full_path ( 'nmap.exe' )
1582
+ nmap = find_nmap_path
1583
+ unless nmap
1584
+ print_error ( "The nmap executable could not be found" )
1585
+ return
1586
+ end
1584
1587
1585
1588
stdout , stderr = Open3 . capture3 ( [ nmap , 'nmap' ] , '--help' )
1586
1589
@@ -1596,9 +1599,10 @@ def cmd_db_nmap_help
1596
1599
end
1597
1600
1598
1601
def cmd_db_nmap_tabs ( str , words )
1599
- nmap =
1600
- Rex ::FileUtils . find_full_path ( 'nmap' ) ||
1601
- Rex ::FileUtils . find_full_path ( 'nmap.exe' )
1602
+ nmap = find_nmap_path
1603
+ unless nmap
1604
+ return
1605
+ end
1602
1606
1603
1607
stdout , stderr = Open3 . capture3 ( [ nmap , 'nmap' ] , '--help' )
1604
1608
tabs = [ ]
You can’t perform that action at this time.
0 commit comments