Skip to content

Instantly share code, notes, and snippets.

View fortitudepub's full-sized avatar
💭
Enthusiast of networking and systems, happy hacking

dyz fortitudepub

💭
Enthusiast of networking and systems, happy hacking
View GitHub Profile
@fortitudepub
fortitudepub / gist:19ec6a6b3d2eb9612009493f05cb6bb1
Created August 2, 2016 07:15
A awk source code to extract some useful logline from log data.
BEGIN {
net2req["id1"] = "req1"
allreq["req1"] = "req1"
}
# 1. found received rpc named 'network_sync', extracted req-id and store it to associative arrays.
# print the line
# 2. found arg dropped for the req-id, print the line
# 3. found notify agen add-fdb, delete the req-id in the associative array, print the line
{
function string_ops:string (val) %{
strlcpy (STAP_RETVALUE, (char*)STAP_ARG_val, MAXSTRINGLEN);
%}
probe kernel.function("__dev_queue_xmit") {
if (execname() =~ "keepalived") {
printf("__dev_queue_xmit %d %s(%d/%d) %s\n", gettimeofday_us(), execname(), pid(), cpu(), $$vars);
i = 0;
printf("dump begin, skb->gso %d\n", @cast($skb->head+$skb->end, "skb_shared_info", "")->gso_size);
for (; i< 14; i++) {
<?xml version="1.0" encoding="UTF-8"?>
<!-- vi: set et smarttab sw=2 tabstop=2: -->
<!--
Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
cat xxx.txt | tr , ' ' | grep keepalive | awk '{ sum+=$1 } END {print sum/160}'
@fortitudepub
fortitudepub / gist:dbf00fd3c0d156c97ccc155351b21220
Created April 22, 2016 07:38
quickly create many tcp connection to exploit service using python eventlet
import eventlet
pool = eventlet.GreenPool()
def bomb():
a = eventlet.connect(("127.0.0.1", 9697))
eventlet.sleep(10)
a.close()
i=0
while i<5000:
pool.spawn(bomb)
@fortitudepub
fortitudepub / gist:bfb6537274e1b82b78689f27888b7b57
Created April 15, 2016 07:48
one liner to count rss memory size.
ps -eo rss,pid,comm | awk '{s+=$1} END {print s}'
@fortitudepub
fortitudepub / gist:9ce92e8dbb62af916a7a
Created February 3, 2016 05:41
calc if rx stats by shell script.
ifname=$1
let bytes1=0
while true; do
let bytes2=`ip -s link show $ifname | grep -A 1 RX | grep -v RX | awk '{print $1}'`
let diff=(bytes2 - bytes1)
let diff=(diff / 1024 / 1024)
echo "bandwitdth is $diff Mbps"
let bytes1=bytes2
sleep 1
@fortitudepub
fortitudepub / gist:5864ab8d1e834aae83b6
Created October 20, 2014 15:04
oneline command to dump dvd/cd video content.
mplayer2 -dumpstream /dev/sr0 -nocache -noidx -dumpfile record.mp4
@fortitudepub
fortitudepub / gist:10289344
Created April 9, 2014 16:31
pulseaudio tips
1. pacmd is a good tool to help you get current pulseaudio information.
list-sinks
list-clients
@fortitudepub
fortitudepub / gist:9151505
Created February 22, 2014 10:09
Linux Whell Group...
Modern Unix systems use user groups to control access privileges. The wheel group is a special user group used on some Unix systems to control access to the su command, which allows a user to masquerade as another user (usually the super user).