Giter Site home page Giter Site logo

icmptunnel's People

Contributors

abhijeetkaur avatar dhavalkapil avatar iblech avatar jjungo avatar liyaoyu avatar miguel-r-s avatar piyush8311 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

icmptunnel's Issues

feature to add client for linphone

hello..
i have client is linphone mobile.
so can u help me to develop for linphone client where to implement it in code?

please

Thanks
Dipen

Segmentation fault

After compiling and executing

# ./icmptunnel

I am getting segmentation fault. Tested this on both debian 8 and ubuntu 14.04 and both give same error.

Can't connect server ip

[DEBUG] Allocating tunnel
[DEBUG] Allocatating tunnel2[DEBUG] Created tunnel tun0
[DEBUG] Starting tunnel - Dest: ..., Server: 0
[DEBUG] Opening ICMP socket
SIOCDELRT: No such process
SIOCADDRT: Network is unreachable
SIOCADDRT: Network is unreachable
[DEBUG] Error in running script

cant bind tun0 address to create a socks proxy

It runs correctly on both ends, but when I try to ssh -D 4444 [email protected] nothing happens:

on server I run sudo ./icmptunnel -s 10.0.1.1, on client sudo ./icmptunnel -c serverip and I have:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        0.0.0.0         255.255.255.0   U     600    0        0 wlp2s0
serverip    10.0.0.1        255.255.255.255 UGH   0      0        0 wlp2s0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

and

$ ip a show tun0
13: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1472 qdisc fq_codel state UNKNOWN group default qlen 500
    link/none 
    inet 10.0.1.2/24 scope global tun0
       valid_lft forever preferred_lft forever
    inet6 fe80::9971:42bb:d660:fd84/64 scope link flags 800 
       valid_lft forever preferred_lft forever

what am I doing wrong here?

note: strangely enought if I try: sudo ssh -D 4444 root@serverip I get prompted for password when I set on server to never ask for that...

# cat /etc/ssh/sshd_config|grep Password
PermitEmptyPasswords no
PasswordAuthentication no

This is another issue but can also be related, sometimes when I press ctrl+c I get this on server side
[DEBUG] Read ICMP packet with src: 10.0.0.29, dest: 10.0.0.12, payload_size: 24, payload: x��� or [DEBUG] Read ICMP packet with src: 10.0.0.29, dest: 10.0.0.12, payload_size: 24, payload: '��D�#�@xxxxxxxxxxxxxxxx�� pls give me some hint, thanks!

authentication

there should be some means of encrypted (one-time) authentication (per ip) so not everyone can use the icmp proxy server.

Security issues and smal improvements

  • Why not use calloc instead of malloc+setmem to set zeros ?
  • I saw many strcpy functions without check the input, why not use strncpy ?

Good job, anyway!

Payload size is small.

[DEBUG] Reading from tunnel
[DEBUG] Sending ICMP packet with payload_size: 60, payload: E
[DEBUG] Data needs to be readed from tun device
[DEBUG] Preparing ICMP packet to be sent
[DEBUG] Destination address: 192.168.56.105
[DEBUG] Reading from tunnel
[DEBUG] Sending ICMP packet with payload_size: 60, payload: E
[DEBUG] Data needs to be readed from tun device
[DEBUG] Preparing ICMP packet to be sent
[DEBUG] Destination address: 192.168.56.105
[DEBUG] Reading from tunnel
[DEBUG] Sending ICMP packet with payload_size: 60, payload: E

As you can see payload_size is very small and hence viewing any page is almost impossible , any workaround this problem?

error while running tunnel on client

[DEBUG] Allocating tunnel
Error returned by ioctl(): Unknown error -1
Error in tun_alloc()
: Device or resource busy

I receive this error while i try to run icmp tunnel on client, i followed all the istructions of the demo

Sending a Ping, crashes the server

ping u.u.u.u crashes the server. Here is a log of the server

[DEBUG] Read ICMP packet with src: x.x.x.x , dest: u.u.u.u, payload_size: 56, payload: �TGV
[DEBUG] Writing to tunnel
Unable to write to tunnel
: Invalid argument

i got error

on the Client

[DEBUG] Allocating tunnel
[DEBUG] Allocatating tunnel2[DEBUG] Created tunnel tun0
[DEBUG] Starting tunnel - Dest: xx.xx.xx.xx, Server: 0
[DEBUG] Opening ICMP socket
SIOCDELRT: No such process
client.sh: 11: client.sh: Syntax error: newline unexpected
[DEBUG] Error in running script
[DEBUG] Data needs to be readed from tun device
[DEBUG] Preparing ICMP packet to be sent
[DEBUG] Destination address: xx.xx.xx.xx
[DEBUG] Reading from tunnel
[DEBUG] Sending ICMP packet with payload_size: 48, payload: `
[DEBUG] Data needs to be readed from tun device
[DEBUG] Preparing ICMP packet to be sent
[DEBUG] Destination address: xx.xx.xx.xx
[DEBUG] Reading from tunnel
[DEBUG] Sending ICMP packet with payload_size: 48, payload: `
[DEBUG] Data needs to be readed from tun device
[DEBUG] Preparing ICMP packet to be sent
[DEBUG] Destination address: xx.xx.xx.xx
[DEBUG] Reading from tunnel
[DEBUG] Sending ICMP packet with payload_size: 48, payload: `

Encrypt traffic?

Should data be encrypted in transit? A simple shared-secret between client and server may suffice. In this way any PCAP solution won't see the raw data and may not detect the tunnel.

Make Problem

Hello,
I installed icmptunnel on ubuntu 14.04 and when wrote make I getting this error,

gcc -c -o icmptunnel.o icmptunnel.c -I. -O3 -Wall
make: gcc: Command not found
make: *** [icmptunnel.o] Error 127

Can you help me with this problem? Sorry if the problem is so basic. I'm new guy

Unable to write to tunnel

So , I was playing around this tool but I could not get it started on a vps because program exited saying
Unable to write to tunnel : Invalid argument. Here's a screenshot to illustrate the issue
Issue
I used Arch Linux here but I had same issue with debian 8

Compile Error on OS X Capitain

This is the error I get when I try to compile icmptunnel on OS X Capitain.

icmptunnel git:(master) make
gcc -c -o icmptunnel.o icmptunnel.c -I.
gcc -c -o icmp.o icmp.c -I.
icmp.c:22:29: warning: declaration of 'struct iphdr' will not be visible outside of this function [-Wvisibility]
void prepare_headers(struct iphdr *ip, struct icmphdr *icmp);
                            ^
icmp.c:22:47: warning: declaration of 'struct icmphdr' will not be visible outside of this function [-Wvisibility]
void prepare_headers(struct iphdr *ip, struct icmphdr *icmp);
                                              ^
icmp.c:100:3: warning: implicit declaration of function 'inet_pton' is invalid in C99 [-Wimplicit-function-declaration]
  inet_pton(AF_INET, packet_details->src_addr, &src_addr);
  ^
icmp.c:103:17: error: invalid application of 'sizeof' to an incomplete type 'struct iphdr'
  packet_size = sizeof(struct iphdr) + sizeof(struct icmphdr) + packet_details->payload_size;
                ^     ~~~~~~~~~~~~~~
icmp.c:91:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:103:40: error: invalid application of 'sizeof' to an incomplete type 'struct icmphdr'
  packet_size = sizeof(struct iphdr) + sizeof(struct icmphdr) + packet_details->payload_size;
                                       ^     ~~~~~~~~~~~~~~~~
icmp.c:92:10: note: forward declaration of 'struct icmphdr'
  struct icmphdr *icmp;
         ^
icmp.c:114:38: error: invalid application of 'sizeof' to an incomplete type 'struct iphdr'
  icmp = (struct icmphdr *)(packet + sizeof(struct iphdr));
                                     ^     ~~~~~~~~~~~~~~
icmp.c:91:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:115:36: error: invalid application of 'sizeof' to an incomplete type 'struct iphdr'
  icmp_payload = (char *)(packet + sizeof(struct iphdr) + sizeof(struct icmphdr));
                                   ^     ~~~~~~~~~~~~~~
icmp.c:91:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:115:59: error: invalid application of 'sizeof' to an incomplete type 'struct icmphdr'
  icmp_payload = (char *)(packet + sizeof(struct iphdr) + sizeof(struct icmphdr));
                                                          ^     ~~~~~~~~~~~~~~~~
icmp.c:92:10: note: forward declaration of 'struct icmphdr'
  struct icmphdr *icmp;
         ^
icmp.c:117:19: warning: incompatible pointer types passing 'struct iphdr *' to parameter of type 'struct iphdr *' [-Wincompatible-pointer-types]
  prepare_headers(ip, icmp);
                  ^~
icmp.c:22:36: note: passing argument to parameter 'ip' here
void prepare_headers(struct iphdr *ip, struct icmphdr *icmp);
                                   ^
icmp.c:117:23: warning: incompatible pointer types passing 'struct icmphdr *' to parameter of type 'struct icmphdr *' [-Wincompatible-pointer-types]
  prepare_headers(ip, icmp);
                      ^~~~
icmp.c:22:56: note: passing argument to parameter 'icmp' here
void prepare_headers(struct iphdr *ip, struct icmphdr *icmp);
                                                       ^
icmp.c:119:5: error: incomplete definition of type 'struct iphdr'
  ip->tot_len = htons(packet_size);
  ~~^
icmp.c:91:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:120:5: error: incomplete definition of type 'struct iphdr'
  ip->saddr = src_addr.s_addr;
  ~~^
icmp.c:91:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:121:5: error: incomplete definition of type 'struct iphdr'
  ip->daddr = dest_addr.s_addr;
  ~~^
icmp.c:91:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:125:7: error: incomplete definition of type 'struct icmphdr'
  icmp->type = packet_details->type;
  ~~~~^
icmp.c:92:10: note: forward declaration of 'struct icmphdr'
  struct icmphdr *icmp;
         ^
icmp.c:126:7: error: incomplete definition of type 'struct icmphdr'
  icmp->checksum = 0;
  ~~~~^
icmp.c:92:10: note: forward declaration of 'struct icmphdr'
  struct icmphdr *icmp;
         ^
icmp.c:127:7: error: incomplete definition of type 'struct icmphdr'
  icmp->checksum = in_cksum((unsigned short *)icmp, sizeof(struct icmphdr) + packet_details->payload_size);
  ~~~~^
icmp.c:92:10: note: forward declaration of 'struct icmphdr'
  struct icmphdr *icmp;
         ^
icmp.c:127:53: error: invalid application of 'sizeof' to an incomplete type 'struct icmphdr'
  icmp->checksum = in_cksum((unsigned short *)icmp, sizeof(struct icmphdr) + packet_details->payload_size);
                                                    ^     ~~~~~~~~~~~~~~~~
icmp.c:92:10: note: forward declaration of 'struct icmphdr'
  struct icmphdr *icmp;
         ^
icmp.c:162:83: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
  packet_size = recvfrom(sock_fd, packet, MTU, 0, (struct sockaddr *)&(src_addr), &src_addr_size);
                                                                                  ^~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/socket.h:592:25: note: passing argument to parameter here
                socklen_t * __restrict) __DARWIN_ALIAS_C(recvfrom);
                                      ^
icmp.c:165:38: error: invalid application of 'sizeof' to an incomplete type 'struct iphdr'
  icmp = (struct icmphdr *)(packet + sizeof(struct iphdr));
                                     ^     ~~~~~~~~~~~~~~
icmp.c:147:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:166:36: error: invalid application of 'sizeof' to an incomplete type 'struct iphdr'
  icmp_payload = (char *)(packet + sizeof(struct iphdr) + sizeof(struct icmphdr));
                                   ^     ~~~~~~~~~~~~~~
icmp.c:147:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:166:59: error: invalid application of 'sizeof' to an incomplete type 'struct icmphdr'
  icmp_payload = (char *)(packet + sizeof(struct iphdr) + sizeof(struct icmphdr));
                                                          ^     ~~~~~~~~~~~~~~~~
icmp.c:148:10: note: forward declaration of 'struct icmphdr'
  struct icmphdr *icmp;
         ^
icmp.c:169:3: warning: implicit declaration of function 'inet_ntop' is invalid in C99 [-Wimplicit-function-declaration]
  inet_ntop(AF_INET, &(ip->saddr), packet_details->src_addr, INET_ADDRSTRLEN);
  ^
icmp.c:169:26: error: incomplete definition of type 'struct iphdr'
  inet_ntop(AF_INET, &(ip->saddr), packet_details->src_addr, INET_ADDRSTRLEN);
                       ~~^
icmp.c:147:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:170:26: error: incomplete definition of type 'struct iphdr'
  inet_ntop(AF_INET, &(ip->daddr), packet_details->dest_addr, INET_ADDRSTRLEN);
                       ~~^
icmp.c:147:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
icmp.c:171:30: error: incomplete definition of type 'struct icmphdr'
  packet_details->type = icmp->type;
                         ~~~~^
icmp.c:148:10: note: forward declaration of 'struct icmphdr'
  struct icmphdr *icmp;
         ^
icmp.c:172:48: error: invalid application of 'sizeof' to an incomplete type 'struct iphdr'
  packet_details->payload_size = packet_size - sizeof(struct iphdr) - sizeof(struct icmphdr);
                                               ^     ~~~~~~~~~~~~~~
icmp.c:147:10: note: forward declaration of 'struct iphdr'
  struct iphdr *ip;
         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
make: *** [icmp.o] Error 1

Ignore simple ping

If a machine ping me during the program is launched, icmptunnel crashed with this error:

root@debian:~/icmptunnel# ./icmptunnel -s 10.0.1.1
[DEBUG] Allocatating tunnel
[DEBUG] Allocatating tunnel2[DEBUG] Created tunnel tun0
[DEBUG] Starting tunnel - Dest: 10.0.1.1, Server: 1
[DEBUG] Opening ICMP socket
[DEBUG] Binding ICMP socket
0+1 records in
0+1 records out
2 bytes (2 B) copied, 9.6663e-05 s, 20.7 kB/s
0+1 records in
0+1 records out
2 bytes (2 B) copied, 7.4032e-05 s, 27.0 kB/s
[DEBUG] Script ran successfully
[DEBUG] Received ICMP packet
[DEBUG] Read ICMP packet with src: 194.90.37.75, dest: 94.23.11.59, payload_size: 129, payload: E
[DEBUG] Writing to tunnel
[DEBUG] Src address being copied: 194.90.37.75
[DEBUG] Received ICMP packet
[DEBUG] Read ICMP packet with src: 188.235.15.178, dest: 94.23.11.59, payload_size: 129, payload: Ep
[DEBUG] Writing to tunnel
[DEBUG] Src address being copied: 188.235.15.178
[DEBUG] Received ICMP packet
[DEBUG] Read ICMP packet with src: 92.222.185.1, dest: 94.23.11.59, payload_size: 4, payload: ^�
;
[DEBUG] Writing to tunnel
Unable to write to tunnel
: Invalid argument

Demo

Just wanted to let you know that I've built a 5-container demo of your tool. It includes an instance of Wireshark (with a web interface) and a PDF showing how to set up and use the demo. The code is at:

https://github.com/packetgeek/icmptunnel-docker-demo

Go ahead and close (or delete) this issue. Just wanted to let y'all know about it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.