Skip to content

Instantly share code, notes, and snippets.

View brentvollebregt's full-sized avatar

Brent Vollebregt brentvollebregt

View GitHub Profile
@brentvollebregt
brentvollebregt / keylogger.pyw
Created April 11, 2017 02:48
A Python 3 keylogger using the pynput module
# From: https://github.com/moses-palmer/pynput
from pynput.keyboard import Key, Listener
import logging
log_dir = ""
logging.basicConfig(filename=(log_dir + "key_log.txt"), level=logging.DEBUG, format='["%(asctime)s", %(message)s]')
def on_press(key):
logging.info('"{0}"'.format(key))
@brentvollebregt
brentvollebregt / mouselogger.py
Created April 11, 2017 02:49
A Python 3 mouselogger using the pynput module
# From: https://github.com/moses-palmer/pynput
from pynput.mouse import Listener
import logging
log_dir = ""
logging.basicConfig(filename=(log_dir + "mouse_log.txt"), level=logging.DEBUG, format='["%(asctime)s", %(message)s]')
def on_click(x, y, button, pressed):
if pressed:
@brentvollebregt
brentvollebregt / clean_folders.py
Created April 11, 2017 02:51
Remove all empty folder in a given directory
import os
import errno
folder_to_scan_and_delete = "C:/Users/Owner/Desktop/Folder Simulation/" # Remember '/' not '\', also make sure to end with '/'
show_ignored = True
show_deleted = True
deleted = 0
for root, dirs, files in os.walk(folder_to_scan_and_delete, topdown=False):
for name in dirs:
@brentvollebregt
brentvollebregt / get_wifi_passwords.py
Last active October 11, 2023 08:32
Will find each network profile on a Windows machine and print the profile and password
import subprocess
a = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8', errors="ignore").split('\n')
a = [i.split(":")[1][1:-1] for i in a if "All User Profile" in i]
for i in a:
try:
results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8', errors="ignore").split('\n')
results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
try:
print ("{:<30}| {:<}".format(i, results[0]))
@brentvollebregt
brentvollebregt / sort_mp3_and_m4a.py
Created June 10, 2017 13:39
Sorts a directory of mp3 and m4a files to folders by their tags
# Will sort a given direcotry of music (copy)
# Requires mutagen
import os
from mutagen.id3 import ID3
from mutagen.easymp4 import EasyMP4
import shutil
input_folder = input("What is the folder to get files from?")
output_folder = os.getcwd() + "/Output/"
@brentvollebregt
brentvollebregt / setModificationTime.py
Created November 5, 2017 06:51
Change/Set Modification and Last Access Time With Python
import os
import time
import datetime
fileLocation = r""
year = 2017
month = 11
day = 5
hour = 19
minute = 50
@brentvollebregt
brentvollebregt / hotkeyDetector.py
Last active April 1, 2020 21:56
Detect when keys are pressed to simulate a hotkey detection script
# from https://github.com/moses-palmer/pynput/issues/20
from pynput import keyboard
# The key combination to check
COMBINATIONS = [
{keyboard.Key.shift_r, keyboard.KeyCode(char='a')},
{keyboard.Key.shift_r, keyboard.KeyCode(char='A')}
]
# The currently active modifiers
@brentvollebregt
brentvollebregt / the-rock-1500-results-2019.json
Created September 13, 2019 10:38
The Rock (NZ radio station - therock.net.nz) 1500 countdown of the most voted songs for 2019
[
{
"rank": "1",
"title": "Black",
"album": "Ten",
"artist": "Pearl Jam",
"albumYear": "1991",
"rankOneYearAgo": "2",
"rankTwoYearsAgo": "3",
"timestamp": "2019-09-13 18:57:13",
@brentvollebregt
brentvollebregt / the-rock-2000-results-2020.json
Last active April 26, 2021 04:34
The Rock (NZ radio station - therock.net.nz) 2000 countdown of the most voted songs for 2020
[
{
"rank": "1",
"title": "Everlong",
"album": "The Colour and the Shape",
"artist": "Foo Fighters",
"albumYear": "1997",
"rankOneYearAgo": "8",
"rankTwoYearsAgo": "6",
"timestamp": "2020-11-06 18:51:00",
"""
Google Photos Takeout Processor
This tool takes an unzipped and merged (for takeouts above 10Gb) Google Photos Takeout and filters duplicates, applies
metadata and moves all files to an output folder with each file having the format
`YYYY-MM-DD_HH-MM-SS {original_filename}`.
Setup:
1. Install tqdm: `pip install tqdm`
2. Install loguru: `pip install loguru`