2002-08-31 09:28:34 +00:00
|
|
|
/* NetStats - IRC Statistical Services Copyright (c) 1999 Adam Rutter,
|
|
|
|
** Justin Hammond http://codeworks.kamserve.com
|
|
|
|
*
|
|
|
|
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
|
|
|
|
*
|
|
|
|
** NetStats CVS Identification
|
2003-09-22 15:14:02 +00:00
|
|
|
** $Id$
|
2002-08-31 09:28:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef OPSB_H
|
|
|
|
#define OPSB_H
|
|
|
|
|
2002-11-05 13:31:59 +00:00
|
|
|
#include "modconfig.h"
|
2003-10-29 11:07:23 +00:00
|
|
|
#include "opm_types.h"
|
2002-11-05 13:31:59 +00:00
|
|
|
|
2003-10-29 11:07:23 +00:00
|
|
|
typedef struct port_list {
|
|
|
|
int type;
|
2002-08-31 09:28:34 +00:00
|
|
|
int port;
|
|
|
|
int nofound;
|
|
|
|
int noopen;
|
2003-10-29 11:07:23 +00:00
|
|
|
} port_list;
|
2002-08-31 09:28:34 +00:00
|
|
|
|
|
|
|
|
2003-10-29 22:43:06 +00:00
|
|
|
extern char s_opsb[MAXNICK];
|
2002-08-31 09:28:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* max scans in the max concurrent scans at any one time */
|
|
|
|
#define MAX_SCANS 100
|
|
|
|
/* max queue is the max amount of scans that may be concurrent and queued. */
|
|
|
|
#define MAX_QUEUE MAX_SCANS * 100
|
|
|
|
/* max no of exempt entries */
|
|
|
|
#define MAX_EXEMPTS 20
|
2003-10-29 11:07:23 +00:00
|
|
|
/* max no of ports to scan */
|
2007-07-28 07:57:57 +00:00
|
|
|
#define MAX_PORTS 250
|
2002-08-31 09:28:34 +00:00
|
|
|
|
2003-12-17 18:05:25 +00:00
|
|
|
#define MAXREASON 128
|
|
|
|
|
2002-08-31 09:28:34 +00:00
|
|
|
struct scanq {
|
|
|
|
char who[MAXHOST];
|
|
|
|
int state;
|
|
|
|
int dnsstate;
|
|
|
|
char lookup[MAXHOST];
|
|
|
|
char server[MAXHOST];
|
|
|
|
struct in_addr ipaddr;
|
|
|
|
User *u;
|
|
|
|
int doreport;
|
|
|
|
time_t started;
|
2002-09-04 08:52:34 +00:00
|
|
|
int doneban;
|
2002-10-24 09:27:58 +00:00
|
|
|
char connectstring[BUFSIZE];
|
2002-08-31 09:28:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct scanq scaninfo;
|
|
|
|
|
|
|
|
struct opsb {
|
2004-02-17 22:16:52 +00:00
|
|
|
char user[MAXUSER];
|
|
|
|
char host[MAXHOST];
|
2004-02-26 19:49:27 +00:00
|
|
|
char realname[MAXREALNAME];
|
2002-08-31 09:28:34 +00:00
|
|
|
char opmdomain[MAXHOST];
|
|
|
|
int init;
|
|
|
|
char targethost[MAXHOST];
|
2004-02-26 19:49:27 +00:00
|
|
|
char lookforstring[BUFSIZE];
|
2002-08-31 09:28:34 +00:00
|
|
|
int targetport;
|
|
|
|
int maxbytes;
|
|
|
|
int timeout;
|
|
|
|
int socks;
|
|
|
|
int timedif;
|
|
|
|
int open;
|
|
|
|
int scanned;
|
2004-02-26 19:49:27 +00:00
|
|
|
char scanmsg[BUFSIZE];
|
2002-08-31 09:28:34 +00:00
|
|
|
int bantime;
|
|
|
|
int confed;
|
|
|
|
int cachetime;
|
2002-10-24 09:27:58 +00:00
|
|
|
int doscan;
|
2003-01-30 11:29:25 +00:00
|
|
|
int cachehits;
|
|
|
|
int opmhits;
|
2003-11-05 12:31:21 +00:00
|
|
|
int doban;
|
2004-02-26 19:49:27 +00:00
|
|
|
int verbose;
|
2003-10-29 11:07:23 +00:00
|
|
|
list_t *ports;
|
2002-08-31 09:28:34 +00:00
|
|
|
} opsb;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct sockinfo socklist;
|
|
|
|
|
|
|
|
|
|
|
|
/* this is the list of items to be queued */
|
|
|
|
list_t *opsbq;
|
|
|
|
/* this is the list of currently active scans */
|
|
|
|
list_t *opsbl;
|
|
|
|
|
|
|
|
|
|
|
|
struct cache_entry {
|
|
|
|
unsigned long ip;
|
|
|
|
time_t when;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct cache_entry C_entry;
|
|
|
|
|
|
|
|
|
|
|
|
/* this is a list of cached scans */
|
|
|
|
list_t *cache;
|
|
|
|
|
|
|
|
struct exempts {
|
|
|
|
char host[MAXHOST];
|
|
|
|
int server;
|
2002-09-06 06:07:34 +00:00
|
|
|
char who[MAXNICK];
|
2003-12-17 18:05:25 +00:00
|
|
|
char reason[MAXREASON];
|
2002-08-31 09:28:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct exempts exemptinfo;
|
|
|
|
|
2003-10-29 11:07:23 +00:00
|
|
|
|
|
|
|
typedef struct proxy_type {
|
|
|
|
int type;
|
|
|
|
char name[MAXNICK];
|
|
|
|
} proxy_type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-08-31 09:28:34 +00:00
|
|
|
/* this is the list of exempted hosts/servers */
|
|
|
|
|
|
|
|
list_t *exempt;
|
|
|
|
|
|
|
|
/* these are some state flags */
|
|
|
|
#define REPORT_DNS 0x0001
|
2004-07-06 12:10:07 +00:00
|
|
|
#define DO_DNS_HOST_LOOKUP 0x0002
|
2002-08-31 09:28:34 +00:00
|
|
|
#define DO_OPM_LOOKUP 0x0004
|
|
|
|
#define DOING_SCAN 0x0008
|
|
|
|
#define GOTOPENPROXY 0x0010
|
|
|
|
#define OPMLIST 0x0020
|
2002-09-06 04:33:28 +00:00
|
|
|
#define NOOPMLIST 0x0040
|
2003-10-28 12:45:28 +00:00
|
|
|
#define FIN_SCAN 0x0080
|
2002-08-31 09:28:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* opsb.c */
|
|
|
|
int findscan(const void *key1, const void *key2);
|
|
|
|
void do_ban(scaninfo *scandata);
|
|
|
|
void checkqueue();
|
|
|
|
void addtocache(unsigned long ipaddr);
|
|
|
|
|
|
|
|
|
|
|
|
/* proxy.c */
|
|
|
|
void start_proxy_scan(lnode_t *scannode);
|
2004-02-26 19:49:27 +00:00
|
|
|
int do_status(User *u, char **av, int ac);
|
2003-10-28 12:45:28 +00:00
|
|
|
void check_scan_free(scaninfo *scandata);
|
2003-10-29 11:07:23 +00:00
|
|
|
int init_libopm();
|
2003-10-29 12:11:16 +00:00
|
|
|
char *type_of_proxy(int type);
|
|
|
|
int get_proxy_by_name(const char *name);
|
|
|
|
void add_port(int type, int port);
|
|
|
|
int load_ports();
|
|
|
|
|
2004-02-26 19:49:27 +00:00
|
|
|
/* help text */
|
|
|
|
extern const char *opsb_help_lookup[];
|
|
|
|
extern const char *opsb_help_info[];
|
|
|
|
extern const char *opsb_help_check[];
|
|
|
|
extern const char *opsb_help_status[];
|
|
|
|
extern const char *opsb_help_exclude[];
|
|
|
|
extern const char *opsb_help_remove[];
|
|
|
|
extern const char *opsb_help_ports[];
|
|
|
|
|
|
|
|
extern const char opsb_help_info_oneline[];
|
|
|
|
extern const char opsb_help_status_oneline[];
|
|
|
|
extern const char opsb_help_lookup_oneline[];
|
|
|
|
extern const char opsb_help_remove_oneline[];
|
|
|
|
extern const char opsb_help_check_oneline[];
|
|
|
|
extern const char opsb_help_exclude_oneline[];
|
|
|
|
extern const char opsb_help_ports_oneline[];
|
|
|
|
extern const char opsb_help_set_oneline[];
|
|
|
|
|
|
|
|
extern const char *opsb_help_set_disablescan [];
|
|
|
|
extern const char *opsb_help_set_doban [];
|
|
|
|
extern const char *opsb_help_set_targetip [];
|
|
|
|
extern const char *opsb_help_set_targetport [];
|
|
|
|
extern const char *opsb_help_set_opmdomain [];
|
|
|
|
extern const char *opsb_help_set_maxbytes [];
|
|
|
|
extern const char *opsb_help_set_timeout [];
|
|
|
|
extern const char *opsb_help_set_openstring [];
|
|
|
|
extern const char *opsb_help_set_splittime [];
|
|
|
|
extern const char *opsb_help_set_scanmsg [];
|
|
|
|
extern const char *opsb_help_set_bantime [];
|
|
|
|
extern const char *opsb_help_set_cachetime [];
|
|
|
|
extern const char *opsb_help_set_verbose [];
|
2002-08-31 09:28:34 +00:00
|
|
|
|
|
|
|
#endif /* OPSB_H */
|