Example related — Recovering typical deleted file in GNU/Linux

$which glxgears /usr/bin/glxgears $rm /usr/bin/glxgears rm: remove write-protected regular file ‘/usr/bin/glxgears’? y rm: cannot remove ‘/usr/bin/glxgears’: Permission denied $sudo rm /usr/bin/glxgears [sudo] password for jeffrin: $ps aux | grep glxgears jeffrin 2469 4.4 0.6 157656 20888 pts/0 Sl+ 22:43 0:07 glxgears jeffrin 2515 0.0 0.0 12656 1560 pts/1 S+ 22:46 0:00 grep glxgears $sudo cat …

Example for – Trace all system calls which involve process management

$strace -e trace=process python dig.py execve(“/usr/bin/python”, [“python”, “dig.py”], [/* 39 vars */]) = 0 arch_prctl(ARCH_SET_FS, 0x7feb563b4700) = 0 I think lscpu command is using proc filesystem to get data. /* /sys paths */ #define _PATH_SYS_SYSTEM “/sys/devices/system” #define _PATH_SYS_CPU _PATH_SYS_SYSTEM “/cpu” #define _PATH_SYS_NODE _PATH_SYS_SYSTEM “/node” #define _PATH_PROC_XEN “/proc/xen” #define _PATH_PROC_XENCAP _PATH_PROC_XEN “/capabilities” #define _PATH_PROC_CPUINFO “/proc/cpuinfo” #define …

Hacking with a JavaScript Program

var drawCats = function (howManyTimes) { for (var i = 0; i < howManyTimes; i++) { console.log(i + " =^.^=); } }; drawCats(11); VM455:4 Uncaught SyntaxError: Unexpected token ILLEGALmessage: "Unexpected token ILLEGAL"stack: (…)get stack: function () { [native code] }arguments: nullcaller: nulllength: 0name: ""prototype: StackTraceGetter__proto__: function Empty() {}set stack: function () { [native code] }arguments: …

Hacking with strace to find about write calls in a program

$strace -e write python dig.py write(1, “\33[31mI think lscpu command is us”…, 69I think lscpu command is using proc filesystem to get data. ) = 69 write(1, “\33[31m/* /sys paths */\33[0m\n”, 26/* /sys paths */ ) = 26 write(1, “\33[31m#define _PATH_SYS_SYSTEM “…, 63#define _PATH_SYS_SYSTEM “/sys/devices/system” ) = 63 write(1, “\33[31m#define _PATH_SYS_CPU “…, 65#define _PATH_SYS_CPU _PATH_SYS_SYSTEM …