Skip to content

Instantly share code, notes, and snippets.

View mattbennett's full-sized avatar

Matt Yule-Bennett mattbennett

  • London, England
View GitHub Profile
@glacjay
glacjay / tun-ping-linux.py
Created September 18, 2010 04:49
Reading/writing Linux's TUN/TAP device using Python.
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2