Ping the target using SIP
Ping the target using a SIP method of your choice. This tool is useful when testing if a target system responds to SIP messages and to monitor that target system. This tool is vaguely inspired from the ping utility and will help understand if a system is responding, if errors occur or if responses are delayed.
This tool repeatedly generates and sends a SIP message and prints out basic information about the responses. The output of the tool consists of the first line in the response, the sequence number, and the response time. When the tool is stopped or comes to an end, it prints out some statistics. The following is an example of the logging from the tool:
PING target (220.127.116.11) with OPTIONS. 200 OK from target: seq=1 time=28.6 ms 200 OK from target: seq=2 time=38.1 ms 200 OK from target: seq=3 time=39.3 ms 500 Internal serv... from target: seq=4 time=300.6 ms Warning: 392 18.104.22.168:5060 "Noisy feedback tells: pid=6112 req_src_ip=22.214.171.124 req_src_port=5082 in_uri=sip:a.b.c ut_uri=sip:a.b.c via_cnt==1" 200 OK from target: seq=5 time=23.5 ms 200 OK from target: seq=7 time=245.1 ms 200 OK from target: seq=8 time=21.3 ms 200 OK from target: seq=9 time=30.6 ms ^C --- target ping statistics --- 6 SIP messages transmitted, 6 received, 1 error, 11% packet loss, time 4s rtt min/avg/max/mdev = 21.3/200.00/300.6/280.772 ms
sipvicious sip utils ping <target1 [target2 [target3 ...]]> [flags]
-u, --credentials string set the username and password in the following format: username:password (e.g. 1000:test123) -D, --domain string override domain name for the SIP address --duration duration set how long to keep pinging -e, --extension string specify a target extension or SIP URI in the To address; if not specified, a random numeric extension is used when required -f, --from string specify a from extension or SIP URI in the From address; if not specified, a random numeric extension is used -i, --interval duration interval between each ping (default 1s) --max-requests int set the maximum number of requests to send -m, --method string set the SIP message method to use (REGISTER|SUBSCRIBE|NOTIFY|PUBLISH|MESSAGE|OPTIONS) (default "OPTIONS") --register maintain a registration; requires -u --show strings specify which response headers to monitor (default [warning]) -W, --timeout duration Time to wait for a response (default 2s)
--ca-cert string TLS CA Certificate --client-cert string TLS client certificate --client-key string TLS client private key -C, --config string configuration file to use (may be JSON, TOML or YAML) --debug set log level to debug --logfile string specify a log filename --srtp string specify if either none, dtls or sdes to enforce SRTP for calls; format: method or method:parameters; see full documentation for details (default "none") --templates string Directory to search for template overrides (default ".") --tls-key-log string TLS key log, - for stdout
sipvicious sip utils ping udp://target:5060 --max-requests 3 --method REGISTER sipvicious sip utils ping tcp://target:5060 --register -u user:pass -i 100ms sipvicious sip utils ping tls://target:5060 -m OPTIONS -e 1234
# pinging with 20 maximum requests, 7 secs timeout and monitoring Server header sipvicious sip utils ping udp://demo.sipvicious.pro:5060 --max-requests 20 --timeout 7s --show server # specify a from address with an interval of 3 secs sipvicious sip utils ping udp://demo.sipvicious.pro:5060 -f email@example.com -i 3s # registering with target and maintaining one during the pinging process sipvicious sip utils ping udp://demo.sipvicious.pro:5060 -u 1000:1500 --register -D siteonsip.tld # pinging extension 2000 with invite and duration 10s sipvicious sip utils ping udp://demo.sipvicious.pro:5060 -e 2000 --duration 10s -m invite # pinging multiple targets with the ping utility with the publish method sipvicious sip utils ping udp://demo.sipvicious.pro:5060 tcp://demo.sipvicious.pro:5060 tls://demo.sipvicious.pro -m publish
Since this tool has no security context, it will never return exit code 3, i.e. security issue. The tool will return exit code 4, i.e. network connectivity issue, when the response rate is not 100%.
The CA cert can be passed when making use of client certificate authentication. The file should be formatted as PEM.
The client certificate must be passed when making use of client certificate authentication. The file should be formatted as PEM.
The client key must be passed when making use of client certificate authentication. The file should be formatted as PEM.
Specify a configuration file which may be a JSON, TOML and YAML config
format. To get the default settings and figure out which settings are available, one may
sipvicious utils dump config command. This is typically used to create a template
configuration that can then be edited as need be.
These settings may be overwritten when the corresponding flag is explicitly set, if one is present.
Specify valid credentials so that the request can authenticated. The following format is used
Tells the logger to print out debug messages.
A domain name can be specified so that the SIP URI contains that particular domain rather than the one specified as the target. This is useful for targets that expect a particular domain name.
Specify the duration of the ping test, for example
This flag allows users to set a particular extension in the SIP URI, overriding the default behaviour of targeting random extensions. The value can be either just the SIP extension/username (e.g. 1234) or a SIP URI (e.g.
Note that in the case of
OPTIONS messages, if the extension parameter is not specified, then to URI and top most address do not contain the user part of the SIP URI (e.g.
sip:example.org). This has the effect of sending an
OPTIONS to the SIP user-agent in the case of a SIP proxy, rather than to a particular user.
This flag allows users to set the
From address, overriding the default behaviour of setting a random extension or the username in the credentials when one is provided. The value can be either just the SIP extension/username (e.g. 1234) or a SIP URI (e.g.
Set the interval between each SIP message, e.g.
logfile flag is specified, a log file is created in the location specified and logs are generated in this file instead of being sent to standard output. If the filename ends with a
.json file extension, then the output format is in JSON, otherwise it defaults to text format.
Specify the maximum number of messages to send before stopping the test.
The SIP ping tool supports the following SIP methods:
Register requires credentials to be passed so that a
REGISTER message is sent to authenticate with a registrar server before starting the test. The registration is maintained as per SIP standards, so that authentication does not time out.
Specify which response headers to display. This is useful when monitoring a particular header for changes, for example the
Contact header in an OPTIONS response which can indicate if a SIP UA is registered or not. Multiple headers can be passed, e.g.
--show=contact,server,user-agent. If the header does not exist in the response, it is simply not displayed.
The output of each specified header is displayed right after each ping update in the output.
srtp flag when specified, allows users to set the SRTP mode. By default, outgoing calls do not make use of SRTP, while incoming calls automatically handle SRTP depending on the SDP body of the incoming
INVITE message. When the
srtp flag is set to
none, incoming calls do not make use of SRTP, regardless of the SDP body in an incoming
srtp mode can also be either
sdes. In both
sdes modes, the parameters are not required and will be generated randomly as need be.
Options for both
sdes mode may be passed after a colon. For example:
--srtp dtls:cert.crt:cert.key[:ca.crt]where the first argument after the mode (
dtls) is the public certificate
cert.crt, then the private key
cert.keyand finally, the optional certificate authority file
--srtp sdes:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSojwhere the argument is the base64 encoded cryptographic master key appended with the master salt.
Note that in the case of
sdes key, the master key needs to be a valid length, which is 30 octets, for the default crypto-suite
Allows one to set the template directory which is used to load (or save) the SIP templates.
To get the default SIP templates, make use of the
sipvicious sip utils dump templates command.
Specify a timeout when the tool gives up waiting for a response and considers the response as not received. Increase this value when the target system is experiencing slow response times.
The TLS key log creates a file with the TLS key that can then be used to decrypt the TLS stream in tools that support it, such as Wireshark.