-
Notifications
You must be signed in to change notification settings - Fork 1
/
searchnse.old
45 lines (44 loc) · 1.06 KB
/
searchnse.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
if [ "$1" = "-h" ]
then
echo "SEARCH THE NMAP SCRIPTING ENGINE DATABASE
by midnightseer
<arg1> <filter-term>
# arg 1 - search term
# arg 2 - optional: an additional filter-term / search parameter"
exit
fi
filter=$2
function print_divs() {
a=$1
for i in $(seq ${#a})
do
echo -n "="
done
}
SAVEIFS=$IFS # Save current IFS
IFS=$'\n' # Change IFS to new line
db_output=$(grep $1 /usr/share/nmap/scripts/script.db)
if [[ ! -z $filter ]]
then
db_output=$(echo "$db_output" | grep $filter)
fi
db_array=($db_output)
IFS=$SAVEIFS
for line in "${db_array[@]}"
do
script_name=$(echo "$line" | cut -d " " -f5 | sed 's/,//g' | sed 's/"//g')
#echo "nmap --script-help=$script_name"
help_output=$(nmap --script-help=$script_name)
script_args=$(cat /usr/share/nmap/scripts/$script_name | sed -n -e '/-- @args/,/auth.*/ p')
echo -n "="
print_divs $script_name
echo "="
echo " $script_name "
echo -n "="
print_divs $script_name
echo "="
echo "$help_output" | sed -e '1,3d'
echo "Script Supplemental Help:"
echo "$script_args"
done