Skip to content

Instantly share code, notes, and snippets.

View mschmitt's full-sized avatar
🥾
Busier than a one-legged man in an ass-kicking contest.

Martin Schmitt mschmitt

🥾
Busier than a one-legged man in an ass-kicking contest.
View GitHub Profile
@mschmitt
mschmitt / ShadowMangler.pl
Created February 19, 2014 08:45
Helper for generating and checking password hashes.
#!/usr/bin/perl -w
use diagnostics;
use strict;
use POSIX qw(setsid);
use Crypt::Passwd::XS;
use Tk;
# Fork off.
if (1){
fork() && exit;
@mschmitt
mschmitt / dyn-bind-updater.sh
Created March 12, 2014 15:01
dyn-bind-updater.sh
#!/bin/sh
# Aktuelle IP
IP=`lynx --dump --source http://www.ipv4.dyn.f00.net/ip.php`
IP6=2001:db8::1234:5678
KEY='dynupdate-meinkey:UGVuaXMhCg=='
HOST='meinhost.dyn.meinedomain.de'
nsupdate -y $KEY <<Ende
@mschmitt
mschmitt / sshgrouplog.pl
Created April 23, 2014 11:56
This correlates per-session sshd logfile entries on a very busy server with many concurrent sessions.
#!/usr/bin/perl -w
use strict;
use diagnostics;
#use File::Navigate; (bundled below)
my $nav = File::Navigate->new($ARGV[0]);
my @connects = @{$nav->find(qr/sshd\[\d+\]: Connection from .+ port \d/)};
foreach (@connects){
// Arduino Leonardo: Send key when a button is pressed.
void setup() {
pinMode(12, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
//if the button is pressed
if(digitalRead(12)==LOW){
@mschmitt
mschmitt / j0rrupt0r.pl
Created June 7, 2014 07:48
Deliberately corrupt a JPEG file.
#!/usr/bin/perl -w
use strict;
use Getopt::Std;
# Deliberately corrupt a JPEG file.
#
# ./j0rrupt0r.pl -i nice.jpg -o corrupt.jpg
# Initial fraction of the image that won't be considered
# for corruption (1/fraction)
#!/bin/bash
# /usr/local/bin/ssh-agent-bootstrap
#
# To run ssh-agent as an application user in the background
#
# Sourced from the user's ~/.bash_profile:
# . /usr/local/bin/ssh-agent-bootstrap
#
# In application startup, add:
@mschmitt
mschmitt / KommentareAufNewsseitenAusblenden.user.js
Last active August 29, 2015 14:06
Kommentare auf Newsseiten ausblenden (UserScript für Greasemonkey)
// ==UserScript==
// @name Kommentare auf Newsseiten ausblenden
// @namespace https://gist.github.com/mschmitt/cebf0ee4e56a746cb856/raw/KommentareAufNewsseitenAusblenden.user.js
// @description Kommentare auf Newsseiten ausblenden
// @include /^https?:\/\/(www\.|)spiegel\.de\/.*/
// @include /^https?:\/\/(www\.|)tagesschau\.de\/.*/
// @include /^https?:\/\/(www\.|)heise\.de\/.*/
// @version 1
// @grant GM_addStyle
// ==/UserScript==
@mschmitt
mschmitt / twitpicdl.pl
Created September 17, 2014 19:35
Improvised downloader (in Perl) for Twitpic. Outputs HTML with timestamps and messages, and a photo directory.
#!/usr/bin/perl -w
use strict;
use diagnostics;
use pQuery;
use LWP::Simple;
use JSON;
use Getopt::Std;
# A script to download a user's pics from twitpic before the shutdown
# in September 2014.
@mschmitt
mschmitt / gist:142f26794fba5569e538
Created October 16, 2014 09:20
Check maillog for non-TLS transfers
gzip -dcf /var/log/mail.info* |
perl -ne '/TLS connection established (to|from) (.+): (.+) with cipher/&&printf"%s %s %s\n",$1,$2,$3;' |
grep -v TLS
@mschmitt
mschmitt / ssh-test-passphrase.sh
Created August 17, 2010 11:04
Script for identifying SSH keys without passphrase
#!/bin/bash
umask 077
if [ "XX$1" == "XX" ]
then
echo "No file specified."
exit 1
fi
if [ ! -e $1 ]
then