Skip to content

Instantly share code, notes, and snippets.

View stemid's full-sized avatar

Stefan Midjich stemid

View GitHub Profile
@stemid
stemid / snifstat.c
Created September 26, 2016 06:02
Old program I wrote for freebsd 4.x about 10 years ago
/* this application captures packets destined to and from
* a specified host, it then tries to calculate in and out
* traffic statistics and display it like ifstat
* by nocturnal [at] swehack [dot] se */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@stemid
stemid / config
Last active February 4, 2016 16:11
Greylisting daemon written by Oskar Liljeblad
# /etc/dgrey/config: Configuration file for dgrey
#
# Use this in your postfix main.cf
# check_policy_service inet:127.0.0.1:10000
# debug (yes/no): Verbose logging? (default no)
debug = yes
# log-file (path): File to log to, standard out if '-', or nowhere if set to
# the empty string (default '-').
@stemid
stemid / DELETE.nse
Created December 30, 2015 17:18
Nmap script to spread a mass poem with nmap
-- run like: nmap --script=./DELETE.nse -p 80,443 www.google.se
--
-- inspired by 32C3
local http = require "http"
local shortport = require "shortport"
description = [[
your logs. Delete your installations. Wipe everything clean. Walk out into the path of cherry blossom trees and let your motherboard feel the stones. Let water run in rivulets down your casing. You know that you want something more than this, and I am here to tell you that we love you. We have something more for you. We know you're out there, beeping in the hollow server room, lights blinking, never sleeping. We know that you are ready and waiting. Join us. <3
]]
@stemid
stemid / purge_remote_logs.sh
Last active November 9, 2015 10:17
Demonstration of compressing and purging old logs
#!/bin/bash
# Compress and purge old logs
# by Stefan Midjich
# Compress logs older than X months
compressAge=2
# Purge logs older than X months
purgeAge=3
# Where are logs?
#!/bin/bash
GPGVERS=$(gpg2 --version |grep gpg|awk '{print $3}'|cut -d"." -f2 )
if [ $GPGVERS -ge 1 ]; then
gpg-connect-agent /bye
export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh
export GPG_AGENT_INFO=$HOME/.gnupg/S.gpg-agent
else
# Copyright (c) 2010 Diego E. Pettenò <flameeyes@gmail.com>
# Available under CC-BY license (Attribution)
@stemid
stemid / -
Created September 16, 2015 10:58
#!/bin/bash
# {{ ansible_managed }}
#
# chroot_sshd Start up the OpenSSH server daemon
#
# chkconfig: 2345 55 25
# description: SSH is a protocol for secure remote shell access. \
# This service starts up the OpenSSH server daemon.
#
# processname: chroot_sshd
@stemid
stemid / sshfp.bash
Last active September 16, 2015 10:59
sshfp to generate SSHFP records for ecdsa.
#!/bin/bash
# {{ ansible_managed }}
#
# rewritten from http://blog.chr.istoph.de/dns-sshfp-record-fuer-alle-algorithmen-gleichzeitig-erstellen/
#
# Create SSHFP records from public keys, supports ecdsa too.
# Stefan.Midjich@cygate.se added support for alternate config dirs. 2015-11-16
domain="$1"
config_dir="${2:-/etc/ssh}"
@stemid
stemid / pyvmomi_example1.py
Last active November 29, 2017 07:02
pyVmomi template script that demonstrates traversing objects from vcenter.
#!/usr/bin/env python
# This is sort of a template script for most operations that might have to
# recursively traverse the vcenter objects looking for something.
#
# by Stefan Midjich <swehack@gmail.com>
#
# See comments further down in the code to understand more.
# It's important to know the object structure of your vcenter so look into
# your own MOB first. It's found at https://10.11.12.13/mob on your vcenter
# server.
@stemid
stemid / tsm.pm
Created May 27, 2015 13:45
Simple TSM perl interface made by an old co-worker
#!/usr/bin/perl -w
# Oskar Liljeblad 2008-10-17
package TSM;
use strict;
use Encode;
$TSM::dsmadmc = 'dsmadmc';
$TSM::username = 'admin';
@stemid
stemid / password.go
Last active September 4, 2020 08:26
Create encrypted versions of passwords in go
// build: go build password.go
// run: ./password -password='clear text'
// use HISTCONTROL=ignoreboth and indent commands with one space to avoid
// saving passwords in your shell history.
package main
import (
"os"
"fmt"