Git Product home page Git Product logo

sipzamine's Introduction

sipzamine (previously sipcaparseye)

Command line SIP dialog matching and searching through offline PCAPs.

pypi_version

Installing

$ sudo apt-get install python-libpcap  # or yum install..
$ sudo pip install sipzamine

Example

A basic example, finding all dialogs that last shorter than 1.5 seconds:

$ sipzamine -m ^BYE -H ^BYE --maxdur 1.5 --pcap 'host 22.22.22.22' stored.pcap
[ [email protected] ]
2011-11-23 22:27:20.746782 22.22.22.22:5060 > 123.123.123.123:5060 102 INVITE
2011-11-23 22:27:20.747508 123.123.123.123:5060 > 22.22.22.22:5060 102 INVITE(100)
2011-11-23 22:27:20.783424 123.123.123.123:5060 > 22.22.22.22:5060 102 INVITE(200)
2011-11-23 22:27:20.783956 22.22.22.22:5060 > 123.123.123.123:5060 102 ACK
2011-11-23 22:27:21.665581 22.22.22.22:5060 > 123.123.123.123:5060 103 BYE <--
2011-11-23 22:27:21.665721 123.123.123.123:5060 > 22.22.22.22:5060 103 BYE(200)

Command options

Normally you use -m to match a dialog by regular expression. And -p to filter by IP.

To highlight a particular text string in the concise output, use -H.

Basic matching options:

--pcap filter, -p filter
    pcap filter expression
--pmatch regex, -m regex
    any packet in dialog must match regex (can be used
    multiple times), e.g. ^INVITE to match calls
--amatch regex, -M regex
    all packets in dialog must match regex (can be used
    multiple times), e.g. ^(SIP/2.0|INVITE|BYE) to match
    calls without an ACK

Output options:

--contents
    show complete packet contents
--dateskew seconds
    offset added to all dates, can be negative (use when
    pcap clock was off)
--highlight regex, -H regex
    highlight first matchgroup in packets (multiple
    highlights are identified by letters a..z)

Special dialog/packet matching options:

--mindate date
    packets must be younger than specified date
--maxdate date
    packets must be older than specified date
--mindur seconds
    dialogs/transactions must be shorter than duration
--maxdur seconds
    dialogs/transactions must be longer than duration
--retransmits count
    at least count retransmits must be involved

TODO

  • Add tests: begin with a smallish pcap.
  • Add the ability to write pcaps from the filter. Combine capability with sipscrub?
  • Compare this to sipgrep (and other tools?). And homer?

Q & A

How do I get pcap files?

You're encouraged to always write SIP pcaps on your VoIP machine. tcpdump allows you easy rotation of pcaps so you won't run out of disk space. You can use the tcpdump247 init script if you like.

sipzamine's People

Contributors

hafkensite avatar wdoekes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sipzamine's Issues

python3 bug with --contents

Cannot print --contents in py3.

Traceback (most recent call last):
  File "/usr/local/bin/sipzamine", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/sipzamine/__main__.py", line 232, in main
    show_contents=args.contents)
  File "/usr/local/lib/python3.5/dist-packages/sipzamine/sipzamine.py", line 121, in main
    print_dialog(dialog, packet_highlights, show_contents=show_contents)
  File "/usr/local/lib/python3.5/dist-packages/sipzamine/sipzamine.py", line 105, in print_dialog
    print(data_munge.sub('  ', packet.data))
TypeError: cannot use a string pattern on a bytes-like object

py3 (only) fix:

        if show_contents:
            print(data_munge.sub('  ', packet.data.decode('utf-8', 'replace')))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.