Skip to content

Instantly share code, notes, and snippets.

View mainframed's full-sized avatar

Soldier of FORTRAN mainframed

View GitHub Profile
@mainframed
mainframed / oprcmd.rexx
Created November 30, 2026 21:56
ssue an MVS or JES operator command through SDSF and print the response
/* rexx - issue an MVS or JES operator command through SDSF */
/* and print the response */
/* */
/* usage: opcmd D A,L */
/* opcmd *I J=12345 (JES3 inquiry) */
/* opcmd '$D J12345' (JES2 - quote it for the shell)*/
parse arg cmd
cmd = strip(cmd)
if cmd = '' then do
say 'usage: opcmd <operator command>'
@mainframed
mainframed / print.sdsf.rexx
Created November 30, 2026 21:06
print every spool DD (incl. input JCL) for all jobs whose name starts with a prefix (default: your user ID)
/* rexx - print every spool DD (incl. input JCL) for all jobs */
/* whose name starts with a prefix (default: your user ID) */
/* */
/* usage: jobdds [prefix] e.g. jobdds (MYID*) */
/* jobdds PAYRL (PAYRL*) */
parse upper arg prefix .
if prefix = '' then prefix = userid()
prefix = strip(prefix, 'T', '*')
rc = isfcalls('ON')
@mainframed
mainframed / PSScan.ps1
Created February 14, 2026 00:31
PSScan.ps1
$FormatEnumerationLimit = -1
function Grab-Banner {
Param(
[string]$TargetIP,
[int]$Port,
[int]$TimeOut = 3000
)
$banner = ""
@mainframed
mainframed / LtpaTokenGenerator.java
Created January 27, 2026 10:09
LTAP Token Generator
import java.io.FileInputStream;
import java.util.Properties;
import javax.security.auth.Subject;
import java.security.Principal;
import com.ibm.websphere.security.ltpa.LTPAToken2;
import com.ibm.websphere.security.ltpa.LTPATokenFactory;
public class LtpaTokenGenerator {
@mainframed
mainframed / ltpa_generate.py
Last active January 26, 2026 09:27
ltpa_generate.py
#!/usr/bin/env python3
"""
LTPA Token Generator - Generates IBM WebSphere LTPA v1 and LTPA2 tokens
Based on analysis of IBM LTPA token format and cryptographic implementation.
References:
- http://tech.srij.it/2012/04/how-to-decrypt-ltpa-cookie-and-view.html
- IBM WebSphere LTPA documentation
- WebSphere {xor} password decoder by Jeroen Zomer
@mainframed
mainframed / xordecoder.py
Created January 23, 2026 14:42
Decode Websphere XOR
import base64
def decode_was_xor(xor_string):
if not xor_string.lower().startswith("{xor}"):
raise ValueError("Not a WebSphere {xor} string")
xor_data = xor_string[5:] # Remove {xor} prefix
# Base64 decode
decoded_bytes = base64.b64decode(xor_data)
#!/bin/bash
REMOTE_USER="user"
REMOTE_HOST="hostname"
REMOTE_PASSWORD="password"
LOCAL_DIR="."
while read remote_file; do
# Remove leading slash from the path
local_path="${remote_file#/}"
@mainframed
mainframed / lpar_rexx.sh
Created January 7, 2026 18:06
Run a REXX script through SSH
#!/bin/bash
# Store password securely (file with 600 permissions)
# echo "yourpassword" > ~/.ssh/z_pass
# chmod 600 ~/.ssh/z_pass
PASSWORD=$(cat ~/.ssh/z_pass)
# List of LPARs
LPARS=("lpar1" "lpar2" "lpar3")
@mainframed
mainframed / resubmit.jcl
Last active December 17, 2025 22:20
I needed some JCL that when submitted would then run some rexx which submit another job, useful for surrogats.
//* The next are lines JCL to create a temp dataset (&&OMG) with
//* a member (REXX). The file then looks like &&OMG(REXX).
//* The end of the REXX file is noted as single line with ## on it
//* The program IEBGENER copies all that data to the temp file
//CREATOMG EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT2 DD DSN=&&OMG(DOIT),UNIT=SYSDA,
// DISP=(NEW,PASS,DELETE),
// SPACE=(TRK,(1,1,1)),
grep open *.nmap | grep tn3270 | sed -E '
/ssl\/tn3270/ {
s/.*\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\.nmap:([0-9]+)\/.*/L:\1:\2/
b
}
s/.*\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\.nmap:([0-9]+)\/.*/\1:\2/
'