ssl - Reading information from nmap poodle vulnerability result. Bash script -
i need make bash script give me list of true or false depending on address scanned. right have simple script
#!/bin/bash input="/root/file1" input2="/root/file2" paste -d, file{1,2}.txt | while ifs=, read x y; nmap -sv --version-light --script ssl-poodle -p $y $x if something(detects vulnerable) echo "true">>file3.txt else (not vulnerable) echo "false">>fie3.txt done
the information nmap returns when vulerable is
nmap scan report ip host (0.044s latency). port state service version port/tcp open ssl/http microsoft iis | ssl-poodle: | vulnerable: | ssl poodle information leak | state: vulnerable
is there way detect word vulnerable, or best way it?
#!/bin/bash input="/root/file1" input2="/root/file2" paste -d, file{1,2}.txt | while ifs=, read x y; nmap_output="$(nmap -sv --version-light --script ssl-poodle -p $y $x)" if [ -n "$(echo "$nmap_output" | grep vulnerable)" ] echo "true">>file3.txt else echo "false">>fie3.txt done
explanation
with line
nmap_output="$(nmap -sv --version-light --script ssl-poodle -p $y $x)"
you saving output of nmap
execution $nmap_output
variable.
and, one:
if [ -n "$(echo "$nmap_output" | grep vulnerable)" ]
you checking if nmap output contains word vulnreable. grepping nmap output , keeping lines vulnerable word. then, checks if grepped string not empty (the -n
switch @ beggining of if
).
Comments
Post a Comment