My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
PirniUsageGuide  
How to use pirni, network sniffer for iPhone.
Phase-Deploy, Featured
Updated Jun 3, 2010 by axelmoll...@gmail.com

Do you like pirni? check out Pirni Pro!

www.rootateverything.com

Introduction

Pirni is the worlds first native network sniffer for iPhone. The iPhone's wifi has some major drawbacks in it's hardware design, thus we can not properly set the device in promiscious mode. This is why pirni comes with an ARP spoofer that successfully routes all the network traffic through your device and then uses packet forwarding to send it to it's normal recipent (ie. the router)

After a successful network sniffing, you can transfer the dumpfile to your computer and open it up with Wireshark (or any other traffic analyzer that supports pcap) to analyze the traffic.

Usage:

pirni [Options] -s <source_ip> -o <logfile>

OPTIONS:

-i: Specifies the interface that you should initialize. In most cases you don't have to supply this, it will automatically choose en0. But if the interface is called something different on your device (perhaps en1), you would have to supply it.

-s: Specifies the IP-adress you want to spoof, most likely the default gateway/router

-d: Specifies the target you want to perform MITM on. Broadcast IP (entire network) will be used if nothing else is supplied

-f: Specifies the Berkley Packet Filter so that pirni only collects interesting packets. This is very good if you want to filter out specific packets - such as FTP, SMTP or HTTP. If no -f options is supplied, all packets will be captured.

-o: Specifies the dumpfile where all the collected packets end up. This is a pcap dump format, that most traffic analyzers can handle.

EXAMPLES:
        pirni -s 192.168.0.1 -o log.pcap
        pirni -s 192.168.0.1 -d 192.168.0.128 -f "tcp dst port 80" -o log.pcap
        pirni -i en1 -s 192.168.0.1 -d 255.255.255.0 -o log.pcap

BPF Filters

BPF filters allow you to select which packets to be dumped. This allows you to "filter" packets, so that only "interesting" packets can be supplied to the software using BPF; this can avoid copying "uninteresting" packets from the operating system kernel to software running in user mode, reducing the CPU requirement to capture packets and the buffer space required to avoid dropping packets.

A full guide of available BPF filters is available here: http://www.cs.ucr.edu/~marios/ethereal-tcpdump.pdf (PDF 76.75Kb)

Examples

To print all packets arriving at or departing from sundown:

"host sundown"

To print traffic between helios and either hot or ace:

"host helios and ( hot or ace )"

To print all IP packets between ace and any host except helios:

"ip host ace and not helios"

To print the start and end packets (the SYN and FIN packets) of each TCP conversation that involves a non-local host:

"tcptcpflags & (tcp-syn|tcp-fin) != 0 and not src and dst net localnet"

To print IP packets longer than 576 bytes sent through gateway snup:

"gateway snup and ip[2:2] > 576"

To print IP broadcast or multicast packets that were not sent via ethernet broadcast or multicast:

"ether0 & 1 = 0 and ip16 >= 224"

To print all ICMP packets that are not echo requests/replies (i.e., not ping packets):

"icmpicmptype != icmp-echo and icmpicmptype != icmp-echoreply"

External documents

TODO (future versions)

  • Implement pcap dump format (this will probably be available within a week or two and will allow you to analyze the traffic in wireshark or any other program that supports the pcap format) DONE
Comment by myownrem...@gmail.com, Feb 28, 2010

High 5 greaT

Comment by Joshua...@gmail.com, May 7, 2010

Slick.

Comment by superman...@gmail.com, May 21, 2010

Much appreciated. This saves me from having to lug around my stupid laptop when analyzing a large network. I would love to see a GUI and some shark features built in but the way it stands kicks butt. Thanks again!'n

Comment by briandh...@gmail.com, Jun 5, 2010

Great app, love it on the iPhone. I'm sure you've been asked already, any plans to release an iPad compatible version?

Comment by lihankun...@gmail.com, Jun 12, 2010

So nice!! Notice that sometimes I have to restart the device before first time use, otherwise pirni can not creat dump file under the 'mobile' directory.

Comment by markjw...@gmail.com, Sep 30, 2010

What if you don’t want to perform a man-in-the-middle attack but rather you just want to capture all the packets traveling to and from the iPhone – is there a way to get Pirni to do this?

This would be very useful to be able to monitor what network traffic is being generated by various apps on the iPhone and also to spot any trojans that could be running on there.

I’ve tried running Perni with a Destination IP of 255.255.255.255 but it seems that the pcap file only contains outbound traffic (iPhone -> Remote Server) but no inbound traffic at all (Remote Server -> iPhone). Does anyone know of a solution, or perhaps a different tool?

Thanks!

Comment by project member axelmoll...@gmail.com, Oct 1, 2010

I would suggest using tcpdump for non-mitm functions. It will just capture packets running through your own NIC.

To capture inbound traffic, you need to change the bpf filter. Try leaving it as blank, that will capture everything

Comment by haminht...@gmail.com, Nov 18, 2010

Hi there, would anyone help me to build n1mda-dev in MacOS 6.4 ?

Thanks very much.

Comment by project member axelmoll...@gmail.com, Nov 18, 2010

See http://code.google.com/p/n1mda-dev/wiki/PirniCompilation

This is how to compile it ON the iPhone or with the iPhone toolchain. Nowadays most people use the SDK but you can still install the toolchain, which is prefered for pirni.

Comment by Punkcra...@gmail.com, Jan 1, 2012

I really love Pirni Pro!

But sad enough it's not compatible with iOS 5.0.1

Please fix this:)

Thanks!

Comment by megacoe...@gmail.com, Jan 2, 2012

Pirni Pro working on iOS 5.0.1 Just download the .deb file and install it with iFile. Works perfect

Megacolho - Si Vis Pacem Para Bellum

Comment by ricky.ka...@gmail.com, Jan 9, 2012

Yeah dont know what you are talking about. Pirni pro works on 5.01. on my iphone 4 and ipad 1

Comment by carlosma...@gmail.com, Feb 2, 2012

Do it works under 3G??


Sign in to add a comment
Powered by Google Project Hosting