Skip to content

Instantly share code, notes, and snippets.

View claudijd's full-sized avatar
🦬

Jonathan Claudius claudijd

🦬
View GitHub Profile
@claudijd
claudijd / tx.txt
Created February 9, 2023 00:33
tx.txt
$ worm parse 01000000020d03632733cadb4398deff53e35fd7255296df9f5a8b8099c701d18fe4328d89351a1da6913276ad8f806f254e13816209e05d68fba914f7a74afa732a0abc56c4a50105aeb171934c5b3336db4ca2ff1dec200798ab0fc554520f2b12a7822684568d8a0de8a5115ae00476aad2607f29e30a559429f66f331d30e281b4f30ad7e799970106aab251c07774ad4d1d2dc4b3657e2b91d43dd41e54b4164dea9b025515d537334d68899e00ef494d54bc3cd6948655b61a8eec1bceebf907e2ab18c0ece009ac01077607cf7e024f2525071b4ecef46060ee23fb1d3ea5e5ed7ea00f44676391719466c071e2facfa35aa364b9c3aba5beb5c1f80b28b38aaef5e9d0f64cc81e2b4f0109ab9995885cb1603ea880323d22ce17752c05f5fb9b0631d1f48552e53f3afa9d3b8097faec35e907be7637543b59db2869bebcf2cda1151f4bf8c2a342e0fd24010a5fc9061809cf2ff11d4d50d3e9d55a0168d6ca4520802d81e5e5fb83af3dbbff297fe42b2e2a2678cbcfc049a99554859ef5046886c6bcb56f2705c44ea7f22c010b6c4e79c796094ec80b096bb495e54d21852a6194d4c35903e25705b97cecdd622cc1e7b4e9a9556a04ef3b255426703e3bc885873e64b0b8fa193f9fd8370c74010c70d7c1940647960e88fb5fe891012567d22394ae99c3beccc9a49b10e70223353e876d510
@claudijd
claudijd / poc.py
Last active October 30, 2021 18:03
Example method to obtain a bearer token and obtain users uuid
import json
import requests
import pdb
import os
BASE_URL = "https://auth.mozilla.auth0.com"
def get_bearer_token():
url = BASE_URL + '/oauth/token'
@claudijd
claudijd / hello.py
Last active February 7, 2020 18:30
log = open("/Users/jclaudius/.aws/config", "r")
for line in log:
print(line)
@claudijd
claudijd / clean_downloads.py
Created January 3, 2020 16:47
Clean downloads
import glob
import os
import os.path
import shutil
mydir = "/Users/jclaudius/Downloads/"
filelist = glob.glob(os.path.join(mydir, "*"))
for f in filelist:
if os.path.isdir(f):
@claudijd
claudijd / clean_desktop.py
Created January 3, 2020 16:02
Clean desktop
import os
import shutil
path = "/Users/jclaudius/Desktop/"
moveto = "/Users/jclaudius/Desktop/Archive/"
files = os.listdir(path)
files.sort()
for f in files:
if not os.path.isdir(f):
src = path+f
@claudijd
claudijd / example.py
Created November 15, 2019 18:00
boto => boto3 file upload
# In boto
import boto
conn = boto.connect_s3(aws_access_key_id=aws_access_key_id,aws_secret_access_key=aws_secret_access_key)
bucket = conn.get_bucket(bucket_name, validate=False)
key = boto.s3.key.Key(bucket)
key.key = key_name
key.set_contents_from_filename(file_path)
url = "https://{}.s3.amazonaws.com/{}".format(bucket.name, key.name)
@claudijd
claudijd / poc.py
Last active October 1, 2019 17:14
import re
# Current
>>> re.search(r"((ssh|https)://)?(git@)?github.com[:/](?P<repo_name>[A-Za-z0-9\/\-_]+)(.git)?", "bananas://github.com:/")
'/'
# Proposed
>>> re.search(r"^((https|ssh)://)?(git@)?github.com/(?P<repo_name>[A-Za-z0-9\/\-_]+)(.git)?$", "https://github.com/org/foo").group("repo_name")
'org/foo'
>>> re.search(r"^((https|ssh)://)?(git@)?github.com/(?P<repo_name>[A-Za-z0-9\/\-_]+)(.git)?$", "https://github.com/org/foo.git").group("repo_name")
@claudijd
claudijd / connections_example.py
Created September 17, 2019 21:08
Simplistic prototype for connections expiry
import datetime
import time
# Simple connections management dict in Python example
connections = {}
class Connection:
def __init__(self):
@claudijd
claudijd / index.js
Created July 22, 2019 14:15
Example CloudFront Distribution Viewer Response Lambda Function to Get better Observatory Grades!
'use strict';
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
// See https://wiki.mozilla.org/Security/Guidelines/Web_Security
headers['Strict-Transport-Security'] = [{'key': 'Strict-Transport-Security', 'value': 'max-age=63072000'}];
headers['X-Content-Type-Options'] = [{'key': 'X-Content-Type-Options', 'value': 'nosniff'}];
headers['X-Frame-Options'] = [{'key': 'X-Frame-Options', 'value': 'DENY'}];
@claudijd
claudijd / report.json
Created July 10, 2019 20:19
example of JSON formatted report
{
"overall": "orange",
scanner_reports: {
"ssh_observatory": "green",
"http_observatory": "orange",
"dir_scan": "green",
"ssh_observatory": "green",
"ssh_observatory": "green"
}
}