Skip to content

Instantly share code, notes, and snippets.

View tuxology's full-sized avatar
💭
Nothing

Suchakra Sharma tuxology

💭
Nothing
View GitHub Profile
#!/bin/bash
indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 \
-cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai \
-saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1 \
$1
[suchakra@moria tracing]$ sudo ./open2ctf.py
trace path: /tmp/tmp26ga140x
^C[suchakra@moria tracing]$ babeltrace /tmp/tmp26ga140x
[00:24:50.796162597] (+?.?????????) 0 do_sys_open: { }, { pid = 909, comm = "iio-sensor-prox", filename = "/dev/iio:device2" }
[00:24:50.796399646] (+0.000237049) 0 do_sys_open: { }, { pid = 909, comm = "iio-sensor-prox", filename = "/dev/iio:device4" }
[00:24:50.801229686] (+0.004830040) 0 do_sys_open: { }, { pid = 1206, comm = "gnome-shell", filename = "/proc/self/stat" }
[00:24:50.801430938] (+0.000201252) 0 do_sys_open: { }, { pid = 1734, comm = "gnome-shell", filename = "/proc/self/stat" }
[00:24:50.807656245] (+0.006225307) 0 do_sys_open: { }, { pid = 18399, comm = "gnome-settings-", filename = "/proc/self/fd" }
[00:24:50.808197672] (+0.000541427) 0 do_sys_open: { }, { pid = 18399, comm = "gnome-settings-", filename = "" }
[00:24:50.816850646] (+0.008652974) 0 do_sys_open: { }, { pid = 18399, comm = "gsd-backlight-h", filename = "/etc/ld.so.cache" }
@tuxology
tuxology / Vagrantfile
Created November 20, 2015 01:54
Kernel Development Vagrant Setup
Vagrant.configure(2) do |config|
config.vm.define :kerneldev do |kerneldev|
kerneldev.vm.box = "fedora/23-cloud-base"
kerneldev.vm.provider :libvirt do |domain|
domain.memory = 2048
domain.cpus = 4
end
config.vm.provision :shell, :path => "bootstrap.sh"
end
end
@tuxology
tuxology / lttng-sched-filter.c
Created December 8, 2014 17:16
LTTng sched_switch eBPF filter
/*
* addons/lttng-sched-filter.c
*
* A filtered version of sched_switch
*
* Copyright (C) 2014 Suchakra Sharma <suchakrapani.sharma@polymtl.ca>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; only
@tuxology
tuxology / lttng-netif-filter.c
Last active January 2, 2018 18:09
LTTng netif_receive_skb eBPF filter
/*
* addons/lttng-netif-filter.c
*
* A filtered version of netif_receive_skb
*
* Copyright (C) 2014 Suchakra Sharma <suchakrapani.sharma@polymtl.ca>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; only
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
String resourceName = req.getParameter( "resourceName" );
BufferedReader r = new BufferedReader( new FileReader( resourceName ) );
while ( ( x = r.readLine() ) != null ) {
resp.getWriter().println( x );
}
}
[
{
"groupId": "net.lingala.zip4j",
"artifactId": "zip4j",
"version": "1.3.2",
"callGraph": {
"cveId": "CVE-2018-1002202",
"versionRanges": [
"[0,1.3.3)"
],
Basic Commands
==============
sl ocular -- --import scripts/deps.sc
import $file.scripts.java.ROOTKIT_suspicious_literals
cpg.method.fullName.l
cpg.method.name("executeQuery").caller.fullName.l
cpg.sink.method.name.l
@tuxology
tuxology / calltree.sc
Last active April 7, 2021 19:39
Print call-tree in ASCII usig Ocular
// calltree.sc
// -----------
//
// Suchakra Sharma <suchakra@shiftleft.io> (2019)
//
// Prints the complete call-tree with all possible branches starting from the top of the input method. It is recommended to increase
// the max steps per query to a higher number (eg. "config.query.maxStepsPerCallQuery = 1000000L") for better results.
//
// Example Usage:
// ocular> import $file.scripts.calltree
@tuxology
tuxology / sym2addr-dwarf.c
Created August 2, 2013 23:05
Gives address of a symbol from a binary (using libdwarf)
/*
* Get address from symbol (libdwarf version)
* Based on code by : Eli Bendersky (http://eli.thegreenplace.net)
*
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>