Skip to content

Instantly share code, notes, and snippets.

@tonicmuroq
tonicmuroq / Netfilter-IPTables-Diagrams.md
Created October 20, 2018 02:37 — forked from nerdalert/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@tonicmuroq
tonicmuroq / SSHwithgit2go.go
Created April 13, 2016 09:40 — forked from zchee/SSHwithgit2go.go
Working example with SSH and libgit2/git2go
package main
import (
git "github.com/libgit2/git2go"
"log"
)
func credentialsCallback(url string, username string, allowedTypes git.CredType) (git.ErrorCode, *git.Cred) {
ret, cred := git.NewCredSshKey("git", "/home/vagrant/.ssh/id_rsa.pub", "/home/vagrant/.ssh/id_rsa", "")
return git.ErrorCode(ret), &cred
#! /usr/bin/python
# -*- coding: utf-8 -*-
# (The MIT License)
#
# Copyright © 2009 John Tantalo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the ‘Software’), to deal in
# the Software without restriction, including without limitation the rights to
@tonicmuroq
tonicmuroq / request.py
Created August 14, 2015 09:44
server simply get `value` from querystring and returns it, request simply pass `value` in querystring and tests if the return value equals `value`
# coding: utf-8
import random
import requests
import multiprocessing
def request_once():
randint = random.randint(1, 10000)
url = 'http://localhost:8000?value=%s' % randint
r = requests.get(url)
package main
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
"io/ioutil"
"strings"
)
func main() {
@tonicmuroq
tonicmuroq / test_sentry.py
Created January 8, 2015 02:14
test_sentry.py
from flask import Flask
from raven.contrib.flask import Sentry
app = Flask(__name__)
sentry = Sentry(dsn='')
sentry.init_app(app)
@app.route('/')
@tonicmuroq
tonicmuroq / sysctl
Created December 25, 2014 09:52
sysctl
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
2014/12/25 15:17:08 [error] 21798#0: *1962274 connect() failed (110: Connection timed out) while connecting to upstream, client: 10.1.201.16, server: ipservice.intra.hunantv.com, request: "GET /exec?ip=116.186.128.2 HTTP/1.0", upstream: "http://10.1.201.46:80/exec?ip=116.186.128.2", host: "ipservice.intra.hunantv.com"
2014/12/25 15:17:08 [error] 21792#0: *1962290 connect() failed (110: Connection timed out) while connecting to upstream, client: 10.1.201.16, server: ipservice.intra.hunantv.com, request: "GET /exec?ip=116.186.128.2 HTTP/1.0", upstream: "http://10.1.201.46:80/exec?ip=116.186.128.2", host: "ipservice.intra.hunantv.com"
2014/12/25 15:17:08 [error] 21792#0: *1962289 connect() failed (110: Connection timed out) while connecting to upstream, client: 10.1.201.16, server: ipservice.intra.hunantv.com, request: "GET /exec?ip=116.186.128.2 HTTP/1.0", upstream: "http://10.1.201.46:80/exec?ip=116.186.128.2", host: "ipservice.intra.hunantv.com"
2014/12/25 15:17:08 [error] 21798#0: *1962275 connect() failed (
@tonicmuroq
tonicmuroq / ipservice.conf
Last active August 29, 2015 14:12
nginx.conf
user nginx;
worker_processes 24;
error_log /mnt/mfs/logs/nbe/master/error-kili10.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 102400;
}
@tonicmuroq
tonicmuroq / vimrc
Created August 11, 2014 08:48
vimrc
syntax on
filetype off
" format and user interface
set nocompatible
set number
set softtabstop=4 tabstop=4 shiftwidth=4
set expandtab
set autoindent
set incsearch