-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnc_wrapper.sh
More file actions
executable file
·29 lines (25 loc) · 1.05 KB
/
nc_wrapper.sh
File metadata and controls
executable file
·29 lines (25 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# nc-wrapper.sh
# Usage: ./nc-wrapper.sh <host> [netconf-console2 options...]
# ─── Credential Store ─────────────────────────────────────────────────────────
# Format: HOST|PORT|USERNAME|PASSWORD
CREDENTIALS=(
"192.168.100.11|830|admin|admin"
"ceos-01|830|admin|admin"
"srl-01|830|admin|NokiaSrl1!"
"192.168.100.12|830|admin|NokiaSrl1!"
"srl-02|830|admin|NokiaSrl1!"
"192.168.100.13|830|admin|NokiaSrl1!"
)
# ─── Credential lookup ────────────────────────────────────────────────────────
TARGET_HOST="$1"
shift
for entry in "${CREDENTIALS[@]}"; do
IFS='|' read -r h p u pw <<< "$entry"
if [[ "$h" == "$TARGET_HOST" ]]; then
netconf-console2 --host "$h" --port "$p" -u "$u" -p "$pw" "$@"
exit $?
fi
done
echo "Error: No credentials found for host '$TARGET_HOST'"
exit 1