Skip to content

Instantly share code, notes, and snippets.

@aboutsip
aboutsip / pom.xml
Last active December 28, 2015 18:05
Basic pom.xml for using siplib (pkts.io)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@aboutsip
aboutsip / pom.xml
Last active August 29, 2015 14:08
Basic pom.xml for using sipstack.io
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@aboutsip
aboutsip / PktsIOStreamsExample001.java
Last active December 19, 2015 04:19
Simple example showing how to use pkts.io's stream support. In this example, we are only interested in SIP streams.
import io.pkts.Pcap;
import io.pkts.packet.sip.SipPacket;
import io.pkts.streams.SipStream;
import io.pkts.streams.Stream;
import io.pkts.streams.StreamHandler;
import io.pkts.streams.StreamListener;
import io.pkts.streams.impl.DefaultStreamHandler;
import java.io.FileNotFoundException;
import java.io.IOException;
@aboutsip
aboutsip / PktsIOCoreExample001.java
Last active December 19, 2015 04:18
Simple example of how to use pkts.io to load a pcap file and print the content of all UDP packets.
import io.pkts.PacketHandler;
import io.pkts.Pcap;
import io.pkts.packet.Packet;
import io.pkts.protocol.Protocol;
import java.io.IOException;
// Step 1 - obtain a new Pcap instance by supplying an InputStream that points
// to a source that contains your captured traffic. Typically you may
// have stored that traffic in a file so there are a few convenience