All Projects â†’ montag451 â†’ Pytun

montag451 / Pytun

Licence: mit
Linux TUN/TAP wrapper for Python

Programming Languages

c
50402 projects - #5 most used programming language
python3
1442 projects
python2
120 projects

Projects that are alternatives of or similar to Pytun

Wireguard Docs
📖 Unofficial WireGuard Documentation: Setup, Usage, Configuration, and full example setups for VPNs supporting both servers & roaming clients.
Stars: ✭ 3,201 (+2659.48%)
Mutual labels:  networking, tunnel
Inlets Pro
Secure TCP and HTTP tunnels that work anywhere
Stars: ✭ 179 (+54.31%)
Mutual labels:  networking, tunnel
Nexer
Content based network multiplexer or redirector made with love and Go
Stars: ✭ 7 (-93.97%)
Mutual labels:  networking, tunnel
vmecs
A simple VMess proxy implementation written in C.
Stars: ✭ 28 (-75.86%)
Mutual labels:  tunnel, networking
Titun
Simple, fast, and cross-platform IP tunnel written in Rust. WireGuard compatible.
Stars: ✭ 19 (-83.62%)
Mutual labels:  networking, tunnel
Pylinkvalidator
pylinkvalidator is a standalone and pure python link validator and crawler that traverses a web site and reports errors (e.g., 500 and 404 errors) encountered.
Stars: ✭ 109 (-6.03%)
Mutual labels:  networking
Aura Operating System
AuraOS, the Franco-English Operating System developed in C# using Cosmos!
Stars: ✭ 111 (-4.31%)
Mutual labels:  networking
Rxalamofire
RxSwift wrapper around the elegant HTTP networking in Swift Alamofire
Stars: ✭ 1,503 (+1195.69%)
Mutual labels:  networking
Frp
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Stars: ✭ 51,746 (+44508.62%)
Mutual labels:  tunnel
Handpose Facemesh Demos
🎥🤟 8 minimalistic templates for tfjs mediapipe handpose and facemesh
Stars: ✭ 116 (+0%)
Mutual labels:  networking
Glider
glider is a forward proxy with multiple protocols support, and also a dns/dhcp server with ipset management features(like dnsmasq).
Stars: ✭ 1,710 (+1374.14%)
Mutual labels:  tunnel
Wwnetworkhelper
AFN层级更高的网络请求API
Stars: ✭ 111 (-4.31%)
Mutual labels:  networking
Gun
Toy gRPC Tunnel over CloudFlare (Proof of Concept)
Stars: ✭ 108 (-6.9%)
Mutual labels:  tunnel
Redcon
Redis compatible server framework for Go
Stars: ✭ 1,683 (+1350.86%)
Mutual labels:  networking
Mole
CLI application to create ssh tunnels focused on resiliency and user experience.
Stars: ✭ 1,520 (+1210.34%)
Mutual labels:  tunnel
Foundational Knowledge For Programmers
List of resources about foundational knowledge for programmers (supposed to last a few decades)
Stars: ✭ 115 (-0.86%)
Mutual labels:  networking
Colyseus Examples
Colyseus Game Server examples for learning purposes
Stars: ✭ 109 (-6.03%)
Mutual labels:  networking
Easyhttpcpp
A cross-platform HTTP client library with a focus on usability and speed
Stars: ✭ 110 (-5.17%)
Mutual labels:  networking
Tls Channel
A Java library that implements a ByteChannel interface over SSLEngine, enabling easy-to-use (socket-like) TLS for Java applications.
Stars: ✭ 113 (-2.59%)
Mutual labels:  networking
Ws Machine
WS-Machine is a websocket finite state machine for client websocket connections (Go)
Stars: ✭ 110 (-5.17%)
Mutual labels:  networking

Linux TUN/TAP wrapper for Python

pytun is a Python module which let you create TUN/TAP device very easily.

License: MIT (see LICENSE)

Installation and Dependencies

Install pytun with pip install python-pytun or download this archive <https://github.com/montag451/pytun/zipball/v2.3.0>_, decompress it and execute python setup.py install. As pytun is a C module you will need a compiler (e.g GCC) and the Python development headers installed on your system (e.g on Debian-like distribution check that build-essential and python-dev are present). There are no dependencies other than the Python Standard Library.

Documentation

NOTE: On most distributions you will need to be root to create TUN/TAP devices.

To create a TUN device::

from pytun import TunTapDevice

tun = TunTapDevice()

To create a TAP device::

from pytun import TunTapDevice, IFF_TAP

tap = TunTapDevice(flags=IFF_TAP)

To create a TUN/TAP device with a custom name use the name keyword::

tun = TunTapDevice(name='mytun')

You can get/set some parameters of the device directly::

print tun.name
tun.addr = '10.8.0.1'
tun.dstaddr = '10.8.0.2'
tun.netmask = '255.255.255.0'
tun.mtu = 1500

If the device is a TAP you can also get/set its MAC address::

tap.hwaddr = '\x00\x11\x22\x33\x44\x55'
print tap.hwaddr

To make the device persistent::

tun.persist(True)

To bring up the device::

tun.up()

To bring down the device::

tun.down()

To enable/disable the queue associated with the device (works only if it has been created with IFF_MULTI_QUEUE)::

tun.mq_attach() # enable the queue
tun.mq_attach(False) # disable the queue

To read/write to the device, use the methods read(size) and write(buf)::

buf = tun.read(tun.mtu)
tun.write(buf)

To close the device::

tun.close()

You can also use TunTapDevice objects with all functions that expect a fileno() method (e.g select())

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].