Skip to content

Instantly share code, notes, and snippets.

@meeuw
meeuw / searchallpw.py
Created December 12, 2024 19:40
List all secrets in gnome-keyring. Somewhat like secret-tool search --all where you don't have to specify any attributes.
import gi
gi.require_version('Secret', '1')
from gi.repository import Secret
for item in Secret.password_search_sync(None, {}, Secret.SearchFlags.ALL, None):
print(f'attributes {item.get_attributes()}')
print(f'label {item.get_label()}')
print(f'secret {item.retrieve_secret_sync().get()}')
@meeuw
meeuw / pystun.py
Created October 2, 2020 19:05
Simple STUN implementation in Python, usage: python pystun.py stun.l.google.com 19302
#!/usr/bin/python
import socket
import uuid
import struct
import io
import sys
def unpack(stream, fmt):
def chunk_bytes(value, bit_length):
"""
Chunk value into bytes of bit_length
"""
for _ in range(0, value.bit_length(), bit_length):
yield value & ((1 << bit_length) - 1)
value >>= bit_length
def one_is_more_encode(value):
"""
Script to use Wooting Gamepad as Mouse
"""
import asyncio
import collections
import signal
import sys
import evdev
import pyudev
@meeuw
meeuw / localsemodule.sh
Created May 26, 2014 19:02
generate selinux module's by using auseach and diffing output
#!/bin/bash
if [ -n "$2" ] ; then
ausearch -m avc -ts $2|audit2allow -m $1 > $1.tt.tmp
diff -ud $1.tt $1.tt.tmp
read
mv -f $1.tt.tmp $1.tt
fi
checkmodule -M -m $1.tt -o $1.mod
semodule_package -o $1.pp -m $1.mod
semodule -i $1.pp
@meeuw
meeuw / injectinput.py
Last active September 27, 2021 09:40
Simple script to replace xdotool when using Gnome/Wayland for entering keystrokes using evdev. This requires root.
# MOVED TO: https://github.com/meeuw/injectinput
#!/usr/bin/python3
import evdev
import sys
upper = { '!': '1', '@': '2', '#': '3', '$': '4', '%': '5', '^': '6', '&': '7', '*': '8', '(': '9', ')': '0' }
with evdev.UInput() as ui:
escape = False
@meeuw
meeuw / testallkeys.py
Created August 27, 2021 10:26
script to test all ssh key in your ssh agent key ring, forces gnome-keyring to ask for a passphrase (and allows you to save it).
import hashlib
import paramiko
a = paramiko.agent.Agent()
for key in a.get_keys():
print(key.sign_ssh_data(hashlib.sha1(b'something to sign').digest()))
@meeuw
meeuw / concat.sh
Created August 2, 2021 19:04
concatenate mp4 files
ls "$1/"*|sed "s%^%file $PWD/%" > /tmp/dmlist
ffmpeg -f concat -protocol_whitelist file,pipe -safe 0 -i /tmp/dmlist -c copy "$1.mp4"
@meeuw
meeuw / _ffmpeg_segments.sh
Created August 2, 2021 19:04
ffmpeg split mp4 file
ffmpeg -i "$1" -acodec copy -f segment -vcodec copy -reset_timestamps 1 -map 0 OUTPUT%04d.mp4
<?xml version='1.0'?>
<!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd">
<signatures version='1.0'>
<opaque name='IONotificationPortRef' type64='^{IONotificationPort=}'/>
<constant name='kIOMasterPortDefault' type64='I'/>
<string_constant name='kIOFirstPublishNotification' value='IOServiceFirstPublish'/>
<string_constant name='kIOPublishNotification' value='IOServicePublish'/>
<string_constant name='kIOMatchedNotification' value='IOServiceMatched'/>
<string_constant name='kIOFirstMatchNotification' value='IOServiceFirstMatch'/>
<string_constant name='kIOTerminatedNotification' value='IOServiceTerminate'/>