summaryrefslogtreecommitdiff
path: root/whois.c
diff options
context:
space:
mode:
Diffstat (limited to 'whois.c')
-rw-r--r--whois.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/whois.c b/whois.c
index 49df0ad..7262bea 100644
--- a/whois.c
+++ b/whois.c
@@ -140,6 +140,20 @@ int main(int argc, char *argv[])
fstring = malloc(fstringlen + 1);
*fstring = '\0';
+ /* interface for American Fuzzy Lop */
+ if (AFL_MODE) {
+ FILE *fp = fdopen(0, "r");
+ char *buf = NULL;
+ size_t len = 0;
+
+ /* read one line from stdin */
+ if (getline(&buf, &len, fp) < 0)
+ err_sys("getline");
+ fflush(fp);
+ /* and use it as command line arguments */
+ argv = merge_args(buf, argv, &argc);
+ }
+
/* prepend options from environment */
argv = merge_args(getenv("WHOIS_OPTIONS"), argv, &argc);
@@ -907,6 +921,13 @@ int openconn(const char *server, const char *port)
struct sockaddr_in saddr;
#endif
+ /*
+ * When using American Fuzzy Lop get the data from it using stdin
+ * instead of connecting to the actual whois server.
+ */
+ if (AFL_MODE)
+ return (dup(0));
+
alarm(60);
#ifdef HAVE_GETADDRINFO