mirror of
https://github.com/h3xduck/TripleCross.git
synced 2025-12-16 23:33:06 +08:00
22 lines
410 B
C
22 lines
410 B
C
|
|
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||
|
|
/* Copyright (c) 2020 Facebook */
|
||
|
|
#include <linux/bpf.h>
|
||
|
|
#include <bpf/bpf_helpers.h>
|
||
|
|
|
||
|
|
char LICENSE[] SEC("license") = "Dual BSD/GPL";
|
||
|
|
|
||
|
|
int my_pid = 0;
|
||
|
|
|
||
|
|
SEC("tp/syscalls/sys_enter_write")
|
||
|
|
int handle_tp(void *ctx)
|
||
|
|
{
|
||
|
|
int pid = bpf_get_current_pid_tgid() >> 32;
|
||
|
|
|
||
|
|
if (pid != my_pid)
|
||
|
|
return 0;
|
||
|
|
|
||
|
|
bpf_printk("BPF triggered from PID %d.\n", pid);
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|