1. PingTunnel-[N]ew[G]eneration Read Me
  2. ====================================
  3. What is ptunnel-ng?
  4. ----------------
  5. Ptunnel-NG is a bugfixed and refactored version of Ptunnel with some additional
  6. features e.g. change the magic value without recompiling.
  7. What is ptunnel?
  8. ----------------
  9. Ptunnel is an application that allows you to reliably tunnel TCP connections
  10. to a remote host using ICMP echo request and reply packets, commonly known as
  11. ping requests and replies.
  12. Simple usage
  13. ------------
  14. Opens a SSH over ICMP tunnel to a remote.
  15. Server:
  16. sudo ptunnel-ng
  17. Client:
  18. sudo ptunnel-ng -p[Server-IP/NAME] -l2222
  19. ssh -p2222 -luser
  20. Restricted usage
  21. ----------------
  22. Opens a SSH over ICMP tunnel to a remote but restricts destination IP/Port for tunnel clients.
  23. is the machine your SSH daemon listens on. This can be a virtual machine, container or (.*).
  24. Server:
  25. sudo ptunnel-ng -r10.0.3.1 -R22
  26. Client:
  27. sudo ptunnel-ng -p[Server-IP/NAME] -l2222 -r10.0.3.1 -R22
  28. ssh -p2222 -luser
  29. Reverse shell usage
  30. -------------------
  31. Opens a SSH over ICMP tunnel to a remote and creates a reverse tunnel on same
  32. but restricts destination IP/Port for tunnel clients.
  33. is the machine your SSH daemon listens on. This can be a virtual machine, container or (.*).
  34. Server:
  35. sudo ptunnel-ng -r10.0.3.1 -R22
  36. Client:
  37. sudo ./src/ptunnel-ng -p[Server-IP/NAME] -l2222 -r10.0.3.1 -R22
  38. ssh -R -p2222
  39. Server:
  40. ssh -p22222 -luser
  41. Contact details
  42. ---------------
  43. The ptunnel-ng fork was done by Toni Uhlig:
  44. <>
  45. You can contact the author of ptunnel, Daniel Stoedle, here:
  46. <>
  47. The official ptunnel website is located here:
  48. <>
  49. Dependencies
  50. ------------
  51. Required: pthread
  52. Optional: pcap, selinux
  53. Compiling
  54. ---------
  55. Either run "./" for a fully automatic build or run it manually with:
  56. "./configure && make"
  57. You should end up with a binary called ptunnel-ng.
  58. This serves as both the client and proxy. You can
  59. optionally install it using "make install".
  60. To compile the Windows binary. You will need mingw installed.
  61. If you want pcap support you will need the WinPcap library as well.
  62. WinPcap is available here:
  63. <>
  64. REMEMBER: ptunnel-ng might not work on Windows without WinPcap!
  65. Running
  66. -------
  67. Ptunnel works best when starting as root, and usually requires starting as root.
  68. Common ptunnel-ng options:
  69. Proxy(Server):
  70. ./ptunnel-ng -r<destination address> -R<destination port> -v <loglevel>
  71. -P<password> -u<user> -g<group>
  72. Forwarder(Client):
  73. ./ptunnel-ng -p <address> -l <listen port> -r<destination address>
  74. -R<destination port> -v <loglevel>
  75. -P<password> -u<user> -g<group>
  76. The -p switch sets the address of the host on which the proxy is running. A
  77. quick test to see if the proxy will work is simply to try pinging this host -
  78. if you get replies, you should be able to make the tunnel work.
  79. If pinging works but you are not able to establish a tunnel, you should play
  80. around with the -m switch and change the magic value. A IDS/IPS or Firwall
  81. might try to fool you.
  82. The -l, -r and -R switches set the local listening port, destination address
  83. and destination port. For instance, to tunnel ssh connections from the client
  84. machine via a proxy running on to the computer
  85., the following command line would be used:
  86. sudo ./ptunnel-ng -p -l 8000 -r -R 22
  87. An ssh connection to can now be established as follows:
  88. ssh -p 8000 localhost
  89. If ssh complains about potential man-in-the-middle attacks, simply remove the
  90. offending key from the known_hosts file. The warning/error is expected if you
  91. have previously ssh'd to your local computer (i.e., ssh localhost), or you have
  92. used ptunnel-ng to forward ssh connections to different hosts.
  93. Of course, for all of this to work, you need to start the proxy on your
  94. proxy-computer (we'll call it here). Doing this is very
  95. simple:
  96. sudo ./ptunnel-ng
  97. If you find that the proxy isn't working, you will need to enable packet
  98. capturing on the main network device. Currently this device is assumed to be
  99. an ethernet-device (i.e., ethernet or wireless). Packet capturing is enabled by
  100. giving the -L switch, and supplying the device name to capture packets on (for
  101. instance eth0 or en1). The same goes for the client. On versions of Mac OS X
  102. prior to 10.4 (Tiger), packet capturing must always be enabled (both for proxy
  103. and client), as resent packets won't be received otherwise.
  104. To protect yourself from others using your proxy, you can protect access to it
  105. with a password using the -P switch. The password is never sent in
  106. the clear, but keep in mind that it may be visible from tools like top or ps,
  107. which can display the command line used to start an application.
  108. Finally, the -u switch will attempt to run the proxy in unprivileged mode (i.e.,
  109. no need for root access), and the -v switch controls the amount of output from
  110. ptunnel-ng. -1 indicates no output, 0 shows errors only, 1 shows info messages, 2
  111. gives more output, 3 provides even more output, level 4 displays debug info and
  112. level 5 displays absolutely everything, including the nasty details of sends and
  113. receives. The -o switch allows output to be saved to a logfile.
  114. Security features: Please see the ptunnel-ng man-page for instructions.
  115. Supported operating systems
  116. ---------------------------
  117. Ptunnel supports most operating systems with libpcap, the usual POSIX functions
  118. and a BSD sockets compatible API. In particular, it has been tested on Linux
  119. Fedora Core 2 and Mac OS X 10.3.6 and above. As of version 0.7, ptunnel-ng can also
  120. be compiled on Windows, courtesy of Mike Miller, assuming mingw and WinPcap is
  121. installed.
  122. TODOs
  123. -----
  124. - refactoring
  125. - libsodium integration
  126. Credits and contributors
  127. ------------------------
  128. Daniel Stoedle et al.
  129. License
  130. -------
  131. Ping Tunnel NG is Copyright (c) 2017-2019, Toni Uhlig <>,
  132. All rights reserved. Ping Tunnel NG is licensed under the
  133. BSD License. Please see the COPYING file for details.