port.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 09 Feb 2012 16:29:36 +0200
changeset 1240 70c6a3153bc7
child 1334 9bf0d5a1f0cf
permissions -rw-r--r--
Move "Reverse SSH Tunneling."
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; -*-
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
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
 Network port.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
===============
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
Port forwarding.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
================
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
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
  $ ssh -L 8888:www.linuxhorizon.ro:80 user@computer -N
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
  $ 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
    13
    25:mail.linuxhorizon.ro:25 user@computer -N
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
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
    16
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
    17
to the mail server.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
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
    20
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
   +----------+<--port 22-->+----------+<--port 80-->o-----------+
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
   |SSH Client|-------------|ssh_server|-------------|   host    |
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
   +----------+             +----------+             o-----------+
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
  localhost:8888              computer      www.linuxhorizon.ro:80
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
Reverse SSH Tunneling.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
======================
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
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
    30
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
    31
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
    32
like systems.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
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
    35
access).
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
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
    38
Destination (192.168.20.55) <- NAT <- Source (138.47.99.99)
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
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
    41
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
  $ ssh -R 19999:localhost:22 sourceuser@138.47.99.99
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
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
    45
through SSH tuneling::
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
  $ ssh localhost -p 19999
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
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
    50
(138.47.99.99). Destination::
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
  (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
    53
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
From Bob's server::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
  $ ssh sourceuser@138.47.99.99
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
After the sucessful login to Source::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
  $ ssh localhost -p 19999
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
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
    63
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
    64
active.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
Port listening.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
===============
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
Connect to a server::
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
  $ nc hostname port
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
Be a server::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
  $ nc -l -p port
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
Simple filetransfer.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
====================
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
Serve a file::
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
  $ nc -l -p port < file
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
Receive a file::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
  $ nc hostname port > file
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
Filesystem cloning.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
===================
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
Serve the filesystem::
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
  $ tar cOPp --same-owner / | nc -l -p port
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
Receive the filesystem::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
  $ nc -w3 hostname port | tar xPp
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
Disk cloning.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
=============
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
Serve the disk image::
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
  $ dd if=/dev/hda | nc -l -p port
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
Receive the image::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
  $ nc -w3 hostname port | dd of=/dev/hda
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
Encrypted, compressed and IP restricted filetransfer.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
=====================================================
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
If combining encryption and compression, be sure to compress first then
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
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
   115
encrypt then compress. Compression works by finding patterns which are
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
destroyed intentionally by the process of encryption. Also, though not
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
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
   118
file is a good idea.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
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
   121
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
  $ 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
   123
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
Receiving, decrypting and decompressing that file::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
  $ 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
   127
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
Scan with nmap.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
===============
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
TODO
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   132
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   133
Scan with netcat.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   134
=================
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
::
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
  $ nc -v -w 2 -z hostname portrange
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   138
  $ nc -v -w 2 -z hostname portlisting
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
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
   141
portlisting is for example 11,20,135 will scan these ports.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   142
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
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
   144
NOT work. Instead, use space separated list. eg::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
  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
   147