#!/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 向我建议 - 为什么它不起作用?
3. 为什么不 doas ip -6 neighbour
工作?
答案1
1.刚进入nmap的Network,会花很长的时间
nmap -6 fe80::/64
2.对我来说没有意义
3.“doas”需要用户名吗?
您无需额外的权利即可见到邻居
ip -6 neighbour