port.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 01 Jul 2013 15:44:13 +0300
changeset 1503 6c23414696fe
parent 1346 a2fbf50a43f4
child 1905 fba288d59662
permissions -rw-r--r--
Scan with nmap.
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::
1240
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
Port forwarding.
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
::
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
  $ ssh -L 8888:www.linuxhorizon.ro:80 user@computer -N
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  $ 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
    15
    25:mail.linuxhorizon.ro:25 user@computer -N
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
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
    18
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
    19
to the mail server.
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
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
    22
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
   +----------+<--port 22-->+----------+<--port 80-->o-----------+
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
   |SSH Client|-------------|ssh_server|-------------|   host    |
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
   +----------+             +----------+             o-----------+
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
  localhost:8888              computer      www.linuxhorizon.ro:80
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
Reverse SSH Tunneling.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
======================
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
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
    32
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
    33
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
    34
like systems.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
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
    37
access).
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
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
    40
Destination (192.168.20.55) <- NAT <- Source (138.47.99.99)
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
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
    43
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
  $ ssh -R 19999:localhost:22 sourceuser@138.47.99.99
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
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
    47
through SSH tuneling::
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
  $ ssh localhost -p 19999
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
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
    52
(138.47.99.99). Destination::
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
  (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
    55
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
From Bob's server::
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
  $ ssh sourceuser@138.47.99.99
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
After the sucessful login to Source::
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
  $ ssh localhost -p 19999
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
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
    65
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
    66
active.
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
Port listening.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
===============
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
Connect to a server::
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
  $ nc hostname port
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
Be a server::
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
  $ nc -l -p port
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
Simple filetransfer.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
====================
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
Serve a 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
  $ nc -l -p port < 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
Receive a 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
  $ nc hostname port > file
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
Filesystem cloning.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
===================
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
Serve the filesystem::
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
  $ tar cOPp --same-owner / | nc -l -p port
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
Receive the filesystem::
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
  $ nc -w3 hostname port | tar xPp
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
Disk cloning.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
=============
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
Serve the disk image::
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
  $ dd if=/dev/hda | nc -l -p port
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
Receive the image::
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
  $ nc -w3 hostname port | dd of=/dev/hda
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
Encrypted, compressed and IP restricted filetransfer.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
=====================================================
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
If combining encryption and compression, be sure to compress first then
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
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
   117
encrypt then compress. Compression works by finding patterns which are
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
destroyed intentionally by the process of encryption. Also, though not
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
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
   120
file is a good idea.
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
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
   123
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
  $ 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
   125
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
Receiving, decrypting and decompressing that 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
  $ 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
   129
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
Scan with nmap.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
===============
1503
6c23414696fe Scan with nmap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   132
::
1240
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   133
1503
6c23414696fe Scan with nmap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
   134
  $ nmap HOSTNAME
1240
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
Scan with netcat.
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   137
=================
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
  $ nc -v -w 2 -z hostname portrange
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   141
  $ nc -v -w 2 -z hostname portlisting
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
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
   144
portlisting is for example 11,20,135 will scan these ports.
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
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
   147
NOT work. Instead, use space separated list. eg::
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   148
70c6a3153bc7 Move "Reverse SSH Tunneling."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   149
  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
   150