Introduction

As part of your tools as system administrators, or as VoIP administrators, you need to know how many VoIP devices are a given network, the tool you need for this is, smap

With this tool you will be able to find Asterisk boxes, and also ATAs, or SIP phones, even should be able to find PC with softphones enabled and listening to VoIP ports.

As far as I know this tool is not coming with Ubuntu nor with Debian, I have not looked for it in other Distros, so it must be compiled from the tarbal, but it is really an easy task.

Instalation

First download the tarbal archive.

wget http://www.wormulon.net/files/pub/smap-syscan.tar.gz

Then compile it.

make

Using it

Usage

smap [ Options ] <ip ip/mask host>

you can run

./smap -h

to get this help text.

smap 0.3.4 hscholz@raisdorf.net http://www.wormulon.net/

usage: smap [ Options ] <ip ip/mask host>
        -h: this help
        -d: increase debugging
        -O: enable fingerprinting
        -l: fingerprint learning mode
       -P0: Treat all hosts as online - skip host discovery
 -p <port>: destination port    -D <domain>: SIP domain to use without leading sip:   -t <timeout>: timeout in msec

To discover all the VoIP enabled devices in your network run

./smap 192.168.1.0/24

change the IP/mask for your own network data, once you have identified a device with VoIP enabled, you can run,

./smap 192.168.1.20

You will see something like this,

smap 0.3.4 hscholz@raisdorf.net http://www.wormulon.net/

Host 192.168.1.20:5060: (ICMP untested) SIP enabled best guess (60% sure) fingerprint: Siemens IAD SLI-5790-I (running Asterisk) headers found: User-Agent: Asterisk PBX

1 hosts scanned, 0 up, 1 SIP enabled

If you want also more information about this device run:

./smap -l 192.168.1.20

And you will get:

smap 0.3.4 <hscholz@raisdorf.net> http://www.wormulon.net/

NOTICE: test_allow: "Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY"
NOTICE: test_headers: cmpstr: "Via:From:To:Call-ID:CSeq:User-Agent:Allow:Accept:Content-Length:"
NOTICE: test_headers: Please add new cmpstr
Host 192.168.1.20:5060: (ICMP untested) SIP enabled
best guess (60% sure) fingerprint:
  Siemens IAD SLI-5790-I (running Asterisk)

FINGERPRINT information:
newmethod=481
allow_class=201
supported_class=NR
hoe_class=NR
options=404
brokenfromto=404
prack=481
invite=404
headers found:
  User-Agent: Asterisk PBX


1 hosts scanned, 0 up, 1 SIP enabled

If you get this error while trying to use this command:

Segmentation fault

You have to run it as root or if you can’t do it, edit the Makefile file, and comment the -DRAW_SOCKET option, so yours should look like this.

#
# smap Makefile
#
# compile flags
# -DHAVE_RANDOM: system has random() as rand() replacement (i.e. FreeBSD)
# -DRAW_SOCKET: use raw socket when available
#
# $Id: Makefile,v 1.9 2006/07/05 20:36:58 hscholz Exp $

LDFLAGS= -L/usr/local/lib -lm
CFLAGS= -Wall -g -I/usr/local/include
CFLAGS+= -DHAVE_RANDOM # -DRAW_SOCKET
CC?= gcc
OBJS= error.o fingerprint.o helpers.o icmpping.o localip.o message.o randomizer.o response.o scan.o sip.o smap.o stats.o test_allow.o test_supported.o test_headers.o

all: smap

smap: $(OBJS)
        $(CC) -o smap $^ $(LDFLAGS)
clean:
        rm -f $(OBJS) smap smap.core