port.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:46:36 +0200
changeset 1905 fba288d59662
parent 1503 6c23414696fe
child 1912 8b81a8f0f692
permissions -rw-r--r--
Include only local subsections into TOC. This prevent duplication of TOC when build single page HTML document. Also this make unnecessary CSS hack to hide document title as top level section.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1240
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1240
diff changeset
     2
.. include:: HEADER.rst
1240
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
===============
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 Network port.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
===============
1346
a2fbf50a43f4 Fix: Has no 'contents::' directive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
     7
.. contents::
1905
fba288d59662 Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1503
diff changeset
     8
   :local:
1240
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
Port forwarding.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
================
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  $ ssh -L 8888:www.linuxhorizon.ro:80 user@computer -N
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
  $ ssh -L 8888:www.linuxhorizon.ro:80 -L 110:mail.linuxhorizon.ro:110 \
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
    25:mail.linuxhorizon.ro:25 user@computer -N
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
The second example (see above) show you how to setup your ssh tunnel for web, pop3
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
and smtp. It is useful to recive/send your e-mails when you don't have direct access
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
to the mail server.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
For the ASCII art and lynx browser fans here is illustrated the first example::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
   +----------+<--port 22-->+----------+<--port 80-->o-----------+
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
   |SSH Client|-------------|ssh_server|-------------|   host    |
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
   +----------+             +----------+             o-----------+
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
  localhost:8888              computer      www.linuxhorizon.ro:80
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
Reverse SSH Tunneling.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
======================
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
Have you ever wanted to ssh to your Linux box that sits behind NAT? Now you can
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
with reverse SSH tunneling. This document will show you step by step how to set
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
up reverse SSH tunneling. The reverse SSH tunneling should work fine with Unix
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
like systems.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
Let's assume that Destination's IP is 192.168.20.55 (Linux box that you want to
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
access).
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
You want to access from Linux client with IP 138.47.99.99.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
Destination (192.168.20.55) <- NAT <- Source (138.47.99.99)
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
SH from the destination to the source (with public ip) using command below::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
  $ ssh -R 19999:localhost:22 sourceuser@138.47.99.99
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
port 19999 can be any unused port. Now you can SSH from source to destination
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
through SSH tuneling::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
  $ ssh localhost -p 19999
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
3rd party servers can also access 192.168.20.55 through Destination
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
(138.47.99.99). Destination::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
  (192.168.20.55) <- |NAT| <- Source (138.47.99.99) <- Bob's server
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
From Bob's server::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
  $ ssh sourceuser@138.47.99.99
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
After the sucessful login to Source::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
  $ ssh localhost -p 19999
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
The connection between destination and source must be alive at all time. Tip:
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
you may run a command (e.g. watch, top) on Destination to keep the connection
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
active.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
Port listening.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
===============
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
Connect to a server::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
  $ nc hostname port
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
Be a server::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
  $ nc -l -p port
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
Simple filetransfer.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
====================
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
Serve a file::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
  $ nc -l -p port < file
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
Receive a file::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
  $ nc hostname port > file
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
Filesystem cloning.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
===================
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
Serve the filesystem::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
  $ tar cOPp --same-owner / | nc -l -p port
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
Receive the filesystem::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
  $ nc -w3 hostname port | tar xPp
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
Disk cloning.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
=============
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
Serve the disk image::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
  $ dd if=/dev/hda | nc -l -p port
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
Receive the image::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
  $ nc -w3 hostname port | dd of=/dev/hda
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
Encrypted, compressed and IP restricted filetransfer.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
=====================================================
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
If combining encryption and compression, be sure to compress first then
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
encrypt when sending and reverse the order for receiving. Do not attempt to
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
encrypt then compress. Compression works by finding patterns which are
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
destroyed intentionally by the process of encryption. Also, though not
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
required, specifying the IP address of the host that will be transferring the
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
file is a good idea.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
Serving a compresssed, encrypted file from 192.168.0.1 to 192.168.0.2::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
  $ gzip -c < file | openssl aes-128-cbc -e -k thispassword | nc -l 192.168.0.2 12345
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
Receiving, decrypting and decompressing that file::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
  $ nc 192.168.0.1 12345 | openssl aes-128-cbc -d -k thispassword | gunzip -c > file
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
Scan with nmap.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   132
===============
1503
6c23414696fe Scan with nmap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   133
::
1240
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   134
1503
6c23414696fe Scan with nmap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   135
  $ nmap HOSTNAME
1240
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   136
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   137
Scan with netcat.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   138
=================
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   139
::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   140
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   141
  $ nc -v -w 2 -z hostname portrange
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   142
  $ nc -v -w 2 -z hostname portlisting
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   144
Where portrange is for example "10-20" to scan all ports between 10 and 20,
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
portlisting is for example 11,20,135 will scan these ports.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   147
I just tried this on windows xp, and the comma separated list of ports does
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   148
NOT work. Instead, use space separated list. eg::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   149
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   150
  cmd> nc.exe -vv -w 2 -z www.example.com 20-25 79 80 110 137-139 443
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   151