-
-
Save syntactician/75b11c76c7aa46be4dd8fa65a01c496b 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
#include <stdio.h> | |
#include <unistd.h> | |
#define LS "/bin/ls" | |
#define FILEPATH "./lusers" | |
#define MESSAGE "\ | |
WARNING! You have put my binary directory ahead of the system's in your $PATH. \ | |
While flattering, this is considered unsafe. This will execute my \ | |
binaries rather than the system's in the case of name collisions. Please, \ | |
append it to the end of your $PATH, instead. This incident will be reported." | |
int | |
main(const int argc, char *const *argv) | |
{ | |
FILE *fp; | |
(void) argc; | |
printf("%s\n\n", MESSAGE); | |
if ((fp = fopen(FILEPATH, "a"))) | |
fprintf(fp, "%s\n", getlogin()); | |
fclose(fp); | |
execv(LS, argv); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment