Skip to content

Instantly share code, notes, and snippets.

View bugcy013's full-sized avatar
🪄
Focusing

Dhanasekaran Anbalagan bugcy013

🪄
Focusing
View GitHub Profile
# On Controller node
$ tcpdump -envi eth0 | grep -i gre
$ tcpdump -envi br-int
$ tcpdump -envi br-tun
$ ip netns exec qrouter-d72adddf-4c02-4916-ae6d-16bfdaf59d99 tcpdump -nn -i qr-63ea2815-b5 icmp
$ ip netns exec qrouter-d72adddf-4c02-4916-ae6d-16bfdaf59d99 tcpdump -nn -i qg-e7110dba-a9 icmp
$ tcpdump -envi 192.168.122.163
$ tcpdump -envi br-ex
$ tcpdump -i eth0 -n arp or icmp

TCPReplay/TCPRewrite/TCPPrep/TCPDump Cheatsheet

tcprewrite

Rewrite IP/Mac addresses, -C optionally to fix checksums

  1. tcpprep, first:C2S, Second S2C, Generate cache file tcpprep –auto=first –pcap=icmp.pcap –cachefile=icmp_in.cache
find dirname -type f | parallel 'nfdump -r {} "host $ip"' | tee /tmp/out.txt
#!/usr/local/python2.7.2/bin/python
# $Id$
# Author: <[email protected]>
# Purpose: Run nfdump for flow exports so searches happen in splunk for atleast the IP hit
# Created: Wed Aug 28 08:50:27 CDT 2013
import sys
import unittest
import argparse
import subprocess, datetime

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

input {
syslog = {
type => syslog
port => 514
}
}
filter {
grok {
type => "auditd"
pattern => [" AUDIT type=%{WORD:audit_type} msg=audit\(%{NUMBER:audit_epoch}:%{NUMBER:audit_coun
_docker_procs()
{
local procs
procs="$(docker ps -q)"
COMPREPLY=( $(compgen -W "${procs}" -- ${cur}) )
}
_docker_imgs()
{
local repos tags imgs
#!/bin/bash
# by TB : 2012-10-12
if [ "$USER" != "root" ]
then
echo "You must be root to execute this script (in order to instruct the kernel to drop the cache)!"
exit 1
fi
if [ -z "$1" ]
#!/bin/bash -e
# Little program that measure the speed in MBps of a file transfer occuring in the current directory
LASTTIME=$(date +%s)
LASTSIZE=$(du -bs . 2> /dev/null | awk '{ print $1 }')
TOTALSIZE=0
TOTALTIME=0
while true
#!/bin/bash
# by TB : 2012-10-12
if [ "$USER" != "root" ]
then
echo "You must be root to execute this script (in order to instruct the kernel to drop the cache)!"
exit 1
fi
if [ -z "$1" ]