voipong-2.0/ 0040755 0001754 0000000 00000000000 10346323236 012047 5 ustar murat wheel voipong-2.0/docs/ 0040755 0001754 0000000 00000000000 10346320213 012767 5 ustar murat wheel voipong-2.0/docs/CVS/ 0040755 0001754 0000000 00000000000 10346320213 013422 5 ustar murat wheel voipong-2.0/docs/CVS/Root 0100644 0001754 0000000 00000000013 10346320213 014257 0 ustar murat wheel /cvsup/cvs
voipong-2.0/docs/CVS/Repository 0100644 0001754 0000000 00000000015 10346320213 015515 0 ustar murat wheel voipong/docs
voipong-2.0/docs/CVS/Entries 0100644 0001754 0000000 00000000035 10346320213 014751 0 ustar murat wheel D/src////
D/users-manual////
voipong-2.0/docs/src/ 0040755 0001754 0000000 00000000000 10346322342 013563 5 ustar murat wheel voipong-2.0/docs/src/CVS/ 0040755 0001754 0000000 00000000000 10346322336 014221 5 ustar murat wheel voipong-2.0/docs/src/CVS/Root 0100644 0001754 0000000 00000000013 10346320213 015046 0 ustar murat wheel /cvsup/cvs
voipong-2.0/docs/src/CVS/Repository 0100644 0001754 0000000 00000000021 10346320213 016301 0 ustar murat wheel voipong/docs/src
voipong-2.0/docs/src/CVS/Entries 0100644 0001754 0000000 00000001021 10346322336 015544 0 ustar murat wheel /Makefile/1.3/Sun Nov 20 15:11:09 2005//
/book.sgml/1.6/Wed Dec 7 11:15:44 2005//
/chapters.ent/1.4/Wed Dec 7 11:15:44 2005//
/config.sgml/1.3/Wed Dec 7 11:15:44 2005//
/dsom.sgml/1.2/Wed Dec 7 11:38:46 2005//
/examples.sgml/1.3/Tue Dec 6 09:29:25 2005//
/faq.sgml/1.1/Sun Nov 20 14:51:02 2005//
/features.sgml/1.2/Sun Dec 4 14:58:40 2005//
/intro.sgml/1.2/Sun Dec 4 14:58:40 2005//
/thanks.sgml/1.1/Sun Nov 20 14:51:02 2005//
/usage.sgml/1.8/Wed Dec 7 13:35:35 2005//
/installation.sgml/1.4/Fri Dec 9 15:36:56 2005//
D
voipong-2.0/docs/src/Makefile 0100644 0001754 0000000 00000000365 10340111015 015207 0 ustar murat wheel DOC?= book
FORMATS?= html-split html
MAINTAINER= murat@enderunix.org
INSTALL_COMPRESSED?=gz
SRCS= book.sgml
DOC_PREFIX?= /usr/doc
#DESTDIR= /home/murat/public_html/
DESTDIR= ../users-manual
.include "${DOC_PREFIX}/share/mk/doc.project.mk"
voipong-2.0/docs/src/book.sgml 0100644 0001754 0000000 00000002321 10345542140 015373 0 ustar murat wheel %man;
%chapters;
]>
VoIPong User's ManualMuratBalabanmurat ~ enderunix.org$Id: book.sgml,v 1.6 2005/12/07 11:15:44 murat Exp $ 2004 2005
Murat Balaban.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by
the Free Software Foundation; with no Invariant Sections,
no Front-Cover Texts, and no Back-Cover Texts.
&chap.intro;
&chap.features;
&chap.install;
&chap.dsom;
&chap.config;
&chap.usage;
&chap.examples;
&chap.faq;
&chap.thanks;
voipong-2.0/docs/src/chapters.ent 0100644 0001754 0000000 00000000627 10345542140 016105 0 ustar murat wheel
voipong-2.0/docs/src/config.sgml 0100644 0001754 0000000 00000016404 10345542140 015715 0 ustar murat wheel Configuration
Configuration files are all installed into VoIPong directory: /usr/local/etc/voipong. Main configuration parameters are included in voipong.conf file. voipongnets file maps network addresses to their proper algorithms. DSOM modules for g711-ulaw and g711-alaw (modvocoder_pcmu.so, modvocoder_pcma.so) are installed to the path given with the modpath configuration file directive.
Configuration file: voipong.conf
Runtime configuration parameters vital to the smoothly operation of VoIPong server are defined in voipong.conf, formatted as a standart .ini file. There are two sections: GENERAL for general server settings, and FILTERS for setting up startup filters.
GENERAL sectionlogdir: specifies the log directory where voipong will save its logs e.g. /var/loglogfile: name of the main server log file e.g. voipong.logoutdir: path where output .WAV and/or .RAW files are to be written. e.g. /var/log/voipoutputcdrfile: name of the CDR (Common Data Record) log file e.g. cdr.lognetworksfile: path to the network/algorithm mappings file e.g. /usr/local/etc/voipong/voipongnetspidfile: path to the pidfile e.g. /var/run/voipong.pidsoxpath: path to the sox executable e.g. /usr/local/bin/soxmodpath: path to the directory where vocoder DSOM modules are installed. e.g. /usr/local/etc/voipong/modulessoxmixpath: path to the soxmix executable e.g. /usr/local/bin/soxmixmgmt_ipcpath: path to the UNIX domain socket for management console e.g. /tmp/voipongmgmt.sockdefalg: Default packet matching algorithm. This can currently only be lfp. Other algorithms are to be developed. e.g. lfprtp_idle_time: (in seconds) when this amount of time elapses and no RTP traffic is received for the call, the call is considered to be finished. e.g. 10device: network device to sniff packets from e.g. eth0promisc: set this to true 1 if you want VoIpong to set your sniffing device to promiscious mode. e.g. set this to 1 for true, 0 for false.mixwaves: set this to true 1 if you want VoIPong to mix the seperate .WAV files into a single .WAV file. e.g. set this to 1 for true, 0 for false.snaplen: maximum number of bytes to capture e.g. 1500readtmt: specifies the read-from-device timeout in milliseconds. e.g. 500FILTERS sectionstartup: Pcap filter string. This filter will be set during startup procedures. To see detailed usage of pcap filters, see pcap(3) manual page. e.g. "udp"Network - Algorithm mappings: voipongnets
Sniffing out voice is a tough task. You cannot design an algorithm and expect to catch all the VoIP calls. VoIP is relatively new and it is not a highly standardized technology. So there have to be several call catching algorithms for various setups. VoIPong provides a framework where you can set the call catching algorithm which you think will best suit your VoIP infrastructure. This results in a much more specialized and successful call sniffing.
Least False Positive (LFP) algorithm
This algorithm tries to detect calls generated via VoIP devices conforming to RTP and RTCP RFCs. This algorithm should detect and record a broad range of calls. The most obvious advantage of this algorithm is that you'll have barely no false positives. This is why this method is named as LFP. The #1 disadvantage will be that this will not be able to catch calls if there are no RTCP packets or the devices do not conform to RFCs. To use this algorithm, you will need to specify a network to use with it in your voipongnets file.
172.16.1.0/255.255.255.0 lfp10.30.0.0/255.255.252.0 lfpFixed (Fixed Port) algorithm
Some VoIP devices (e.g. Grandstream(TM) IP adapters) use a fixed port to send and receive RTP datagrams, and they do not conform to RFCs, and do not send any link control information (RTCP packets). If you have such devices in your network, you can specify their algorithm as fixed in the voipongnets file. This algorithm cannot be used with networks, it can only be used with hosts, so netmask address should always be 255.255.255.255. Please note that, after the fixed keyword, you are expected to set the fixed port number the device is using. For example, suppose that you have a device which uses port 40000 to send RTP packets, you should add this line to your voipongnets file:
172.16.1.101/255.255.255.255 fixed 40000LRA-SIP Algorithm
LRA-SIP will follow SIP signalling packets, and will spot the RTP/RTCP session from the SDP packets. This algorithm is not implemented yet, however I will be working on it for the next release (probably 2.1.?)
voipong-2.0/docs/src/dsom.sgml 0100644 0001754 0000000 00000004053 10345544706 015421 0 ustar murat wheel Dynamic Shared Object Modules (DSOM)
Since release 2.0 upwards, VoIPong provides a powerful dynamic framework for loading of 3rd party voice decoders into the running voipong executable at runtime. This is called Dynamic Shared Object Modules (DSOM) Framework. Simply put, DSOM vocoder modules are shared libraries with the .so extension. VoIPong looks for those shared libraries in the preconfigured modpath directory, loads them one by one. DSOM engine resident at VoIPong core, spots the initialization method in the shared module and invokes it allowing the module to register itself inside VoIPong runtime environment:
07/12/05 13:29:25: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcmu.so (@0x2813e370)
07/12/05 13:29:25: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcma.so (@0x28140390)
07/12/05 13:29:25: loaded 2 module(s)
For security reasons, the DSOMs are expected to be owned by the same user and group who is running the core VoIPong executable. For instance, if the user running the program has uid 1000 and gid 10; the modules should also be owned by uid 1000 and gid 10.
The naming convention is that the modules should start with the modvocoder_ keyword, and should include the name of the decoder in the module, followed by the .so extension. For example, the correct name for the g711 (u-law) module can be modvocoder_pcmu.so.
There are two pre-written voice decoder modules with VoIPong release 2.0:
modvocoder_pcmu.so: g711 (u-law) decoder (payload type 0)modvocoder_pcma.so: g711 (a-law) decoder (payload type 8)
To code and install your own vocoder module (i.e. for g726), VoIPong DSOM Decoder Writer's Guide will be available soon.
voipong-2.0/docs/src/examples.sgml 0100644 0001754 0000000 00000007310 10345254765 016277 0 ustar murat wheel Example Scenarios
You can try VoIPong with Microsoft Netmeeting. Set up netmeeting so that it uses G711 at both ends, and make a voice call. You'll see the calls captured and wave files created after your call finishes.
If you do not have a testbed, do not want so much pain to test VoIPong, you can replay a test capture file in your machine and see if it is catched.
Replaying a previous capture fileDownload this test call capture, where me and Baris are talking about EnderUNIX team.Download and install tcpreplay tool. Tcpreplay tool reads pcap capture files, and re-injects the packets into a live network.Start VoIPong
04/12/05 16:27:20: EnderUNIX VOIPONG Voice Over IP Sniffer starting...
04/12/05 16:27:20: Release 2.0-DEVEL running on efe.enderunix.org [FreeBSD 5.4-STABLE FreeBSD 5.4-STABLE #0: Sun Oct 23 16:39:41 EEST 2005 mb@efe.enderunix.org:/usr/src/sys/i386/compile/EFE i386]. (c) Murat Balaban http://www.enderunix.org/ [pid: 1075]
04/12/05 16:27:20: Default matching algorithm: lfp
04/12/05 16:27:20: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcmu.so (@0x2817f3bc)
04/12/05 16:27:20: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcma.so (@0x281813e0)
04/12/05 16:27:20: loaded 2 module(s)
04/12/05 16:27:20: loadnet(10.30.0.11/255.255.255.255) method: fixed 40000
04/12/05 16:27:20: em0 has been opened in promisc mode. (192.168.1.0/255.255.255.0)
Start tcpreplay with the test capture you just downloaded at step 1.
[root@efe ~/calls/ok]$ /usr/local/sbin/tcpreplay -i em0 endercall2.pcap
sending on: em0
4534 packets (1344595 bytes) sent in 141.44 seconds
9506.2 bytes/sec 0.07 megabits/sec 32 packets/sec
You will see that VoIPong immediately starts monitoring your call. Following lines will appear in your voipong.log file:
24/10/05 20:47:23: created a call recording instance!
24/10/05 20:47:23: [68826] VoIP call has been detected.
24/10/05 20:47:23: [68826] 10.0.0.145:49604 < -- > 10.0.0.200:49606
24/10/05 20:47:23: [68826] Encoding 0-PCMU-8KHz, recording.......
At the end of the call, you'll see that two .WAV files are created:
24/10/05 20:52:52: [68826] maximum idle time [10 secs] has been elapsed for this call, the call might have been ended.
24/10/05 20:52:52: [68826] .WAV file output/20051204/session-enc0-PCMU-8KHz-10.0.0.145,49604-10.0.0.200,49606.wav has been created successfully
24/10/05 20:52:52: [68826] .WAV file output/20051204/session-enc0-PCMU-8KHz-10.0.0.200,49606-10.0.0.145,49604.wav has been created successfully
&prompt.root; ls /var/log/output/20051024/
session-enc0-PCMU-8KHz-10.0.0.200,49606-10.0.0.145,49604.wav session-enc0-PCMU-8KHz-10.0.0.145,49604-10.0.0.200,49606.wav
You can play output files with several utilities including play, xmms etc.:
&prompt.root; play /var/log/voipoutput/20051025/session-enc0-PCMU-8KHz-10.0.0.145,49604-10.0.0.200,49606.wavCapturing a Microsoft Netmeeting call
Not written yet.
voipong-2.0/docs/src/faq.sgml 0100644 0001754 0000000 00000000604 10340106526 015211 0 ustar murat wheel Frequently Asked Questions
This is a a non-complete list of questions frequently asked at voipong mailing list. You can have a more recent and updated one within the FAQ at VoIPong web site.
voipong-2.0/docs/src/features.sgml 0100644 0001754 0000000 00000002271 10344602040 016256 0 ustar murat wheel Features
Simple, optimized, extendable, fast code
Easy debugging
Easy installation and administration
Powerful management console (voipctl) for run-time server administration
Detailed logging
CSV style CDR (Call Detail Record) logs
Dynamic framework for multiple call-catching algorithms to co-exist together
Dynamic Shared Object Modules (DSOM) for loading of third party voice codec modules
at runtime.
Users can choose the best algorithm to suit their networks.
Produces audible output (.wav) for G711 (u-law) and G711 (a-law) codecs.
Output can be merged into one single file via soxmix.
voipong-2.0/docs/src/installation.sgml 0100644 0001754 0000000 00000006564 10346322230 017154 0 ustar murat wheel InstallationBefore you proceed: Prerequisites
You should have pcap library installed beforehand. Please download libpcap from tcpdump.org and install it if you don't have it in your system. Please note that most Operating Systems and Linux distributions provide this library in their default installations.
Also, for .WAV file creation, you should have sox and soxmix tools installed. If you don't have those, please download them from sox.sourceforge.net and install it in your system.
Compilation & Installation
Download the latest VoIPong tarball from EnderUNIX and uncompress it:
&prompt.root; tar zxvf voipong-version.tar.gz
There are several pre-written Makefile files in the source directory. Examine each of
them and choose the one which most suits your system. If you're running of the
the BSD type Operating Systems (i.e. FreeBSD, OpenBSD, NetBSD, Mac OSX) copy
Makefile.bsd as Makefile; if you're using a Linux distribution then, copy
Makefile.linux as Makefile. You might need to change CFLAGS and LDFLAGS variables accordingly:
&prompt.root; cp Makefile.bsd Makefile
Type make to compile voipong, voipctl and voice decoder modules:
&prompt.root; make
Type make install to copy compiled binaries, shared modules, configuration files, manual pages and related documentation into the proper locations:
&prompt.root; make install Installation via BSD ports system
BSD Operating Systems (FreeBSD, NetBSD, OpenBSD, Darwin etc.) has a ports system for easy package administration. VoIPong is a FreeBSD port, so you can install it from FreeBSD ports tree. VoIPong is located in /usr/ports/audio/voipong directory:
Change your current working directory to /usr/ports/audio/voipong and type:
&prompt.root; cd /usr/ports/audio/voipong
&prompt.root; make install clean
FreeBSD will fetch the tarball, uncompress it, compile the sources and install VoIPong for you.
Alternatively, you can install VoIPong .tbz package with pkg_add (1) command:
&prompt.root; fetch \
ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.4-RELEASE/packages/audio/voipong-2.0.tbz
&prompt.root; pkg_add voipong-2.0.tbz
voipong-2.0/docs/src/intro.sgml 0100644 0001754 0000000 00000003047 10344602040 015575 0 ustar murat wheel Introduction
VoIPong is a sniffer utility which tries to detects Voice Over IP calls on a pipeline, and for those which have vocoder modules loaded, dumps actual conversation to seperate wave files. Currently it can catch calls made via a wide variety of protocols including SIP, H323, Cisco's Skinny Client Protocol. It can also catch calls made through dummy IP adapters which do not do any signalling but transport voice payload via RTP protocol.
It's been written in C language for performance reasons, proved to be running on Solaris, Linux and FreeBSD; though it's thought to compile and run on other platforms as well.
On a 45 Mbit/sec actual network traffic, it's been verified that VoIPong successfully detected all VoIP gateways and the VoIP calls. CPU utilization during the run has been found ranging between 66% - 80% on a 256MB RAM, Celeron 1700 Mhz Toshiba notebook.
With its powerful and extensible Dynamic Shared Object Modules (DSOM) subsystem, and its related API (will be documented later), new third party voice decoder modules can be coded and installed, resulting in a great flexibility. By default, VoIPong comes with two pre-written voice decoder modules for calls encoded with G711 (u-law) and G711 (a-law) . Audible output can be generated for calls encoded with any one of them.
voipong-2.0/docs/src/thanks.sgml 0100644 0001754 0000000 00000000372 10340106526 015734 0 ustar murat wheel Thanks
Please find a list of people and organizations who contributed or gave support to VoIPong here .
voipong-2.0/docs/src/usage.sgml 0100644 0001754 0000000 00000031357 10345562447 015574 0 ustar murat wheel Usage
Similar to other sniffer tools at the market, VoIPong needs to get a copy of the voice traffic you're interested in. If you're sharing a hub with one of the endpoints of the voice conversation, you will not need to do anything, since hub devices inherently copy traffic to all its ports. If you are in a switched environment, some network administration will be needed. Most modern switch devices has a handy "monitor port" which you can use for copying traffic going through one or more switch ports. So you'll need to copy one of the endpoints' traffic to that monitor port, and connect the computer on which VoIPong is running. If you're running VoIPong on a gateway machine, where this machine has already access to all the voice traffic, you will not need to do anything.
Startup Parameters
You can use -h switch to see available startup parameters:
[murat@efe ~/voipong]$ ./voipong -h
usage: voipong [options]
options:
-h this screen
-v version info
-f run in foreground (don't become a daemon)
-d debug level. Valid levels are 0 through 4. Default: 0
-c config file path
-v switch shows VoIPong version information:
[murat@efe ~/voipong]$ ./voipong -v
EnderUNIX VOIPONG Voice Over IP Sniffer Release 2.0-DEVEL
Copyright (C) 2004 Murat Balaban murat || enderunix.org
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
For more information on licensing, please see LICENSE
file included in the voipong source distribution.
[murat@efe ~/voipong]$
You can set the debug log level by -d switch. Valid levels are 0 through 4, latter being the most verbose. Default configuration file is /usr/local/etc/voipong/voipong.conf. You can use alternate configuration file by issuing -c switch and providing full path to the alternate configuration file. If you don't want VoIPong to daemonize, but instead you want it to stay at your terminal and dump log messages to the terminal, you will need to issue -f switch.
So, If you want VoIPong to stay at the terminal, and you want to see as many log messages as possible, you should fire VoIPong as such:
[root@devel ~]$ voipong -d4 -f
EnderUNIX VOIPONG Voice Over IP Sniffer starting...
Release 2.0-DEVEL, running on devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
(c) Murat Balaban http://www.enderunix.org/
20/11/05 19:33:33: EnderUNIX VOIPONG Voice Over IP Sniffer starting...
20/11/05 19:33:33: Release 2.0-DEVEL running on devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]. (c) Murat Balaban http://www.enderunix.org/ [pid: 23627]
20/11/05 19:33:33: Default matching algorithm: lfp
20/11/05 19:33:33: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcmu.so (@0x2817f3bc)
20/11/05 19:33:33: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcma.so (@0x281813e0)
20/11/05 19:33:33: loaded 2 module(s)
20/11/05 19:33:33: loadnet(10.0.0.145/255.255.255.255) method: fixed 49604
20/11/05 19:33:33: loadnet(172.16.0.10/255.255.0.0) method: lfp
20/11/05 19:33:33: fxp0 has been opened in promisc mode. (43.43.43.0/255.255.255.192)
Management Console: voipctl
VoIPong provides the user with the ability to administer the server at runtime. You can use voipctl command for this purpose. When fired, voipctl will connect VoIPong and will wait for user's commands:
[root@efe ~/voipong]$ voipctl
Connected to VoIPong Management Console
System:
efe.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
voipong>
help is the same old "help":
voipong> help
Commands:
help : this one
quit : quit management console
uptime : Server uptime
setdebug [level] : set debug level to [level]
logrotate : rotate server's logs
shutdown : shutdown server
rusage : CPU usage statistics for the server
loadnets : Reload voipongnets file
info : General server information
shcall : Show currently monitored calls
shrtcp : Show currently RTCP cache
killcall [id] : end monitoring session with [id]
voipong>
uptime shows how long the server has been running:
voipong> uptime
Server uptime: 5 minutes 57 seconds
voipong>
!!: You can use !! command to issue the last command you typed. (same as in sh):
voipong> !!
Server uptime: 6 minutes 13 seconds
voipong>
logrotate command rotates server logs:
voipong> logrotate
Logrotate successfull
voipong>
shutdown command will shutdown the server and close management console connection
voipong> shutdown
rusage command will give information related to server's CPU utilization
voipong> rusage
Current CPU usage stats:
----------------------------------------
Total "user" time : 0 seconds
Total used "system" time : 0 seconds
Shared Memory Size : 384 KB
Integral Memory Size : 1512 KB
Integral stack Size : 1024 KB
Page requests : 70
Page errors : 0
Block input operations : 0
Block output operations : 2
Messages sent : 1
Messages received : 1
Signals : 0
Voluntary "context switch"s : 78
Involuntary "context switch"s : 1
voipong>
loadnets command will re-read voipongnets and re-load network/algorithms mapping table
voipong> loadnets
Networks file has been reloaded successfuly
voipong>
info command will give general server information
voipong> info
General Server Info:
--------------------------:
Server version : Release 2.0-DEVEL
System : efe.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
Current work. direct. : /usr/home/murat/voipong
Log level : 4
Process ID (PID) : 16240
User : root [Charlie &]
Group : 0
voipong>
setdebug command will change runtime log verbosity
voipong> setdebug 4
# set new debug level to 4
voipong>
shcall command will list calls currently monitored
voipong> shcall
ID NODE1 PORT1 NODE2 PORT2 STIME DURATION
----- ---------------- ----- ---------------- ----- ----------------- ------------
01123 41.27.13.1 12000 31.12.11.8 24000 24/10/05 11:11:23 33 seconds
Total listed: 1
voipong>
shrtcp command will show current RTCP cache
voipong> shrtcp
ID NODE1 PORT1 NODE2 PORT2 STIME
----- ---------------- ----- ---------------- ----- -----------------
01123 41.27.13.1 12001 31.12.11.8 24001 24/10/05 11:11:23
Total listed: 1
voipong>
killcall will end monitoring the call by id
voipong> killcall 2
transport_simplecmd: server returned error: No such session by ID: 2
cannot process killcall command
voipong>
q, quit, exit commands will end management session
voipong> q
Bye!
[root@efe /home/murat/voipong]$
Running VoIPong with a non-privileged user
It is strongly advised that you avoid running VoIPong with super-user, but use a non-privileged special user created only for it. This section describes the steps you should take to accomplish this. Note that these steps should be done after you compiled and installed VoIPong successfully.
Create voipong user and group
&prompt.root; pw group add voipong
&prompt.root; pw user add voipong -g voipong -m -s /usr/local/bin/bashChange ownership of voipong, voipctl and /usr/local/etc/voipong directory to voipong user:
&prompt.root; chown voipong /usr/local/bin/voipong
&prompt.root; chown voipong /usr/local/bin/voipctl
&prompt.root; chown -R voipong /usr/local/etc/voipong
&prompt.root; chgrp -R voipong /usr/local/etc/voipongChange ownership of BPF device files (/dev/bpf*) to voipong user:
&prompt.root; chown voipong /dev/bpf*Switch user to voipong:
&prompt.root; su - voipong
To see all of the directories on your FreeBSD system, type
ls -R / | more
-- Dru genesis@istar.ca
&prompt.user;
Create runtime directories:
&prompt.user; mkdir logs
&prompt.user; mkdir output
&prompt.user; mkdir runChange log, pid and output directory paths to the new directories in voipong.conf
logdir = /home/voipong/logs/
logfile = voipong.log
outdir = /home/voipong/output/
cdrfile = /home/voipong/output/voipcdr.log
pidfile = /home/voipong/run/voipong.pid
mgmt_ipcpath = /home/voipong/run/voipongmgmt.sockYou can now run voipong
&prompt.user; id
uid=1042(voipong) gid=1042(voipong) groups=1042(voipong)
&prompt.user; voipong -d4 -f
EnderUNIX VOIPONG Voice Over IP Sniffer starting...
Release 2.0-DEVEL, running on devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
(c) Murat Balaban http://www.enderunix.org/
20/11/05 22:34:03: EnderUNIX VOIPONG Voice Over IP Sniffer starting...
20/11/05 22:34:03: Release 2.0-DEVEL running on devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]. (c) Murat Balaban http://www.enderunix.org/ [pid: 41334]
20/11/05 22:34:03: Default matching algorithm: lfp
20/11/05 22:34:03: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcmu.so (@0x2817f3bc)
20/11/05 22:34:03: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcma.so (@0x281813e0)
20/11/05 22:34:03: loaded 2 module(s)
20/11/05 22:34:03: loadnet(10.0.0.145/255.255.255.255) method: fixed 49604
20/11/05 22:34:03: loadnet(172.16.0.10/255.255.0.0) method: lfp
20/11/05 22:34:03: fxp0 has been opened in promisc mode. (43.43.43.0/255.255.255.128)
You can check whether the daemon is running with the correct user with voipctl
&prompt.user; id
uid=1042(voipong) gid=1042(voipong) groups=1042(voipong)
&prompt.user; voipctl
Connected to VoIPong Management Console
System:
devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
voipong> info
General Server Info:
--------------------------:
Server version : Release 2.0-DEVEL
System : devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
Current work. direct. : /usr/home/voipong
Log level : 4
Mix Voice Flag : true
Process ID (PID) : 41334
User : voipong [VoIPong Kullanicisi]
Group : 1042
voipong>
VoIPong Live CD
Omer Faruk Sen has maintains VoIPong LiveCD! based on FreeSBIE project. LiveCD is an ISO image which can be burnt into a blank CD directly, and includes pre-installed VoIPong release along with several boot-time scripts for configuring the OS and VoIPong.
Please find the gzip'ed ISO images here:
Version 2.0 MD5: 2458d372b0113771eb642987ce0b2f43
voipong-2.0/docs/users-manual/ 0040755 0001754 0000000 00000000000 10346322276 015416 5 ustar murat wheel voipong-2.0/docs/users-manual/CVS/ 0040755 0001754 0000000 00000000000 10346320213 016036 5 ustar murat wheel voipong-2.0/docs/users-manual/CVS/Root 0100644 0001754 0000000 00000000013 10346320213 016673 0 ustar murat wheel /cvsup/cvs
voipong-2.0/docs/users-manual/CVS/Repository 0100644 0001754 0000000 00000000032 10346320213 020130 0 ustar murat wheel voipong/docs/users-manual
voipong-2.0/docs/users-manual/CVS/Entries 0100644 0001754 0000000 00000000002 10346320213 017357 0 ustar murat wheel D
voipong-2.0/docs/users-manual/index.html 0100444 0001754 0000000 00000010242 10346322276 017405 0 ustar murat wheel
VoIPong is a sniffer utility which tries to detects Voice Over IP calls on a pipeline,
and for those which have vocoder modules loaded, dumps actual conversation to seperate
wave files. Currently it can catch calls made via a wide variety of protocols including
SIP, H323, Cisco's Skinny Client
Protocol. It can also catch calls made through dummy IP adapters which do not
do any signalling but transport voice payload via RTP protocol.
It's been written in C language for performance reasons, proved to be running on Solaris, Linux and FreeBSD; though it's
thought to compile and run on other platforms as well.
On a 45 Mbit/sec actual network traffic, it's been verified that VoIPong successfully
detected all VoIP gateways and the VoIP calls. CPU utilization during the run has been
found ranging between 66% - 80% on a 256MB RAM, Celeron 1700 Mhz Toshiba notebook.
With its powerful and extensible Dynamic
Shared Object Modules (DSOM) subsystem, and its related API (will be
documented later), new third party voice decoder modules can be coded and installed,
resulting in a great flexibility. By default, VoIPong comes with two pre-written voice
decoder modules for calls encoded with G711
(u-law) and G711 (a-law)
. Audible output can be generated for calls encoded with any one of them.
You should have pcap library installed beforehand. Please
download libpcap from tcpdump.org and install it if you don't have it in your system. Please
note that most Operating Systems and Linux distributions provide this library in their
default installations.
Also, for .WAV file creation, you should have sox and soxmix tools installed. If you don't have those, please download
them from sox.sourceforge.net and
install it in your system.
Download the latest VoIPong tarball from EnderUNIX and uncompress it:
#tar zxvf voipong-version.tar.gz
There are several pre-written Makefile files in the source
directory. Examine each of them and choose the one which most suits your system. If
you're running of the the BSD type Operating Systems (i.e. FreeBSD, OpenBSD, NetBSD, Mac
OSX) copy Makefile.bsd as Makefile;
if you're using a Linux distribution then, copy Makefile.linux
as Makefile. You might need to change CFLAGS and LDFLAGS variables
accordingly:
#cp Makefile.bsd Makefile
Type make to compile voipong, voipctl and voice decoder modules:
#make
Type make install to copy compiled binaries, shared modules,
configuration files, manual pages and related documentation into the proper locations:
BSD Operating Systems (FreeBSD, NetBSD, OpenBSD, Darwin etc.) has a ports system for
easy package administration. VoIPong is a FreeBSD port, so you can install it from
FreeBSD ports tree. VoIPong is located in /usr/ports/audio/voipong directory:
Change your current working directory to /usr/ports/audio/voipong and type:
#cd /usr/ports/audio/voipong#make install clean
FreeBSD will fetch the tarball, uncompress it, compile the sources and install VoIPong
for you.
Alternatively, you can install VoIPong .tbz package with pkg_add (1) command:
Since release 2.0 upwards, VoIPong provides a powerful dynamic framework for loading
of 3rd party voice decoders into the running voipong executable at runtime. This is
called Dynamic Shared Object Modules (DSOM) Framework. Simply put, DSOM vocoder modules
are shared libraries with the .so extension. VoIPong looks for
those shared libraries in the preconfigured modpath directory,
loads them one by one. DSOM engine resident at VoIPong core, spots the initialization
method in the shared module and invokes it allowing the module to register itself inside
VoIPong runtime environment:
For security reasons, the DSOMs are expected to be owned by the same user and group
who is running the core VoIPong executable. For instance, if the user running the program
has uid 1000 and gid 10; the modules should also be owned by uid 1000 and gid 10.
The naming convention is that the modules should start with the modvocoder_ keyword, and should include the name of the decoder in
the module, followed by the .so extension. For example, the
correct name for the g711 (u-law) module can be modvocoder_pcmu.so.
There are two pre-written voice decoder modules with VoIPong release 2.0:
modvocoder_pcmu.so: g711 (u-law) decoder (payload type
0)
modvocoder_pcma.so: g711 (a-law) decoder (payload type
8)
To code and install your own vocoder module (i.e. for g726), VoIPong DSOM Decoder
Writer's Guide will be available soon.
Configuration files are all installed into VoIPong directory: /usr/local/etc/voipong. Main configuration parameters are included
in voipong.conf file. voipongnets
file maps network addresses to their proper algorithms. DSOM modules for g711-ulaw and g711-alaw (modvocoder_pcmu.so, modvocoder_pcma.so) are installed to the path given with the modpath configuration file directive.
Runtime configuration parameters vital to the smoothly operation of VoIPong server are
defined in voipong.conf, formatted as a standart .ini file. There are two sections: GENERAL for general server settings, and
FILTERS for setting up startup
filters.
logdir: specifies the log directory where voipong will save
its logs e.g. /var/log
logfile: name of the main server log file e.g. voipong.log
outdir: path where output .WAV and/or .RAW files are to be
written. e.g. /var/log/voipoutput
cdrfile: name of the CDR (Common Data Record) log file e.g.
cdr.log
networksfile: path to the network/algorithm mappings file
e.g. /usr/local/etc/voipong/voipongnets
pidfile: path to the pidfile e.g. /var/run/voipong.pid
soxpath: path to the sox executable e.g. /usr/local/bin/sox
modpath: path to the directory where vocoder DSOM modules are
installed. e.g. /usr/local/etc/voipong/modules
soxmixpath: path to the soxmix executable e.g. /usr/local/bin/soxmix
mgmt_ipcpath: path to the UNIX domain socket for management
console e.g. /tmp/voipongmgmt.sock
defalg: Default packet matching algorithm. This can currently
only be lfp. Other algorithms are to be developed. e.g. lfp
rtp_idle_time: (in seconds) when this amount of time elapses
and no RTP traffic is received for the call, the call is considered to be finished. e.g.
10
device: network device to sniff packets from e.g. eth0
promisc: set this to true 1 if you
want VoIpong to set your sniffing device to promiscious mode. e.g. set this to 1 for true, 0 for false.
mixwaves: set this to true 1 if you
want VoIPong to mix the seperate .WAV files into a single .WAV file. e.g. set this to 1 for true, 0 for false.
snaplen: maximum number of bytes to capture e.g. 1500
readtmt: specifies the read-from-device timeout in
milliseconds. e.g. 500
startup: Pcap filter string. This filter will be set during
startup procedures. To see detailed usage of pcap filters, see pcap(3) manual page. e.g.
"udp"
Sniffing out voice is a tough task. You cannot design an algorithm and expect to catch
all the VoIP calls. VoIP is relatively new and it is not a highly standardized
technology. So there have to be several call catching algorithms for various setups.
VoIPong provides a framework where you can set the call catching algorithm which you
think will best suit your VoIP infrastructure. This results in a much more specialized
and successful call sniffing.
This algorithm tries to detect calls generated via VoIP devices conforming to RTP and RTCP RFCs. This algorithm should detect and record a broad
range of calls. The most obvious advantage of this algorithm is that you'll have barely
no false positives. This is why this method is named as LFP. The #1 disadvantage will be
that this will not be able to catch calls if there are no RTCP packets or the devices do not conform to RFCs. To use
this algorithm, you will need to specify a network to use with it in your voipongnets
file.
Some VoIP devices (e.g. Grandstream(TM) IP adapters) use a fixed port to send and
receive RTP datagrams, and they do not conform to RFCs, and do not send any link control
information (RTCP packets). If you have such devices in your network, you can specify
their algorithm as fixed in the voipongnets file. This
algorithm cannot be used with networks, it can only be used with hosts, so netmask
address should always be 255.255.255.255. Please note that, after
the fixed keyword, you are expected to set the fixed port number the device is using. For
example, suppose that you have a device which uses port 40000 to
send RTP packets, you should add
this line to your voipongnets file:
LRA-SIP will follow SIP
signalling packets, and will spot the RTP/RTCP session from the SDP packets. This algorithm is not implemented yet, however I
will be working on it for the next release (probably 2.1.?)
Similar to other sniffer tools at the market, VoIPong needs to get a copy of the voice
traffic you're interested in. If you're sharing a hub with one of the endpoints of the voice conversation, you
will not need to do anything, since hub devices inherently copy traffic to all its ports.
If you are in a switched
environment, some network administration will be needed. Most modern switch devices has a
handy "monitor port" which you can
use for copying traffic going through one or more switch ports. So you'll need to copy
one of the endpoints' traffic to that monitor port, and connect the computer on which
VoIPong is running. If you're running VoIPong on a gateway machine, where this machine has already access to all
the voice traffic, you will not need to do anything.
You can use -h switch to see available startup
parameters:
[murat@efe ~/voipong]$ ./voipong -h
usage: voipong [options]
options:
-h this screen
-v version info
-f run in foreground (don't become a daemon)
-d debug level. Valid levels are 0 through 4. Default: 0
-c config file path
-v switch shows VoIPong version information:
[murat@efe ~/voipong]$ ./voipong -v
EnderUNIX VOIPONG Voice Over IP Sniffer Release 2.0-DEVEL
Copyright (C) 2004 Murat Balaban murat || enderunix.org
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
For more information on licensing, please see LICENSE
file included in the voipong source distribution.
[murat@efe ~/voipong]$
You can set the debug log level by -d switch. Valid levels are
0 through 4, latter being the most
verbose. Default configuration file is /usr/local/etc/voipong/voipong.conf. You can use alternate
configuration file by issuing -c switch and providing full path
to the alternate configuration file. If you don't want VoIPong to daemonize, but instead
you want it to stay at your terminal and dump log messages to the terminal, you will need
to issue -f switch.
So, If you want VoIPong to stay at the terminal, and you want to see as many log
messages as possible, you should fire VoIPong as such:
[root@devel ~]$ voipong -d4 -f
EnderUNIX VOIPONG Voice Over IP Sniffer starting...
Release 2.0-DEVEL, running on devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
(c) Murat Balaban http://www.enderunix.org/
20/11/05 19:33:33: EnderUNIX VOIPONG Voice Over IP Sniffer starting...
20/11/05 19:33:33: Release 2.0-DEVEL running on devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]. (c) Murat Balaban http://www.enderunix.org/ [pid: 23627]
20/11/05 19:33:33: Default matching algorithm: lfp
20/11/05 19:33:33: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcmu.so (@0x2817f3bc)
20/11/05 19:33:33: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcma.so (@0x281813e0)
20/11/05 19:33:33: loaded 2 module(s)
20/11/05 19:33:33: loadnet(10.0.0.145/255.255.255.255) method: fixed 49604
20/11/05 19:33:33: loadnet(172.16.0.10/255.255.0.0) method: lfp
20/11/05 19:33:33: fxp0 has been opened in promisc mode. (43.43.43.0/255.255.255.192)
VoIPong provides the user with the ability to administer the server at runtime. You
can use voipctl command for this purpose. When fired, voipctl will connect VoIPong and will wait for user's commands:
voipong> help
Commands:
help : this one
quit : quit management console
uptime : Server uptime
setdebug [level] : set debug level to [level]
logrotate : rotate server's logs
shutdown : shutdown server
rusage : CPU usage statistics for the server
loadnets : Reload voipongnets file
info : General server information
shcall : Show currently monitored calls
shrtcp : Show currently RTCP cache
killcall [id] : end monitoring session with [id]
voipong>
uptime shows how long the server has been running:
voipong> uptime
Server uptime: 5 minutes 57 seconds
voipong>
!!: You can use !! command to issue the last command you typed.
(same as in sh):
voipong> !!
Server uptime: 6 minutes 13 seconds
voipong>
logrotate command rotates server logs:
voipong> logrotate
Logrotate successfull
voipong>
shutdown command will shutdown the server and close management
console connection
voipong> shutdown
rusage command will give information related to server's CPU
utilization
voipong> rusage
Current CPU usage stats:
----------------------------------------
Total "user" time : 0 seconds
Total used "system" time : 0 seconds
Shared Memory Size : 384 KB
Integral Memory Size : 1512 KB
Integral stack Size : 1024 KB
Page requests : 70
Page errors : 0
Block input operations : 0
Block output operations : 2
Messages sent : 1
Messages received : 1
Signals : 0
Voluntary "context switch"s : 78
Involuntary "context switch"s : 1
voipong>
loadnets command will re-read voipongnets and re-load
network/algorithms mapping table
voipong> loadnets
Networks file has been reloaded successfuly
voipong>
info command will give general server information
voipong> info
General Server Info:
--------------------------:
Server version : Release 2.0-DEVEL
System : efe.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
Current work. direct. : /usr/home/murat/voipong
Log level : 4
Process ID (PID) : 16240
User : root [Charlie &]
Group : 0
voipong>
setdebug command will change runtime log verbosity
voipong> setdebug 4
# set new debug level to 4
voipong>
shcall command will list calls currently monitored
voipong-2.0/docs/users-manual/usage-nonpriv.html 0100444 0001754 0000000 00000015663 10346322276 021107 0 ustar murat wheel
Running VoIPong with a non-privileged user
It is strongly advised that you avoid running VoIPong with super-user, but use a
non-privileged special user created only for it. This section describes the steps you
should take to accomplish this. Note that these steps should be done after you compiled
and installed VoIPong successfully.
Create voipong user and group
#pw group add voipong#pw user add voipong -g voipong -m -s /usr/local/bin/bash
Change ownership of voipong, voipctl
and /usr/local/etc/voipong directory to voipong user:
Omer Faruk Sen has maintains VoIPong LiveCD! based on FreeSBIE project. LiveCD is an
ISO image which can be burnt into a blank CD directly, and includes pre-installed VoIPong
release along with several boot-time scripts for configuring the OS and VoIPong.
You can try VoIPong with Microsoft Netmeeting. Set up netmeeting so that it uses G711
at both ends, and make a voice call. You'll see the calls captured and wave files created
after your call finishes.
If you do not have a testbed, do not want so much pain to test VoIPong, you can replay
a test capture file in your machine and see if it is catched.
Download and install tcpreplay tool. Tcpreplay tool reads pcap capture files, and
re-injects the packets into a live network.
Start VoIPong
04/12/05 16:27:20: EnderUNIX VOIPONG Voice Over IP Sniffer starting...
04/12/05 16:27:20: Release 2.0-DEVEL running on efe.enderunix.org [FreeBSD 5.4-STABLE FreeBSD 5.4-STABLE #0: Sun Oct 23 16:39:41 EEST 2005 mb@efe.enderunix.org:/usr/src/sys/i386/compile/EFE i386]. (c) Murat Balaban http://www.enderunix.org/ [pid: 1075]
04/12/05 16:27:20: Default matching algorithm: lfp
04/12/05 16:27:20: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcmu.so (@0x2817f3bc)
04/12/05 16:27:20: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcma.so (@0x281813e0)
04/12/05 16:27:20: loaded 2 module(s)
04/12/05 16:27:20: loadnet(10.30.0.11/255.255.255.255) method: fixed 40000
04/12/05 16:27:20: em0 has been opened in promisc mode. (192.168.1.0/255.255.255.0)
Start tcpreplay with the test capture you just downloaded at
step 1.
[root@efe ~/calls/ok]$ /usr/local/sbin/tcpreplay -i em0 endercall2.pcap
sending on: em0
4534 packets (1344595 bytes) sent in 141.44 seconds
9506.2 bytes/sec 0.07 megabits/sec 32 packets/sec
You will see that VoIPong immediately starts monitoring your call. Following lines
will appear in your voipong.log file:
24/10/05 20:47:23: created a call recording instance!
24/10/05 20:47:23: [68826] VoIP call has been detected.
24/10/05 20:47:23: [68826] 10.0.0.145:49604 < -- > 10.0.0.200:49606
24/10/05 20:47:23: [68826] Encoding 0-PCMU-8KHz, recording.......
At the end of the call, you'll see that two .WAV files are created:
24/10/05 20:52:52: [68826] maximum idle time [10 secs] has been elapsed for this call, the call might have been ended.
24/10/05 20:52:52: [68826] .WAV file output/20051204/session-enc0-PCMU-8KHz-10.0.0.145,49604-10.0.0.200,49606.wav has been created successfully
24/10/05 20:52:52: [68826] .WAV file output/20051204/session-enc0-PCMU-8KHz-10.0.0.200,49606-10.0.0.145,49604.wav has been created successfully
This is a a non-complete list of questions frequently asked at voipong mailing list.
You can have a more recent and updated one within the FAQ at
VoIPong web site.
voipong-2.0/docs/users-manual/docbook.css 0100444 0001754 0000000 00000005633 10346322276 017552 0 ustar murat wheel /*
* Copyright (c) 2001, 2003 The FreeBSD Documentation Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: doc/share/misc/docbook.css,v 1.7 2004/03/22 19:17:52 ceri Exp $
*/
BODY ADDRESS {
line-height: 1.3;
margin: .6em 0;
}
BODY BLOCKQUOTE {
margin-top: .75em;
line-height: 1.5;
margin-bottom: .75em;
}
HTML BODY {
margin: 1em 8% 1em 10%;
line-height: 1.2;
}
.LEGALNOTICE {
font-size: small;
font-variant: small-caps;
}
BODY DIV {
margin: 0;
}
DL {
margin: .8em 0;
line-height: 1.2;
}
BODY FORM {
margin: .6em 0;
}
H1, H2, H3, H4, H5, H6,
DIV.EXAMPLE P B,
.QUESTION,
DIV.TABLE P B,
DIV.PROCEDURE P B {
color: #990000;
}
BODY H1 {
margin: .8em 0 0 -4%;
line-height: 1.3;
}
BODY H2 {
margin: .8em 0 0 -4%;
line-height: 1.3;
}
BODY H3 {
margin: .8em 0 0 -3%;
line-height: 1.3;
}
BODY H4 {
margin: .8em 0 0 -3%;
line-height: 1.3;
}
BODY H5 {
margin: .8em 0 0 -2%;
line-height: 1.3;
}
BODY H6 {
margin: .8em 0 0 -1%;
line-height: 1.3;
}
BODY HR {
margin: .6em
}
BODY IMG.NAVHEADER {
margin: 0 0 0 -4%;
}
OL {
margin: 0 0 0 5%;
line-height: 1.2;
}
BODY PRE {
margin: .75em 0;
line-height: 1.0;
color: #461b7e;
}
BODY TD {
line-height: 1.2
}
BODY TH {
line-height: 1.2;
}
UL, BODY DIR, BODY MENU {
margin: 0 0 0 5%;
line-height: 1.2;
}
HTML {
margin: 0;
padding: 0;
}
.FILENAME {
color: #007a00;
}
BODY H1, BODY H2, BODY H3, BODY H4, BODY H5, BODY H6 {
margin-left: 0
}
.GUIMENU, .GUIMENUITEM, .GUISUBMENU,
.GUILABEL, .INTERFACE, .GUIBUTTON,
.SHORTCUT, .SHORTCUT .KEYCAP {
background-color: #F0F0F0;
}
.ACCEL {
background-color: #F0F0F0;
text-decoration: underline;
}
.PROGRAMLISTING, .SCREEN {
margin-left: 3ex;
}
voipong-2.0/docs/users-manual/book.html 0100444 0001754 0000000 00000114245 10346322276 017240 0 ustar murat wheel
VoIPong User's Manual
VoIPong is a sniffer utility which tries to detects Voice Over IP calls on a pipeline,
and for those which have vocoder modules loaded, dumps actual conversation to seperate
wave files. Currently it can catch calls made via a wide variety of protocols including
SIP, H323, Cisco's Skinny Client
Protocol. It can also catch calls made through dummy IP adapters which do not
do any signalling but transport voice payload via RTP protocol.
It's been written in C language for performance reasons, proved to be running on Solaris, Linux and FreeBSD; though it's
thought to compile and run on other platforms as well.
On a 45 Mbit/sec actual network traffic, it's been verified that VoIPong successfully
detected all VoIP gateways and the VoIP calls. CPU utilization during the run has been
found ranging between 66% - 80% on a 256MB RAM, Celeron 1700 Mhz Toshiba notebook.
With its powerful and extensible Dynamic
Shared Object Modules (DSOM) subsystem, and its related API (will be
documented later), new third party voice decoder modules can be coded and installed,
resulting in a great flexibility. By default, VoIPong comes with two pre-written voice
decoder modules for calls encoded with G711
(u-law) and G711 (a-law)
. Audible output can be generated for calls encoded with any one of them.
Chapter 2. Features
Simple, optimized, extendable, fast code
Easy debugging
Easy installation and administration
Powerful management console (voipctl) for run-time server administration
Detailed logging
CSV style CDR (Call Detail Record) logs
Dynamic framework for multiple call-catching algorithms to co-exist together
Dynamic Shared Object Modules (DSOM) for loading of third party voice codec modules at
runtime.
Users can choose the best algorithm to suit their networks.
Produces audible output (.wav) for G711 (u-law) and G711 (a-law) codecs.
Output can be merged into one single file via soxmix.
You should have pcap library installed beforehand. Please
download libpcap from tcpdump.org and install it if you don't have it in your system. Please
note that most Operating Systems and Linux distributions provide this library in their
default installations.
Also, for .WAV file creation, you should have sox and soxmix tools installed. If you don't have those, please download
them from sox.sourceforge.net and
install it in your system.
Download the latest VoIPong tarball from EnderUNIX and uncompress it:
#tar zxvf voipong-version.tar.gz
There are several pre-written Makefile files in the source
directory. Examine each of them and choose the one which most suits your system. If
you're running of the the BSD type Operating Systems (i.e. FreeBSD, OpenBSD, NetBSD, Mac
OSX) copy Makefile.bsd as Makefile;
if you're using a Linux distribution then, copy Makefile.linux
as Makefile. You might need to change CFLAGS and LDFLAGS variables
accordingly:
#cp Makefile.bsd Makefile
Type make to compile voipong, voipctl and voice decoder modules:
#make
Type make install to copy compiled binaries, shared modules,
configuration files, manual pages and related documentation into the proper locations:
BSD Operating Systems (FreeBSD, NetBSD, OpenBSD, Darwin etc.) has a ports system for
easy package administration. VoIPong is a FreeBSD port, so you can install it from
FreeBSD ports tree. VoIPong is located in /usr/ports/audio/voipong directory:
Change your current working directory to /usr/ports/audio/voipong and type:
#cd /usr/ports/audio/voipong#make install clean
FreeBSD will fetch the tarball, uncompress it, compile the sources and install VoIPong
for you.
Alternatively, you can install VoIPong .tbz package with pkg_add (1) command:
Since release 2.0 upwards, VoIPong provides a powerful dynamic framework for loading
of 3rd party voice decoders into the running voipong executable at runtime. This is
called Dynamic Shared Object Modules (DSOM) Framework. Simply put, DSOM vocoder modules
are shared libraries with the .so extension. VoIPong looks for
those shared libraries in the preconfigured modpath directory,
loads them one by one. DSOM engine resident at VoIPong core, spots the initialization
method in the shared module and invokes it allowing the module to register itself inside
VoIPong runtime environment:
For security reasons, the DSOMs are expected to be owned by the same user and group
who is running the core VoIPong executable. For instance, if the user running the program
has uid 1000 and gid 10; the modules should also be owned by uid 1000 and gid 10.
The naming convention is that the modules should start with the modvocoder_ keyword, and should include the name of the decoder in
the module, followed by the .so extension. For example, the
correct name for the g711 (u-law) module can be modvocoder_pcmu.so.
There are two pre-written voice decoder modules with VoIPong release 2.0:
modvocoder_pcmu.so: g711 (u-law) decoder (payload type
0)
modvocoder_pcma.so: g711 (a-law) decoder (payload type
8)
To code and install your own vocoder module (i.e. for g726), VoIPong DSOM Decoder
Writer's Guide will be available soon.
Chapter 5. Configuration
Configuration files are all installed into VoIPong directory: /usr/local/etc/voipong. Main configuration parameters are included
in voipong.conf file. voipongnets
file maps network addresses to their proper algorithms. DSOM modules for g711-ulaw and g711-alaw (modvocoder_pcmu.so, modvocoder_pcma.so) are installed to the path given with the modpath configuration file directive.
Runtime configuration parameters vital to the smoothly operation of VoIPong server are
defined in voipong.conf, formatted as a standart .ini file. There are two sections: GENERAL for general server settings, and
FILTERS for setting up startup
filters.
logdir: specifies the log directory where voipong will save
its logs e.g. /var/log
logfile: name of the main server log file e.g. voipong.log
outdir: path where output .WAV and/or .RAW files are to be
written. e.g. /var/log/voipoutput
cdrfile: name of the CDR (Common Data Record) log file e.g.
cdr.log
networksfile: path to the network/algorithm mappings file
e.g. /usr/local/etc/voipong/voipongnets
pidfile: path to the pidfile e.g. /var/run/voipong.pid
soxpath: path to the sox executable e.g. /usr/local/bin/sox
modpath: path to the directory where vocoder DSOM modules are
installed. e.g. /usr/local/etc/voipong/modules
soxmixpath: path to the soxmix executable e.g. /usr/local/bin/soxmix
mgmt_ipcpath: path to the UNIX domain socket for management
console e.g. /tmp/voipongmgmt.sock
defalg: Default packet matching algorithm. This can currently
only be lfp. Other algorithms are to be developed. e.g. lfp
rtp_idle_time: (in seconds) when this amount of time elapses
and no RTP traffic is received for the call, the call is considered to be finished. e.g.
10
device: network device to sniff packets from e.g. eth0
promisc: set this to true 1 if you
want VoIpong to set your sniffing device to promiscious mode. e.g. set this to 1 for true, 0 for false.
mixwaves: set this to true 1 if you
want VoIPong to mix the seperate .WAV files into a single .WAV file. e.g. set this to 1 for true, 0 for false.
snaplen: maximum number of bytes to capture e.g. 1500
readtmt: specifies the read-from-device timeout in
milliseconds. e.g. 500
startup: Pcap filter string. This filter will be set during
startup procedures. To see detailed usage of pcap filters, see pcap(3) manual page. e.g.
"udp"
Sniffing out voice is a tough task. You cannot design an algorithm and expect to catch
all the VoIP calls. VoIP is relatively new and it is not a highly standardized
technology. So there have to be several call catching algorithms for various setups.
VoIPong provides a framework where you can set the call catching algorithm which you
think will best suit your VoIP infrastructure. This results in a much more specialized
and successful call sniffing.
This algorithm tries to detect calls generated via VoIP devices conforming to RTP and RTCP RFCs. This algorithm should detect and record a broad
range of calls. The most obvious advantage of this algorithm is that you'll have barely
no false positives. This is why this method is named as LFP. The #1 disadvantage will be
that this will not be able to catch calls if there are no RTCP packets or the devices do not conform to RFCs. To use
this algorithm, you will need to specify a network to use with it in your voipongnets
file.
Some VoIP devices (e.g. Grandstream(TM) IP adapters) use a fixed port to send and
receive RTP datagrams, and they do not conform to RFCs, and do not send any link control
information (RTCP packets). If you have such devices in your network, you can specify
their algorithm as fixed in the voipongnets file. This
algorithm cannot be used with networks, it can only be used with hosts, so netmask
address should always be 255.255.255.255. Please note that, after
the fixed keyword, you are expected to set the fixed port number the device is using. For
example, suppose that you have a device which uses port 40000 to
send RTP packets, you should add
this line to your voipongnets file:
LRA-SIP will follow SIP
signalling packets, and will spot the RTP/RTCP session from the SDP packets. This algorithm is not implemented yet, however I
will be working on it for the next release (probably 2.1.?)
Chapter 6. Usage
Similar to other sniffer tools at the market, VoIPong needs to get a copy of the voice
traffic you're interested in. If you're sharing a hub with one of the endpoints of the voice conversation, you
will not need to do anything, since hub devices inherently copy traffic to all its ports.
If you are in a switched
environment, some network administration will be needed. Most modern switch devices has a
handy "monitor port" which you can
use for copying traffic going through one or more switch ports. So you'll need to copy
one of the endpoints' traffic to that monitor port, and connect the computer on which
VoIPong is running. If you're running VoIPong on a gateway machine, where this machine has already access to all
the voice traffic, you will not need to do anything.
You can use -h switch to see available startup
parameters:
[murat@efe ~/voipong]$ ./voipong -h
usage: voipong [options]
options:
-h this screen
-v version info
-f run in foreground (don't become a daemon)
-d debug level. Valid levels are 0 through 4. Default: 0
-c config file path
-v switch shows VoIPong version information:
[murat@efe ~/voipong]$ ./voipong -v
EnderUNIX VOIPONG Voice Over IP Sniffer Release 2.0-DEVEL
Copyright (C) 2004 Murat Balaban murat || enderunix.org
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
For more information on licensing, please see LICENSE
file included in the voipong source distribution.
[murat@efe ~/voipong]$
You can set the debug log level by -d switch. Valid levels are
0 through 4, latter being the most
verbose. Default configuration file is /usr/local/etc/voipong/voipong.conf. You can use alternate
configuration file by issuing -c switch and providing full path
to the alternate configuration file. If you don't want VoIPong to daemonize, but instead
you want it to stay at your terminal and dump log messages to the terminal, you will need
to issue -f switch.
So, If you want VoIPong to stay at the terminal, and you want to see as many log
messages as possible, you should fire VoIPong as such:
[root@devel ~]$ voipong -d4 -f
EnderUNIX VOIPONG Voice Over IP Sniffer starting...
Release 2.0-DEVEL, running on devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
(c) Murat Balaban http://www.enderunix.org/
20/11/05 19:33:33: EnderUNIX VOIPONG Voice Over IP Sniffer starting...
20/11/05 19:33:33: Release 2.0-DEVEL running on devel.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]. (c) Murat Balaban http://www.enderunix.org/ [pid: 23627]
20/11/05 19:33:33: Default matching algorithm: lfp
20/11/05 19:33:33: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcmu.so (@0x2817f3bc)
20/11/05 19:33:33: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcma.so (@0x281813e0)
20/11/05 19:33:33: loaded 2 module(s)
20/11/05 19:33:33: loadnet(10.0.0.145/255.255.255.255) method: fixed 49604
20/11/05 19:33:33: loadnet(172.16.0.10/255.255.0.0) method: lfp
20/11/05 19:33:33: fxp0 has been opened in promisc mode. (43.43.43.0/255.255.255.192)
VoIPong provides the user with the ability to administer the server at runtime. You
can use voipctl command for this purpose. When fired, voipctl will connect VoIPong and will wait for user's commands:
voipong> help
Commands:
help : this one
quit : quit management console
uptime : Server uptime
setdebug [level] : set debug level to [level]
logrotate : rotate server's logs
shutdown : shutdown server
rusage : CPU usage statistics for the server
loadnets : Reload voipongnets file
info : General server information
shcall : Show currently monitored calls
shrtcp : Show currently RTCP cache
killcall [id] : end monitoring session with [id]
voipong>
uptime shows how long the server has been running:
voipong> uptime
Server uptime: 5 minutes 57 seconds
voipong>
!!: You can use !! command to issue the last command you typed.
(same as in sh):
voipong> !!
Server uptime: 6 minutes 13 seconds
voipong>
logrotate command rotates server logs:
voipong> logrotate
Logrotate successfull
voipong>
shutdown command will shutdown the server and close management
console connection
voipong> shutdown
rusage command will give information related to server's CPU
utilization
voipong> rusage
Current CPU usage stats:
----------------------------------------
Total "user" time : 0 seconds
Total used "system" time : 0 seconds
Shared Memory Size : 384 KB
Integral Memory Size : 1512 KB
Integral stack Size : 1024 KB
Page requests : 70
Page errors : 0
Block input operations : 0
Block output operations : 2
Messages sent : 1
Messages received : 1
Signals : 0
Voluntary "context switch"s : 78
Involuntary "context switch"s : 1
voipong>
loadnets command will re-read voipongnets and re-load
network/algorithms mapping table
voipong> loadnets
Networks file has been reloaded successfuly
voipong>
info command will give general server information
voipong> info
General Server Info:
--------------------------:
Server version : Release 2.0-DEVEL
System : efe.enderunix.org [FreeBSD 4.11-STABLE FreeBSD 4.11-STABLE #0: Tue Sep i386]
Current work. direct. : /usr/home/murat/voipong
Log level : 4
Process ID (PID) : 16240
User : root [Charlie &]
Group : 0
voipong>
setdebug command will change runtime log verbosity
voipong> setdebug 4
# set new debug level to 4
voipong>
shcall command will list calls currently monitored
It is strongly advised that you avoid running VoIPong with super-user, but use a
non-privileged special user created only for it. This section describes the steps you
should take to accomplish this. Note that these steps should be done after you compiled
and installed VoIPong successfully.
Create voipong user and group
#pw group add voipong#pw user add voipong -g voipong -m -s /usr/local/bin/bash
Change ownership of voipong, voipctl
and /usr/local/etc/voipong directory to voipong user:
Omer Faruk Sen has maintains VoIPong LiveCD! based on FreeSBIE project. LiveCD is an
ISO image which can be burnt into a blank CD directly, and includes pre-installed VoIPong
release along with several boot-time scripts for configuring the OS and VoIPong.
You can try VoIPong with Microsoft Netmeeting. Set up netmeeting so that it uses G711
at both ends, and make a voice call. You'll see the calls captured and wave files created
after your call finishes.
If you do not have a testbed, do not want so much pain to test VoIPong, you can replay
a test capture file in your machine and see if it is catched.
Download and install tcpreplay tool. Tcpreplay tool reads pcap capture files, and
re-injects the packets into a live network.
Start VoIPong
04/12/05 16:27:20: EnderUNIX VOIPONG Voice Over IP Sniffer starting...
04/12/05 16:27:20: Release 2.0-DEVEL running on efe.enderunix.org [FreeBSD 5.4-STABLE FreeBSD 5.4-STABLE #0: Sun Oct 23 16:39:41 EEST 2005 mb@efe.enderunix.org:/usr/src/sys/i386/compile/EFE i386]. (c) Murat Balaban http://www.enderunix.org/ [pid: 1075]
04/12/05 16:27:20: Default matching algorithm: lfp
04/12/05 16:27:20: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcmu.so (@0x2817f3bc)
04/12/05 16:27:20: loadmodule: /usr/local/etc/voipong/modules/modvocoder_pcma.so (@0x281813e0)
04/12/05 16:27:20: loaded 2 module(s)
04/12/05 16:27:20: loadnet(10.30.0.11/255.255.255.255) method: fixed 40000
04/12/05 16:27:20: em0 has been opened in promisc mode. (192.168.1.0/255.255.255.0)
Start tcpreplay with the test capture you just downloaded at
step 1.
[root@efe ~/calls/ok]$ /usr/local/sbin/tcpreplay -i em0 endercall2.pcap
sending on: em0
4534 packets (1344595 bytes) sent in 141.44 seconds
9506.2 bytes/sec 0.07 megabits/sec 32 packets/sec
You will see that VoIPong immediately starts monitoring your call. Following lines
will appear in your voipong.log file:
24/10/05 20:47:23: created a call recording instance!
24/10/05 20:47:23: [68826] VoIP call has been detected.
24/10/05 20:47:23: [68826] 10.0.0.145:49604 < -- > 10.0.0.200:49606
24/10/05 20:47:23: [68826] Encoding 0-PCMU-8KHz, recording.......
At the end of the call, you'll see that two .WAV files are created:
24/10/05 20:52:52: [68826] maximum idle time [10 secs] has been elapsed for this call, the call might have been ended.
24/10/05 20:52:52: [68826] .WAV file output/20051204/session-enc0-PCMU-8KHz-10.0.0.145,49604-10.0.0.200,49606.wav has been created successfully
24/10/05 20:52:52: [68826] .WAV file output/20051204/session-enc0-PCMU-8KHz-10.0.0.200,49606-10.0.0.145,49604.wav has been created successfully
This is a a non-complete list of questions frequently asked at voipong mailing list.
You can have a more recent and updated one within the FAQ at
VoIPong web site.
Chapter 9. Thanks
Please find a list of people and organizations who contributed or gave support to
VoIPong here .
voipong-2.0/CVS/ 0040755 0001754 0000000 00000000000 10346323241 012476 5 ustar murat wheel voipong-2.0/CVS/Root 0100644 0001754 0000000 00000000013 10346320213 013327 0 ustar murat wheel /cvsup/cvs
voipong-2.0/CVS/Repository 0100644 0001754 0000000 00000000010 10346320213 014560 0 ustar murat wheel voipong
voipong-2.0/CVS/Entries 0100644 0001754 0000000 00000002647 10346323241 014040 0 ustar murat wheel /ALGORITHMS/1.1/Thu Oct 20 08:26:33 2005//
/AUTHORS/1.1.1.1/Tue Oct 18 17:28:10 2005//
/COPYING/1.1.1.1/Tue Oct 18 17:28:15 2005//
/ChangeLog/1.13/Sun Dec 4 14:29:14 2005//
/conf.c/1.2/Wed Oct 19 11:18:34 2005//
/configure.in/1.1/Sun Nov 20 17:14:47 2005//
/miscutil.c/1.7/Fri Dec 9 14:59:26 2005//
/modvocoder_pcma.c/1.6/Fri Dec 9 14:59:26 2005//
/modvocoder_pcmu.c/1.6/Thu Nov 17 15:41:24 2005//
/voipctl.c/1.10/Fri Dec 9 14:59:26 2005//
/voipong.c/1.11/Fri Dec 9 14:59:26 2005//
/voipongcdr.c/1.2/Fri Dec 9 14:59:26 2005//
/voipongcodec.c/1.10/Tue Dec 6 09:07:56 2005//
/voipongfixed.c/1.2/Mon Nov 14 18:58:20 2005//
/voipongglobals.c/1.6/Sun Dec 4 14:27:35 2005//
/voiponglfp.c/1.3/Mon Nov 14 18:58:20 2005//
/voipongmgmt.c/1.7/Mon Nov 14 18:58:20 2005//
/voipongnet.c/1.3/Sat Oct 22 11:46:28 2005//
/voipongpcap.c/1.5/Fri Dec 9 14:59:26 2005//
/voipongsign.c/1.2/Fri Dec 9 14:59:26 2005//
/voipongsock.c/1.3/Wed Nov 23 18:59:15 2005//
/voipongvoip.c/1.5/Tue Dec 6 09:19:47 2005//
/voipongworker.c/1.12/Sat Nov 26 10:28:47 2005//
D/docs////
D/etc////
D/include////
/Makefile.bsd/1.3/Fri Dec 9 15:20:53 2005//
/Makefile.linux/1.3/Fri Dec 9 15:20:38 2005//
/INSTALL/1.3/Fri Dec 9 15:38:38 2005//
/KNOWN_BUGS/1.2/Fri Dec 9 15:45:33 2005//
/LICENSE/1.2/Fri Dec 9 15:42:46 2005//
/NEWS/1.2/Fri Dec 9 15:43:56 2005//
/README/1.2/Fri Dec 9 15:42:11 2005//
/THANKS/1.8/Fri Dec 9 15:43:18 2005//
/TODO/1.4/Fri Dec 9 15:44:06 2005//
voipong-2.0/etc/ 0040755 0001754 0000000 00000000000 10346320213 012612 5 ustar murat wheel voipong-2.0/etc/CVS/ 0040755 0001754 0000000 00000000000 10346320213 013245 5 ustar murat wheel voipong-2.0/etc/CVS/Root 0100644 0001754 0000000 00000000013 10346320213 014102 0 ustar murat wheel /cvsup/cvs
voipong-2.0/etc/CVS/Repository 0100644 0001754 0000000 00000000014 10346320213 015337 0 ustar murat wheel voipong/etc
voipong-2.0/etc/CVS/Entries 0100644 0001754 0000000 00000000140 10346320213 014571 0 ustar murat wheel /voipong.conf/1.10/Sun Dec 4 14:27:35 2005//
/voipongnets/1.1.1.1/Tue Oct 18 17:28:26 2005//
D
voipong-2.0/etc/voipong.conf 0100755 0001754 0000000 00000002511 10344576327 015162 0 ustar murat wheel #
# voipong.conf
# VOIPONG konfigurasyon dosyasi
#
# VoIPong Voice Over IP Sniffer
# Copyright (C) 2004,2005 Murat Balaban
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# $Id: voipong.conf,v 1.10 2005/12/04 14:27:35 murat Exp $
#
[GENERAL]
logdir = /var/log
logfile = voipong.log
cdrfile = /var/log/voipcdr.log
networksfile = /usr/local/etc/voipong/voipongnets
pidfile = /var/run/voipong.pid
mgmt_ipcpath = /tmp/voipongmgmt.sock
soxpath = /usr/local/bin/sox
soxmixpath = /usr/local/bin/soxmix
modpath = /usr/local/etc/voipong/modules
mixwaves = 1
defalg = lfp
rtp_idle_time = 10
#device = fxp0
device = em0
promisc = 1
snaplen = 1500
readtmt = 500
outdir = output
[FILTERS]
startup = "udp"
voipong-2.0/etc/voipongnets 0100644 0001754 0000000 00000000105 10325230272 015103 0 ustar murat wheel #10.0.0.145/255.255.255.255 fixed 49604
#172.16.0.10/255.255.0.0 lfp
voipong-2.0/include/ 0040755 0001754 0000000 00000000000 10346321170 013465 5 ustar murat wheel voipong-2.0/include/CVS/ 0040755 0001754 0000000 00000000000 10346322430 014120 5 ustar murat wheel voipong-2.0/include/CVS/Root 0100644 0001754 0000000 00000000013 10346320213 014752 0 ustar murat wheel /cvsup/cvs
voipong-2.0/include/CVS/Repository 0100644 0001754 0000000 00000000020 10346320213 016204 0 ustar murat wheel voipong/include
voipong-2.0/include/CVS/Entries 0100644 0001754 0000000 00000001271 10346322430 015452 0 ustar murat wheel /Makefile.am/1.1/Thu Dec 8 10:57:46 2005//
/conf.h/1.1.1.1/Tue Oct 18 17:28:25 2005//
/g711.h/1.2/Wed Oct 26 12:28:14 2005//
/miscutil.h/1.5/Sun Oct 30 14:31:07 2005//
/osspecific.h/1.1.1.1/Tue Oct 18 17:28:25 2005//
/voipongcdr.h/1.1/Sat Oct 22 12:00:53 2005//
/voipongcodec.h/1.2/Sun Oct 23 11:53:49 2005//
/voipongmgmt.h/1.1.1.1/Tue Oct 18 17:28:26 2005//
/voipongnet.h/1.2/Sat Oct 22 11:46:28 2005//
/voipongpcap.h/1.1.1.1/Tue Oct 18 17:28:25 2005//
/voipongsign.h/1.1.1.1/Tue Oct 18 17:28:25 2005//
/voipongsock.h/1.1.1.1/Tue Oct 18 17:28:25 2005//
/voipongvoip.h/1.1.1.1/Tue Oct 18 17:28:26 2005//
/voipongworker.h/1.4/Mon Nov 14 18:58:21 2005//
/voipong.h/1.2/Fri Dec 9 15:27:52 2005//
D
voipong-2.0/include/Makefile.am 0100644 0001754 0000000 00000000347 10346010652 015522 0 ustar murat wheel noinst_HEADERS = conf.h\
g711.h\
miscutil.h\
osspecific.h\
voipong.h\
voipongcdr.h\
voipongcodec.h\
voipongmgmt.h\
voipongnet.h\
voipongpcap.h\
voipongsign.h\
voipongsock.h\
voipongvoip.h\
voipongworker.h
voipong-2.0/include/conf.h 0100644 0001754 0000000 00000004046 10325230271 014562 0 ustar murat wheel #ifndef CONF_H__
#define CONF_H__
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#define CONFERRBUFSIZ 1024
#define CONFFILESIZ 256
#define SECTSIZ 256
#define KEYWORDSIZ 256
#define VALSIZ 1024
typedef struct confsect confsect;
typedef struct confnode confnode;
typedef struct config config;
struct confnode {
char node[KEYWORDSIZ];
char val[VALSIZ];
struct confnode *next;
};
struct confsect {
char sect[SECTSIZ];
struct confnode *nodes;
struct confsect *next;
};
struct config {
char file[CONFFILESIZ];
struct confsect *sects;
};
int
config_getsectionname(char *sect, int len, char *buf);
int
config_getkwvalpair(char *kw, int kwlen, char *val, int vallen, char *buf);
config *
config_parse(config *cfg, FILE *fp, char *errbuf);
config *
config_load(config *cfg, const char *path, char *errbuf);
void
config_dump(const config *cfg);
void
config_free(config *cfg);
const char *
config_getval(config *cfg, char *st, char *kw);
int
config_getstr(config *cfg, char *st, char *kw, char *out, int outlen);
int
config_getint(config *cfg, char *st, char *kw, int defval);
long
config_getlong(config *cfg, char *st, char *kw, long defval);
double
config_getdouble(config *cfg, char *st, char *kw, double defval);
int
config_save(const config *cfg, char *errbuf);
#endif
voipong-2.0/include/g711.h 0100644 0001754 0000000 00000001616 10327673136 014331 0 ustar murat wheel #ifndef G711_H
#define G711_H
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
int ulaw2linear(u_char u_val);
int alaw2linear(u_char u_val);
#endif
voipong-2.0/include/miscutil.h 0100644 0001754 0000000 00000005441 10331154453 015472 0 ustar murat wheel
#ifndef MISCUTIL_H
#define MISCUTIL_H
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#define MISC_LOGFG 1
#define MISC_LOGBG 0
#define O_LOGHEX 0x00000001
#define O_LOGCHAR 0x00000002
#define read_lock(fd) \
misc_lockreg(fd, F_SETLK, F_RDLCK, 0, SEEK_END, 0)
#define readw_lock(fd) \
misc_lockreg(fd, F_SETLKW, F_RDLCK, 0, SEEK_END, 0)
#define write_lock(fd) \
misc_lockreg(fd, F_SETLK, F_WRLCK, 0, SEEK_END, 0)
#define writew_lock(fd) \
misc_lockreg(fd, F_SETLKW, F_WRLCK, 0, SEEK_END, 0)
#define un_lock(fd) \
misc_lockreg(fd, F_SETLK, F_UNLCK, 0, SEEK_END, 0)
void misc_setlogtype(int t);
void misc_setlogdir(const char *);
void misc_setlogfile(const char *);
void misc_setloglevel(int);
int misc_getlogleve();
int misc_openlog();
int misc_closelog();
void misc_debug(int, char *, ...);
void misc_devmsglog(char *a, int flags, unsigned char *buf, int len);
void misc_devlogx(char *a, int flags, unsigned char *buf, int len, char direction);
void misc_devlog(char *a, char *fmt, ...);
int misc_rotatelog();
char * misc_getunamestr(char *, int);
char * misc_getuptimestr(char *, int, time_t);
char *misc_inet_ntoa(int);
int misc_inet_addr(char *);
char *misc_trim(char *, int);
char *misc_trimnewline(char *, int);
int misc_hexstr2raw(char *str, char *out, int len);
int misc_hexchar2int(char *str);
int misc_substr(char *out, char *in, int offset, int len);
int misc_strftime(char *out, int len, char *fmt);
int misc_strftimegiven(char *out, int len, char *fmt, time_t tv);
int misc_strstr(char *out, int outlen, char *in, int inlen, char sep, int sepix);
double misc_getamount(char *stramount, int currencycode);
double misc_timediff(struct timeval *t2, struct timeval *t1);
int misc_trimnongraph(char *str, int len);
int misc_getdayofmonth(time_t *tv);
int misc_getmonth(time_t *tv);
int misc_getyear(time_t *tv);
char * misc_strbuf(char *hs, int hslen, char *ndl, int ndllen);
int misc_lockreg(int fd, int cmd, int type, int offset, int whence, int len);
void misc_strrev(char *str, int len);
#endif
voipong-2.0/include/osspecific.h 0100644 0001754 0000000 00000000065 10325230271 015761 0 ustar murat wheel #ifndef __OSSPECIFIC__
#define __OSSPECIFIC__
#endif
voipong-2.0/include/voipong.h 0100644 0001754 0000000 00000002516 10346321170 015320 0 ustar murat wheel
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef VOIPONG_H
#define VOIPONG_H
#define PROGRAM "EnderUNIX VOIPONG Voice Over IP Sniffer"
#define VERSION "Release 2.0"
#define COPYRIGHT "(c) Murat Balaban http://www.enderunix.org/"
#include
enum {
ERRBUFSIZ = 1024,
MAXSBUFSIZ = 128,
MAXMBUFSIZ = 512,
MAXBUFSIZ = 1024,
MAXLBUFSIZ = 2048,
MAXXBUFSIZ = 4096,
MAXXXBUFSIZ = 8192
};
void graceful_shutdown();
void reload();
void usage();
void wexit(int);
void waitforevents(void);
void process_deadchild(void);
void init_config();
void get_initcfgvals();
#endif
voipong-2.0/include/voipongcdr.h 0100644 0001754 0000000 00000000132 10326424765 016015 0 ustar murat wheel #ifndef CDR_H_
#define CDR_H_
#include
int add2cdr(worker *);
#endif
voipong-2.0/include/voipongcodec.h 0100644 0001754 0000000 00000000434 10326674715 016331 0 ustar murat wheel #ifndef VOIPONGCODEC_H_
#define VOIPONGCODEC_H_
#define MAXCODECS 128
typedef int vocoder_t(int, unsigned char *, int);
typedef struct vocoder vocoder;
struct vocoder {
int rate;
vocoder_t *f;
};
void init_vocoders(void);
int vocoder_default(int, unsigned char *, int);
#endif
voipong-2.0/include/voipongmgmt.h 0100644 0001754 0000000 00000002103 10325230272 016174 0 ustar murat wheel #ifndef MGMTCONSOLE_H
#define MGMTCONSOLE_H
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define MGMTMAXPASSTRIES 3
#include
#include
#include
int is_mgmt_active();
void accept_mgmt_client(int);
void process_mgmt_request();
void close_mgmt_client();
int get_mgmt_fd();
#endif
voipong-2.0/include/voipongnet.h 0100644 0001754 0000000 00000002432 10326423224 016025 0 ustar murat wheel
#ifndef VOIPONGNET_H
#define VOIPONGNET_H
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
enum algos {
ALGORITHM_LFP = 1,
ALGORITHM_LRA = 2,
ALGORITHM_FIXED
};
typedef struct vnet vnet;
struct vnet {
int addr;
int mask;
int algo;
int fixport;
short inuse;
void (*op) (struct vnet *, unsigned char *udata, const struct pcap_pkthdr *pkthdr, const unsigned char *packet);
struct vnet *next;
};
int loadnetfile(char *netfile);
void init_vnet();
void free_vnet();
vnet *get_vnet();
#endif
voipong-2.0/include/voipongpcap.h 0100644 0001754 0000000 00000003202 10325230271 016153 0 ustar murat wheel
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef VOIPONGPCAP_H
#define VOIPONGPCAP_H 1
#define isodd(x) (x & 1)
#define iseven(x) !(x & 1)
#include
#include
typedef struct voipstat voipstat;
struct voipstat {
double totalpack;
double rtcppack;
double rtcpsess;
double rtpsess;
};
voipstat * getstats();
void setstats(voipstat *s);
int initpcap(int, char *, char *errbuf);
int getdllen();
void peekpcap(int, pcap_handler);
pcap_t *getpcapt();
void packet_handler(u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
void packet_handler_lfp(vnet *, u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
void packet_handler_lra(vnet *, u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
void packet_handler_fixed(vnet *, u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
#endif
voipong-2.0/include/voipongsign.h 0100644 0001754 0000000 00000002003 10325230271 016166 0 ustar murat wheel #ifndef SIGNALOPS_H
#define SIGNALOPS_H
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void sighandler(int);
void sigint_handler();
void sigterm_handler();
void sigusr2_handler();
void sighup_handler();
void sigchld_handler();
void sigworkerhandler(int);
#endif
voipong-2.0/include/voipongsock.h 0100644 0001754 0000000 00000002242 10325230271 016172 0 ustar murat wheel
#ifndef VOIPONGSOCKET_H
#define VOIPONGSOCKET_H
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#define AUTHCLIRBUFSIZ 8192
int open_server_socket();
void add_to_select_set(int);
void remove_from_select_set(int);
void sockets_run(void);
/*
void init_socket();
void close_all_connections();
void setselecttimeout(int val);
int getselecttimeout(void);
int open_server_socket(int, int *);
*/
#endif
voipong-2.0/include/voipongvoip.h 0100644 0001754 0000000 00000004431 10325230272 016213 0 ustar murat wheel #ifndef RTP_H
#define RTP_H
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define PT_ULAW 0
#define PT_G723 4
#define PT_G729 18
#define SNAPLEN 1514
#define MAXNODE 10000
#include
#include
typedef struct rtp_session {
u_int32_t ip1;
u_int16_t port1;
u_int32_t ip2;
u_int16_t port2;
char dev[256];
int rate;
int size;
int enc;
int pid;
time_t stime;
struct rtp_session *next;
} rtp_session;
typedef struct rtcp_session rtcp_session;
struct rtcp_session {
u_int32_t ip1;
u_int16_t port1;
u_int32_t ip2;
u_int16_t port2;
time_t stime;
struct rtcp_session *next;
};
struct rtphdr {
unsigned int cc:4;
unsigned int ext:1;
unsigned int pad:1;
unsigned int ver:2;
unsigned int pt:7;
unsigned int mark:1;
u_int16_t seq;
u_int32_t timestamp;
u_int32_t ssrc;
u_int32_t csrc;
};
typedef struct u_data {
u_int32_t ip_arr[2];
int fd[2];
char ip1[24];
char ip2[24];
int dloffset;
int last_req1;
int last_req2;
} u_data;
#define IP_L sizeof(struct ip)
#define UDP_L sizeof(struct udphdr)
#define RTP_L sizeof(struct rtphdr)
void removertcp();
void probertp(u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
void probertcp(u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
int child_loop(pcap_t *pd, int cnt, pcap_handler callback, u_char *user);
unsigned int tuplehash(u_int32_t sip, u_int32_t dip, u_int16_t sp, u_int16_t dp);
void init_voip();
int create_rtp_instance(rtcp_session **, u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
#endif
voipong-2.0/include/voipongworker.h 0100644 0001754 0000000 00000001542 10336157115 016555 0 ustar murat wheel #ifndef ___WORKER_H
#define ___WORKER_H
#include
#include
#include
typedef struct worker worker;
struct worker {
pid_t pid;
rtcp_session *rtcp;
rtp_session *rtp;
int ip1fd;
int ip2fd;
char file1name[MAXLBUFSIZ];
char file2name[MAXLBUFSIZ];
time_t stime;
time_t etime;
struct worker *next;
};
void init_workers();
void worker_main(worker *, int, unsigned char *);
void kill_workers();
worker *getworkerbypid(pid_t );
void worker_remove(worker *);
int worker_create(worker **, int, unsigned char *);
int worker_isexist(u_int32_t, u_int32_t, u_int16_t, u_int16_t);
int create_wave();
int exec_sox(char *, char *, char *, char *, char *);
int exec_soxmix(char *, char *, char *);
int create_outpath();
void worker_graceful_exit(int);
void dumprtppayload(u_char *, const struct pcap_pkthdr *, const u_char *);
#endif
voipong-2.0/ALGORITHMS 0100644 0001754 0000000 00000002770 10325652271 013447 0 ustar murat wheel
VOIPONG ALGORITHMS
Following release 2.0, voipong has started to provide a framework where the
user will be able to select the algorithm that will be used for a network.
This will hopefully enable the user to select the best algorithm to suit his
VoIP infrastructure, so that many more calls can be detected.
There are two currently active algorithms:
1. LFP (Least False Positive) Algorithm:
----------------------------------------
This algorithm tries to detect calls generated via VoIP devices conforming to
RTP and RTCP RFCs. This algorithm should be able to detect and record a wide
range of calls (about 70 % - 80 %).
To use this algorithm, you'll need to specify a network to use with it in your
voipongnets configuration file.
E.g.:
172.16.1.0/255.255.255.0 lfp
2. FIXED (Fixed Port) Algorithm:
--------------------------------
Some VoIP devices (e.g. Grand Stream IP phone adapters) use a fixed port to
send and receive RTP packets, and they do not conform to RFCs. If you have
such a device, you'll need to specify it in your voipongnets file:
E.g.:
172.16.1.101/255.255.255.255 fixed 40000
The number next to "fixed" keyword specifies the fixed port number the device
uses for RTP transportation.
3. LRA-SIP (Least Run Away - SIP) Algorithm:
--------------------------------------------
This algo will follow SIP signalling packets, and will spot the RTP/RTCP session
from the SDP packets.
LRA-SIP is not implemented yet, however I'll be working on it for the
next release (probably 2.1).
voipong-2.0/INSTALL 0100644 0001754 0000000 00000004451 10346322376 013105 0 ustar murat wheel
EnderUNIX VoIPong 2.0 INSTALL
The program is tested on
- FreeBSD 5.4
- Solaris 8
- istanbulX GNU/Linux
[1] Prerequisites
a) You should have libpcap packet capturing library installed
b) For .WAV file creation, you should install sox program
and supply sox and soxmix path in voipong.conf configuration file.
To compile VoIPong:
There are several pre-written Makefiles in the source directory. Examine each of
them and choose the one which most suits your system. If you're running of the
the BSD type Operating Systems (i.e. FreeBSD, OpenBSD, NetBSD, Mac OSX) copy
Makefile.bsd as Makefile; if you're using a Linux distribution then, copy
Makefile.linux as Makefile. You might need to change CFLAGS and LDFLAGS variables
accordingly.
After you've chosen the Makefile and copied it, type make to compile VoIPong:
# make
To install the compiled binaries, type:
# make install
and binaries will be installed at /usr/local/bin/, the configuration
file will be installed as /usr/local/etc/voipong.conf, and the algorithm
specification file as /usr/local/etc/voipongnets.
You're done. All you need to edit the configuration file, change
soxpath and device parameters to suit your system and fire voipong
$ voipong
You can connect to mgmt interface and control your server from the
interface. Use voipctl command for this purpose:
mb@efe ~$ voipctl
Connected to /var/run/voipongmgmt.sock.
Escape character is '^]'.
EnderUNIX VOIPONG Voice Over IP Sniffer Welcome to management console
System: efe.enderunix.org [FreeBSD 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun May 8 10:21:06 UTC 2005 root@harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386]
voipong>
voipong> help
Commands:
help : this one
quit : quit management console
logrotate : rotate server's logs
shutdown : shutdown server
rusage : CPU usage statistics for the server
info : General server information
uptime : Server uptime
shcall : Show currently monitored calls
shrtcp : Show current RTCP cache
killcall [id] : end monitoring session with [id]
voipong>
Please see ALGORITHMS file for a quick primer on using VoIPong's call catching algorithms.
Wed Sep 28 16:42:02 EEST 2005
http://www.enderunix.org
voipong-2.0/KNOWN_BUGS 0100644 0001754 0000000 00000000310 10346323235 013474 0 ustar murat wheel
- Some calls might not be detected, see Question 2:
http://www.enderunix.org/voipong/index.php?sect=faq&lang=en
- Only for G711 u-law and G711 a-law payload types will there be
.WAV files.
voipong-2.0/LICENSE 0100644 0001754 0000000 00000003444 10346322766 013065 0 ustar murat wheel
EnderUNIX VoIPong Voice Over IP Sniffer
Copyright (C) 2004 - ... Murat Balaban
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Murat Balaban retains copyright to VoIPong as a whole (including, but not
limited to, call catching algorithms), and therefore can grant, at his sole
discretion, the ability for companies, individuals, or organizations to
create proprietary or Open Source (but non-GPL'd) modules which may be
dynamically linked at runtime or statically linked at compile time with the
portions of VoIPong which fall under his copyright umbrella, or are
distributed under more flexible licenses than GPL.
If you want to use my code in your GPL'd programs, go for it -- there is no
requirement that you provide the same exemption in your GPL'd products
(although if you've written a module for VoIPong I would strongly encourage
you to make the same exemption that I do).
You can see GPL-License file for details about GNU General Public License
http://www.enderunix.org
http://www.enderunix.org/voipong/
http://www.enderunix.org/murat/
voipong-2.0/Makefile.bsd 0100644 0001754 0000000 00000004200 10346320325 014243 0 ustar murat wheel #
# VoIPong Voice Over IP Sniffer
# Copyright (C) 2005 Murat Balaban
# All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
CC=cc
CFLAGS= -g -Wall -Iinclude
SHLIBS=-lpcap
CLEARX = rm -f *~ *core* *pid
all: voipong voipctl modules
modules: modvocoder_pcmu modvocoder_pcma
modvocoder_pcmu:
$(CLEARX)
$(CC) -fPIC $(CFLAGS) -c modvocoder_pcmu.c
$(CC) -shared -nostdlib -o modvocoder_pcmu.so modvocoder_pcmu.o
modvocoder_pcma:
$(CLEARX)
$(CC) -fPIC $(CFLAGS) -c modvocoder_pcma.c
$(CC) -shared -nostdlib -o modvocoder_pcma.so modvocoder_pcma.o
OBJS= miscutil.o conf.o voipongglobals.o voipongsign.o voipong.o voipongsock.o \
voipongnet.o voipongpcap.o voipongvoip.o voipongmgmt.o voipongworker.o \
voipongcdr.o voipongcodec.o voiponglfp.o voipongfixed.o
voipong: $(OBJS)
$(CLEARX)
$(CC) -g -o voipong $(CFLAGS) $(LDFLAGS) $(OBJS) $(STLIBS) $(SHLIBS)
voipctl: voipctl.o voipongglobals.o
$(CLEARX)
$(CC) -g -o voipctl voipctl.o voipongglobals.o conf.o miscutil.o $(CFLAGS)
install:
mkdir -p /usr/local/etc/voipong
mkdir -p /usr/local/etc/voipong/modules
cp voipong /usr/local/bin/
cp voipctl /usr/local/bin/
cp etc/voipong.conf /usr/local/etc/voipong/
chmod 750 /usr/local/bin/voipong
chmod 750 /usr/local/bin/voipctl
chmod 600 /usr/local/etc/voipong/voipong.conf
cp modvocoder_*.so /usr/local/etc/voipong/modules/
chmod 500 /usr/local/etc/voipong/modules/*
cls:
$(CLEARX)
clean:
$(CLEARX)
rm -f voipong voipctl $(OBJS) *.o *.so *~
voipong-2.0/Makefile.linux 0100644 0001754 0000000 00000004205 10346320306 014636 0 ustar murat wheel #
# VoIPong Voice Over IP Sniffer
# Copyright (C) 2005 Murat Balaban
# All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
CC=cc
CFLAGS= -g -Wall -Iinclude
SHLIBS=-lpcap -ldl
CLEARX = rm -f *~ *core* *pid
OBJS= miscutil.o conf.o voipongglobals.o voipongsign.o voipong.o voipongsock.o \
voipongnet.o voipongpcap.o voipongvoip.o voipongmgmt.o voipongworker.o \
voipongcdr.o voipongcodec.o voiponglfp.o voipongfixed.o
all: modules voipong voipctl
voipong: $(OBJS)
$(CLEARX)
$(CC) -g -o voipong $(CFLAGS) $(LDFLAGS) $(OBJS) $(STLIBS) $(SHLIBS)
voipctl: voipctl.o voipongglobals.o
$(CLEARX)
$(CC) -g -o voipctl voipctl.o voipongglobals.o conf.o miscutil.o $(CFLAGS)
modules: modvocoder_pcmu modvocoder_pcma
modvocoder_pcmu:
$(CLEARX)
$(CC) -fPIC $(CFLAGS) -c modvocoder_pcmu.c
$(CC) -shared -nostdlib -o modvocoder_pcmu.so modvocoder_pcmu.o
modvocoder_pcma:
$(CLEARX)
$(CC) -fPIC $(CFLAGS) -c modvocoder_pcma.c
$(CC) -shared -nostdlib -o modvocoder_pcma.so modvocoder_pcma.o
install:
mkdir -p /usr/local/etc/voipong
mkdir -p /usr/local/etc/voipong/modules
cp voipong /usr/local/bin/
cp voipctl /usr/local/bin/
cp etc/voipong.conf /usr/local/etc/voipong/
chmod 750 /usr/local/bin/voipong
chmod 750 /usr/local/bin/voipctl
chmod 600 /usr/local/etc/voipong/voipong.conf
cp modvocoder_*.so /usr/local/etc/voipong/modules/
chmod 500 /usr/local/etc/voipong/modules/*
cls:
$(CLEARX)
clean:
$(CLEARX)
rm -f voipong voipctl $(OBJS) *.o *.so *~
voipong-2.0/NEWS 0100644 0001754 0000000 00000000412 10346323074 012540 0 ustar murat wheel - VoIPong 2.0 has been released (2005/12/9)
- VoIPong 2.0-DEVEL has been released for beta testers (2005/10/18)
- VoIPong has been awarded the first standing in IBM Turkiye Linux competition. (2004/12/15)
- VoIPong 1.1 has been released for public use. (2004/12/15)
voipong-2.0/README 0100755 0001754 0000000 00000002374 10346322723 012735 0 ustar murat wheel
EnderUNIX VoIPong
VoIP call detector and voice dumper
VoIPong is a utility which detects all Voice Over IP calls
on a pipeline, and for those which are G711 encoded, dumps actual
conversation to seperate wave files. It supports SIP, H323, Cisco's
Skinny Client Protocol, RTP and RTCP.
It's been written in C language for performance reasons, proved
to be running on Solaris, Linux and FreeBSD; though it's thought to compile
and run on other platforms as well.
It's multi-algoritm framework enables users with the ability to
suit the best packet matching algorithm for their environment.
On a 45 Mbit/sec actual network traffic, it's been verified
that VoIPong successfully detected all VoIP gateways and the VoIP calls.
CPU utilization during the run has been found ranging between 66% - 80%
on a 256MB RAM, Celeron 1700 Mhz Toshiba notebook.
With it's dynamic framework for coding 3rd party voice codecs,
the current decoding capability can be easily extended.
VoIPong has been awarded the first standing by IBM Turkiye in its Linux Awards
2004 competition.
Please see INSTALL file in this tarball, and the online User's Manual available at:
http://www.enderunix.org/voipong/manual/ to compile and install VoIPong into your
system.
voipong-2.0/THANKS 0100644 0001754 0000000 00000003775 10346323026 012770 0 ustar murat wheel
Special thanks to:
* IBM Turk for electing VoIPong as the best project in Linux Awards 2004.
* Baris Simsek
for his work on VoIPong autoconf scripts, pointers for codecs and CDR file.
* Omer Faruk Sen
for his work on VoIPong Live-CD!.
* Halil Demirezen for the Solaris Makefile.
* EnderUNIX team for their invaluable support and friendships
* Alex Barger
for bug-reports, patches and sample voice sessions.
* Andreas Jutzy
for the hint about G711 PCMA support.
* Eric [valgasu at club-internet dot fr]
for the hint about fixed ip-port IP adapters
* Pete Erickson
fot the news about Gentoo-Linux compilation
* "Vitalij Gura"
for the codec pointers
* Ignacio Bolivar
for the codec pointers
* Stijn Vande Casteele
for the hint about startup filters
* Mark Wiater
for the idea of generating much more information out of RTP/RTCP.
* Ami Chayun
for the notice about daemon_init pidfile locking issue.
* bobci
for bug-reports
* Aaron Schulman
for letting me know that VoIPong runs on OS X 10.4.2
* Kevin Watkins
for .wav file injection idea.
* Rob Deker
for bug-reports
for sample voice sessions:
* Rupa Schomaker
* Ramamohan Yeggoni
* Richard Hill
* Jonathan Wilson
* Clement Chen
* Rodrigo Frez
* Andrea wizard
* Eric Alexander
* Iqbal < iqbal at gigo dot co dot uk>
Wed Sep 28 16:58:31 EEST 2005
voipong-2.0/TODO 0100644 0001754 0000000 00000000714 10346323106 012532 0 ustar murat wheel
VoIPong TODO
* Implement "algorithm SIP" (a.k.a. algorithm lra) ,
where VoIPong will trace SIP signalling and catch calls
out of SDP packets.
* VoIPong Distributed:
Redesign and code call recording so that it can be done in a
distributed manner
* Collect call statistics out of RTP/RTCP packets.
* Better Cisco Skinny support (i.e. extract phone numbers)
* G726 codec support
Investigate further: Ignecio's mail
* G723.1 codec support
voipong-2.0/conf.c 0100644 0001754 0000000 00000017114 10325425612 013137 0 ustar murat wheel
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
static const char emptystr[] = "";
int
config_getsectionname(char *sect, int len, char *buf)
{
int i = 0;
int j = 0;
int buflen = strlen(buf);
memset(sect, 0, len);
for (buf++, buflen--; j < len - 1 && i < buflen && buf[i] != ']'; i++)
sect[j++] = buf[i];
sect[j] = '\0';
return j;
}
int
config_getkwvalpair(char *kw, int kwlen, char *val, int vallen, char *buf)
{
int j = 0;
char *cp1 = NULL;
int buflen = strlen(buf);
memset(kw, 0, kwlen);
memset(val, 0, vallen);
cp1 = buf;
for (; !isgraph(*cp1) && (cp1 - buf) < buflen; cp1++)
;
for (; *cp1 != '=' && *cp1 != '#' && *cp1 != ' ' && (j < kwlen - 1) && (cp1 - buf) < buflen; cp1++, j++)
kw[j] = *cp1;
kw[j] = '\0';
if (strlen(kw) == 0)
return 0;
for (; (!isgraph(*cp1) || *cp1 == '=') && (cp1 - buf) < buflen; cp1++)
;
j = 0;
if (*cp1 == '"')
for (cp1++; *cp1 != '"' && (j < vallen - 1) && (cp1 - buf) < buflen; cp1++, j++)
val[j] = *cp1;
else
for (; *cp1 != '#' && (j < vallen - 1) && (cp1 - buf) < buflen; cp1++, j++)
val[j] = *cp1;
val[j] = '\0';
if (strlen(val) == 0)
return 0;
return 1;
}
config *
config_parse(config *cfg, FILE *fp, char *errbuf)
{
char kw[KEYWORDSIZ];
char val[VALSIZ];
char buf[2048];
char sect[SECTSIZ];
int line;
confsect *sptr = NULL;
confnode *nptr = NULL;
confsect *cursect = NULL;
line = 0;
while(fgets(buf, sizeof(buf) - 1, fp) != NULL) {
/* misc_trimnongraph(buf, strlen(buf)); */
misc_trimnewline(buf, strlen(buf));
line++;
if (buf[0] == '#' || strlen(buf) == 0)
continue;
if (buf[0] == '[') {
config_getsectionname(sect, sizeof(sect), buf);
if ((sptr = (confsect *)calloc(1, sizeof(confsect))) == NULL) {
config_free(cfg);
return NULL;
}
strncpy(sptr->sect, sect, SECTSIZ - 2);
sptr->next = cfg->sects;
cfg->sects = sptr;
cursect = sptr;
continue;
}
if (!config_getkwvalpair(kw, sizeof(kw), val, sizeof(val), buf))
continue;
if (cursect == NULL) {
if ((sptr = (confsect *)calloc(1, sizeof(confsect))) == NULL) {
config_free(cfg);
return NULL;
}
strncpy(sptr->sect, "DEFAULT", SECTSIZ - 2);
sptr->next = cfg->sects;
cfg->sects = sptr;
cursect = sptr;
}
if ((nptr = (confnode *)calloc(1, sizeof(confnode))) == NULL) {
config_free(cfg);
return NULL;
}
strncpy(nptr->node, kw, KEYWORDSIZ - 2);
strncpy(nptr->val, val, VALSIZ - 2);
nptr->next = cursect->nodes;
cursect->nodes = nptr;
}
fclose(fp);
return cfg;
}
config *
config_load(config *cfg, const char *path, char *errbuf)
{
FILE *fp = NULL;
if ((fp = fopen(path, "r")) == NULL) {
if (errbuf != NULL)
snprintf(errbuf, CONFERRBUFSIZ - 2, "config_load: fopen(%s) failed: %s", path, strerror(errno));
return NULL;
}
strncpy(cfg->file, path, CONFFILESIZ - 2);
cfg->sects = NULL;
return config_parse(cfg, fp, errbuf);
}
void
config_dump(const config *cfg)
{
confsect *sect = NULL;
confnode *node = NULL;
printf("config_dump for file %s\n\n", cfg->file);
for (sect = cfg->sects; sect != NULL; sect = sect->next) {
printf("[%s]\n", sect->sect);
for (node = sect->nodes; node != NULL; node = node->next)
printf("\t%s = %s\n", node->node, node->val);
printf("\n");
}
}
void
config_free(config *cfg)
{
confsect *sect = NULL;
confnode *node = NULL;
for (sect = cfg->sects; sect != NULL; sect = sect->next) {
for (node = sect->nodes; node != NULL; node = node->next)
free(node);
free(sect);
}
cfg->sects = NULL;
}
const char *
config_getval(config *cfg, char *st, char *kw)
{
confsect *sect = NULL;
confnode *node = NULL;
for (sect = cfg->sects; sect != NULL; sect = sect->next) {
if (st != NULL)
if (memcmp(sect->sect, st, strlen(sect->sect)) != 0)
continue;
for (node = sect->nodes; node != NULL; node = node->next)
if (memcmp(node->node, kw, strlen(node->node)) == 0)
return node->val;
if (st != NULL)
break;
}
return emptystr;
}
int
config_getstr(config *cfg, char *st, char *kw, char *out, int outlen)
{
confsect *sect = NULL;
confnode *node = NULL;
int cplen = 0;
for (sect = cfg->sects; sect != NULL; sect = sect->next) {
if (st != NULL)
if (memcmp(sect->sect, st, strlen(sect->sect)) != 0)
continue;
for (node = sect->nodes; node != NULL; node = node->next)
if (memcmp(node->node, kw, strlen(node->node)) == 0) {
cplen = strlen(node->val) < outlen ? strlen(node->val) : outlen - 1;
memcpy(out, node->val, cplen);
out[cplen] = '\0';
return strlen(out);
}
if (st != NULL)
break;
}
return 0;
}
int
config_getint(config *cfg, char *st, char *kw, int defval)
{
confsect *sect = NULL;
confnode *node = NULL;
for (sect = cfg->sects; sect != NULL; sect = sect->next) {
if (st != NULL)
if (memcmp(sect->sect, st, strlen(sect->sect)) != 0)
continue;
for (node = sect->nodes; node != NULL; node = node->next)
if (memcmp(node->node, kw, strlen(node->node)) == 0) {
return atoi(node->val);
}
if (st != NULL)
break;
}
return defval;
}
long
config_getlong(config *cfg, char *st, char *kw, long defval)
{
confsect *sect = NULL;
confnode *node = NULL;
for (sect = cfg->sects; sect != NULL; sect = sect->next) {
if (st != NULL)
if (memcmp(sect->sect, st, strlen(sect->sect)) != 0)
continue;
for (node = sect->nodes; node != NULL; node = node->next)
if (memcmp(node->node, kw, strlen(node->node)) == 0) {
return atol(node->val);
}
if (st != NULL)
break;
}
return defval;
}
double
config_getdouble(config *cfg, char *st, char *kw, double defval)
{
confsect *sect = NULL;
confnode *node = NULL;
for (sect = cfg->sects; sect != NULL; sect = sect->next) {
if (st != NULL)
if (memcmp(sect->sect, st, strlen(sect->sect)) != 0)
continue;
for (node = sect->nodes; node != NULL; node = node->next)
if (memcmp(node->node, kw, strlen(node->node)) == 0) {
return atof(node->val);
}
if (st != NULL)
break;
}
return defval;
}
int
config_save(const config *cfg, char *errbuf)
{
FILE *fp;
char tstamp[64];
confsect *sect = NULL;
confnode *node = NULL;
if (strlen(cfg->file) == 0) {
if (errbuf != NULL)
snprintf(errbuf, CONFERRBUFSIZ - 2, "config_load: cfg->file is not specified!\n");
return -1;
}
if ((fp = fopen(cfg->file, "w")) == NULL) {
if (errbuf != NULL)
snprintf(errbuf, CONFERRBUFSIZ - 2, "config_load: fopen(%s) failed: %s", cfg->file, strerror(errno));
return -1;
}
misc_strftime(tstamp, sizeof(tstamp) - 2, "%Y.%m.%d-%H.%M.%S");
fprintf(fp, "#\n# %s, created by libconfig2 at %s\n#\n\n", cfg->file, tstamp);
for (sect = cfg->sects; sect != NULL; sect = sect->next) {
fprintf(fp, "[%s]\n", sect->sect);
for (node = sect->nodes; node != NULL; node = node->next)
fprintf(fp, "\t%s=%s\n", node->node, node->val);
fprintf(fp, "\n");
}
fflush(fp);
fclose(fp);
return 0;
}
voipong-2.0/configure.in 0100644 0001754 0000000 00000004672 10340127407 014362 0 ustar murat wheel #
# b$
# Thu Dec 23 11:04:01 EET 2004
#
AC_INIT(voipong, 2.0, murat@enderunix.org)
AM_INIT_AUTOMAKE(voipong, 2.0)
AM_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT([/usr/local])
AC_CANONICAL_HOST
CFLAGS=""
LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/lib"
LIBS=-lpcap
AC_MSG_CHECKING([for operating system])
case "$host_os" in
linux*)
AC_DEFINE([LINUX], 1, [Define for the Linux operating system.])
;;
freebsd*)
AC_DEFINE([FREEBSD], 1, [Define for the freebsd operating system.])
;;
openbsd*)
AC_DEFINE([FREEBSD], 1, [Define for the openbsd operating system.])
;;
netbsd*)
AC_DEFINE([FREEBSD], 1, [Define for the netbsd operating system.])
;;
solaris*)
AC_DEFINE([SOLARIS], 1, [Define for the solaris operating system.])
LIBS="${LIBS} -lsocket -lresolv -lnsl"
;;
hpux*)
AC_DEFINE([HPUX], 1, [Define for the hp-ux operating system.])
;;
aix*)
AC_DEFINE([AIX], 1, [Define for the aix operating system.])
;;
*)
AC_MSG_ERROR([Non supprted operating system: $host_os. exiting.])
;;
esac
AC_MSG_RESULT($host_os)
AC_CONFIG_SRCDIR([voipong.c])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lpcap':
AC_CHECK_LIB([pcap], [pcap_lookupnet], [], [
echo "Error! You need to have pcap library."
echo "Visit http://www.tcpdump.org/ for pcap library."
exit -1
])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_CHECK_TYPE(u_int32_t, [
echo "#ifndef __OSSPECIFIC__" > include/osspecific.h;
echo "#define __OSSPECIFIC__" >> include/osspecific.h;
], [
echo "#ifndef __OSSPECIFIC__" > include/osspecific.h;
echo "#define __OSSPECIFIC__" >> include/osspecific.h;
echo "typedef unsigned int u_int32_t;" >> include/osspecific.h;
]
)
AC_CHECK_TYPE(u_int16_t, [
echo "#endif" >> include/osspecific.h;
],
[
echo "typedef unsigned short u_int16_t;" >> include/osspecific.h;
echo "#endif" >> include/osspecific.h;
]
)
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getcwd inet_ntoa localtime_r memmove memset mkdir select socket strerror uname])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
voipong-2.0/miscutil.c 0100644 0001754 0000000 00000020647 10346315716 014056 0 ustar murat wheel
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static int debuglevel = 0;
static char logdir[1024];
static char logfile[1024];
static FILE *logp = NULL;
static int foreground = 0;
#ifdef __REENTRANT
static pthread_mutex_t logmtx = PTHREAD_MUTEX_INITIALIZER;
#endif
void
misc_setlogtype(int t)
{
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
if (t == 1)
foreground = 1;
else
foreground = 0;
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
}
void
misc_setlogdir(const char *l)
{
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
strncpy(logdir, l, sizeof(logdir) - 2);
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
}
void
misc_setlogfile(const char *l)
{
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
strncpy(logfile, l, sizeof(logfile) - 2);
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
}
void
misc_setloglevel(int l)
{
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
debuglevel = l;
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
}
int
misc_getloglevel()
{
int ret = 0;
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
ret = debuglevel;
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
return ret;
}
int
misc_openlog()
{
char logpath[1024];
snprintf(logpath, sizeof(logpath) - 2, "%s/%s", logdir, logfile);
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
if ((logp = fopen(logpath, "a")) == NULL) {
syslog(LOG_ERR, "cannot open %s for writing: %s", logpath, strerror(errno));
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
return -1;
}
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
return 0;
}
int
misc_closelog()
{
if (logp == NULL)
return 0;
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
if (fclose(logp) != 0) {
syslog(LOG_ERR, "cannot close logfile: %s\n", strerror(errno));
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
return -errno;
}
logp = NULL;
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
return 0;
}
int
misc_rotatelog()
{
time_t tv;
struct tm tm;
char tbuf[64];
char movepath[1024];
char logpath[1024];
time(&tv);
localtime_r(&tv, &tm);
strftime(tbuf, sizeof(tbuf) - 2, "%Y.%m.%d-%H.%M.%S", &tm);
snprintf(movepath, sizeof(movepath) - 2, "%s/%s-%s", logdir, logfile, tbuf);
snprintf(logpath, sizeof(logpath) - 2, "%s/%s", logdir, logfile);
misc_debug(0, "Switching main server log from %s to %s\n", logpath, movepath);
if (misc_closelog() < 0)
return -1;
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
if ((rename(logpath, movepath)) < 0) {
syslog(LOG_ERR, "Cannot rename %s to %s: %s\n", logpath, movepath, strerror(errno));
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
return -1;
}
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
misc_openlog();
misc_debug(0, "Logrotate finished successfully\n");
return 0;
}
char *
misc_trim(char *s, int len)
{
int i, j = 0;
char *tmp = (char *)malloc(len + 1);
len = strlen(s);
for (i = 0, j = 0; (i < (len - 1)) && (j < (len - 1)); i++) {
if (s[i] == ' ')
continue;
tmp[j++] = s[i];
}
tmp[j] = '\0';
memset(s, 0x0, len);
strncpy(s, tmp, len - 1);
free(tmp);
return s;
}
char *
misc_trimnewline(char *s, int len)
{
int i, j = 0;
char *tmp;
tmp = (char *)malloc(len + 1);
for (i = 0, j = 0; (i < (len - 1)) && (j < (len - 1)); i++) {
if (s[i] == '\r' || s[i] == '\n')
continue;
tmp[j++] = s[i];
}
tmp[j] = '\0';
memset(s, 0, len);
strncpy(s, tmp, len - 1);
free(tmp);
return s;
}
void
misc_debug(int l, char *fmt, ...)
{
va_list ap;
FILE *lp;
time_t tv;
struct tm tm;
char lfmt[4096];
char tbuf[64];
if (logp == NULL)
return;
if (l > debuglevel)
return;
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
if (foreground == 1)
lp = stdout;
else
lp = logp;
time(&tv);
localtime_r(&tv, &tm);
strftime(tbuf, sizeof(tbuf) - 2, "%d/%m/%y %H:%M:%S", &tm);
snprintf(lfmt, sizeof(lfmt) - 2, "%s: %s", tbuf, fmt);
va_start(ap, fmt);
if (vfprintf(lp, lfmt, ap) < 1) {
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
misc_closelog();
misc_openlog();
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
}
if (fflush(lp) != 0) {
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
misc_closelog();
misc_openlog();
#ifdef __REENTRANT
pthread_mutex_lock(&logmtx);
#endif
}
#ifdef __REENTRANT
pthread_mutex_unlock(&logmtx);
#endif
va_end(ap);
}
char *
misc_getunamestr(char *uname_str, int len)
{
struct utsname uts;
if (uname(&uts) < 0)
strcpy(uname_str, "Undefined host");
else
snprintf(uname_str, len - 1, "%s [%s %s %s %s]",
uts.nodename, uts.sysname, uts.release, uts.version, uts.machine);
return uname_str;
}
char *
misc_getuptimestr(char *uptime_str, int len, time_t firetime)
{
char fmt[32];
time_t now;
time_t diff;
time(&now);
diff = now - firetime;
memset(uptime_str, 0x0, len);
if (diff > 86400) {
snprintf(fmt, sizeof(fmt) - 2, "%d days ", diff / 86400);
diff -= (diff / 86400) * 86400;
strncpy(uptime_str, fmt, len - 1);
}
if (diff > 3600) {
snprintf(fmt, sizeof(fmt) - 2, "%d hours ", diff / 3600);
diff -= (diff / 3600) * 3600;
strncat(uptime_str, fmt, len - 1);
}
if (diff > 60) {
snprintf(fmt, sizeof(fmt) - 2, "%d minutes ", diff / 60);
diff -= (diff / 60) * 60;
strncat(uptime_str, fmt, len - 1);
}
if (diff > 0) {
snprintf(fmt, sizeof(fmt) - 2, "%d seconds", diff);
strncat(uptime_str, fmt, len - 1);
}
return uptime_str;
}
/* Returns formatted current time */
int
misc_strftime(char *out, int len, char *fmt)
{
time_t tv;
struct tm tm;
time(&tv);
localtime_r(&tv, &tm);
return strftime(out, len, fmt, &tm);
}
/* Returns formatted given time */
int
misc_strftimegiven(char *out, int len, char *fmt, time_t tv)
{
struct tm tm;
localtime_r(&tv, &tm);
return strftime(out, len, fmt, &tm);
}
int
misc_lockreg(int fd, int cmd, int type, int offset, int whence, int len)
{
struct flock lock;
lock.l_type = type;
lock.l_start = offset;
lock.l_whence = whence;
lock.l_len = len;
return fcntl(fd, cmd, &lock);
}
double
misc_timediff(struct timeval *t2, struct timeval *t1)
{
double diff = 0.0;
diff = t2->tv_sec - t1->tv_sec;
diff += (t2->tv_usec - t1->tv_usec) / 1000000.0;
return diff;
}
int
misc_trimnongraph(char *str, int len)
{
register int i = 0;
for (i = 0; i < len; ) {
if (!isgraph(str[i]))
memmove(&str[i], &str[i + 1], --len);
else
i++;
}
str[len] = '\0';
return len;
}
char *
misc_inet_ntoa(int ip)
{
struct in_addr in;
in.s_addr = ip;
return inet_ntoa(in);
}
int
misc_inet_addr(char *ip)
{
return inet_addr(ip);
}
char *
misc_strbuf(char *hs, int hslen, char *ndl, int ndllen)
{
int i = 0, j = 0, match = 0;
for (i = 0, j = 0; i < hslen; i++) {
if (hs[i] == ndl[0]) {
for (j = 1, match = 1, i++; j < ndllen && i < hslen; j++, i++) {
if (hs[i] != ndl[j])
break;
else
match++;
}
if (match == ndllen)
return &hs[i - match];
}
}
return NULL;
}
void
misc_strrev(char *str, int len)
{
register int i = 0, j = 0;
char tmp;
for (i = 0, j = len - 1; (i <= j) && (i < len) && (j < len); i++, j--) {
tmp = str[i];
str[i] = str[j];
str[j] = tmp;
}
}
voipong-2.0/modvocoder_pcma.c 0100644 0001754 0000000 00000007026 10346315716 015362 0 ustar murat wheel /*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
G711 PCMA (a-law) Decoder Module
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
#include
#include
#include
/* modvocoder_pcma.c
*
* Module Definitions
*
*/
#define MODNAME "VOIPONG vocoder G711 (a-law)"
#define MODVERSION "1.0"
#define MODPAYLOADTYPE 8
#define MODPAYLOADRATE 8000
/*
* g711.c
*
* u-law, A-law and linear PCM conversions.
*/
#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */
#define QUANT_MASK (0xf) /* Quantization field mask. */
#define NSEGS (8) /* Number of A-law segments. */
#define SEG_SHIFT (4) /* Left shift for segment number. */
#define SEG_MASK (0x70) /* Segment field mask. */
/*
* alaw2linear() - Convert an A-law value to 16-bit linear PCM
*
*/
static int
alaw2linear(
unsigned char a_val)
{
int t;
int seg;
a_val ^= 0x55;
t = (a_val & QUANT_MASK) << 4;
seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT;
switch (seg) {
case 0:
t += 8;
break;
case 1:
t += 0x108;
break;
default:
t += 0x108;
t <<= seg - 1;
}
return ((a_val & SIGN_BIT) ? t : -t);
}
/* Decodes one byte PCMU data to two bytes unsigned linear data */
static int
vocoder_alaw(int fd, u_char *pl, int len)
{
u_int16_t wbuf[2048];
int i = 0;
int wlen = len * sizeof(u_int16_t);
for (i = 0; i < len && (i < sizeof(wbuf) / sizeof(u_int16_t)); i++)
wbuf[i] = alaw2linear(pl[i]);
if (write(fd, wbuf, wlen) < wlen)
return -1;
return wlen;
}
/* Install module hook */
vocoder_t *
modvocoder_pcma_init(vocoder vocoders[])
{
vocoders[MODPAYLOADTYPE].rate = MODPAYLOADRATE;
vocoders[MODPAYLOADTYPE].f = vocoder_alaw;
return (vocoder_t *)vocoders[MODPAYLOADTYPE].f;
}
voipong-2.0/modvocoder_pcmu.c 0100644 0001754 0000000 00000007641 10337122244 015401 0 ustar murat wheel /*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
G711 PCMU (u-law) Decoder Module
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
#include
#include
#include
/* modvocoder_pcmu.c
*
* Module Definitions
*/
#define MODNAME "VOIPONG vocoder G711 (u-law)"
#define MODVERSION "1.0"
#define MODPAYLOADTYPE 0
#define MODPAYLOADRATE 8000
/*
* g711.c
*
* u-law, A-law and linear PCM conversions.
*/
#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */
#define QUANT_MASK (0xf) /* Quantization field mask. */
#define NSEGS (8) /* Number of A-law segments. */
#define SEG_SHIFT (4) /* Left shift for segment number. */
#define SEG_MASK (0x70) /* Segment field mask. */
#define BIAS (0x84) /* Bias for linear code. */
/*
* ulaw2linear() - Convert a u-law value to 16-bit linear PCM
*
* First, a biased linear code is derived from the code word. An unbiased
* output can then be obtained by subtracting 33 from the biased code.
*
* Note that this function expects to be passed the complement of the
* original code word. This is in keeping with ISDN conventions.
*/
static int
ulaw2linear(
unsigned char u_val)
{
int t;
/* Complement to obtain normal u-law value. */
u_val = ~u_val;
/*
* Extract and bias the quantization bits. Then
* shift up by the segment number and subtract out the bias.
*/
t = ((u_val & QUANT_MASK) << 3) + BIAS;
t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS));
}
/* Decodes one byte PCMU data to two bytes unsigned linear data */
static int
vocoder_ulaw(int fd, u_char *pl, int len)
{
u_int16_t wbuf[2048];
int i = 0;
int wlen = len * sizeof(u_int16_t);
for (i = 0; i < len && (i < sizeof(wbuf) / sizeof(u_int16_t)); i++)
wbuf[i] = ulaw2linear(pl[i]);
if (write(fd, wbuf, wlen) < wlen)
return -1;
return wlen;
}
/* Install module hook */
vocoder_t *
modvocoder_pcmu_init(vocoder vocoders[])
{
vocoders[MODPAYLOADTYPE].rate = MODPAYLOADRATE;
vocoders[MODPAYLOADTYPE].f = vocoder_ulaw;
return (vocoder_t *)vocoders[MODPAYLOADTYPE].f;
}
voipong-2.0/voipctl.c 0100644 0001754 0000000 00000031277 10346315716 013706 0 ustar murat wheel /*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004,2005 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* Externals */
extern config cfg;
extern char gcfgfile[128];
extern int gthisday;
extern int gthismon;
extern time_t gstarttime;
extern char gmgmt_path[128];
static int sd = -1;
int process_greets(void);
void process_req(void);
int open_client_socket();
void freecmds(char **cmds, int csiz);
int
main(int argc, char **argv)
{
extern char *optarg;
int error = 0;
int c = 0;
struct tm tm;
/* Program baslarken bugunku tarihi alalim */
time(&gstarttime);
localtime_r(&gstarttime, &tm);
gthisday = tm.tm_mday;
gthismon = tm.tm_mon;
strcpy(gcfgfile, "/usr/local/etc/voipong/voipong.conf");
while (!error && (c = getopt(argc, argv, "c:hv")) != -1) {
switch(c) {
case 'v':
printf("%s %s\n", "voipctl", VERSION);
printf("Copyright (C) 2005 Murat Balaban \n"
"All rights reserved.\n\n"
"This program is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU General Public License\n"
"as published by the Free Software Foundation; either version 2\n"
"of the License, or (at your option) any later version.\n\n"
"For more information on copying and license, please see LICENSE\n"
"file included in the voipong source distribution.\n");
exit(0);
break;
case 'h':
usage();
exit(0);
break;
case 'c':
strncpy(gcfgfile, optarg, sizeof(gcfgfile) - 2);
break;
default:
printf("invalid option: %c, try -h for help\n", c);
exit(EX_USAGE);
}
}
init_config();
if ((sd = open_client_socket()) == -1)
exit(1);
process_req();
return 0;
}
void
init_config()
{
char errbuf[CONFERRBUFSIZ];
if ((config_load(&cfg, gcfgfile, errbuf)) == NULL) {
fprintf(stderr, "init_config: %s\n", errbuf);
exit(1);
}
get_initcfgvals();
}
void
get_initcfgvals()
{
if (config_getstr(&cfg, "GENERAL", "mgmt_ipcpath", gmgmt_path, sizeof(gmgmt_path) - 2) == 0) {
printf("cannot get mgmtipcpath from configfile, shutting down......\n");
exit(1);
}
}
void
usage()
{
printf("usage: voipctl [options]\n");
printf("\toptions:\n");
printf("\t\t-h this screen\n");
printf("\t\t-v version info\n");
printf("\t\t-c config file path\n");
printf("\n");
}
int
open_client_socket()
{
struct sockaddr_un sun;
memset(&sun, 0x0, sizeof(sun));
sun.sun_family = AF_LOCAL;
strncpy(sun.sun_path, gmgmt_path, 100);
if ((sd = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1) {
fprintf(stderr, "open_client_socket: socket: %s\n", strerror(errno));
return -1;
}
if (connect(sd, (const struct sockaddr *)&sun, sizeof(sun)) == -1) {
fprintf(stderr, "open_client_socket: connect(%s): %s\n", sun.sun_path, strerror(errno));
return -1;
}
if (process_greets() != 0) {
fprintf(stderr, "open_client_socket: greeting failed with the management server\n");
return -1;
}
return sd;
}
void
prompt()
{
printf("voipong> ");
fflush(stdout);
}
int
process_greets(void)
{
char rbuf[1024];
int rlen = 0;
memset(rbuf, 0x0, sizeof(rbuf));
if ((rlen = recv(sd, rbuf, sizeof(rbuf) - 2, 0)) == -1) {
fprintf(stderr, "process_greets: recv: %s\n", strerror(errno));
return -1;
}
if (memcmp(rbuf, "+OK", 3) != 0) {
fprintf(stderr, "process_greets: server did not welcome us:\n%s\n", rbuf);
return -1;
}
printf("\n\n\nConnected to VoIPong Management Console\n\nSystem:\n%s\n\n", rbuf + 4);
return 0;
}
int
parsecmd(char *str, int siz, char **cmds, int csiz)
{
char tmp[1024];
int i = 0, j = 0, k = 0;
while (i < siz && k < csiz) {
memset(tmp, 0x0, sizeof(tmp));
for (; (i < siz) && (!isalnum(str[i])); i++)
;
for (j = 0; (i < siz) && (isalnum(str[i])) && j < (sizeof(tmp) - 2); i++)
tmp[j++] = str[i];
tmp[j] = '\0';
if (strlen(tmp) == 0)
continue;
cmds[k++] = strdup(tmp);
}
return k;
}
void
freecmds(char **cmds, int csiz)
{
int i = 0;
for (i = 0; i < csiz; i++) {
if (cmds[i] != NULL) {
free(cmds[i]);
cmds[i] = NULL;
}
}
}
void
help()
{
printf("Commands:\n");
printf("help : this one\n");
printf("quit : quit management console\n");
printf("uptime : Server uptime\n");
printf("logrotate : rotate server's logs\n");
printf("setdebug [level] : set debug level to [level]\n");
printf("setmixflag [flag] : set mix voice flag to true or false [e.g: 1 for true, 0 for false]\n");
printf("shutdown : shutdown server\n");
printf("rusage : CPU usage statistics for the server\n");
printf("loadnets : Reload voipongnets file\n");
printf("info : General server information\n");
printf("shcall : Show currently monitored calls\n");
printf("shrtcp : Show currently RTCP cache\n");
printf("killcall [id] : end monitoring session with [id]\n");
}
int
transport_simplecmd(char *sbuf, int slen, char *rbuf, int rlen)
{
int ret = 0;
if ((ret = send(sd, sbuf, slen, 0)) < slen) {
printf("transport_simplecmd: send (%d): %s\n", ret, strerror(errno));
return -1;
}
memset(rbuf, 0x0, rlen);
if ((ret = recv(sd, rbuf, rlen, 0)) == -1) {
printf("transport_simplecmd: recv: %s\n", strerror(errno));
return -1;
}
if (memcmp(rbuf, "+OK", 3) != 0) {
printf("transport_simplecmd: server returned error: %.128s\n", rbuf + 5);
return -1;
}
return 0;
}
int
transport_advcmd(char *sbuf, int slen, char *rbuf, int rlen)
{
int ret = 0;
char *tmp;
int ntmp = 0;
if ((ret = send(sd, sbuf, slen, 0)) < slen) {
printf("transport_advcmd: send (%d): %s\n", ret, strerror(errno));
return -1;
}
memset(rbuf, 0x0, rlen);
if ((ret = recv(sd, rbuf, rlen, 0)) == -1) {
printf("transport_advcmd: recv: %s\n", strerror(errno));
return -1;
}
if (memcmp(rbuf, "+OK", 3) != 0) {
printf("transport_advcmd: server returned error: %.128s\n", rbuf + 5);
return -1;
}
if ((tmp = misc_strbuf(rbuf, ret, "+OK .", 5)) != NULL)
ntmp = (tmp - rbuf - 5);
else
return -1;
fwrite(rbuf + 5, sizeof(char), ntmp, stdout);
fflush(stdout);
while(misc_strbuf(rbuf, ret, "+OK .", 5) == NULL) {
memset(rbuf, 0x0, rlen);
if ((ret = recv(sd, rbuf, rlen, 0)) == -1) {
printf("transport_advcmd: w recv: %s\n", strerror(errno));
return -1;
}
fwrite(rbuf, sizeof(char), ret, stdout);
fflush(stdout);
}
return 0;
}
void
uptime(char **cmds, int cnt)
{
char buf[1024];
if (transport_simplecmd("UPTIME\r\n", 8, buf, sizeof(buf) - 2) == -1) {
printf("cannot retrieve uptime information\n");
return;
}
printf("Server uptime: %s\n", buf + 4);
}
void
logrotate(char **cmds, int cnt)
{
char buf[1024];
if (transport_simplecmd("LOGROTATE\r\n", 11, buf, sizeof(buf) - 2) == -1) {
printf("cannot rotate logs\n");
return;
}
printf("Logrotate successfull\n");
}
void
loadnets(char **cmds, int cnt)
{
char buf[1024];
if (transport_simplecmd("LOADNETS\r\n", 10, buf, sizeof(buf) - 2) == -1) {
printf("cannot load voipongnets\n");
return;
}
printf("Networks file has been reloaded successfull\n");
}
void
sshutdown(char **cmds, int cnt)
{
char buf[1024];
if (transport_simplecmd("SHUTDOWN\r\n", 10, buf, sizeof(buf) - 2) == -1) {
printf("cannot send shutdown command\n");
return;
}
exit(0);
}
void
sendclose(char **cmds, int cnt)
{
char buf[1024];
if (transport_simplecmd("CLOSESESSION\r\n", 14, buf, sizeof(buf) - 2) == -1) {
printf("cannot send closesession command\n");
return;
}
}
void
rusage(char **cmds, int cnt)
{
char buf[1024];
if (transport_advcmd("RUSAGE\r\n", 8, buf, sizeof(buf) - 2) == -1) {
printf("cannot process rusage command\n");
return;
}
}
void
info(char **cmds, int cnt)
{
char buf[1024];
if (transport_advcmd("INFO\r\n", 6, buf, sizeof(buf) - 2) == -1) {
printf("cannot process info command\n");
return;
}
}
void
shcall(char **cmds, int cnt)
{
char buf[1024];
if (transport_advcmd("SHCALL\r\n", 8, buf, sizeof(buf) - 2) == -1) {
printf("cannot process shcall command\n");
return;
}
}
void
shrtcp(char **cmds, int cnt)
{
char buf[1024];
if (transport_advcmd("SHRTCP\r\n", 8, buf, sizeof(buf) - 2) == -1) {
printf("cannot process shrtcp command\n");
return;
}
}
void
killcall(char **cmds, int cnt)
{
char sbuf[1024];
char buf[1024];
if (cmds[1] == NULL)
return;
if (strlen(cmds[1]) < 1)
return;
snprintf(sbuf, sizeof(sbuf) - 2, "KILLCALL %.20s\r\n", cmds[1]);
if (transport_simplecmd(sbuf, strlen(sbuf), buf, sizeof(buf) - 2) == -1) {
printf("cannot process killcall command\n");
return;
}
printf("# %s\n", buf + 4);
}
void
setdebug(char **cmds, int cnt)
{
char sbuf[1024];
char buf[1024];
if (cmds[1] == NULL)
return;
if (strlen(cmds[1]) < 1)
return;
snprintf(sbuf, sizeof(sbuf) - 2, "SETDEBUG %.20s\r\n", cmds[1]);
if (transport_simplecmd(sbuf, strlen(sbuf), buf, sizeof(buf) - 2) == -1) {
printf("cannot process setdebug command\n");
return;
}
printf("# %s\n", buf + 4);
}
void
setmixflag(char **cmds, int cnt)
{
char sbuf[1024];
char buf[1024];
if (cmds[1] == NULL)
return;
if (strlen(cmds[1]) < 1)
return;
snprintf(sbuf, sizeof(sbuf) - 2, "SETMIXFLAG %.20s\r\n", cmds[1]);
if (transport_simplecmd(sbuf, strlen(sbuf), buf, sizeof(buf) - 2) == -1) {
printf("cannot process setmixflag command\n");
return;
}
printf("# %s\n", buf + 4);
}
void
process_req(void)
{
char line[1024];
char prevline[1024];
char *cmds[10];
int ccnt = 0;
memset(line, 0x0, sizeof(line));
memset(prevline, 0x0, sizeof(prevline));
prompt();
while (fgets(line, sizeof(line) - 1, stdin) != NULL) {
ccnt = 0;
memset(cmds, 0x0, sizeof(cmds));
misc_trimnewline(line, strlen(line));
if (strlen(line) == 0) {
prompt();
continue;
}
if (memcmp(line, "!!", 2) == 0) {
if (strlen(prevline) == 0) {
prompt();
continue;
}
strncpy(line, prevline, sizeof(line) - 2);
}
if ((ccnt = parsecmd(line, strlen(line), cmds, sizeof(cmds) / sizeof(char *))) < 1) {
printf("cannot parse command: %s\n", line);
freecmds(cmds, sizeof(cmds) / sizeof(char *));
prompt();
continue;
}
if (cmds[0] == NULL)
continue;
strncpy(prevline, line, sizeof(prevline) - 2);
/* Here it is: */
if (memcmp(cmds[0], "q", 1) == 0 ||
memcmp(cmds[0], "quit", 4) == 0 ||
memcmp(cmds[0], "exit", 4) == 0 ||
memcmp(cmds[0], "bye", 3) == 0) {
printf("Bye!\n");
sendclose(cmds, ccnt);
close(sd);
return;
} else
if (memcmp(cmds[0], "help", 4) == 0)
help();
else
if (memcmp(cmds[0], "uptime", 5) == 0)
uptime(cmds, ccnt);
else
if (memcmp(cmds[0], "logrotate", 9) == 0)
logrotate(cmds, ccnt);
else
if (memcmp(cmds[0], "shutdown", 8) == 0)
sshutdown(cmds, ccnt);
else
if (memcmp(cmds[0], "rusage", 6) == 0)
rusage(cmds, ccnt);
else
if (memcmp(cmds[0], "info", 4) == 0)
info(cmds, ccnt);
else
if (memcmp(cmds[0], "shcall", 6) == 0)
shcall(cmds, ccnt);
else
if (memcmp(cmds[0], "shrtcp", 6) == 0)
shrtcp(cmds, ccnt);
else
if (memcmp(cmds[0], "killcall", 8) == 0)
killcall(cmds, ccnt);
else
if (memcmp(cmds[0], "setdebug", 8) == 0)
setdebug(cmds, ccnt);
else
if (memcmp(cmds[0], "setmixflag", 8) == 0)
setmixflag(cmds, ccnt);
else
if (memcmp(cmds[0], "loadnets", 8) == 0)
loadnets(cmds, ccnt);
freecmds(cmds, sizeof(cmds) / sizeof(char *));
prompt();
}
printf("Closing management console...\n");
close(sd);
}
voipong-2.0/voipong.c 0100644 0001754 0000000 00000024775 10346315716 013714 0 ustar murat wheel
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* Externals */
extern config cfg;
extern int gfg;
extern int gdbg;
extern char gcfgfile[128];
extern int gthisday;
extern int gthismon;
extern time_t gstarttime;
extern char gsoxpath[256];
extern char gsoxmixpath[256];
extern int gsoxmixflag;
extern char gpidfile[128];
extern char goutdir[256];
extern char gmodpath[256];
extern char gnetfile[256];
extern char gcdrfile[256];
extern char gdefalg[256];
extern int pcapfd, mgmtfd;
extern char gdevice[256];
extern char gfilter[1024];
extern char gmgmt_path[128];
extern int gpromisc;
extern int gsnaplen;
extern int greadtmt;
extern int grtp_idle_time;
extern rtp_session *rtps;
extern void (*packet_handler_default) (vnet *, u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
int
daemon_init(void)
{
FILE *lckp = NULL;
pid_t pid = 0;
int i = 0;
if (gfg == 0) {
if ((pid = fork()) < 0)
return -1;
else if (pid != 0)
exit(0);
setsid();
/* fork again so that I cannot gain controlling terminal anymore */
if ((pid = fork()) < 0)
return -1;
else if (pid != 0)
exit(0);
for (i = getdtablesize(); i >= 0; i--)
close(i);
if ((i = open(_PATH_DEVNULL, O_RDWR, 0640)) == -1) /* stdin */
exit(1);
dup2(i, STDOUT_FILENO);
dup2(i, STDERR_FILENO);
}
setuid(getuid());
setgid(getgid());
umask(077);
openlog("voipong", 0, LOG_DAEMON);
if ((lckp = fopen(gpidfile, "w")) == NULL) {
fprintf(stderr, "cannot open pidfile: %s\n", strerror(errno));
syslog(LOG_WARNING, "cannot open pidfile: %.128s\n", strerror(errno));
exit(1);
}
if (lockf(fileno(lckp), F_TLOCK, 0)) {
fprintf(stderr, "cannot lock pidfile %s: %s, may be another copy running?\n", gpidfile, strerror(errno));
syslog(LOG_WARNING, "cannot lock pidfile %.128s: %.128s, may be another copy running?\n", gpidfile, strerror(errno));
exit(1);
}
/* write pid */
fprintf(lckp, "%d\n", getpid());
fflush(lckp);
return 0;
}
void
wexit(int c)
{
char tmp[1024];
misc_debug(0, "PID %d [parent: %d]: exited with code: %d. uptime: %s.\n", getpid(), getppid(), c,
misc_getuptimestr(tmp, sizeof(tmp) - 2, gstarttime));
if (unlink(gpidfile) == -1)
syslog(LOG_ERR, "can't remove pidfile[%.128s]: %.128s\n", gpidfile, strerror(errno));
if (unlink(gmgmt_path) == -1)
syslog(LOG_ERR, "can't remove mgmt_ipcfile[%.128s]: %.128s\n", gmgmt_path, strerror(errno));
misc_closelog();
exit(c);
}
int
main(int argc, char **argv)
{
extern char *optarg;
int error = 0;
int c = 0;
char tmp[512];
struct tm tm;
struct sigaction sa;
struct sigaction sa_old;
char errbuf[ERRBUFSIZ];
sa.sa_handler = sighandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
sigaction(SIGHUP, &sa, &sa_old);
sigaction(SIGUSR2, &sa, &sa_old);
sigaction(SIGTERM, &sa, &sa_old);
sigaction(SIGINT, &sa, &sa_old);
sigaction(SIGCHLD, &sa, &sa_old);
sigaction(SIGSTOP, &sa, &sa_old);
sigaction(SIGQUIT, &sa, &sa_old);
sigaction(SIGPIPE, &sa, &sa_old);
sigaction(SIGALRM, &sa, &sa_old);
/* Program baslarken bugunku tarihi alalim */
time(&gstarttime);
localtime_r(&gstarttime, &tm);
gthisday = tm.tm_mday;
gthismon = tm.tm_mon;
strcpy(gcfgfile, "/usr/local/etc/voipong/voipong.conf");
while (!error && (c = getopt(argc, argv, "c:d:hvf")) != -1) {
switch(c) {
case 'v':
printf("%s %s\n", PROGRAM, VERSION);
printf("Copyright (C) 2004 Murat Balaban \n"
"All rights reserved.\n\n"
"This program is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU General Public License\n"
"as published by the Free Software Foundation; either version 2\n"
"of the License, or (at your option) any later version.\n\n"
"For more information on licensing, please see LICENSE\n"
"file included in the voipong source distribution.\n");
exit(0);
break;
case 'h':
usage();
exit(0);
break;
case 'f':
gfg = 1;
break;
case 'd':
gdbg = atoi(optarg);
break;
case 'c':
strncpy(gcfgfile, optarg, sizeof(gcfgfile) - 2);
break;
default:
printf("invalid option: %c, try -h for help\n", c);
exit(EX_USAGE);
}
}
init_config();
misc_setlogtype(gfg);
misc_setlogdir(config_getval(&cfg, "GENERAL", "logdir"));
misc_setlogfile(config_getval(&cfg, "GENERAL", "logfile"));
misc_setloglevel(gdbg);
printf("%s starting...\n", PROGRAM);
printf("%s, running on %s\n\n", VERSION, misc_getunamestr(tmp, sizeof(tmp) - 2));
printf("%s\n", COPYRIGHT);
daemon_init();
if (misc_openlog() < 0) {
syslog(LOG_ERR, "misc_openlog: error!: %.128s", strerror(errno));
wexit(1);
}
misc_debug(0, "%s starting...\n", PROGRAM);
misc_debug(0, "%s running on %s. %s [pid: %d]\n", VERSION, misc_getunamestr(tmp, 512), COPYRIGHT, getpid());
misc_debug(0, "Default matching algorithm: %s\n", gdefalg);
init_voip();
init_workers();
init_vnet();
init_vocoders();
loadnetfile(gnetfile);
if ((pcapfd = initpcap(1, gfilter, errbuf)) == -1) {
misc_debug(0, "libpcap start failure: %s\n", errbuf);
wexit(1);
}
add_to_select_set(pcapfd);
if (open_server_socket() == -1) {
misc_debug(0, "mgmt socket open failure!\n");
wexit(1);
}
sockets_run();
wexit(0);
return 0;
}
void
graceful_shutdown()
{
kill_workers();
wexit(0);
}
void
reload()
{
}
void
init_config()
{
char errbuf[CONFERRBUFSIZ];
if ((config_load(&cfg, gcfgfile, errbuf)) == NULL) {
fprintf(stderr, "init_config: %s\n", errbuf);
wexit(1);
}
get_initcfgvals();
}
void
get_initcfgvals()
{
if (config_getstr(&cfg, "GENERAL", "mgmt_ipcpath", gmgmt_path, sizeof(gmgmt_path) -2) == 0) {
printf("cannot get mgmtipcpath from configfile, shutting down......\n");
exit(1);
}
if (config_getstr(&cfg, "GENERAL", "pidfile", gpidfile, sizeof(gpidfile) - 2) == 0) {
printf("cannot get pidfile from configfile, shutting down......\n");
exit(1);
}
if ((grtp_idle_time = config_getint(&cfg, "GENERAL", "rtp_idle_time", -1)) == -1) {
printf("cannot get rtp_idle_time from configfile, shutting down......\n");
exit(1);
}
if (config_getstr(&cfg, "GENERAL", "outdir", goutdir, sizeof(goutdir) - 2) == 0) {
printf("cannot get outdir from configfile, shutting down......\n");
exit(1);
}
if (config_getstr(&cfg, "GENERAL", "cdrfile", gcdrfile, sizeof(gcdrfile) - 2) == 0) {
printf("cannot get cdrfile from configfile, shutting down......\n");
exit(1);
}
if (config_getstr(&cfg, "GENERAL", "soxpath", gsoxpath, sizeof(gsoxpath) - 2) == 0) {
printf("cannot get soxpath from configfile, shutting down......\n");
exit(1);
}
if (config_getstr(&cfg, "GENERAL", "soxmixpath", gsoxmixpath, sizeof(gsoxmixpath) - 2) == 0) {
printf("cannot get soxmixpath from configfile, shutting down......\n");
exit(1);
}
gsoxmixflag = config_getint(&cfg, "GENERAL", "mixwaves", 0);
if (config_getstr(&cfg, "GENERAL", "defalg", gdefalg, sizeof(gdefalg) - 2) == 0) {
printf("cannot get gdefalg from configfile, shutting down......\n");
exit(1);
}
if (config_getstr(&cfg, "GENERAL", "modpath", gmodpath, sizeof(gmodpath) - 2) == 0) {
printf("cannot get modpath from configfile, shutting down......\n");
exit(1);
}
if (strcmp(gdefalg, "lfp") == 0)
packet_handler_default = packet_handler_lfp;
else
if (strcmp(gdefalg, "lra") == 0) {
printf("This matching algorithm is not implemented yet!\n");
/*packet_handler_default = packet_handler_lra; */
exit(1);
}
else {
printf("Default packet matching algorithm should be selected: (lfp/lra) wrong input: %s\n", gdefalg);
exit(1);
}
config_getstr(&cfg, "FILTERS", "startup_filter", gfilter, sizeof(gfilter) - 2);
config_getstr(&cfg, "GENERAL", "device", gdevice, sizeof(gdevice) - 2);
config_getstr(&cfg, "GENERAL", "networksfile", gnetfile, sizeof(gdevice) - 2);
if ((gpromisc = config_getint(&cfg, "GENERAL", "promisc", -1)) == -1) {
printf("cannot get promisc value from configfile, shutting down......\n");
exit(1);
}
if ((gsnaplen = config_getint(&cfg, "GENERAL", "snaplen", -1)) == -1) {
printf("cannot get snaplen value from configfile, shutting down......\n");
exit(1);
}
if ((greadtmt = config_getint(&cfg, "GENERAL", "readtmt", -1)) == -1) {
printf("cannot get readtmt value from configfile, shutting down......\n");
exit(1);
}
}
void
usage()
{
printf("usage: voipong [options]\n");
printf("\toptions:\n");
printf("\t\t-h this screen\n");
printf("\t\t-v version info\n");
printf("\t\t-f run in foreground (don't become a daemon)\n");
printf("\t\t-d debug level. Valid levels are 0 through 4. Default: 0\n");
printf("\t\t-c config file path\n");
printf("\n");
}
void
process_deadchild()
{
pid_t pid;
int stat = 0;
int termsig = 0, exitcode = 0;
struct sigaction sa;
worker *w;
sigemptyset(&sa.sa_mask);
sigaddset(&(sa.sa_mask), SIGCHLD);
sigprocmask(SIG_BLOCK, &(sa.sa_mask), NULL);
if ((pid = wait(&stat)) == -1) {
misc_debug(0, "process_deadchild: wait error: %s\n", strerror(errno));
return;
}
if ((w = getworkerbypid(pid)) == NULL) {
misc_debug(0, "I dont have a child with pid %d\n", pid);
return;
}
if (WIFEXITED(stat))
misc_debug(0, "child [pid: %d] terminated normally [exit code: %d]\n", pid, (exitcode = WEXITSTATUS(stat)));
else
if (WIFSIGNALED(stat))
misc_debug(0, "child [pid: %d] terminated by signal %d\n", pid, (termsig = WTERMSIG(stat)));
worker_remove(w);
free(w);
}
voipong-2.0/voipongcdr.c 0100644 0001754 0000000 00000003142 10346315716 014366 0 ustar murat wheel #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define __USE_BSD 1
#define __FAVOR_BSD 1
#include
#include
#include
#include
#include
#include
#include
extern char goutdir[256];
extern char gcdrfile[256];
void
checkcdrfile()
{
struct stat st;
FILE *fp;
if (stat(gcdrfile, &st) == -1)
if (errno == ENOENT) {
if ((fp = fopen(gcdrfile, "a")) == NULL) {
misc_debug(0, "checkcdrfile: fopen(%s): %s\n", gcdrfile, strerror(errno));
return;
}
writew_lock(fileno(fp));
fprintf(fp, "Start;End;Duration(seconds);Session Id;Party1 RTP Pair; Party 2 RTP Pair;Encoding;Rate\n");
fclose(fp);
}
}
int
add2cdr(worker *w)
{
FILE *fp;
char stime[256];
char etime[256];
checkcdrfile();
if ((fp = fopen(gcdrfile, "a")) == NULL) {
misc_debug(0, "add2cdr: fopen(%s): %s\n", gcdrfile, strerror(errno));
return -1;
}
writew_lock(fileno(fp));
misc_strftimegiven(stime, sizeof(stime) - 2, "%a %b %d %H:%M:%S %Y", w->stime);
misc_strftimegiven(etime, sizeof(etime) - 2, "%a %b %d %H:%M:%S %Y", w->etime);
fprintf(fp, "%s;%s;%d;%d;%s:%d;%s:%d;%d;%d\n", stime, etime, (w->etime - w->stime), getpid(),
misc_inet_ntoa(w->rtp->ip1), w->rtp->port1,
misc_inet_ntoa(w->rtp->ip2), w->rtp->port2, w->rtp->enc, w->rtp->rate);
fclose(fp);
return 0;
}
voipong-2.0/voipongcodec.c 0100644 0001754 0000000 00000010530 10345252354 014667 0 ustar murat wheel /*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
Decoder Modules Interfaces
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define __USE_BSD 1
#define __FAVOR_BSD 1
#include
#include
#include
#include
#include
#include
#include
#include
#include
extern char gmodpath[256];
vocoder vocoders[MAXCODECS];
int
vocoder_default(int fd, u_char *pl, int len)
{
if (write(fd, pl, len) < len) {
misc_debug(0, "dumppl_default: write: %s\n", strerror(errno));
return -1;
}
return len;
}
void
getmodinitfunc(char *initstr, short initlen, char *mpath)
{
int i = 0, j = 0;
char modname[128];
for (i = strlen(mpath) - 1, j = 0; i > 0 && j < sizeof(modname) - 6; i--) {
if (mpath[i] == '/')
break;
modname[j++] = mpath[i];
}
modname[j] = '\0';
misc_strrev(modname, strlen(modname));
strncpy(initstr, modname, initlen - 6);
memcpy(initstr + (strlen(initstr) - 3), "_init", 5);
}
int
loadmodule(char *path)
{
void * ld;
const char *errstr = NULL;
char initstr[128];
vocoder_t * (*f) (vocoder vocoders[]);
void *addr = NULL;
if ((ld = dlopen(path, RTLD_NOW)) == NULL) {
misc_debug(0, "loadmodule: dlopen(%s): %s\n", path, dlerror());
return -1;
}
getmodinitfunc(initstr, sizeof(initstr) - 2, path);
f = dlsym(ld, initstr);
if ((errstr = dlerror()) != NULL) {
misc_debug(0, "loadmodule (%s): dlsym: %s\n", path, errstr);
dlclose(ld);
return -1;
}
addr = (*f) (vocoders);
misc_debug(0, "loadmodule: %s (@%p)\n", path, addr);
return 0;
}
/* Try to avoid some "really nasty" actions... */
int
securemod(struct stat *st, char *fname)
{
if (strlen(fname) < 7) {
misc_debug(0, "error: securemod(%s): invalid module naming", fname);
return 0;
}
if (st->st_uid != getuid()) {
misc_debug(0, "error: securemod(%s): uid: got %d, expected %d\n", fname, st->st_uid, getuid());
return 0;
}
if (st->st_gid != getgid()) {
misc_debug(0, "error: securemod(%s): gid: got %d, expected %d\n", fname, st->st_gid, getgid());
return 0;
}
if (st->st_mode & S_IWGRP) {
misc_debug(0, "error: securemod(%s): module has group-writable bit set\n", fname);
return 0;
}
if (st->st_mode & S_IWOTH) {
misc_debug(0, "error: securemod(%s): module has world-writable bit set\n", fname);
return 0;
}
if (S_ISLNK(st->st_mode)) {
misc_debug(0, "error: securemod(%s): module cannot be a symbolic link\n", fname);
return 0;
}
return 1;
}
void
init_vocoders()
{
char fname[1024];
DIR *dirp;
struct dirent *dp;
int i = 0;
struct stat st;
int cnt = 0;
for (i = 0; i < MAXCODECS; i++) {
vocoders[i].f = vocoder_default;
vocoders[i].rate = 0;
}
if ((dirp = opendir(gmodpath)) == NULL) {
misc_debug(0, "init_vocoders: cannot open modules dir %s: %s\n", gmodpath, strerror(errno));
return;
}
while((dp = readdir(dirp)) != NULL) {
if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0 || (memcmp(dp->d_name, "mod", 3) != 0))
continue;
snprintf(fname, sizeof(fname) - 2, "%s/%s", gmodpath, dp->d_name);
stat(fname, &st);
if (S_ISREG(st.st_mode))
if (securemod(&st, fname))
if (loadmodule(fname) == 0)
cnt++;
}
misc_debug(0, "loaded %d module(s)\n", cnt);
}
voipong-2.0/COPYING 0100644 0001754 0000000 00000035360 10325230257 013103 0 ustar murat wheel GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
voipong-2.0/voipongfixed.c 0100644 0001754 0000000 00000004554 10336157114 014720 0 ustar murat wheel /*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"Fixed Pcap-Capture-String" Algorithm
This is useful for catching dummy IP adapters, which has neither signalling
nor RTCP, RTSP, but always use fixed port numbers. In voipongnet.conf file,
the user is expected to supply a pcap filter string:
(e.g. "port 40000 and udp").
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define __USE_BSD 1
#define __FAVOR_BSD 1
#include
#include
#include
#include
#include
#include
#include
/*
* #include
*/
#include
#include
#include
extern char gdevice[256];
extern char gfilter[1024];
extern int gpromisc;
extern int gsnaplen;
extern int greadtmt;
void
packet_handler_fixed(vnet *v, u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet)
{
struct ip *ip;
struct udphdr *udp;
short iphlen;
rtcp_session *rtcp = NULL;
ip = (struct ip *)packet;
iphlen = ip->ip_hl << 2;
if (ip->ip_p != IPPROTO_UDP)
return;
udp = (struct udphdr *)(packet + iphlen);
if (udp->uh_sport == v->fixport || udp->uh_dport == v->fixport) {
if (worker_isexist(ip->ip_src.s_addr, ip->ip_dst.s_addr, ntohs(udp->uh_sport), ntohs(udp->uh_dport)))
return;
if (create_rtp_instance(&rtcp, udata, pkthdr, packet) == -1)
misc_debug(0, "packet_handler_fixed: failed creating rtp instance\n");
}
}
voipong-2.0/voipongglobals.c 0100644 0001754 0000000 00000003032 10344576327 015244 0 ustar murat wheel /*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
/* GLOBALS */
config cfg;
int gfg = 0;
int gdbg = 0;
char gcfgfile[128];
char gmgmt_path[128];
char gmodpath[256];
int grtp_idle_time = 0;
int gthisday = 0;
int gthismon = 0;
time_t gstarttime = 0;
int mgmt_client = 0;
int gmgmtport = 0;
char gsoxpath[256];
char gsoxmixpath[256];
int gsoxmixflag = 0;
char gpidfile[128];
char goutdir[256];
char gnetfile[256];
char gcdrfile[256];
char gdefalg[256];
int pcapfd = -1, mgmtfd = -1;
char gdevice[256];
char gfilter[1024];
int gpromisc = 1;
int gsnaplen = 1;
int greadtmt = 1;
rtp_session *rtps = NULL;
void (*packet_handler_default) (vnet *, u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet);
voipong-2.0/voiponglfp.c 0100644 0001754 0000000 00000004215 10336157114 014374 0 ustar murat wheel /*
VoIPong Voice Over IP Sniffer
Copyright (C) 2005 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"Least False Positive" Algorithm
This will try to catch calls that are compliant with the RTP and RTCP RFCs.
Note that this algorithm was the default call-catching algorithm prior to
version 1.2 and may not catch calls that are not RFC-compliant at all.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define __USE_BSD 1
#define __FAVOR_BSD 1
#include
#include
#include
#include
#include
#include
#include
#include
#include
extern char gdevice[256];
extern char gfilter[1024];
extern int gpromisc;
extern int gsnaplen;
extern int greadtmt;
void
packet_handler_lfp(vnet *v, u_char *udata, const struct pcap_pkthdr *pkthdr, const u_char *packet)
{
struct ip *ip;
struct udphdr *udp;
short iphlen = 0;
ip = (struct ip *)packet;
iphlen = ip->ip_hl << 2;
if (ip->ip_p != IPPROTO_UDP)
return;
udp = (struct udphdr *)(packet + iphlen);
if (isodd(ntohs(udp->uh_sport)) && isodd(ntohs(udp->uh_dport)))
probertcp(udata, pkthdr, packet);
else
if (iseven(ntohs(udp->uh_sport)) && iseven(ntohs(udp->uh_dport)))
probertp(udata, pkthdr, packet);
}
voipong-2.0/voipongmgmt.c 0100644 0001754 0000000 00000023370 10336157114 014562 0 ustar murat wheel
/*
VoIPong Voice Over IP Sniffer
Copyright (C) 2004 Murat Balaban
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include