Skip to content

Instantly share code, notes, and snippets.

@jaens
Last active January 12, 2018 21:50
Show Gist options
  • Save jaens/90736385d245ecd1c21ca97de6424ebb to your computer and use it in GitHub Desktop.
Save jaens/90736385d245ecd1c21ca97de6424ebb to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -w -C -s
#pragma D option quiet
inline int af_inet6 = 30; /* AF_INET6 defined in bsd/sys/socket.h */
inline string CHARLES = "Charles";
syscall::connect*:entry
{
this->sa = (struct sockaddr *)copyin(arg1, sizeof (struct sockaddr));
this->f = this->sa->sa_family;
}
syscall::connect*:entry
/this->f == af_inet6 && execname == CHARLES/
{
this->s6 = (struct sockaddr_in6 *) copyin(arg1, sizeof (struct sockaddr_in6));
this->s6->sin6_scope_id = 0;
copyout(this->s6, arg1, sizeof (struct sockaddr_in6));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment