Skip to content

Instantly share code, notes, and snippets.

View thimslugga's full-sized avatar
🏠
Working from home

adam kaminski thimslugga

🏠
Working from home
View GitHub Profile
@thimslugga
thimslugga / netflow_asa.yaml
Created October 10, 2015 00:19 — forked from msheiny/netflow_asa.yaml
Logstash netflow codec description for Cisco ASA
---
148:
- 4
- :conn_id
8:
- :ip4_addr
- :ipv4_src_addr
7:
- 2
- :src_port
@thimslugga
thimslugga / Linux Static IP
Last active December 30, 2016 21:08 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@thimslugga
thimslugga / update-spamhaus
Last active December 30, 2016 21:08
update spamhaus list tweaked
#!/bin/vbash
NETGROUP="SPAMHAUS_DROP"
>/tmp/block
curl -s http://www.spamhaus.org/drop/drop.txt | grep '^[0-9]' | sed -e 's/;.*//' >> /tmp/block
curl -s http://www.spamhaus.org/drop/edrop.txt | grep '^[0-9]' | sed -e 's/;.*//' >> /tmp/block
sudo ipset -q -L $NETGROUP > /dev/null 2>&1
if [ "$?" != 0 ]; then
@thimslugga
thimslugga / update-spamhaus2
Last active December 30, 2016 21:07
update spamhaus list revised
#!/bin/bash
NETGROUP="SPAMHAUS_DROP"
TMPFILE=/tmp/spamhaus-block-$$.tmp
TMPFILE2=/tmp/temp-spamhaus-block-$$.tmp
clean_up ()
{
/sbin/ipset --destroy $NEWGROUP
/bin/rm $TMPFILE $TMPFILE2
@thimslugga
thimslugga / update-emergingthreats
Last active January 9, 2017 03:28
Revised emerging threats list script
#!/bin/sh
NETGROUP="ET-A"
curl -O http://rules.emergingthreats.net/fwrules/emerging-Block-IPs.txt
getnetblocks() {
cat <<EOF
# Generated by ipset
-N geotmp nethash --hashsize 1024 --probes 4 --resize 20
#! /bin/bash
#################################################################################
# File Name : gen_blacklist.sh
# Created By : wirerydr
# Creation Date : [2016-08-25 14:24]
# Last Modified : [2016-09-26 23:08]
# Description : Creates a blacklist from various sources
#################################################################################
# 03e95a9 (2016-09-26) : Reinstated cleanup code in exit trap
# fb5995a (2016-09-26) : Added instructive comments to output header
http://pgl.yoyo.org/as/iplist.php
http://www.spamhaus.org/drop/drop.txt
http://www.spamhaus.org/drop/edrop.txt
http://www.okean.com/sinokoreacidr.txt
http://lists.blocklist.de/lists/all.txt
@thimslugga
thimslugga / callable.py
Created January 12, 2017 16:19 — forked from durden/callable.py
Clever way to use Python __call__ and __getattr__ to create web APIs that can map directly (dynamically) to actual API
class MyCallable(object):
def __init__(self, urlparts, callable):
self.urlparts = urlparts
self.callable = callable
def __call__(self, **kwargs):
print kwargs
print self.urlparts
def __getattr__(self, name):
# Return a callable object of this same type so that you can just keep
# chaining together calls and just adding that missing attribute to the
@thimslugga
thimslugga / gist:487819ab4cace55a6dcb8606df4797d6
Created January 19, 2017 19:16 — forked from luginbash/gist:ffd9ec4c9f9e80cb57be
Console log for ocserv configuration
# Please edit /etc/default/ufw first
# DEFAULT_FORWARD_POLICY="ACCEPT"
# then at /etc/ufw/sysctl.conf
# net/ipv4/ip_forward=1
# net/ipv6/conf/default/forwarding=1
# allow mtu dectection
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
ip access-list extended cp-any-any
permit ip any any
ip access-list extended cp-dns
permit udp host 66.230.128.14 eq domain any
permit udp host 66.230.128.18 eq domain any
ip access-list extended cp-fragments
permit ip any any fragments