Есть список баннеров при сканировании ssh серверов через масскан
Подскажите рецепт, чтобы средствами bash оставить только список ip столбиком при условии что оставить надо только те адреса, которые имеюt определенную версию ssh
↑ (https://antichat.live/posts/3868220/)
формат списка бы привели
Например вывод в формате json
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "status": "open", "reason": "syn-ack", "ttl": 59} ] },
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "status": "open", "reason": "syn-ack", "ttl": 59} ] },
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "status": "open", "reason": "syn-ack", "ttl": 59} ] },
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "status": "open", "reason": "syn-ack", "ttl": 59} ] },
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "service": {"name": "ftp", "banner": "220 (vsFTPd 2.3.2)\u000a530 Please login with USER and PASS."} } ] },
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "service": {"name": "ftp", "banner": "220 (vsFTPd 2.3.2)\u000a530 Please login with USER and PASS."} } ] },
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "service": {"name": "ftp", "banner": "220 FTP Server ready.\u000a500 AUTH not understood"} } ] },
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "service": {"name": "ftp", "banner": "220 FTP Server ready.\u000a500 AUTH "} } ] },
{ "ip": "xxx.xxx.xxx.xxx", "ports": [ {"port": 21, "proto": "tcp", "service": {"name": "ftp", "banner": "220 ProFTPD 1.3.3a Server (Debian) [::ffff:xxx.xxx.xxx.xxx]\u000a500 AUTH not understood"} } ] },
Необходимо получить список адресов где баннер содержит "220 (vsFTPd 2.3.2)"
cat qqq | grep '220 (vsFTPd 2.3.2)' | awk '{print $3}' | tr -d '",'
Вот так
↑ (https://antichat.live/posts/3868262/)
Вот так
Спасибо)
Не хочется создавать под каждый вопрос тему, спрошу тут
В баш скрипте необходимо получать ввод пользователя, а именно диапазона адресов
Банальный пример
#!/bin/bash
echo "Enter ip range for scan ex.10.0.0.0/8"
read range
Подскажите как применить маску для ввода и выдавать ошибку при некорректном вводе диапазона
man test
А вот пару примеров: http://stackoverflow.com/questions/14425613/regex-and-input-validation-bash
vBulletin® v3.8.14, Copyright ©2000-2026, vBulletin Solutions, Inc. Перевод: zCarot