Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Philipp Klaus pklaus

🎯
Focusing
  • PwC
  • Frankfurt, Germany
View GitHub Profile
@pklaus
pklaus / ping.py
Created Mar 5, 2011
A pure python ping implementation using raw socket.
View ping.py
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping
@pklaus
pklaus / brother_ql - Related and Unrelated Software.md
Last active Sep 28, 2022
brother_ql - Related and Unrelated Software
View brother_ql - Related and Unrelated Software.md
@pklaus
pklaus / tunnelbroker-net.linux.etc-network-interfaces.sh
Created May 9, 2011
tunnelbroker.net : tunnel setup on Linux using "ip" from the iproute suite (iproute2)
View tunnelbroker-net.linux.etc-network-interfaces.sh
#!/bin/bash
# IPv6 Tunnel setup of an tunnelbroker.net tunnel on Linux using the configuration file `/etc/network/interfaces`
# (needs the `ip` tool from the iproute suite, Ubuntu package: <http://packages.ubuntu.com/iproute>)
#
# Run like this:
# ./tunnelbroker-net.linux.etc-network-interfaces.sh
#
# 2011 by Philipp Klaus
# Published on <http://blog.philippklaus.de/2011/05/ipv6-6in4-tunnel-via-hurricane-electric-tunnelbroker-net-tunnel-setup-on-ubuntu-11-04/>
@pklaus
pklaus / tunnelbroker-net.sh
Last active Sep 27, 2022
tunnelbroker.net automatic tunnel IP update and tunnel setup (on Mac OS X)
View tunnelbroker-net.sh
#!/bin/bash
#### This script is published by Philipp Klaus <philipp.l.klaus@web.de>
#### on <http://blog.philippklaus.de/2011/05/ipv6-6in4-tunnel-via-hurricane-electric-tunnelbroker-net-automatic-ip-update-on-mac-os-x/>
#### It is originally by freese60 and modified by limemonkey.
#### Found on <http://www.tunnelbroker.net/forums/index.php?topic=287.0>
### Uncomment this line to debug the script:
#set -x
@pklaus
pklaus / wifiscan.py
Last active Sep 22, 2022
Run `iw wlan0 scan` and interpret output with Python
View wifiscan.py
#!/usr/bin/env python
# originally from johnl found at
# http://ubuntuforums.org/showthread.php?t=1604981&p=10024295#post10024295
import subprocess
import re
class line_matcher:
def __init__(self, regexp, handler):
@pklaus
pklaus / enumerate_interfaces.py
Last active Sep 22, 2022
Python: List all Network Interfaces On Computer
View enumerate_interfaces.py
"""
Determine IPv4 addresses on a Linux machine via the socket interface.
Thanks @bubthegreat the changes to make it Py2/3 compatible and the helpful
code comments: https://gist.github.com/pklaus/289646#gistcomment-2396272
This version has all comments removed for brevity.
"""
import socket
import array
import struct
@pklaus
pklaus / getnet.sh
Created Feb 14, 2012
Retrieve network info from the command line
View getnet.sh
#! /bin/bash
### Script by obearsstate found on
### http://hints.macworld.com/article.php?story=20100604064451501
QUERY0="$(ipconfig getpacket en0)";
QUERY1="$(ipconfig getpacket en1)";
MAC0="$(ifconfig en0 | grep ether | awk '{print $2}')";
MAC1="$(ifconfig en1 | grep ether | awk '{print $2}')";
@pklaus
pklaus / clearRAM.sh
Last active Sep 22, 2022
A Script to Clear Cached RAM on Linux
View clearRAM.sh
#!/bin/bash
## Bash Script to clear cached memory on (Ubuntu/Debian) Linux
## By Philipp Klaus
## see <http://blog.philippklaus.de/2011/02/clear-cached-memory-on-ubuntu/>
if [ "$(whoami)" != "root" ]
then
echo "You have to run this script as Superuser!"
exit 1
fi
@pklaus
pklaus / analyseBreakinAttempts.sh
Last active Sep 20, 2022
A script that analyses the log files /var/log/auth.log* for illegal break-in attempts and writes all output to $logdir – Check http://blog.philippklaus.de/2010/02/analyse-illegal-ssh-login-attempts/
View analyseBreakinAttempts.sh
#!/bin/bash
# This script analyses the log files /var/log/auth.log* for
# illegal break-in attempts and writes all output to $logdir.
# <http://blog.philippklaus.de/2010/02/analyse-illegal-ssh-login-attempts/#comment-12211>
# inspired by <http://goo.gl/QMOhiU>
# and <http://filipivianna.blogspot.com/2009/10/checking-authlog-for-ssh-brute-force.html>
logbasedir=~/logs
@pklaus
pklaus / StatusIcon.py
Created Feb 15, 2010
StatusIcon – A Simple Tray Icon Application Using PyGTK
View StatusIcon.py
#!/usr/bin/env python
# found on <http://files.majorsilence.com/rubbish/pygtk-book/pygtk-notebook-html/pygtk-notebook-latest.html#SECTION00430000000000000000>
# simple example of a tray icon application using PyGTK
import gtk
def message(data=None):
"Function to display messages to the user."