gpt4 book ai didi

bash - 从 nmap poodle 漏洞结果中读取信息。 Bash 脚本

转载 作者:太空宇宙 更新时间:2023-11-03 13:07:23 26 4
gpt4 key购买 nike

我需要制作一个 bash 脚本,根据它扫描的地址给我一个 true 或 false 列表。现在我有这个简单的脚本

#!/bin/bash
input="/root/file1"
input2="/root/file2"
paste -d, file{1,2}.txt | while IFS=, read x y;
do nmap -sV --version-light --script ssl-poodle -p $y $x
if something(detects its vulnerable)
echo "true">>file3.txt
else (not vulnerable)
echo "false">>fie3.txt
done

vulerable时nmap返回的信息

IP 的 Nmap 扫描报告主机启动(0.044 秒延迟)。港口国服务版本端口/tcp 打开 ssl/http Microsoft IIS| ssl- Poodle :|易受伤害的:| SSL POODLE信息泄露|状态:易受攻击

有没有办法检测易受攻击这个词,或者最好的方法是什么?

最佳答案

#!/bin/bash
input="/root/file1"
input2="/root/file2"
paste -d, file{1,2}.txt | while IFS=, read x y;
do
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

解释

用这条线

nmap_output="$(nmap -sV --version-light --script ssl-poodle -p $y $x)"

您正在将 nmap 执行的输出保存到 $nmap_output 变量。

并且,对于这个:

if [ -n "$(echo "$nmap_output" | grep VULNERABLE)" ]

您正在检查 nmap 输出是否包含单词 VULNREABLE。它通过 grepping nmap 输出并仅保留带有 VULNERABLE 字的行来实现。然后,它检查 grepped 字符串是否不为空(if 开头的 -n 开关)。

关于bash - 从 nmap poodle 漏洞结果中读取信息。 Bash 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32915467/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com