-
-
Save anonymous/1f51db98faef0a566a2f8a7a02104ecf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
void slankdev_test() | |
{ | |
puts("fuckin"); | |
} | |
int main() | |
{ | |
while (1) { | |
slankdev_test(); | |
sleep(1); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
g++ -static main.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from bcc import BPF | |
bpf_program = """ | |
void call(struct pt_regs *ctx) { bpf_trace_printk("call\\n"); } | |
void ret (struct pt_regs *ctx) { bpf_trace_printk("ret\\n"); } | |
void pp (void* c) { bpf_trace_printk("puts\\n"); } | |
""" | |
trace_pgm_name = "./a.out" | |
b = BPF(text=bpf_program) | |
b.attach_uprobe (name=trace_pgm_name, sym="_Z13slankdev_testv", fn_name="call") | |
b.attach_uretprobe(name=trace_pgm_name, sym="_Z13slankdev_testv", fn_name="ret") | |
b.attach_uprobe (name=trace_pgm_name, sym="puts" , fn_name="pp") | |
while True: | |
print(b.trace_fields()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment