$sudo cat /sys/devices/cpu/events/cache-misses event=0x81 $sudo cat /sys/devices/cpu/type 4 $sudo cat /sys/devices/cpu/events/branch-instructions event=0xc2 $sudo cat /sys/devices/cpu/events/branch-instructions event=0xc2 $sudo cat /sys/devices/cpu/events/branch-instructions event=0xc2 $sudo cat /sys/devices/cpu/events/branch-instructions event=0xc2 $sudo cat /sys/devices/cpu/events/branch-misses event=0xc3 $sudo cat /sys/devices/cpu/events/branch-misses event=0xc3 $sudo cat /sys/devices/cpu/events/cache-references event=0x80 $sudo cat /sys/devices/cpu/events/cpu-cycles event=0x76 $sudo cat /sys/devices/cpu/events/instructions event=0xc0 $
Author Archives: jeffrin
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 …
Continue reading “Example related — Recovering typical deleted file in GNU/Linux”
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 …
Continue reading “Example for – Trace all system calls which involve process management”
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 …
Continue reading “Hacking with strace to find about write calls in a program”
Internal of lscpu command
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 _PATH_PROC_PCIDEVS “/proc/bus/pci/devices” #define _PATH_PROC_SYSINFO “/proc/sysinfo” #define _PATH_PROC_STATUS “/proc/self/status” #define _PATH_PROC_VZ “/proc/vz” #define _PATH_PROC_BC “/proc/bc” #define _PATH_PROC_DEVICETREE “/proc/device-tree” #define …
Looking into a few commands with python interactive shell
ABOUT PYTHON Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It provides constructs that enable clear programming on both small and large scales.[26] Van Rossum led the language community until stepping down …
Continue reading “Looking into a few commands with python interactive shell”
Hacking with strace on ls
$ls 1 $strace ls execve(“/bin/ls”, [“ls”], [/* 38 vars */]) = 0 brk(0) = 0x7ae000 access(“/etc/ld.so.nohwcap”, F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb78ab18000 access(“/etc/ld.so.preload”, R_OK) = -1 ENOENT (No such file or directory) open(“/etc/ld.so.cache”, O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=136302, …}) = 0 mmap(NULL, 136302, …
Examining an ELF binary with binutils
$strings a.out /lib64/ld-linux-x86-64.so.2 libc.so.6 printf __libc_start_main __gmon_start__ GLIBC_2.2.5 fffff. []A\A]A^A_ hello ;*3$” GCC: (Debian 4.9.2-10) 4.9.2 GCC: (Debian 4.8.3-13) 4.8.3 hello.c long unsigned int short unsigned int short int GNU C 4.9.2 -mtune=generic -march=x86-64 -g unsigned char long int sizetype main hello.c /home/jeffrin .symtab .strtab .shstrtab .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn …
6 Framed photos was added to the collection
6 Framed photos was added to the collection 4 small ones and 2 relatively bigger ones All the photos are related to NATIONAL GEOGRAPHIC