{"id":15373117,"url":"https://github.com/vi/udptap_tunnel","last_synced_at":"2025-04-15T12:31:28.558Z","repository":{"id":137140258,"uuid":"4058928","full_name":"vi/udptap_tunnel","owner":"vi","description":"Simple UDP tun/tap-based tunnel with mcrypt encryption. Also some more AF_PACKET and tun/tap related tools.","archived":false,"fork":false,"pushed_at":"2015-10-23T14:37:26.000Z","size":198,"stargazers_count":38,"open_issues_count":1,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T21:03:36.091Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-18T01:06:17.000Z","updated_at":"2024-09-04T17:25:02.000Z","dependencies_parsed_at":"2023-03-13T14:12:09.740Z","dependency_job_id":null,"html_url":"https://github.com/vi/udptap_tunnel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Fudptap_tunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Fudptap_tunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Fudptap_tunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vi%2Fudptap_tunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vi","download_url":"https://codeload.github.com/vi/udptap_tunnel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249072207,"owners_count":21208139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T13:54:19.290Z","updated_at":"2025-04-15T12:31:28.302Z","avatar_url":"https://github.com/vi.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"udptap_tunnel\n---\n\nPoor man's OpenVPN.\n\n```\nUsage: udptap_tunnel [-6] \u003clocalip\u003e \u003clocalport\u003e \u003cremotehost\u003e \u003cremoteport\u003e\n    Environment variables:\n    TUN_DEVICE  /dev/net/tun\n    DEV_NAME    name of the device, default tun0\n    IFF_TUN     if set, uses point-to-point instead ot TAP.\n    \n    MCRYPT_KEYFILE  -- turn on encryption, read key from this file\n    MCRYPT_KEYSIZE  -- key size in bits, default 256\n    MCRYPT_ALGO     -- algorithm, default is twofish. aes256 is called rijndael-256\n    MCRYPT_MODE     -- mode, default is CBC\n```\n\nIPv6 mode requires \"-6\" option as argv[1].\n\n\nNote that each packet is encrypted separately and there is no filtering of invalid packets. Replay-based attacks will work.\nTransferring some file using this tunnel's encryption feature is less secure than encrypting the file and then transferring it.\n\nThe project is named \"udptap_tunnel\" because of there is already other udptap on Github.\n\nUsage example:\n\non server:\n\n    IFF_TUN=1 DEV_NAME=udp0 MCRYPT_KEYFILE=/root/my.key udptap_tunnel 0.0.0.0 3443\n    ip addr add 192.168.90.1/30 dev udp0\n    ip link set udp0 up\n    ip link set udp0 mtu 1280\n\non client:\n\n    IFF_TUN=1 MCRYPT_KEYFILE=/root/my.key DEV_NAME=udp0 udptap_tunnel 0.0.0.0 0 1.2.3.4 3443\n    ip link set udp0  up\n    ip addr add 192.168.90.2/30 dev udp0\n    ip link set ppp8 mtu 1280\n\n\ntap_mcrypt\n---\n\ntap_mcrypt - create TAP device that sends/receives encrypted packets to interface\nIt uses EtherType 0x08F4.\n\n```\nUsage: tap_mcrypt plaintext_interface {auto|destination_mac_address}\nExample: tap_mcrypt wlan0 auto\n                (note that ff:ff:ff:ff:ff:ff may work bad in Wi-Fi)\n    Environment variables:\n    TUN_DEVICE  /dev/net/tun\n    DEV_NAME    name of the device, default tun%d\n    SOURCE_MAC_ADDRESS -- by default use interface's one\n    IFF_TUN     if set, uses point-to-point instead ot TAP.\n    \n    MCRYPT_KEYFILE  -- turn on encryption, read key from this file\n    MCRYPT_KEYSIZE  -- key size in bits, default 256\n    MCRYPT_ALGO     -- algorithm, default is twofish. aes256 is called rijndael-256\n    MCRYPT_MODE     -- mode, default is CBC\n```\n\n\nNote that each packet is encrypted separately and there is no filtering of invalid packets. Replay-based attacks will work.\nTransferring some file using this tunnel's encryption feature is less secure than encrypting the file and then transferring it.\n\nNetworking with more than two peers (without locking to broadcast mode) is not implemented. \nUse https://github.com/vi/udptap_tunnel/issues/new if you want tap_mcrypt to have it.\n\nvethify\n---\n```\nUsage: vethify interface1 interface2\nExample: vethify wlan0 veth0\n    Environment variables:\n    SOURCE_MAC_ADDRESS1 -- by default use interface's one\n    SOURCE_MAC_ADDRESS2 -- by default use interface's one\n    DEBUG=0,1,2 print send and recv packets\n    \nPrimary use case: workaround inability to move wireless connections to other network namespaces on Linux\n    Setup Wi-Fi connection on wlan0, but don't configure any addresses on it\n    then create veth0/veth1 pair, use vethify to exchange packets between unmanagable wlan0 and manageable veth0\n    then move veth1 to your namespace and setup IPv4/IPv6 addresses there\n```\n\ntap_copy\n---\n```\nUsage: tap_copy interface\nExample: tap_copy eth0\n    Environment variables:\n    TUN_DEVICE  /dev/net/tun\n    DEV_NAME    name of the device, default tun%d\n    SOURCE_MAC_ADDRESS -- by default use interface's one\n    DEBUG=0,1,2 print send and recv packets\n```\n\nI actually don't remember why I needed this one.\n\n\nseqpackettool\n---\n\n[socat][1] seems to lack support of AF_UNIX SOCK_SEQPACKET. So I implemented poor man's socat that allows you to connect and listen AF_UNIX SOCK_SEQPACKET sockets, exchanging data between them and SCTP or started processes. It can also start two processes, mutually (circularly) connected by a seqpacket socket pairt.\n\n```\nUsage: seqpackettool [options] part part\n   part := listen_unix | connect_unix | listen_sctp | connect_sctp | startp | stdiop\n   stdiop := '-' # use fd 0 for recv and fd 1 for send\n   listen_unix := 'unix_listen' addressu\n   connect_unix := 'connect' addressu\n   listen_sctp := 'sctp_listen4' address4 port | 'sctp_listen6' address6 port\n   connect_sctp := 'sctp_connect4' address4 port | 'sctp_connect6' address6 port\n   startp := 'start' '--' full_path_to_program argv0 ... argvN '--'\n   addressu - /path/to/unix/socket or @abstract_socket_address\n   \n   You may use more than two dashes in delimiters to allow '--' inside argv.\n   BUFSIZE environment variable adjusts buffer size\nOptions:\n   --listen-once - don't fork, accept only one connection\n   --unidirectional - only recv from first  and send to second part\n   --allow-empty - don't shutdown connection on empty packets\nExamples:\n    seqpackettool sctp4_listen 0.0.0.0 6655 sctp4_listen 127.0.0.1 5566\n       emulate   socat sctp-listen:6655,fork,reuseaddr sctp-listen:5566,reuseaddr,bind=127.0.0.1\n    seqpackettool unix_listen @myprog start -- /usr/bin/my_program my_program arg1 arg2 --\n       for each incoming connection at abstract address 'myprog',\n       start the program and provide the seqpacket socket as stdin/stdout\n    seqpackettool - unix_connect /path/to/socket\n       exchange data between stdin/stdout and AF_UNIX seqpacket socket\n```\n[1]:http://www.dest-unreach.org/socat/\n\nipvampire\n---\n\nSniff the given interface for IPv4 or IPv6 packets belonging to the given subnet and copy them to stdout.\nInject packets appearing on stdin to the interface back.\n\nUse case: OpenVPN-ing a part of networking out of restrictive VPN (such as OpenVZ without tun/tap enabled).\n\n```\nUsage: ipvampire interface {-6|-4} ip_address/netmask\nExample: ipvampire venet0 -6 2a01:4f8:162:732f:419::acbd/84\n    Environment variables:\n    SOURCE_MAC_ADDRESS1 -- by default use interface's one\n    DEBUG=0,1,2 print send and recv packets\n    \nImplemented by Vitaly \"_Vi\" Shukela based on Robert M Supnik's code\nExample:\n    ./seqpackettool start -- ./openvpn openvpn --dev stdout --log /dev/stderr -- start -- ./ipvampire ./ipvampire venet0 -6 2a01:4f8:162:732f:419:8000::/88 --\n```\n\nYou can find the patched OpenVPN at https://github.com/vi/openvpn/tree/stdout\n\n\nudpjump\n---\n\nAllow OpenVPN to jump from UDP socket to UDP socket, avoiding long-lived associations.\nA workaround against problems in a particular network.\n\n```\nUsage: udpjump {listen|connect|listen6|connect6} address post {listen|connect|listen6|connect6} multiport_address multiport_port1 multiport_port2 ... multiport_portN\nEnvironment variables:\n   MINISESSION_TIMEOUT_MS=3000 (milliseconds)\nExample:\non server: udpjump connect 127.0.0.1 1194 listen 0.0.0.0 {4000.4039}\non client: udpjump listen  127.0.0.1 1195 connect 1.2.3.4 {4000.4039}\n```\n\nmapopentounixsocket\n---\n\nSometimes usual pipelines are not enough. \n\n```\nsource | sink\n```\n\nFor example, you may want to pre-buffer some content, then start the sink. Sink may be started later and independently of source.\n\n```\n# echo 100000000 \u003e  /proc/sys/net/core/wmem_max\n$ socketpair_dispenser $((1000*1000*50)) /tmp/123\n$ LD_PRELOAD=libmapopentounixsocket.so MAPOPENTOUNIXSOCKET=/tmp/123 sh -c 'source \u003e /tmp/somefile.sock'\n$ LD_PRELOAD=libmapopentounixsocket.so MAPOPENTOUNIXSOCKET=/tmp/123 sink /tmp/somefile.sock\n```\n\nThe source can start filling the 50-megabyte buffer even before sink is started.\n\n\nbuffered_pipeline\n---\n\nLike Shell's pipeline, but with AF_UNIX socketpair instead of pipe2's FIFO, with adjustable buffer size.\n\n\n```\n$ ./buffered_pipeline ! pv -i 10 -c -N 1 /dev/zero ! $((20*1000*1000)) ! pv -i 10 -L 100k -c -N 2 ! \u003e /dev/zero\n        1: 13.4MB 0:00:40 [ 103kB/s] [         \u003c=\u003e          ]\n        2: 3.91MB 0:00:40 [ 100kB/s] [         \u003c=\u003e          ]\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvi%2Fudptap_tunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvi%2Fudptap_tunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvi%2Fudptap_tunnel/lists"}