< Back

New-SSHLocalPortForward

Sat Jan 18, 2020 7:58 pm

NAME New-SSHLocalPortForward



SYNOPSIS

Redirects traffic from a local port to a remote host and port via a SSH Session.





SYNTAX

New-SSHLocalPortForward [-BoundHost] <String> [-BoundPort] <Int32> [-RemoteAddress] <String> [-RemotePort] <Int32>

[-SessionId] <Int32> [<CommonParameters>]



New-SSHLocalPortForward [-BoundHost] <String> [-BoundPort] <Int32> [-RemoteAddress] <String> [-RemotePort] <Int32>

[-SSHSession] <SshSession> [<CommonParameters>]





DESCRIPTION

Redirects TCP traffic from a local port to a remote host and port via a SSH Session.





PARAMETERS

-BoundHost <String>



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BoundPort <Int32>



Required? true

Position? 3

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-RemoteAddress <String>



Required? true

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-RemotePort <Int32>



Required? true

Position? 5

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-SSHSession <SshSession>



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-SessionId <Int32>



Required? true

Position? 1

Default value 0

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Forward traffic from 0.0.0.0:8081 to 10.10.10.1:80 thru a SSH Session



PS C:\\> New-SSHLocalPortForward -Index 0 -LocalAdress 0.0.0.0 -LocalPort 8081 -RemoteAddress 10.10.10.1

-RemotePort 80 -Verbose

VERBOSE: Finding session with Index 0

VERBOSE: 0

VERBOSE: Adding Forward Port Configuration to session 0

VERBOSE: Starting the Port Forward.

VERBOSE: Forwarding has been started.



PS C:\\> Invoke-WebRequest -Uri http://localhost:8081





StatusCode : 200

StatusDescription : OK

Content :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

<script type="text/javascript" src="/javascript/scri...

RawContent : HTTP/1.1 200 OK

Expires: Tue, 16 Apr 2013 03:43:18 GMT,Thu, 19 Nov 1981 08:52:00 GMT

Cache-Control: max-age=180000,no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Set-Cookie: PHPSESS...

Forms : {iform}

Headers : {[Expires, Tue, 16 Apr 2013 03:43:18 GMT,Thu, 19 Nov 1981 08:52:00 GMT], [Cache-Control,

max-age=180000,no-store, no-cache,

must-revalidate, post-check=0, pre-check=0], [Set-Cookie,

PHPSESSID=d53d3dc62ffac241112bcfd16af36bb8; path=/], [Pragma, no-cache]...}

Images : {}

InputFields : {@{innerHTML=; innerText=; outerHTML=<INPUT onchange=clearError(); onclick=clearError();

tabIndex=1 id=usernamefld class="formfld user"

name=usernamefld>; outerText=; tagName=INPUT; onchange=clearError();; onclick=clearError();;

tabIndex=1; id=usernamefld; class=formfld

user; name=usernamefld}, @{innerHTML=; innerText=; outerHTML=<INPUT onchange=clearError();

onclick=clearError(); tabIndex=2

id=passwordfld class="formfld pwd" type=password value="" name=passwordfld>; outerText=;

tagName=INPUT; onchange=clearError();;

onclick=clearError();; tabIndex=2; id=passwordfld; class=formfld pwd; type=password; value=;

name=passwordfld}, @{innerHTML=;

innerText=; outerHTML=<INPUT tabIndex=3 class=formbtn type=submit value=Login name=login>;

outerText=; tagName=INPUT; tabIndex=3;

class=formbtn; type=submit; value=Login; name=login}}

Links : {}

ParsedHtml : mshtml.HTMLDocumentClass

RawContentLength : 5932











RELATED LINKS