Total Pageviews

Monday 21 May 2018

vpn程序-simpletun

simpletun, a (too) simple tunnelling program.



To compile the program, just do

$ gcc simpletun.c -o simpletun

If you have GNU make, you can also exploit implicit targets and do

$ make simpletun



Usage:
simpletun -i <ifacename> [-s|-c <serverIP>] [-p <port>] [-u|-a] [-d]
simpletun -h

-i <ifacename>: Name of interface to use (mandatory)
-s|-c <serverIP>: run in server mode (-s), or specify server address (-c <serverIP>) (mandatory)
-p <port>: port to listen on (if run in server mode) or to connect to (in client mode), default 55555
-u|-a: use TUN (-u, default) or TAP (-a)
-d: outputs debug information while running
-h: prints this help text



Refer to http://backreference.org/2010/03/27/tuntap-interface-tutorial/ for 
more information on tun/tap interfaces in Linux in general, and on this 
program in particular.
The program must be run at one end as a server, and as client at the other 
end. The tun/tap interface must already exist, be up and configured with an IP 
address, and owned by the user who runs simpletun. That user must also have
read/write permission on /dev/net/tun. (Alternatively, you can run the
program as root, and configure the transient interfaces manually before
starting to exchange packets. This is not recommended)

Use is straightforward. On one end just run

[server]$ ./simpletun -i tun13 -s

at the other end run

[client]$ ./simpletun -i tun0 -c 10.2.3.4

where 10.2.3.4 is the remote server's IP address, and tun13 and tun0 must be 
replaced with the names of the actual tun interfaces used on the computers.
By default it assumes a tun device is being used (use -u to be explicit), and
-a can be used to tell the program that the interface is tap. 
By default it uses TCP port 55555, but you can change that by using -p (the 
value you use must match on the client and the server, of course). Use -d to 
add some debug information. Press ctrl-c on either side to exit (the other end
will exit too).

The program is very limited, so expect to be disappointed.
 
from https://github.com/gregnietsky/simpletun
-------
 
在linux vps上,安装没问题。
在mac上,不行:
yudeMacBook-Air:simpletun brite$ ls
AUTHORS  LICENSE  README
Changelog Makefile simpletun.c
yudeMacBook-Air:simpletun brite$ gcc simpletun.c -o simpletun
simpletun.c:28:10: fatal error: 'linux/if_tun.h' file not found
#include <linux/if_tun.h>
         ^
1 error generated.
yudeMacBook-Air:simpletun brite$
 
看到上面的蓝色文字了吗?说明只能在linux系统(比如linux桌面系统)上安装!
------------
 

Simpletun

This is a 
simple tunnelling program written to test tunnelling of IPv4 and IPv6 
over IPv4. It can use TCP or UDP as underlying protocol over which 
tunnelling happens. 
 
This is a simple tunnelling program written to test tunnelling of IPv4 and IPv6 over IPv4 or IPv6. It can use TCP or UDP as underlying protocol over which tunnelling happens. It can also create a persistent tun device and set its owner.
The program uses multithreading (pthread) to read and write between two devices (tun and network). Although the code is written by me, I have referred to and am influenced by article and code snippets on http://backreference.org/2010/03/26/tuntap-interface-tutorial/

from  https://github.com/aoak/Simpletun
----------

Virtual Private Network (VPN) Lab

Overview

A Virtual Private Network (VPN) is used for creating a private scope of computer communications or providing a secure extension of a private network into an insecure network such as the Internet. VPN is a widely used security technology. VPN can be built upon IPSec or Secure Socket Layer (SSL). These are two fundamentally different approaches for building VPNs. In this lab, we focus on the SSL-based VPNs. This type of VPNs is often referred to as SSL VPNs. The learning objective of this lab is for students to master the network and security technologies underlying SSL VPNs. The design and implementation of SSL VPNs exemplify a number of security principles and technologies, including crypto, integrity, authentication, key management, key exchange, and Public-Key Infrastructure (PKI). To achieve this goal, students will implement miniVPN, a simple SSL VPN, in the Linux operating system.

Lab Description and Tasks (PDF)

    For instructors: if you prefer to modify the lab description to suit your own courses, you can download the source files (Latex) from here.

Recommended Time: 4 weeks


Files You Need


Helpful Documents

from http://www.cis.syr.edu/~wedu/seed/Labs/VPN/
-------

https://blog.cobaltstrike.com/2014/10/14/how-vpn-pivoting-works-with-source-code/

No comments:

Post a Comment