Last active
March 26, 2024 06:09
-
-
Save szaydel/d4a371aebb8ef52a61c482d0612cd2cb to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/sbin/dtrace -qCs | |
#define NT_STATUS_WRONG_PASSWORD 0xC000006A | |
#define NT_STATUS_LOGON_FAILURE 0xC000006D | |
BEGIN | |
{ | |
printf("%-32s %s\n", "USER", "IP"); | |
} | |
pid$target::smb_logon:entry | |
{ | |
self->logon = args[0] | |
} | |
pid$target::smb_logon:return | |
/self->logon->lg_status == NT_STATUS_WRONG_PASSWORD || | |
self->logon->lg_status == NT_STATUS_LOGON_FAILURE/ | |
{ | |
uaddrp = (userland ipaddr_t *)&self->logon->lg_clnt_ipaddr.au_addr.au_ipv4; | |
addrp = copyin((uintptr_t)uaddrp, 4); | |
user = (uintptr_t)self->logon->lg_username; | |
printf("%-32s %s\n", copyinstr(user), inet_ntoa(addrp)); | |
} | |
pid$target::smb_logon:return | |
{ | |
self->logon = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment