26 lines
521 B
C
26 lines
521 B
C
#include <dlfcn.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/types.h>
|
|
|
|
#define SECRET "MySecretThought"
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
if (argc > 1) {
|
|
printf("Your secret: %s\n", argv[1]);
|
|
int r = strcmp(argv[1], SECRET);
|
|
|
|
if (r != 0) {
|
|
printf("Secret is invalid\n");
|
|
} else {
|
|
printf("Yay secret is valid\n");
|
|
}
|
|
} else {
|
|
printf("You need to provide a secret as an argument\n");
|
|
}
|
|
|
|
int fd = socket(AF_INET, SOCK_DGRAM, 0);
|
|
return fd;
|
|
}
|