#define VERSION "mns-v.95beta"
#define AUTHORS "(c)2000 bind & aempirei"

//#define DEBUG

#define _BSD_SOURCE
#define __BSD_SOURCE
#define __FAVOR_BSD
#define _USE_BSD

#define OSCFGFILE "fingerprints.conf"
#define PORT_FILE "portlist.conf"
#define CONF_FILE "mns.conf"

#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <ctype.h>
#include <fcntl.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
#include <netinet/in_systm.h>
#include <sys/utsname.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "X11/Xlib.h"

#define VULNQPOP (1     )
#define VULNIMAP (1 << 1)
#define VULNCGI  (1 << 2)
#define VULNRPC  (1 << 3)
#define VULNFTP  (1 << 4)
#define WINGATE  (1 << 5)
#define XOPEN    (1 << 6)
#define RESOLVE  (1 << 7)
#define HOSTLIST (1 << 8)
#define SYNSCAN  (1 << 9)
#define UDPSCAN  (1 << 10)
#define VERBOSE  (1 << 11)
#define ALLVULNS ~(RESOLVE | HOSTLIST | SYNSCAN | UDPSCAN | VERBOSE)

#define ERROR -1
#define TIMEOUT 3

#define SA   struct sockaddr
#define SAin struct sockaddr_in

#define IPV4_ADDRLEN 16

#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))

struct servicetype {
   char *name;
   int port;
};

extern struct servicetype *servlist;
extern int services;

extern u_short mns_opts;
extern char *device;
extern char global[16];

/* ipv4.c */
extern const char *ipv4_ntop(int, const void *, char *, size_t);
extern const char *ipv4_showname(int, const void *, char *, size_t);
extern u_short tcp_cksum(char *, int, struct in_addr, struct in_addr);
extern u_short in_cksum(u_short *, int);
extern int ipv4_rslvhost(char *, SAin *);
extern int hamming(u_long);

/* portscan.c */
extern int stealthscan(struct in_addr, FILE *, int **, struct in_addr *);
extern int udpportscan(struct in_addr, FILE *, struct in_addr);

/* osdetect.c */
extern int checkos(struct in_addr, FILE *, int *, struct in_addr);

/* vulnscan.c */
extern int rpc(struct in_addr, FILE *);
extern int qpop(struct in_addr, FILE *);
extern int imap(struct in_addr, FILE *);
extern int cgi(struct in_addr, FILE *);
extern int ftp(struct in_addr, FILE *);
extern int wingate(struct in_addr, FILE *);
extern int xopen(struct in_addr, FILE *);

/* init.c */
extern void sighandler(int);

