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