forked from antifork/vudu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vudu.sh
90 lines (80 loc) · 2.22 KB
/
vudu.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
#
# $Id$
#
# vudu v0.2 - Unix X.25 NUA Scanner
# Copyright (c) 2001 Raptor <[email protected]>
#
# Vudu is a simple X.25 NUA scanner for Unix systems: his
# main goal is portability, so it's written in bourne shell
# scripting language, without fancy stuff. Remember to change
# the vars to suit your operating system's needs.
# FOR EDUCATIONAL PURPOSES ONLY.
#
# Tested mainly on Solaris. Thanks to Sentinel for his _old_ code.
#
# Usage example: ./vudu 0208057040 535 542 [who can forget QSD? :)]
#
# Some vars (change them if needed)
tmp=vudu.tmp
valid=vudu.nua
pad=./pad
# Response codes (optimized for Sun pad)
com=Connected
dte=DTE
der="Out Of Order"
rpe="Remote Procedure Error"
na="Access Barred"
occ="Number Busy"
# Command line
base="$1"
start="$2"
end="$3"
suffix="$4"
current=$start
# Interactive logging
echo ""
echo "*** VUDU X.25 Scanner for Unix ***"
echo ""
echo "[ Starting with: ${base}${start} ]"
# Perform the scan
while :
do
$pad $base$current$suffix >$tmp 2>$tmp
# COM (valid NUA)
if fgrep $com $tmp > /dev/null; then
echo "${base}${current}${suffix} (OK)"
echo "${base}${current}${suffix} (OK)" >> $valid
# DTE
elif fgrep $dte $tmp > /dev/null; then
echo "${base}${current}${suffix} DTE"
echo "${base}${current}${suffix} DTE" >> $valid
# DER (out of order)
elif fgrep "$der" $tmp > /dev/null; then
echo "${base}${current}${suffix} DER"
echo "${base}${current}${suffix} DER" >> $valid
# RPE (remote procedure error)
elif fgrep "$rpe" $tmp > /dev/null; then
echo "${base}${current}${suffix} RPE"
echo "${base}${current}${suffix} RPE" >> $valid
# NA (access barred)
elif fgrep "$na" $tmp > /dev/null; then
echo "${base}${current}${suffix} N/A"
echo "${base}${current}${suffix} N/A" >> $valid
# OCC (number busy)
elif fgrep "$occ" $tmp > /dev/null; then
echo "${base}${current}${suffix} OCC"
echo "${base}${current}${suffix} OCC" >> $valid
else
echo "${base}${current}${suffix}"
fi
# Go for the next address
if [ $current -eq $end ]; then
break
else
current=`expr $current + 1`
fi
done
rm $tmp
echo "[ Ended with: ${base}${end} ]"
echo ""