Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
<# This creates a web server on port 800 that runs given commands It servers up output from this script. example: http://localhost:8000/?cmd=dir c:\ #> $url = 'http://localhost:8000/' $listener = New-Object System.Net.HttpListener $listener.Prefixes.Add($url) $listener.Start() Write-Host "Listening at $url..." while ($listener.IsListening) { $context = $listener.GetContext() $requestUrl = $context.Request.Url $response = $context.Response Write-Host '' Write-Host "> $requestUrl" $localPath = $requestUrl.LocalPath $cmd = $requestURL -split "cmd="; $cmd = $cmd[1].split(); Write-Host "Executing: cmd /c $cmd" $OutputVariable = & cmd /c $cmd | Out-String Write-Host "$OutputVariable" $buffer = [System.Text.Encoding]::UTF8.GetBytes($OutputVariable) $response.ContentLength64 = $buffer.Length $response.OutputStream.Write($buffer, 0, $buffer.Length) $response.Close() $responseStatus = $response.StatusCode }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)