#!/usr/bin/bash
echo "Give me your private IP and its mask";read given
if [[ "$given" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/{0,1}[0-9]{1,3} ]]; then
echo "version 4"
doas nmap -sn "$given"
arp
else
echo "version 6"
prefix=${given::6}
mask=$(echo "$given"|sed -E 's|.*(/[0-9]{1,3})|\1|')
echo "$mask"
echo "$prefix"
doas nmap -6 -sn "$given" #halts, I have to press Ctrl-C
doas nmap -6 --script=neighbors "$given" #does not work
doas nmap -6 --script=neighbors "$prefix$mask" #does not work
doas ip -6 neighbour #empty line, no results
fi
Give me your private IP and its mask
fe80::xxxx:xxxx:xxxx:xxxx/64
version 6
/64
fe80::
doas (j@j-AERO-17-KC) password:
Starting Nmap 7.80 ( https://nmap.org ) at 2023-11-26 12:55 CET
Interrupt
doas (j@j-AERO-17-KC) password:
Starting Nmap 7.80 ( https://nmap.org ) at 2023-11-26 12:59 CET
NSE: failed to initialize the script engine:
/usr/bin/../share/nmap/nse_main.lua:818: 'neighbors' did not match a category, filename, or directory
stack traceback:
[C]: in function 'error'
/usr/bin/../share/nmap/nse_main.lua:818: in local 'get_chosen_scripts'
/usr/bin/../share/nmap/nse_main.lua:1310: in main chunk
[C]: in ?
QUITTING!
doas (j@j-AERO-17-KC) password:
Starting Nmap 7.80 ( https://nmap.org ) at 2023-11-26 12:59 CET
NSE: failed to initialize the script engine:
/usr/bin/../share/nmap/nse_main.lua:818: 'neighbors' did not match a category, filename, or directory
stack traceback:
[C]: in function 'error'
/usr/bin/../share/nmap/nse_main.lua:818: in local 'get_chosen_scripts'
/usr/bin/../share/nmap/nse_main.lua:1310: in main chunk
[C]: in ?
QUITTING!
x
私のプライバシーを保護するために、私の住所のいくつかの番号に置き換えました。
1.doas nmap -6 -sn "$given"
IPv6アドレスが提供されると、私のスクリプトが停止するのはなぜですか?
2. doas nmap -6 --script=neighbors "$prefix$mask"
ChatGPTは私に提案しましたが、なぜ動作しませんか?
三。 なぜできないの doas ip -6 neighbour
働く?
答え1
1.nmapのネットワークに初めて入ると時間がかかります。
nmap -6 fe80::/64
2.私には理解できません。
三。「doas」にはユーザー名が必要ですか?
近所を見るために追加の権限は必要ありません
ip -6 neighbour