Add scripts for tracking single process
parent
5488b0eb53
commit
08e0ca8c33
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env -S python3 -u
|
||||
import sys
|
||||
from ipaddress import ip_network, ip_address
|
||||
|
||||
nets = []
|
||||
with open("goog-prefixes.txt") as f:
|
||||
nets = [line.strip() for line in f.readlines()]
|
||||
|
||||
for line in iter(sys.stdin.readline, ''):
|
||||
line = line.strip()
|
||||
for net in nets:
|
||||
try:
|
||||
if ip_address(line) in ip_network(net):
|
||||
print(line)
|
||||
|
||||
continue
|
||||
except:
|
||||
continue
|
||||
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/bpftrace
|
||||
#include <net/sock.h>
|
||||
|
||||
kprobe:udp_sendmsg,
|
||||
kprobe:tcp_sendmsg
|
||||
{
|
||||
$sk = (struct sock *)arg0;
|
||||
|
||||
$daddr = ntop($sk->__sk_common.skc_daddr);
|
||||
|
||||
printf("%-8d\t%s\t(%s)\n", pid, $daddr, comm);
|
||||
}
|
||||
Loading…
Reference in New Issue