Results 1 to 5 of 5

Thread: NetCat & Port Redirection & -b option

Hybrid View

  1. #1
    Member
    Join Date
    Jun 2006
    Posts
    107

    Default NetCat & Port Redirection & -b option

    Dears,

    I am trying to implement Port redirection using netcat. I have 3 PCs:

    "A" from which I run
    Code:
    nc -vv 192.168.1.2 -p 80
    "B" from which I run
    Code:
    nc -lvvp 80 | nc -vv 192.168.1.3 -p 5555
    "C" from which I run
    Code:
    nc -lvvp 5555
    The idea is to connect from A to C on the port 5555 (assuming A is behind firewall and only port 80 is opened)

    the flow works correctly, Text from A goes to C, however, text from C doesn't came back to A, but stuck in B.

    I have searched and found that this can be solved by adding a second pipe to B as follows:
    nc -lvvp 80 | nc -vv 192.168.1.3 -p 5555 | nc -lvv -b -p 80

    however, my netcat doesnt contain -b option (on both BT2 & windows binary).

    I have searched the forum and found a solutions using backpipe, but really I didn't understood it.
    Code:
    mknod backpipe p
    nc -l -p 80 0<backpipe | tee -a inflow | nc localhost 81 | tee -a outflow 1>backpipe
    thanks in advance,

  2. #2
    Member
    Join Date
    Jun 2007
    Posts
    218

    Default

    The mknod creates a FIFO that can use to pass data between the tees and NetCats.

  3. #3
    Member
    Join Date
    Jun 2006
    Posts
    107

    Default

    The mknod creates a FIFO that can use to pass data between the tees and NetCats.
    Thanks level for the clarification.

    However, I think mknod is a *nix command, which means that it cannot be run on a windows box (I know some will say, this is not a windows forum).

    May problem is why the netcat version on BT2.0 doesn't contain the -b option (for broadcasting).

    Thanks alot in advance,

  4. #4
    My life is this forum thorin's Avatar
    Join Date
    Jan 2010
    Posts
    2,629

    Default

    Quote Originally Posted by l1nuxant_ee View Post
    Thanks level for the clarification.

    However, I think mknod is a *nix command, which means that it cannot be run on a windows box (I know some will say, this is not a windows forum).
    mknod is available under the GNUWin32 CoreUtils package:
    http://gnuwin32.sourceforge.net/packages/coreutils.htm
    I'm a compulsive post editor, you might wanna wait until my post has been online for 5-10 mins before quoting it as it will likely change.

    I know I seem harsh in some of my replies. SORRY! But if you're doing something illegal or posting something that seems to be obvious BS I'm going to call you on it.

  5. #5
    Member
    Join Date
    Jun 2006
    Posts
    107

    Default

    Quote Originally Posted by thorin View Post
    mknod is available under the GNUWin32 CoreUtils package:
    http://gnuwin32.sourceforge.net/packages/coreutils.htm
    Thanks alot thorin, I will be checking it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •