Skip to content

Commit

Permalink
Merge pull request #802 from lorenzocamilli/shodan-vulns
Browse files Browse the repository at this point in the history
Shodan vulns and ports
  • Loading branch information
six2dez authored Dec 12, 2023
2 parents c154ecf + 1d4833e commit 182d49a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions reconftw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,30 @@ function portscan() {
[ -s ".tmp/ips_nocdn.txt" ] && cat .tmp/ips_nocdn.txt | sort
geo_info
printf "${bblue}\n Scanning ports... ${reset}\n\n"
ips_file="${dir}/hosts/ips.txt"
if [ "$PORTSCAN_PASSIVE" = true ] ; then
if [ ! -f $ips_file ]; then
echo "File $ips_file does not exist."
else
start_subfunc "Running : Shodan to check for open ports "
for cip in $(cat "$ips_file"); do
json_result=$(curl -s https://internetdb.shodan.io/${cip})
json_array+=("$json_result")
done
formatted_json="["
for ((i=0; i<${#json_array[@]}; i++)); do
formatted_json+="$(echo ${json_array[i]} | tr -d '\n')"
if [ $i -lt $((${#json_array[@]}-1)) ]; then
formatted_json+=", "
fi
done
formatted_json+="]"
echo "$formatted_json" > "${dir}/hosts/shodan_results.json"
fi
else
printf "${yellow} ${FUNCNAME[0]} is already processed, to force executing ${FUNCNAME[0]} delete\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
fi
end_func "Results are saved in hosts/shodan_results.json" ${FUNCNAME[0]}
if [[ $PORTSCAN_PASSIVE == true ]] && [[ ! -f "hosts/portscan_passive.txt" ]] && [[ -s ".tmp/ips_nocdn.txt" ]]; then
smap -iL .tmp/ips_nocdn.txt >hosts/portscan_passive.txt
fi
Expand Down

0 comments on commit 182d49a

Please sign in to comment.