Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
Automatically enroll systemd TPM unlock feature on all LUKS partitions.
"""
import sys
import json
import subprocess
@sedrubal
sedrubal / cpio.py
Created July 22, 2023 13:39
cpio parser
#!/usr/bin/python3
"""
Docs: https://www.systutorials.com/docs/linux/man/5-cpio/
Implements the old binary format.
TODO does only support regular files
TODO does not yet extract the files
"""
@sedrubal
sedrubal / clean.sh
Created May 14, 2023 11:14
Clean Fahrradverkehrsdaten from offenedaten-koeln.de
for f in *.csv; do
new_file_name=$(echo $f | cut -d'_' -f 4 | cut -d' ' -f 6)
echo $new_file_name
encoding=$(file -N --mime-encoding "${f}" | cut -d':' -f2)
iconv -f ${encoding} -t utf-8 "${f}" |
sed 's/^M\+$//' |
sed 's/\.//g' |
sed -r 's/Jan(uar| [0-9]+)/01/;s/Feb(ruar| [0-9]+)/02/;s/(März|Mrz [0-9]+)/03/;s/Apr(il| [0-9]+)/04/;s/Mai(| [0-9]+)/05/;s/Jun(i| [0-9]+)/06/;s/Jul(i| [0-9]+)/07/;s/Aug(ust| [0-9]+)/08/;s/Sep(tember| [0-9]+)/09/;s/Okt(ober| [0-9]+)/10/;s/Nov(ember| [0-9]+)/11/;s/Dez(ember| [0-9]+)/12/' |
sed -r 's/Jahr [0-9]+//' |
sed 's/Jahressumme.*$//' > "${new_file_name}"
@sedrubal
sedrubal / Thinkpad P70 prototype
Last active July 1, 2017 14:36
Validity90 prototype output
Prototype version 10b
Found device 138a:0090
Index 1, size 12
0000 65 38 38 35 38 34 35 33 35 34 36 35
usb write:
0000 01
usb read:
0000 00 00 f0 b0 5e 54 a4 00 00 00 06 07 01 30 00 01
0010 00 00 8e 58 48 35 45 56 00 23 00 00 00 00 01 00
@sedrubal
sedrubal / CVE-2017-6513.md
Last active April 19, 2017 06:37
WHMCS Reseller Module V2 for Softaculous Virtualizor Privilege Escalation

Security Advisory for CVE-2017-6513

CVE ID: CVE-2017-6513: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-6513

Dates

  • 2017-03-06 01:00 CET: Sebastian discovered the vulnerability while using the software provided by IP Interactive UG. He tried to estimate the consequences of this issue.
  • 2017-03-06 02:00 CET: Sebastian contacted IP Interactive UG, because he thought it's an issue in their specific installation.
  • 2017-03-06 before 14:15 CET: IP Interactive UG contacted Softaculous and received a patch for this issue. He reported this to Sebastian and the issue could not be reproduced anymore.
  • 2017-03-06 14:20 CET: During a discussion with Julian we found out that this issue needs a CVE-ID and a public announcement. Sebastian tried to gather information. He asked IP Interactive UG and tried to install the software locally.
@sedrubal
sedrubal / wp_feed_import.py
Created February 10, 2017 20:32
Import posts from (Drupal) RSS feed to WordPress
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Import posts from RSS feed and bring it to WordPress export format.
This works for our Drupal 6.
It prints the content of the WordPress export xml (wpx) to stdout and
all images that have to be imported manually to stderr.
@sedrubal
sedrubal / opacapp1.svg
Created September 17, 2016 13:35
opacapp logo drafts
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sedrubal
sedrubal / debug.vcard
Created March 30, 2016 13:49
A broken contact image in vcard
BEGIN:VCARD
VERSION:3.0
UID:20140129T234653.1006b69f26@192.168.0.101
PRODID:+//IDN bitfire.at//DAVdroid/0.9.1.2 vcard4android ez-vcard/0.9.8
FN:Foo Bar
N:Foo;Bar;;;
TEL;TYPE=cell;PREF=1:1234
TEL:1234
TEL:1234
TEL;TYPE=cell:1234
@sedrubal
sedrubal / k9-log.txt
Created February 23, 2016 22:22
k9 Mail LogCat for "Empty Trash"
--------- beginning of system
--------- beginning of main
02-23 23:13:59.819 V/k9 (13449): Stored uid '7713' for msgSeq 5331 into map
02-23 23:13:59.819 V/k9 (13449): conn256987670<<<#null# [5332, FETCH, [UID, 7714, FLAGS, [\Seen, <Folder>]]]
02-23 23:13:59.819 V/k9 (13449): Stored uid '7714' for msgSeq 5332 into map
02-23 23:13:59.820 V/k9 (13449): conn256987670<<<#null# [5333, FETCH, [UID, 7715, FLAGS, [\Seen, <Folder>]]]
02-23 23:13:59.820 V/k9 (13449): Stored uid '7715' for msgSeq 5333 into map
02-23 23:13:59.820 V/k9 (13449): conn256987670<<<#null# [5334, FETCH, [UID, 7716, FLAGS, [\Seen, <Folder>]]]
02-23 23:13:59.820 V/k9 (13449): Stored uid '7716' for msgSeq 5334 into map
02-23 23:13:59.820 V/k9 (13449): conn256987670<<<#null# [5335, FETCH, [UID, 7717, FLAGS, [\Seen, <Folder>]]]
@sedrubal
sedrubal / cava.spec
Created October 27, 2015 21:52
cava - RPM SPEC
Name: cava
Version: 0.3.5
Release: 1%{?dist}
Summary: Console-based Audio Visualizer for Alsa
Group: Applications/Multimedia
License: MIT
URL: https://karlstav.github.io/%{name}/
Source0: https://github.com/karlstav/%{name}/archive/%{version}.tar.gz