-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.html
More file actions
120 lines (115 loc) · 3.76 KB
/
index.html
File metadata and controls
120 lines (115 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---
title: C++ packet sniffing and crafting library
layout: default
section: home
---
<div id="index-header-separator">
</div>
<h3>Introduction</h3>
<p>
<i>libtins</i> is a high-level, multiplatform <i>C++</i> network
packet sniffing and crafting library.
</p>
<p>
Its main purpose is to provide the <i>C++</i> developer an easy,
efficient, platform and endianness-independent way to create tools
which need to send, receive and manipulate network packets.
</p>
<p>
It uses a BSD-2 license and it's hosted at
<a href="https://github.com/mfontanini/libtins">github</a>.
</p>
<h3>It's easy to use!</h3>
<p>
The library is very simple to use. As a short example, this is
how it could be used to print the source and destination addresses
and ports of every <i>TCP</i> packet captured in the <i>eth0</i>
interface:
</p>
{% highlight cpp %}
#include <iostream>
#include <tins/tins.h>
using namespace Tins;
using namespace std;
bool callback(const PDU &pdu) {
// Find the IP layer
const IP &ip = pdu.rfind_pdu<IP>();
// Find the TCP layer
const TCP &tcp = pdu.rfind_pdu<TCP>();
cout << ip.src_addr() << ':' << tcp.sport() << " -> "
<< ip.dst_addr() << ':' << tcp.dport() << endl;
return true;
}
int main() {
Sniffer("eth0").sniff_loop(callback);
}
{% endhighlight %}
<h3>High level != inefficient</h3>
<p>
<i>libtins</i> was designed keeping efficiency in mind at all times.
In fact, it is one of the fastest packet sniffing and interpretation
libraries available. The <a href="/benchmark/">benchmark</a> section
contains some actual measurements of how fast it works.
</p>
<h3>It's been thoroughly tested</h3>
<p>
Almost as much time was invested testing the library than
developing it. At the moment of writing, there are 624 unit tests,
which check that everything in <i>libtins</i> does what's
expected.
</p>
<h3>Portability</h3>
<p>
Making your applications portable is very important. That is why a lot
of work has been done so that <i>libtins</i> works on <i>Windows</i>,
<i>OSX</i> and both little and big endian <i>GNU/Linux</i> and
<i>FreeBSD</i> operating systems. This means you can develop some
sniffing application, cross-compile it and execute it directly on your
<i>ARM</i> or <i>MIPS</i> routers, or any other device that has sniffing
capabilities, provided it has enough RAM. (libtins is ~10MB)
</p>
<h3>Features</h3>
<p>
<i>libtins</i> supports several protocols and features:
</p>
<ul>
<li>Network packet crafting.</li>
<li>Packet sniffing and automatic packet interpretation.</li>
<li>Reading and writing <i>PCAP</i> files.</li>
<li>Following and reassembling <i>TCP</i> streams on the fly.</li>
<li>Decrypting <i>WEP</i> and <i>WPA2</i>(<i>TKIP</i> and <i>CCMP</i>)
encrypted 802.11 data frames on the fly and interpreting the
decrypted content.</li>
<li>Works properly on at least the following architectures:
x86, x64, ARM and MIPS (probably more).</li>
<li>
Supported protocols:
<ul>
<li>IEEE 802.11</li>
<li>IEEE 802.3</li>
<li>IEEE 802.1q</li>
<li>Ethernet</li>
<li>ARP</li>
<li>IP</li>
<li>IPv6</li>
<li>ICMP</li>
<li>ICMPv6</li>
<li>TCP</li>
<li>UDP</li>
<li>DHCP</li>
<li>DHCPv6</li>
<li>DNS</li>
<li>RadioTap</li>
<li>MPLS</li>
<li>EAPOL</li>
<li>PPPoE</li>
<li>STP</li>
<li>LLC</li>
<li>LLC+SNAP</li>
<li>Linux Cooked Capture</li>
<li>PPI</li>
<li>PKTAP</li>
<li>NULL/Loopback</li>
</ul>
</li>
</ul>