unsigned int ps_mailport;
sstring *ps_mailname;
+unsigned long scanspermin;
+unsigned long tempscanspermin=0;
+unsigned long lastscants=0;
+
nick *proxyscannick;
FILE *ps_logfile;
starttime=time(NULL);
glinedhosts=0;
+ scanspermin=0;
+ lastscants=time(NULL);
+
/* Listen port */
cfgstr=getcopyconfigitem("proxyscan","port","9999",6);
listenport=strtol(cfgstr->content,NULL,10);
proxyscan_addscantype(STYPE_HTTP, 63809);
proxyscan_addscantype(STYPE_HTTP, 63000);
proxyscan_addscantype(STYPE_SOCKS4, 559);
+ proxyscan_addscantype(STYPE_SOCKS4, 29992);
/* Schedule saves */
schedulerecurring(time(NULL)+3600,0,3600,&dumpcachehosts,NULL);
void startscan(unsigned int IP, int type, int port, int class) {
scan *sp;
+
+ float scantmp;
+
+ if (scansdone>maxscans)
+ {
+ /* ignore the first maxscans as this will skew our scans per second! */
+ tempscanspermin++;
+ if ((lastscants+60) <= time(NULL))
+ {
+ /* ok, at least 60 seconds has passed, calculate the scans per minute figure */
+ scantmp = time(NULL) - lastscants;
+ scantmp = tempscanspermin / scantmp;
+ scantmp = (scantmp * 60);
+ scanspermin = scantmp;
+ lastscants = time(NULL);
+ tempscanspermin = 0;
+ }
+ }
sp=getscan();
sendnoticetouser(proxyscannick,np,"Total scans completed: %d",scansdone);
sendnoticetouser(proxyscannick,np,"Total hosts glined: %d",glinedhosts);
+ sendnoticetouser(proxyscannick,np,"pendingscan structures: %lu x %lu bytes = %lu bytes total",countpendingscan,
+ sizeof(pendingscan), (countpendingscan * sizeof(pendingscan)));
+
sendnoticetouser(proxyscannick,np,"Currently active scans: %d/%d",activescans,maxscans);
+ sendnoticetouser(proxyscannick,np,"Processing speed: %lu scans per minute",scanspermin);
sendnoticetouser(proxyscannick,np,"Normal queued scans: %d",normalqueuedscans);
sendnoticetouser(proxyscannick,np,"Timed queued scans: %d",prioqueuedscans);
sendnoticetouser(proxyscannick,np,"'Clean' cached hosts: %d",cleancount());
*/
#include "proxyscan.h"
+#include "../irc/irc.h"
pendingscan *ps_normalqueue=NULL;
pendingscan *ps_prioqueue=NULL;
unsigned int normalqueuedscans=0;
unsigned int prioqueuedscans=0;
+unsigned long countpendingscan=0;
+
void queuescan(unsigned int IP, short scantype, unsigned short port, char class, time_t when) {
pendingscan *psp, *psp2;
}
/* We have to queue it */
- psp=getpendingscan();
+ psp = (struct pendingscan *) malloc(sizeof(pendingscan));
+ if (!psp)
+ {
+ /* shutdown due to no memory */
+ irc_send("%s SQ %s 0 :Out of memory - exiting.",mynumeric->content,myserver->content);
+ irc_disconnected();
+ exit(0);
+ } else {
+ countpendingscan++;
+ }
psp->IP=IP;
psp->type=scantype;
psp->port=port;
if (psp) {
startscan(psp->IP, psp->type, psp->port, psp->class);
- freependingscan(psp);
+ free(psp);
+ countpendingscan--;
psp=NULL;
} else {
break;