Skip to content

Instantly share code, notes, and snippets.

At this point, it is probably easier to just use something like this: https://github.com/reznok/Spring4Shell-POC
- clone https://spring.io/guides/gs/handling-form-submission/
- you can skip right to gs-handling-form-submission/complete, no need to follow the tutorial
- modify it so that you can build a war file (https://www.baeldung.com/spring-boot-war-tomcat-deploy)
- install tomcat9 + java 11 (i did it on ubuntu 20.04)
- deploy the war file
- update the PoC (https://share.vx-underground.org/) to write the tomcatwar.jsp file to webapps/handling-form-submission instead of webapps/ROOT
package main
import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
func httpReq(authToken string, method string, URL string, postData []byte, isJson bool) (*http.Response, error) {
client := &http.Client{
Timeout: 20 * time.Second,
}
req, err := http.NewRequest(method, URL, bytes.NewBuffer(postData))
if err != nil {
log.Println("Error with building request for "+URL+": ", err)
return &http.Response{}, err
}
if authToken != "" {
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
},
"variables": {},
"resources": [
{
"type": "Microsoft.Network/networkSecurityGroups",
"name": "app2-nsg-uiq76ih4woyp4",
# /etc/salt/cloud.providers.d/azure.conf
azure:
driver: azurearm
master: salt
subscription_id: my_sub_id
client_id: my_client_id
secret: my_client_secret
tenant: my_tenant_id
location: westus
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"automationAccountName": {
"type": "string",
"metadata": {
"description": "Specify the name of your Automation Account"
}
},
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountDiagnosticName": {
"defaultValue": "[concat('asrmockdiag', uniqueString(resourceGroup().id))]",
"type": "String",
"metadata": {
"description": "Name of storage account"}
},
###########################################
# Generate or retrieve the API key - Log in to the Enterprise portal and follow the tutorial
# under Help - Reporting APIs. The first section under this help article explains how to
# generate or retrieve the API key for the specified enrollment.
# Source: https://docs.microsoft.com/en-us/azure/billing/billing-enterprise-api
#
# Endpoints and sample responses are here:
# https://docs.microsoft.com/en-us/rest/api/billing/enterprise/billing-enterprise-api-usage-detail#json-format
# You can use that documentation to help understand the key/values returned.
###########################################
#r "Microsoft.WindowsAzure.Storage"
using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.Blob.Protocol;
using Microsoft.WindowsAzure.Storage.Auth;
using System.IO;
using System.Threading.Tasks;