Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kern: support uid/pid filter in ebpf TC hook. #606

Merged
merged 1 commit into from
Aug 25, 2024
Merged

Conversation

cfc4n
Copy link
Member

@cfc4n cfc4n commented Aug 25, 2024

remove uid/pid filter in kprobe/tcp_sendmsg.

tcp_sendmsg hook all processes are monitored, so there is no need to filter pid and uid, otherwise pid\uid cannot be used in the TC capture_packets function to filter network packets

remove uid/pid filter in kprobe/tcp_sendmsg.

tcp_sendmsg hook all processes are monitored, so there is no need to filter pid and uid, otherwise pid\uid cannot be used in the TC capture_packets function to filter network packets

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
@cfc4n
Copy link
Member Author

cfc4n commented Aug 25, 2024

@xxxxxliil try it.

@xxxxxliil
Copy link
Contributor

@xxxxxliil try it.

fix #602 and #605?

@cfc4n
Copy link
Member Author

cfc4n commented Aug 25, 2024

@xxxxxliil try it.

fix #602 and #605?

Yes, there are three bugs in these two issues:

  1. The error message indicates the Hook type is for Golang.
  2. There is no support for filtering network packets by uid.
  3. conn_id is undefined.

Among them, bug 1 involves incorrect character output but does not actually affect the program logic. bug 3 was fixed by removing related logs that had no value. The main focus was on fixing bug 2.

@xxxxxliil
Copy link
Contributor

#605 fixed
#602 I can't build android target

@cfc4n
Copy link
Member Author

cfc4n commented Aug 25, 2024

ANDROID=1 make

@xxxxxliil
Copy link
Contributor

ANDROID=1 make

此处的不能构建不是不知道构建命令,而是发行版不能提供对应的 aarch64 头文件(包 aarch64-linux-gnu-linux-api-headers 没有提供 kconfig.h

@cfc4n
Copy link
Member Author

cfc4n commented Aug 25, 2024

我本地做了测试,是可以构建ANDROID的。 如果你在amd64上,也是可以编译x86_64的ANDROID程序。

如果你想交叉编译,那么你需要参考 https://github.com/gojue/ecapture/blob/master/.github/workflows/release.yml#L27 ,下载头文件源码,并构建生成相关头文件。 在makefile时引用。

sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
test -f .config || sudo make oldconfig
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- prepare V=0
ls -al /usr/src/linux-source-${kernel_ver}

另外:因为你不是ubuntu,无法使用已经提供好的脚本。所以,你需要手动安装。

@cfc4n cfc4n merged commit 71b44e2 into master Aug 25, 2024
6 checks passed
@cfc4n cfc4n deleted the ebpf-tc-uid-filter branch August 25, 2024 11:19
@xxxxxliil
Copy link
Contributor

xxxxxliil commented Aug 25, 2024

@cfc4n #602 没有被这个 pr 解决,需要重新开启 issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working fix bug fix PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

小米平板在使用 pcap 与 keylog 抓 tls 包时表现非预期行为
2 participants