-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.c
More file actions
732 lines (648 loc) · 18.1 KB
/
proxy.c
File metadata and controls
732 lines (648 loc) · 18.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
/* NeoStats - IRC Statistical Services
** Copyright (c) 1999-2006 Adam Rutter, Justin Hammond, Mark Hetherington
** http://www.neostats.net/
**
** Portions Copyright (c) 2004 Erik Fears
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
** USA
**
** NeoStats CVS Identification
** $Id: proxy.c 229 2008-01-14 06:31:01Z Fish $
*/
#include "neostats.h"
#include "event.h"
#include "updates.h"
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#include "opsb.h"
typedef enum PORT_TYPE
{
PTYPE_HTTP = 1,
PTYPE_SOCKS4,
PTYPE_SOCKS5,
PTYPE_WINGATE,
PTYPE_ROUTER,
PTYPE_HTTPPOST,
PTYPE_MAX
}PORT_TYPE;
typedef struct proxy_type {
PORT_TYPE type;
char name[MAXNICK];
sockcb writefunc;
int scanned;
int numopen;
} proxy_type;
typedef struct conninfo {
int type;
int port;
OS_SOCKET fd;
Sock *sock;
scaninfo *scandata;
} conninfo;
static int http_send (int fd, void *data);
static int sock4_send(int fd, void *data);
static int sock5_send(int fd, void *data);
static int wingate_send(int fd, void *data);
static int router_send(int fd, void *data);
static int httppost_send(int fd, void *data);
static char *defaultports[] = {
"80 8080 8000 3128",
"1080",
"1080",
"23",
"23",
"80 8080 8000 3128",
};
static char *stdmatchstrings[] = {
"*Looking up your hostname*",
"*You have not registered*",
"*HTTP/1.0 200 Connection established*",
NULL
};
static proxy_type proxy_list[] = {
{ PTYPE_HTTP, "HTTP", http_send, 0, 0},
{ PTYPE_SOCKS4, "SOCKS4", sock4_send, 0, 0 },
{ PTYPE_SOCKS5, "SOCKS5", sock5_send, 0, 0 },
{ PTYPE_WINGATE, "WINGATE", wingate_send, 0, 0},
{ PTYPE_ROUTER, "ROUTER", router_send, 0, 0},
{ PTYPE_HTTPPOST, "HTTPPOST", httppost_send, 0, 0},
{ 0, "", NULL, 0, 0 }
};
static char http_send_buf[BUFSIZE];
static int http_send_buf_len;
static char httppost_send_buf[BUFSIZE];
static int httppost_send_buf_len;
static char router_send_buf[BUFSIZE];
static int router_send_buf_len;
static char wingate_send_buf[BUFSIZE];
static int wingate_send_buf_len;
static char socks4_send_buf[BUFSIZE];
static int socks4_send_buf_len;
static char socks5_send_buf[BUFSIZE];
static int socks5_send_buf_len;
/** @brief findconn
*
*
*
* @param
*
* @return
*/
static int findconn( const void *key1, const void *key2 )
{
const conninfo *ci1 = key1;
const conninfo *ci2 = key2;
if ((ci1->type == ci2->type) && (ci1->port == ci2->port))
return 0;
return -1;
}
/** @brief check_scan_free
*
*
*
* @param
*
* @return
*/
static void check_scan_free(scaninfo *scandata) {
lnode_t *scannode;
if (scandata->state == DOING_SCAN) {
dlog (DEBUG2, "Not Cleaning up Scaninfo for %s yet. Scan hasn't completed", scandata->who);
return;
}
if (scandata->state != GOTOPENPROXY) {
addtocache(scandata->ip.s_addr);
dlog (DEBUG1, "%s's Host is clean. Adding to Cache", scandata->who);
}
scannode = list_find(opsbl, scandata->who, findscan);
if (scannode) {
dlog (DEBUG1, "%s scan finished. Cleaning up", scandata->who);
list_delete(opsbl, scannode);
lnode_destroy(scannode);
scandata->reqclient = NULL;
list_destroy(scandata->connections);
ns_free(scandata);
} else {
nlog (LOG_WARNING, "Damn, Can't find ScanNode %s. Something is fubar", scandata->who);
}
checkqueue();
}
static void report_positive (const char *hostip, const conninfo *connection)
{
MMessage *msg;
int32 *msgver;
MByteBuffer **host;
MByteBuffer **proxy;
int32 *port;
MByteBuffer **NeoVer;
SET_SEGV_LOCATION();
if (opsb.doreport) {
/* get our template message */
msg = MQCreateMessage("OPSB", "securebot", 0, NULL, 1);
if (msg) {
msgver = MMPutInt32Field(msg, false, "msgver", 1);
host = MMPutStringField(msg, false, "Host", 1);
proxy = MMPutStringField(msg, false, "Proxy", 1);
NeoVer = MMPutStringField(msg, false, "NeoVer", 1);
port = MMPutInt32Field(msg, false, "Port", 1);
host[0] = MBStrdupByteBuffer(hostip);
proxy[0] = MBStrdupByteBuffer(type_of_proxy(connection->type));
NeoVer[0] = MBStrdupByteBuffer(MODULE_VERSION);
port[0] = connection->port;
/* msgver 1 = SecureServ, msgver 2 = OPSB */
msgver[0] = 2;
MQSendMessage(msg, 1);
} else {
nlog(LOG_WARNING, "Couldn't create Report Message");
}
}
}
/** @brief open_proxy
*
*
*
* @param
*
* @return
*/
static void open_proxy(const conninfo *connection)
{
scaninfo *scandata = connection->scandata;
Client *u;
SET_SEGV_LOCATION();
if (scandata->doneban == 1)
return;
++opsb.open;
nlog (LOG_CRITICAL, "OPSB: Banning %s (%s) for Open Proxy - %s(%d)", scandata->who, scandata->lookup, type_of_proxy(connection->type), connection->port);
irc_chanalert (opsb_bot, "Banning %s (%s) for Open Proxy - %s(%d)", scandata->who, scandata->lookup, type_of_proxy(connection->type), connection->port);
irc_globops (opsb_bot, "Banning %s (%s) for Open Proxy - %s(%d)", scandata->who, scandata->lookup, type_of_proxy(connection->type), connection->port);
if (scandata->reqclient) irc_prefmsg (opsb_bot, scandata->reqclient, "Banning %s (%s) for Open Proxy - %s(%d)", scandata->who, scandata->lookup, type_of_proxy(connection->type), connection->port);
u = FindUser(scandata->who);
if (u) {
irc_prefmsg(opsb_bot, u, "An %s open proxy was found on port %d from your host. Please see http://secure.irc-chat.net/op.php?f=opsb&t=%d&p=%d&ip=%s", type_of_proxy(connection->type), connection->port, connection->type, connection->port, inet_ntoa(scandata->ip));
#ifndef WIN32
report_positive(inet_ntoa(scandata->ip), connection);
#endif
}
if (opsb.doakill)
irc_akill (opsb_bot, inet_ntoa(scandata->ip), "*", opsb.akilltime, "An %s open proxy was found on port %d from your host. Please see http://secure.irc-chat.net/op.php?f=opsb&t=%d&p=%d&ip=%s", type_of_proxy(connection->type), connection->port, connection->type, connection->port, inet_ntoa(scandata->ip));
/* no point continuing the scan if they are found open */
scandata->state = GOTOPENPROXY;
/* XXX end scan */
scandata->doneban = 1;
}
/** @brief proxy_read
*
*
*
* @param
*
* @return
*/
static int proxy_read( void *data, void *recv, int size )
{
conninfo *ci = (conninfo *)data;
scaninfo *si = ci->scandata;
lnode_t *connode;
int i;
SET_SEGV_LOCATION();
/* XXX delete CI */
switch (size) {
case -1: /* connect refused */
case -2: /* timeout */
connode = list_find(si->connections, ci, findconn);
if (connode) {
list_delete(si->connections, connode);
lnode_destroy(connode);
if (si->reqclient) irc_prefmsg(opsb_bot, si->reqclient, "Connection on %s (%s:%d) for Protocol %s Closed", si->who, si->lookup, ci->port, type_of_proxy(ci->type));
ns_free(ci);
}
if (list_count(si->connections) == 0) {
if (si->state == DOING_SCAN) si->state = FIN_SCAN;
check_scan_free(si);
}
return NS_FAILURE;
default:
proxy_list[ci->type-1].scanned++;
for (i = 0; stdmatchstrings[i] != NULL; i++) {
if (match(stdmatchstrings[i], recv)) {
proxy_list[ci->type-1].numopen++;
if (si->state == DOING_SCAN) si->state = GOTOPENPROXY;
open_proxy(ci);
}
}
break;
}
return NS_SUCCESS;
}
/** @brief type_of_proxy
*
*
*
* @param
*
* @return
*/
char *type_of_proxy(int type)
{
return proxy_list[type-1].name;
}
/** @brief get_proxy_by_name
*
*
*
* @param
*
* @return
*/
int get_proxy_by_name(const char *name)
{
int i;
for( i = 0; proxy_list[i].type != 0; i++ )
{
if( ircstrcasecmp( proxy_list[i].name, name ) == 0 )
return proxy_list[i].type;
}
return 0;
}
/** @brief save_ports
*
*
*
* @param
*
* @return
*/
void save_ports( void )
{
lnode_t *pn;
port_list *pl;
static char ports[512];
static char tmpports[512];
int lasttype = -1;
SET_SEGV_LOCATION();
pn = list_first(opsb.ports);
while (pn) {
pl = lnode_get(pn);
/* if the port is different from the last round, and its not the first round, save it */
if ((pl->type != lasttype) && (lasttype != -1)) {
DBAStoreConfigStr(type_of_proxy(lasttype), ports, 512);
}
if (pl->type != lasttype) {
ircsnprintf(ports, 512, "%d", pl->port);
} else {
ircsnprintf(tmpports, 512, "%s %d", ports, pl->port);
strlcpy(ports, tmpports, 512);
}
lasttype = pl->type;
pn = list_next(opsb.ports, pn);
}
DBAStoreConfigStr(type_of_proxy(lasttype), ports, 512);
}
/** @brief load_port
*
*
*
* @param
*
* @return
*/
static void load_port(int type, const char *portname)
{
static char portlist[512];
char **av;
unsigned int j, ac;
port_list *prtlst;
SET_SEGV_LOCATION();
strlcpy (portlist, portname, 512);
ac = split_buf(portlist, &av);
for (j = 0; j < ac; j++) {
if (atoi(av[j]) == 0) {
nlog (LOG_WARNING, "Invalid port %s for proxy type %s", av[j], type_of_proxy(type));
continue;
}
if (list_isfull(opsb.ports)) {
nlog (LOG_WARNING, "Ports list is full.");
break;
}
prtlst = ns_malloc(sizeof(port_list));
prtlst->type = type;
prtlst->port = atoi(av[j]);
prtlst->numopen = 0;
lnode_create_append (opsb.ports, prtlst);
dlog (DEBUG1, "Added port %d for protocol %s", prtlst->port, type_of_proxy(type));
}
ns_free(av);
}
/** @brief load_ports
*
*
*
* @param
*
* @return
*/
int load_ports( void )
{
static char portname[512];
int i;
int ok = 0;
SET_SEGV_LOCATION();
for (i = 0; proxy_list[i].type != 0; i++) {
if (DBAFetchConfigStr (proxy_list[i].name, portname, 512) != NS_SUCCESS) {
nlog (LOG_WARNING, "Warning, no ports defined for protocol %s, using defaults", proxy_list[i].name);
load_port(proxy_list[i].type, defaultports[i]);
DBAStoreConfigStr(proxy_list[i].name, defaultports[i], 512);
ok = 1;
} else {
load_port(proxy_list[i].type, portname);
ok = 1;
}
}
return ( ok == 1 ) ? NS_SUCCESS : NS_FAILURE;
}
/** @brief init_scanengine
*
*
*
* @param
*
* @return
*/
int init_scanengine( void )
{
struct in_addr addr;
unsigned long laddr;
SET_SEGV_LOCATION();
/* set up our send buffers */
http_send_buf_len = ircsnprintf(http_send_buf, BUFSIZE, "CONNECT %s:%d HTTP/1.0\r\n\r\nquit\r\n\r\n", opsb.targetip, opsb.targetport);
httppost_send_buf_len = ircsnprintf(httppost_send_buf, BUFSIZE, "POST http://%s:%d/ HTTP/1.0\r\nContent-type: text/plain\r\nContent-length: 5\r\n\r\nquit\r\n\r\n", opsb.targetip, opsb.targetport);
router_send_buf_len = ircsnprintf(router_send_buf, BUFSIZE, "cisco\r\ntelnet %s %d\r\n", opsb.targetip, opsb.targetport);
wingate_send_buf_len = ircsnprintf(wingate_send_buf, BUFSIZE, "%s:%d\r\n", opsb.targetip, opsb.targetport);
if (inet_aton(opsb.targetip, &addr) == 0)
{
nlog(LOG_ERROR, "Couldn't Setup connect address for init_scan_engine: %s", opsb.targetip);
return NS_FAILURE;
}
laddr = htonl(addr.s_addr);
/* taken from libopm */
socks4_send_buf_len = ircsnprintf(socks4_send_buf, BUFSIZE, "%c%c%c%c%c%c%c%c%c", 4, 1,
(((unsigned short) opsb.targetport) >> 8) & 0xFF,
(((unsigned short) opsb.targetport) & 0xFF),
(char) (laddr >> 24) & 0xFF, (char) (laddr >> 16) & 0xFF,
(char) (laddr >> 8) & 0xFF, (char) laddr & 0xFF, 0);
socks5_send_buf_len = ircsnprintf(socks5_send_buf, BUFSIZE, "%c%c%c%c%c%c%c%c%c%c%c%c%c", 5, 1, 0, 5, 1, 0, 1,
(char) (laddr >> 24) & 0xFF, (char) (laddr >> 16) & 0xFF,
(char) (laddr >> 8) & 0xFF, (char) laddr & 0xFF,
(((unsigned short) opsb.targetport) >> 8) & 0xFF,
(((unsigned short) opsb.targetport) & 0xFF));
return NS_SUCCESS;
}
/** @brief start_proxy_scan
*
*
*
* @param
*
* @return
*/
void start_proxy_scan(scaninfo *scandata)
{
int i;
lnode_t *pn;
port_list *pl;
conninfo *ci;
char tmpname[512];
struct timeval tv;
SET_SEGV_LOCATION();
if (scandata->reqclient) irc_chanalert (opsb_bot, "Starting proxy scan on %s (%s) by Request of %s", scandata->who, scandata->lookup, scandata->reqclient->name);
opsb.scanned++;
tv.tv_sec = opsb.timeout;
tv.tv_usec = 0;
scandata->state = DOING_SCAN;
/* this is so we can timeout scans */
scandata->started = time(NULL);
scandata->connections = list_create(LISTCOUNT_T_MAX);
pn = list_first(opsb.ports);
while( pn != NULL )
{
pl = lnode_get(pn);
ci = ns_malloc(sizeof(conninfo));
ci->type = pl->type;
ci->port = pl->port;
ci->scandata = scandata;
/* get the callbacks etc */
for (i=0; proxy_list[i].type != 0; i++) {
if (proxy_list[i].type == pl->type) {
if ((ci->fd = sock_connect(SOCK_STREAM, scandata->ip, ci->port)) == NS_FAILURE) {
nlog(LOG_WARNING, "start_proxy_scan(): Failed Connect for protocol %s on port %d", type_of_proxy(ci->type), ci->port);
ns_free(ci);
pn = list_next(opsb.ports, pn);
continue;
}
/* ok, it worked... lets add it as a standard socket */
ircsnprintf(tmpname, 512, "%s:%d-%d", type_of_proxy(ci->type), ci->port, ci->fd);
if (( ci->sock = AddSock(SOCK_STANDARD, tmpname, ci->fd, proxy_read, proxy_list[i].writefunc, EV_WRITE|EV_READ|EV_TIMEOUT|EV_PERSIST, ci, &tv)) == NULL) {
nlog(LOG_WARNING, "start_proxy_scan(): Failed AddSock for protocol %s on port %d", type_of_proxy(ci->type), ci->port);
os_sock_close(ci->fd);
ns_free(ci);
pn = list_next(opsb.ports, pn);
continue;
}
}
}
lnode_create_append(scandata->connections, ci);
pn = list_next(opsb.ports, pn);
}
}
/** @brief http_send
*
*
*
* @param
*
* @return
*/
static int http_send(int fd, void *data)
{
conninfo *ci = (conninfo *)data;
struct timeval tv;
SET_SEGV_LOCATION();
if (send_to_sock(ci->sock, http_send_buf, http_send_buf_len) != NS_FAILURE) {
/* our timeout */
tv.tv_sec = opsb.timeout;
tv.tv_usec = 0;
UpdateSock(ci->sock, EV_READ|EV_PERSIST|EV_TIMEOUT, 1, &tv);
}
return NS_SUCCESS;
}
/** @brief sock4_send
*
*
*
* @param
*
* @return
*/
static int sock4_send(int fd, void *data)
{
conninfo *ci = (conninfo *)data;
struct timeval tv;
SET_SEGV_LOCATION();
if (send_to_sock(ci->sock, socks4_send_buf, socks4_send_buf_len) != NS_FAILURE) {
/* our timeout */
tv.tv_sec = opsb.timeout;
tv.tv_usec = 0;
UpdateSock(ci->sock, EV_READ|EV_PERSIST|EV_TIMEOUT, 1, &tv);
}
return NS_SUCCESS;
}
/** @brief sock5_send
*
*
*
* @param
*
* @return
*/
static int sock5_send(int fd, void *data)
{
conninfo *ci = (conninfo *)data;
struct timeval tv;
SET_SEGV_LOCATION();
if (send_to_sock(ci->sock, socks5_send_buf, socks5_send_buf_len) != NS_FAILURE) {
/* our timeout */
tv.tv_sec = opsb.timeout;
tv.tv_usec = 0;
UpdateSock(ci->sock, EV_READ|EV_PERSIST|EV_TIMEOUT, 1, &tv);
}
return NS_SUCCESS;
}
/** @brief wingate_send
*
*
*
* @param
*
* @return
*/
static int wingate_send(int fd, void *data)
{
conninfo *ci = (conninfo *)data;
struct timeval tv;
SET_SEGV_LOCATION();
if (send_to_sock(ci->sock, wingate_send_buf, wingate_send_buf_len) != NS_FAILURE) {
/* our timeout */
tv.tv_sec = opsb.timeout;
tv.tv_usec = 0;
UpdateSock(ci->sock, EV_READ|EV_PERSIST|EV_TIMEOUT, 1, &tv);
}
return NS_SUCCESS;
}
/** @brief router_send
*
*
*
* @param
*
* @return
*/
static int router_send(int fd, void *data)
{
conninfo *ci = (conninfo *)data;
struct timeval tv;
SET_SEGV_LOCATION();
if (send_to_sock(ci->sock, wingate_send_buf, wingate_send_buf_len) != NS_FAILURE) {
/* our timeout */
tv.tv_sec = opsb.timeout;
tv.tv_usec = 0;
UpdateSock(ci->sock, EV_READ|EV_PERSIST|EV_TIMEOUT, 1, &tv);
}
return NS_SUCCESS;
}
/** @brief httppost_send
*
*
*
* @param
*
* @return
*/
static int httppost_send(int fd, void *data)
{
conninfo *ci = (conninfo *)data;
struct timeval tv;
SET_SEGV_LOCATION();
if (send_to_sock(ci->sock, httppost_send_buf, httppost_send_buf_len) != NS_FAILURE) {
/* our timeout */
tv.tv_sec = opsb.timeout;
tv.tv_usec = 0;
UpdateSock(ci->sock, EV_READ|EV_PERSIST|EV_TIMEOUT, 1, &tv);
}
return NS_SUCCESS;
}
/** @brief opsb_cmd_status
*
* STATUS command handler
*
* @param cmdparam struct
*
* @return NS_SUCCESS if suceeds else result of command
*/
int opsb_cmd_status( const CmdParams *cmdparams )
{
lnode_t *node;
scaninfo *scandata;
lnode_t *cnode;
conninfo *ci;
int i;
SET_SEGV_LOCATION();
irc_prefmsg (opsb_bot, cmdparams->source, "Proxy Results:");
irc_prefmsg (opsb_bot, cmdparams->source, "Hosts Scanned: %d Hosts found Open: %d", opsb.scanned, opsb.open);
irc_prefmsg (opsb_bot, cmdparams->source, "Cache Entries: %d", (int)list_count(cache));
irc_prefmsg (opsb_bot, cmdparams->source, "Cache Hits: %d", opsb.cachehits);
for (i = 0; proxy_list[i].type != 0; i++) {
irc_prefmsg (opsb_bot, cmdparams->source, "Proxy %s Found %d Open %d", proxy_list[i].name, proxy_list[i].scanned, proxy_list[i].numopen);
}
irc_prefmsg (opsb_bot, cmdparams->source, "Currently Scanning %d Proxies (%d in queue):", (int)list_count(opsbl), (int)list_count(opsbq));
node = list_first(opsbl);
while (node) {
scandata = lnode_get(node);
if (scandata->reqclient)
irc_prefmsg (opsb_bot, cmdparams->source, "Scanning %s by request of %s", scandata->lookup, scandata->reqclient->name);
else
irc_prefmsg (opsb_bot, cmdparams->source, "Scanning %s (%s) - %s", scandata->lookup, inet_ntoa(scandata->ip), scandata->who);
switch(scandata->state) {
case DOING_SCAN:
irc_prefmsg (opsb_bot, cmdparams->source, " Scanning for Open Proxies");
break;
case GOTOPENPROXY:
irc_prefmsg (opsb_bot, cmdparams->source, " Contains an Open Proxy");
break;
default:
irc_prefmsg (opsb_bot, cmdparams->source, " Unknown State (Scan)");
}
cnode = list_first(scandata->connections);
while (cnode) {
ci = lnode_get(cnode);
irc_prefmsg(opsb_bot, cmdparams->source, " Checking for %s Proxy on port %d", type_of_proxy(ci->type), ci->port);
cnode = list_next(scandata->connections, cnode);
}
node = list_next(opsbl, node);
}
return 0;
}