Lightweight rest api that allows users to run Powershell commands over HTTP.

Powershell Proxy

Build Powershell-Proxy

Lightweight rest api that allows users to run Powershell commands over HTTP. Requests require a valid JWT and responses are returned in JSON format.

Build

Build the application by running the build.sh script on Linux or WSL:

$ ./build.sh

[BUILD START] đŸ”Ĩ Building Powershell Proxy - Version: 0.0.1639180082
[BUILD] đŸ”ĩ Cleaning Build Directory ./build
[BUILD] đŸŸĸ Build Directory Cleaned
[BUILD] đŸ”ĩ Compiling Windows Binary
[BUILD] đŸŸĸ Windows Binary Compiled to ./build/win/powershell-proxy_0.0.1639180082
[BUILD] đŸ”ĩ Compiling Linux Binary
[BUILD] đŸŸĸ Linux Binary Compiled to ./build/linux/powershell-proxy_0.0.1639180082
[BUILD] âŦ‡ī¸  Binaries Successfully Created

./build:
linux  win

./build/linux:
powershell-proxy_0.0.1639180082

./build/win:
powershell-proxy_0.0.1639180082.exe

[BUILD SUCCESS] ✅ Built Powershell Proxy | Version: '0.0.1' | Build Time: '1 sec'

Environment Variables

To run this application, you will need to add the following environment variables:

PWSHPRXY_LISTEN_ADDR - optional - default: 0.0.0.0

PWSHPRXY_LISTEN_PORT - optional - default: 8000

PWSHPRXY_TYPE - required - valid values: "core" or "windows"

PWSHPRXY_OKTA_CLIENT_ID - required

PWSHPRXY_OKTA_ISSUER - required

PWSHPRXY_OKTA_AUDIENCE - required

Run

To run the application ensure all the required environment variables are set then execute the binary:

Windows

C:\> powershell-proxy.exe

Linux

$ ./powershell-proxy

Output

2021/12/10 19:02:40 đŸ”ĩ Starting
2021/12/10 19:02:40 INFO: Env Variable 'PWSHPRXY_LISTEN_ADDR' not set, defaulting to 0.0.0.0
2021/12/10 19:02:40 INFO: IP Address: 0.0.0.0 is Valid
2021/12/10 19:02:40 INFO: Env Variable 'PWSHPRXY_APP_NAME' not set, defaulting to 8000
2021/12/10 19:02:40 INFO: Using Powershell Type: pwsh
2021/12/10 19:02:40 INFO: Using AppName: Powershell Proxy API
2021/12/10 19:02:40 INFO: Using ListenPort: 8888
2021/12/10 19:02:40 INFO: Using ListenAddress: 0.0.0.0
2021/12/10 19:02:40 INFO: Using OktaClientId: ***********
2021/12/10 19:02:40 INFO: Using OktaAudience: api://default
2021/12/10 19:02:40 INFO: Using OktaIssuer: https://tenant.okta.com/oauth2/default
2021/12/10 19:02:40 đŸŸĸ Started Powershell Proxy API

Usage/Examples

Get API Info

  GET /api

Example Requests

curl

curl -X GET \
  'http://localhost:8000/api'

python

import requests

reqUrl = "http://localhost:8000/api/"

response = requests.request("GET", reqUrl)

print(response.text)

javascript

fetch("http://localhost:8000/api", {
  method: "GET",
})
  .then(function (response) {
    return response.text();
  })
  .then(function (data) {
    console.log(data);
  });

Example Response

✋ Powershell Proxy API

Run Command

  POST /api/command

Query Parameters

Parameter Type Description
depth int Optional. Set the depth of json responses. Default: 4 (range: 1-6)

Headers Parameters

Header Description
Authorization Required. Valid JWT Access Token generated from Okta

Example Requests

curl

curl -X POST \
  'http://127.0.0.1:8000/api/command?depth=4' \
  -H 'Authorization: Bearer <JWT>' \
  -H 'Content-Type: application/json' \
  -d '{"commands": ["Get-ChildItem | Select-Object Name"]}'

python

import requests

reqUrl = "http://127.0.0.1:8000/api/command?depth=4"

headersList = {
 "Authorization": "Bearer <JWT>",
 "Content-Type": "application/json"
}

payload = "{\n\"commands\":[\"Get-ChildItem | Select-Object Name\"]\n}"

response = requests.request("POST", reqUrl, data=payload,  headers=headersList)

print(response.text)

javascript

let headersList = {
  Authorization: "Bearer <JWT>",
  "Content-Type": "application/json",
};

fetch("http://127.0.0.1:8000/api/command?depth=4", {
  method: "POST",
  body: '{\n"commands":["Get-ChildItem | Select-Object Name"]\n}',
  headers: headersList,
})
  .then(function (response) {
    return response.text();
  })
  .then(function (data) {
    console.log(data);
  });

Example Response

[
  {
    "Name": "build"
  },
  {
    "Name": "build.sh"
  },
  {
    "Name": "go.mod"
  },
  {
    "Name": "go.sum"
  },
  {
    "Name": "main.go"
  },
  {
    "Name": "README.md"
  }
]

Author

Owner
Similar Resources

Executing shell commands via HTTP server

shell2http HTTP-server to execute shell commands. Designed for development, prototyping or remote control. Settings through two command line arguments

Jan 1, 2023

A CLI tool queries the GitHub GraphQL API for users and ranks them according to number of contributions

Project homepage Most Active GitHub Users Counter This CLI tool queries the GitHub GraphQL API for users and ranks them according to number of contrib

Dec 6, 2021

Transparent TLS and HTTP proxy serve and operate on all 65535 ports, with domain regex whitelist and rest api control

goshkan Transparent TLS and HTTP proxy serve & operating on all 65535 ports, with domain regex whitelist and rest api control tls and http on same por

Nov 5, 2022

Chisel is a fast TCP/UDP tunnel, transported over HTTP, secured via SSH.

Chisel is a fast TCP/UDP tunnel, transported over HTTP, secured via SSH.

Chisel is a fast TCP/UDP tunnel, transported over HTTP, secured via SSH. Single executable including both client and server. Written in Go (golang). Chisel is mainly useful for passing through firewalls, though it can also be used to provide a secure endpoint into your network.

Jan 1, 2023

A C/S Tool to Download Torrent Remotely and Retrieve Files Back Over HTTP at Full Speed without ISP Torrent Limitation.

remote-torrent Download Torrent Remotely and Retrieve Files Over HTTP at Full Speed without ISP Torrent Limitation. This repository is an extension to

Sep 30, 2022

Transfer 10Gbps http traffic over 1Gbps networks :)

httpteleport Teleports 10Gbps http traffic over 1Gbps networks. Built on top of fastrpc. Use cases httpteleport may significantly reduce inter-server

Nov 30, 2022

Access more HTTP ports over CDN with this application.

Access more HTTP ports over CDN with this application.

More-Ports More Ports is a proxy service to establish all web-based applications on different ports on the server-side over a well known TCP port. It

May 8, 2022

V3IO Frames ("Frames") is a Golang based remote data frames access (over gRPC or HTTP stream)

V3IO Frames ("Frames") is a multi-model open-source data-access library that provides a unified high-performance DataFrame API for working with different types of data sources (backends). The library was developed by Iguazio to simplify working with data in the Iguazio Data Science Platform ("the platform"), but it can be extended to support additional backend types.

Oct 1, 2022
Comments
  • Fix okta vuln

    Fix okta vuln

    Upgrades the version of github.com/lestrrat-go/jwx to v1.2.13 to address the following security vulnerabilities:

    CVE-2020-9283
    CVE-2021-44716
    CVE-2020-14040
    CWE-400
    CVE-2019-11254
    
  • Auth endpoint

    Auth endpoint

    Adds an auth endpoint to the application. See README.md for examples for usage. Requires your Okta account, application and API configured to support device authorization.

Creates a linux group of users synced to your Google Workspace users and automatically imports their public SSH keys.
Creates a linux group of users synced to your Google Workspace users and automatically imports their public SSH keys.

Creates a linux group of users synced to your Google Workspace users and automatically imports their public SSH keys.

Jan 27, 2022
httpx is a fast and multi-purpose HTTP toolkit allows to run multiple probers using retryablehttp library, it is designed to maintain the result reliability with increased threads.
httpx is a fast and multi-purpose HTTP toolkit allows to run multiple probers using retryablehttp library, it is designed to maintain the result reliability with increased threads.

Features â€ĸ Installation â€ĸ Usage â€ĸ Running httpx â€ĸ Notes â€ĸ Join Discord httpx is a fast and multi-purpose HTTP toolkit allow to run multiple probers us

Jan 8, 2023
IP2Proxy Go package allows users to query an IP address to determine if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.

IP2Proxy Go Package This package allows user to query an IP address if it was being used as VPN anonymizer, open proxies, web proxies, Tor exits, data

Sep 15, 2022
protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over HTTP REST endpoints using human-readable text formats

protoCURL protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over HTTP REST endpoints using human-readable text forma

Jan 6, 2023
Go Library to Execute Commands Over SSH at Scale
Go Library to Execute Commands Over SSH at Scale

vSSH Go library to handle tens of thousands SSH connections and execute the command(s) with higher-level API for building network device / server auto

Dec 9, 2022
🤘 The native golang ssh client to execute your commands over ssh connection. 🚀🚀
🤘 The native golang ssh client to execute your commands over ssh connection. 🚀🚀

Golang SSH Client. Fast and easy golang ssh client module. Goph is a lightweight Go SSH client focusing on simplicity! Installation ❘ Features ❘ Usage

Dec 24, 2022
Run commands on remote hosts, inspecting key indicators to manage infrastructure

inspector This is a very basic ssh helper tool to manage a smaller (few 100s up to a few 1000s) fleet of servers. The main point of inspector is to pr

Mar 3, 2022
The devs are over here at devzat, chat over SSH!

Devzat Where are the devs at? Devzat! Devzat is chat over SSH Try it out: ssh sshchat.hackclub.com Add this to ~/.ssh/config: Host chat HostName s

Jan 7, 2023
Multiplexer over TCP. Useful if target server only allows you to create limited tcp connections concurrently.

tcp-multiplexer Use it in front of target server and let your client programs connect it, if target server only allows you to create limited tcp conne

May 27, 2021
red-tldr is a lightweight text search tool, which is used to help red team staff quickly find the commands and key points they want to execute, so it is more suitable for use by red team personnel with certain experience.
red-tldr is a lightweight text search tool, which is used to help red team staff quickly find the commands and key points they want to execute, so it is more suitable for use by red team personnel with certain experience.

Red Team TL;DR English | 中文įŽ€äŊ“ What is Red Team TL;DR ? red-tldr is a lightweight text search tool, which is used to help red team staff quickly find t

Jan 5, 2023