Skip to content

Instantly share code, notes, and snippets.

View korc's full-sized avatar

Lauri Korts-Pärn korc

View GitHub Profile
@korc
korc / test_func_args.py
Last active August 29, 2015 14:04
Test getting of wrapped function arguments
#!/usr/bin/python
from __future__ import print_function
import functools
import inspect
def orig_func(db):
print("this func has db argument", db)
#!/usr/bin/python
from bottle import Bottle, response, request, HTTPResponse
import subprocess
import os
import json
import sys
ADB=os.environ.get("ADB", "adb")
@korc
korc / d3timeline.js
Created August 30, 2014 15:52
Timeline object using d3js framework
function D3TimeLine(container, attributes, data) {
if(container) this._=container;
for(var k in attributes) this[k]=attributes[k];
if(data) this.data=data;
}
D3TimeLine.prototype={
axisDomainStyle: {"fill-opacity": 0.1},
brushExtentStyle: {"fill-opacity": 0.1},
getDataValue: function(d) {return d.count;},
@korc
korc / ipt2socks.py
Last active August 29, 2015 14:10
iptables to socks forwarder
#!/usr/bin/python
from __future__ import print_function
import os,sys
import asyncore
import socket
import struct
#!/bin/sh
set -e
setname="$1"
test -n "$setname" -a -n "$2" || {
echo "Usage: ${0##*/} <setname> <pattern..>" >&2
exit 1
}
@korc
korc / pcap2pg.py
Last active September 30, 2015 04:06
pcap2pg
#!/usr/bin/python
import getopt
import psycopg2
import sys
import datetime
from utils import PSQLPipeCopierMixIn, PCapReader, _std_init, SharkReader, PCapProducer
sql_initdb="""
@korc
korc / lstfs.py
Last active October 28, 2015 17:45
#!/usr/bin/python
import fuse
import os
import stat
import errno
import re
import time
import warnings
@korc
korc / imgren.py
Last active March 18, 2016 23:41
Image rename tool
#!/usr/bin/python
import os
from gi.repository import Gtk, GLib
class SignalHandler(object):
selected_model = None
def __init__(self, builder):
self.builder = builder
def on_quit(self, window, ev):
#!/usr/bin/python
import sys
import re
generics=set(['the', 'and', 'to', 'of', 'a', 'in', 'i', 'we', 'this', 'that', 'for', 'it', 'on', 'will',
'be', 'are', 'can', 'with', 'by', 'from', 'or', 'how', 'an', 's', 'these', 'have', 'not',
'our', 'used', 'at', 'their', 'has', 'such', 'also', 'which', 'using', 'they', 'but',
'all', 'what', 'about', 'based', 'you', 'more', 'been', 'some', 'use', 'other', 'one',
'when', 'them', 'many', 'well', 'o', 'll', 'up'])
@korc
korc / bf_known_hosts.py
Created December 7, 2016 22:36
~/.ssh/known_hosts bruteforcer
#!/usr/bin/python
import Crypto.Hash.SHA, Crypto.Hash.HMAC
import sys, re, os
import getopt
import time
kh_re=re.compile(r'^\|1\|(?P<salt>[a-zA-Z0-9/+]+=*)\|(?P<hash>[a-zA-Z0-9/+]+=*) (?P<keytype>\S+) (?P<hostkey>[a-zA-Z0-9/+]+=*)$')
def read_kh(fname):
ret=[]