parent
a12c72a26a
commit
9fa1190f7d
2 changed files with 10 additions and 2 deletions
11
rdo.c
11
rdo.c
|
@ -4,6 +4,7 @@
|
|||
#include <crypt.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <bsd/readpassphrase.h>
|
||||
|
||||
|
@ -40,6 +41,10 @@ void runprog(int argc, char** argv) {
|
|||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char username[64];
|
||||
char wrong_pw_sleep[64];
|
||||
unsigned int sleep_ms;
|
||||
|
||||
if (argc < 2)
|
||||
errx(1, "Please specify a program to run");
|
||||
|
||||
|
@ -54,9 +59,10 @@ int main(int argc, char** argv) {
|
|||
runprog(argc, argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char username[64];
|
||||
|
||||
getconf(fp, "username", username, sizeof(username));
|
||||
getconf(fp, "wrong_pw_sleep", wrong_pw_sleep, sizeof(wrong_pw_sleep));
|
||||
sleep_ms = atoi(wrong_pw_sleep) * 1000;
|
||||
|
||||
struct passwd* p = getpwnam(username);
|
||||
if (!p)
|
||||
|
@ -82,6 +88,7 @@ int main(int argc, char** argv) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
usleep(sleep_ms);
|
||||
fprintf(stderr, "Wrong password.\n");
|
||||
tries++;
|
||||
}
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
username=sw1tchbl4d3
|
||||
wrong_pw_sleep=1000
|
||||
|
|
Loading…
Add table
Reference in a new issue