<commit_before># pypcap

Python/C bindings for the libpcap library.
Most of the functions are 1:1 mapped to the libpcap library.

## Example 1

```python
>>> import pypcap
>>> pypcap.pcap_lookupdev()
'fw0'
>>> pypcap.pcap_findalldevs()
['fw0', 'en0', 'utun0', 'en1', 'p2p0']
>>> pypcap.pcap_lookupnet('en1')
('192.168.1.10', '255.255.252.0')
>>> pypcap.pcap_lib_version()
'libpcap version 1.1.1'
```

## Example 2

```python
from pypcap, dpkt
pc = pcap()
x.pcap_create( 'en1' )
x.pcap_set_buffer_size( 1000 )
x.pcap_set_snaplen( 576 )
x.pcap_set_timeout( 512 )
x.pcap_set_promisc( 1 )
x.pcap_activate()
x.pcap_compile( 'udp' )

def pcap_callback(pkt):
    eth = dpkt.ethernet.Ethernet(pkt)
    ip = eth.data
    udp = ip.data
    dns = dpkt.dns.DNS(udp.data)
    for qd in dns.qd:
        print qd.name

x.pcap_set_callback(pcap_callback)
x.pcap_loop()
```<commit_msg>updated notes<commit_after># pypcap

Python/C bindings for the libpcap library.
Most of the functions are 1:1 mapped to the libpcap library. 
 
Seems fairly stable on OSX. Needs some more work before it will work on linux.

## Example 1

```python
>>> import pypcap
>>> pypcap.pcap_lookupdev()
'fw0'
>>> pypcap.pcap_findalldevs()
['fw0', 'en0', 'utun0', 'en1', 'p2p0']
>>> pypcap.pcap_lookupnet('en1')
('192.168.1.10', '255.255.252.0')
>>> pypcap.pcap_lib_version()
'libpcap version 1.1.1'
```

## Example 2

```python
from pypcap, dpkt
x = pcap()
x.pcap_create( 'eth0' )
x.pcap_set_buffer_size( 1000 )
x.pcap_set_snaplen( 576 )
x.pcap_set_timeout( 512 )
x.pcap_set_promisc( 1 )
x.pcap_activate()
x.pcap_compile( 'udp' )

def pcap_callback(pkt):
    # do stuff with packet
    eth = dpkt.ethernet.Ethernet(pkt)

x.pcap_set_callback(pcap_callback)
x.pcap_loop()
```

### License
See LICENSE file

### Requires
* Python 2.5 or later
* python-dev
* libpcap-dev

### Tested on
* OSX 10.8  - x86_64
* Did not test on linux yet
{'fraction_non_alphanumeric': 0.15722604552673372, 'fraction_numerical': 0.05346744309158285, 'mean_word_length': 4.323943661971831, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '550811', 'n_tokens_mistral': 887, 'n_tokens_neox': 821, 'n_words': 186}