about summary refs log tree commit diff
path: root/examples/socket_fuzzing/socketfuzz.c
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2020-12-01 14:40:30 +0100
committervanhauser-thc <vh@thc.org>2020-12-01 14:40:30 +0100
commitc05e4efbe9b4e7d1ff078b7a392621f2ca7572e6 (patch)
treee005593b09169435cbad53c9990c6485e8fd9d06 /examples/socket_fuzzing/socketfuzz.c
parent8584f9d2b5de9687c518c672e471f4f8cd9166fa (diff)
downloadafl++-c05e4efbe9b4e7d1ff078b7a392621f2ca7572e6.tar.gz
renamed examples/ to utils/
Diffstat (limited to 'examples/socket_fuzzing/socketfuzz.c')
-rw-r--r--examples/socket_fuzzing/socketfuzz.c110
1 files changed, 0 insertions, 110 deletions
diff --git a/examples/socket_fuzzing/socketfuzz.c b/examples/socket_fuzzing/socketfuzz.c
deleted file mode 100644
index 3ec8383b..00000000
--- a/examples/socket_fuzzing/socketfuzz.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * This is desock_dup.c from the amazing preeny project
- * https://github.com/zardus/preeny
- *
- * It is packaged in afl++ to have it at hand if needed
- *
- */
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>   //
-#include <sys/socket.h>  //
-#include <sys/stat.h>    //
-#include <fcntl.h>       //
-#include <netinet/in.h>
-#include <pthread.h>
-#include <signal.h>
-#include <dlfcn.h>
-#include <errno.h>
-#include <stdio.h>
-#include <poll.h>
-//#include "logging.h" // switche from preeny_info() to fprintf(stderr, "Info: "
-
-//
-// originals
-//
-int (*original_close)(int);
-int (*original_dup2)(int, int);
-__attribute__((constructor)) void preeny_desock_dup_orig() {
-
-  original_close = dlsym(RTLD_NEXT, "close");
-  original_dup2 = dlsym(RTLD_NEXT, "dup2");
-
-}
-
-int close(int sockfd) {
-
-  if (sockfd <= 2) {
-
-    fprintf(stderr, "Info: Disabling close on %d\n", sockfd);
-    return 0;
-
-  } else {
-
-    return original_close(sockfd);
-
-  }
-
-}
-
-int dup2(int old, int new) {
-
-  if (new <= 2) {
-
-    fprintf(stderr, "Info: Disabling dup from %d to %d\n", old, new);
-    return 0;
-
-  } else {
-
-    return original_dup2(old, new);
-
-  }
-
-}
-
-int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
-
-  (void)sockfd;
-  (void)addr;
-  (void)addrlen;
-  fprintf(stderr, "Info: Emulating accept on %d\n", sockfd);
-  return 0;
-
-}
-
-int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
-
-  (void)sockfd;
-  (void)addr;
-  (void)addrlen;
-  fprintf(stderr, "Info: Emulating bind on port %d\n",
-          ntohs(((struct sockaddr_in *)addr)->sin_port));
-  return 0;
-
-}
-
-int listen(int sockfd, int backlog) {
-
-  (void)sockfd;
-  (void)backlog;
-  return 0;
-
-}
-
-int setsockopt(int sockfd, int level, int optid, const void *optdata,
-               socklen_t optdatalen) {
-
-  (void)sockfd;
-  (void)level;
-  (void)optid;
-  (void)optdata;
-  (void)optdatalen;
-  return 0;
-
-}
-