Skip to content

Instantly share code, notes, and snippets.

View korc's full-sized avatar

Lauri Korts-Pärn korc

View GitHub Profile
package main
import (
"bufio"
"bytes"
"crypto/tls"
"encoding/binary"
"flag"
"fmt"
"io"
package main
// +build windows,386
import (
"bytes"
"encoding/binary"
"errors"
"flag"
"fmt"
@korc
korc / foldertree.py
Last active September 14, 2017 02:33
terminator foldertree plugin
#!/usr/bin/python
## Put this file to $HOME/.config/terminator/plugins and enable 'FolderTree' plugin from preferences
import os, stat
import re
from terminatorlib import plugin, terminator
#!/usr/bin/python
import sys,socket,struct,time
snaplen = 65535
try: iface = sys.argv[1]
except IndexError:
sys.stderr.write("Usage: %s <interface> >output.pcap\n"%(sys.argv[0]))
raise SystemExit(1)
<!DOCTYPE html>
<html>
<head>
<title>Control Remote Web</title>
<script>
"use strict";
var targets = [];
var messageQueue = {};
// This program is intented to use with iptables REDIRECT directive
// for example if your provider is blocking outgoing port 25 connections
// 1) connect to server in datacenter which allows connections
// ssh -D 1080 user@example.com
// 2) redirect all outgoing SMTP connections through this here
// iptables -t nat -A OUTPUT -p tcp --dport 25 -j REDIRECT --to-ports 4567
// *Note* for router configuration (iptables PREROUTING chain) you have to listen on other IP than 127.0.0.1
package main
@korc
korc / debdeps.py
Created July 5, 2017 19:15
Shows dependencies of installed debian packages, recursively if asked
#!/usr/bin/python
import apt
import sys
import os
def print_deb_deps(name, recurse=1, prep="", _processed=None):
if _processed is None: _processed={}
print "%s%s:"%(prep, name),
sys.stdout.flush()
package main
import (
"bufio"
"crypto/sha1"
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
@korc
korc / maildir-smtpd.go
Created May 14, 2017 14:07
SMTP daemon saving all mails to maildir
package main
import (
"os"
"os/signal"
"log"
"github.com/flashmob/go-guerrilla/mail"
"strings"
"github.com/flashmob/go-maildir"
"fmt"
#!/usr/bin/python
import psycopg2, os, sys
import json
import pprint
whois_table=os.environ.get("WHOIS_TABLE", "whois")
dsn=os.environ.get("WHOIS_DSN", "")
check_table_sql="select 1 from %s where 1=0"%(whois_table,)