Skip to content

Instantly share code, notes, and snippets.

View bryaneaton's full-sized avatar
🏖️
Tis the season

Bryan Eaton bryaneaton

🏖️
Tis the season
  • Maryville, TN
View GitHub Profile
@bryaneaton
bryaneaton / fix_borked_json.py
Last active March 1, 2024 12:50
Fix Broken JSON
import json
import re
with open("somefile.json", 'r', encoding='utf-8) as f:
s = f.read()
# Original code here by tobias_k: https://stackoverflow.com/questions/18514910/how-do-i-automatically-fix-an-invalid-json-string
while True:
try:
@bryaneaton
bryaneaton / asyncio.py
Created November 3, 2023 18:36
Asyncio and Click
import asyncio
# Async operation definition remains the same
async def async_operation():
print("Starting async operation")
await asyncio.sleep(1)
print("Async operation completed")
@bryaneaton
bryaneaton / banips.sh
Created September 17, 2023 14:19
Grep TarSSH log for ips and add to fail2ban list
#!/bin/bash
set -euo pipefail
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
GWX 3.0
Once you created a symlink with no space in its name, you can install GWX using its installer, pointing to that symlink instead of the default silent hunter 3 install location (which contains spaces, and other characters nobody should use)
If you just install GWX, it will start in 4:3 resolution ; to make it work in proper 1920x1080 resolution, i tried multiple widescreen "mods" (dll + GUI) ; the only one that worked and gave me a UI that i like is ahnenerbe's one.
0. downloads
- download "Ahnenerbe WideGui 1920 x 1080 Final" from
http://www.subsim.com/radioroom/showthread.php?t=215433
- download GWX from
import com.helger.schematron.ISchematronResource;
import com.helger.schematron.svrl.SVRLFailedAssertAndReport;
import com.helger.schematron.xslt.SchematronResourceSCH;
import javax.xml.transform.stream.StreamSource;
import java.io.File;
import java.util.List;
public class SchematronValidator {
<xs:schema xmlns="http://csrc.nist.gov/ns/oscal/1.0"
xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
elementFormDefault="qualified"
targetNamespace="http://csrc.nist.gov/ns/oscal/1.0"
version="1.1.0">
<xs:annotation>
<xs:appinfo>
<m:schema-name>OSCAL System Security Plan (SSP) Model</m:schema-name>
@bryaneaton
bryaneaton / risk_issues.py
Created April 25, 2023 19:23
risk_issues.py
# Python 3.6+
# pip(3) install requests
import requests
# Standard headers
HEADERS_AUTH = {"Content-Type": "application/x-www-form-urlencoded"}
HEADERS = {"Content-Type": "application/json"}
client_id = "SERVICE_ACCOUNT_CLIENT_ID"
client_secret = "SERVICE_ACCOUNT_CLIENT_SECRET"
#!/usr/bin/env python3
import sys
from lxml import etree
from pathlib import Path
import random
stig_folder = "./tests/test_data"
@bryaneaton
bryaneaton / nist-formatted.json
Last active March 2, 2023 01:51
nist-formatted.json
[
{
"ID": "ac-1",
"TITLE": "Access Control Policy and Procedures",
"Confidentiality": "Low",
"Integrity": "Low",
"Availability": "Low"
},
{
"ID": "ac-2",
## AlienVault CLI
This CLI is provided to ingest pulses from [AlienVault](https://otx.alienvault.com/). The RegScale CLI tool will convert this data feed into threats for use within the RegScale platform. It is commonly used to support Threat-Hunting and Threat-Based Risk Modeling for RegScale customers.
### Init.yaml Configuration
There is one required variable that will configure the AlienVault integration. The AlienVault user API key will allow pulses to pull from all subscribed feeds within AlienVault and into the RegScale platform.
- `otx` - enter AlienVault API key here