minor updates to OPSB, configurable cachesize now
This commit is contained in:
parent
5dd339fb30
commit
0eef06ff90
4 changed files with 17 additions and 7 deletions
11
opsb.c
11
opsb.c
|
@ -298,6 +298,7 @@ static bot_setting opsb_settings[]=
|
|||
{"OPENSTRING", &opsb.openstring, SET_TYPE_MSG, 0, BUFSIZE, NS_ULEVEL_ADMIN, NULL, opsb_help_set_openstring, do_set_cb, (void*)"*** Looking up your hostname..." },
|
||||
{"SCANMSG", &opsb.scanmsg, SET_TYPE_MSG, 0, BUFSIZE, NS_ULEVEL_ADMIN, NULL, opsb_help_set_scanmsg, do_set_cb, (void*)"Your Host is being Scanned for Open Proxies" },
|
||||
{"CACHETIME", &opsb.cachetime, SET_TYPE_INT, 0, 86400, NS_ULEVEL_ADMIN, NULL, opsb_help_set_cachetime, do_set_cb, (void*)3600 },
|
||||
{"CACHESIZE", &opsb.cachesize, SET_TYPE_INT, 0, 10000, NS_ULEVEL_ADMIN, NULL, opsb_help_set_cachesize, do_set_cb, (void*)1000 },
|
||||
{"VERBOSE", &opsb.verbose, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, NULL, opsb_help_set_verbose, do_set_cb, (void*)1 },
|
||||
{"EXCLUSIONS", &opsb.exclusions, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, NULL, opsb_help_set_exclusions, opsb_set_exclusions_cb, (void *)0 },
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
@ -604,19 +605,19 @@ int ModInit( void )
|
|||
}
|
||||
/* queue can be anything we want */
|
||||
opsbq = list_create(MAX_QUEUE);
|
||||
/* scan cache is MAX_QUEUE size (why not?) */
|
||||
cache = list_create(MAX_QUEUE);
|
||||
cache = list_create(opsb.cachesize);
|
||||
opsb.ports = list_create(MAX_PORTS);
|
||||
opsb.open = 0;
|
||||
opsb.scanned = 0;
|
||||
opsb.cachehits = 1;
|
||||
opsb.opmhits = 1;
|
||||
opsb.cachehits = 0;
|
||||
opsb.opmhits = 0;
|
||||
if (load_ports() != 1) {
|
||||
nlog (LOG_WARNING, "Can't Load opsb. No Ports Defined for Scanner. Did you install Correctly?");
|
||||
return NS_FAILURE;
|
||||
}
|
||||
/* XXX needs work */
|
||||
if (strlen(opsb.targetip) <= 0) {
|
||||
strlcpy(opsb.targetip, "10.1.1.26", MAXHOST);
|
||||
strlcpy(opsb.targetip, me.uplink, MAXHOST);
|
||||
}
|
||||
if (init_scanengine() != NS_SUCCESS) {
|
||||
return NS_FAILURE;
|
||||
|
|
3
opsb.h
3
opsb.h
|
@ -76,6 +76,7 @@ struct opsb {
|
|||
int akilltime;
|
||||
int confed;
|
||||
int cachetime;
|
||||
int cachesize;
|
||||
int doscan;
|
||||
int cachehits;
|
||||
int opmhits;
|
||||
|
@ -163,5 +164,5 @@ extern const char *opsb_help_set_akilltime [];
|
|||
extern const char *opsb_help_set_cachetime [];
|
||||
extern const char *opsb_help_set_verbose [];
|
||||
extern const char *opsb_help_set_exclusions[];
|
||||
|
||||
extern const char *opsb_help_set_cachesize[];
|
||||
#endif /* OPSB_H */
|
||||
|
|
|
@ -153,6 +153,13 @@ const char *opsb_help_set_cachetime [] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
const char *opsb_help_set_cachesize [] = {
|
||||
"\2CACHESIZE <size>\2",
|
||||
"The total number of clean hosts that OPSB will cache",
|
||||
"Setting this too large may cause NeoStats to Lag",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *opsb_help_set_verbose [] = {
|
||||
"\2VERBOSE <ON|OFF>\2",
|
||||
"Whether OPSB is verbose in operation or not",
|
||||
|
|
3
proxy.c
3
proxy.c
|
@ -382,7 +382,7 @@ int proxy_read (void *data, void *recv, size_t size) {
|
|||
free(ci);
|
||||
}
|
||||
if (list_count(si->connections) == 0) {
|
||||
si->state = FIN_SCAN;
|
||||
if (si->state == DOING_SCAN) si->state = FIN_SCAN;
|
||||
check_scan_free(si);
|
||||
}
|
||||
return NS_FAILURE;
|
||||
|
@ -391,6 +391,7 @@ int proxy_read (void *data, void *recv, size_t size) {
|
|||
for (i = 0; stdmatchstrings[i] != NULL; i++) {
|
||||
if (match(stdmatchstrings[i], recv)) {
|
||||
proxy_list[ci->type-1].noopen++;
|
||||
if (si->state == DOING_SCAN) si->state = GOTOPENPROXY;
|
||||
open_proxy(ci);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue