Check Changelog... RC1 ready for release

This commit is contained in:
fishwaldo 2002-10-24 09:27:58 +00:00
parent fc3b66a3f1
commit 8b67e305b4
7 changed files with 88 additions and 41 deletions

View file

@ -1,5 +1,13 @@
Open Proxy Scanning Bot Module for NeoStats Changelog.
==============================================================================
* Version 1.0RC1 * 24/10/2002 * Fish
- Strings recieved from proxies are now buffered
- new set option DISABLESCAN to only do opm lookup, and not a proxy check
- OLD Conf files are *INVALID* rm data/opsb.db file
- fixed up /msg opsb help interface
- added real connect string to opsb.log for detection and OPM reporting
- Added a few default IRCd throttle strings for added detection of open proxies when a Proxy Connect gets throttled.
* Version 1.0Beta2 * 2/8/2002 * Fish
- Added GPL headers and credit to BOPM authors
- A few fixes in a attempt to find this socket/checklist bug

View file

@ -1,4 +1,4 @@
Open Proxy Scanning Bot Version 1.0 Beta2 - fish@dynam.ac
Open Proxy Scanning Bot Version 1.0 Release Canidate 1 - fish@dynam.ac
+++++++++++++++++++++++++++++++++++++++++
Thanks for Downloading opsb. opsb is a bot for the NeoStats IRC services

View file

@ -1,11 +1,11 @@
#! /bin/bash
#! /bin/sh
# Generated by configure.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
SHELL=${CONFIG_SHELL-/bin/bash}
SHELL=${CONFIG_SHELL-/bin/sh}
## --------------------- ##
## M4sh Initialization. ##
@ -277,7 +277,7 @@ Report bugs to <bug-autoconf@gnu.org>."
ac_cs_version="\
config.status
configured by ./configure, generated by GNU Autoconf 2.53,
with options \"\"
with options \"'--enable-debug'\"
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
@ -307,8 +307,8 @@ do
case $1 in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
echo "running /bin/bash ./configure " " --no-create --no-recursion"
exec /bin/bash ./configure --no-create --no-recursion ;;
echo "running /bin/sh ./configure " '--enable-debug' " --no-create --no-recursion"
exec /bin/sh ./configure '--enable-debug' --no-create --no-recursion ;;
--version | --vers* | -V )
echo "$ac_cs_version"; exit 0 ;;
--he | --h)
@ -398,7 +398,7 @@ if test -n "$CONFIG_FILES"; then
# Protect against being on the right side of a sed subst in config.status.
sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g;
s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF
s,@SHELL@,/bin/bash,;t t
s,@SHELL@,/bin/sh,;t t
s,@PATH_SEPARATOR@,:,;t t
s,@PACKAGE_NAME@,,;t t
s,@PACKAGE_TARNAME@,,;t t
@ -406,7 +406,7 @@ s,@PACKAGE_VERSION@,,;t t
s,@PACKAGE_STRING@,,;t t
s,@PACKAGE_BUGREPORT@,,;t t
s,@exec_prefix@,${prefix},;t t
s,@prefix@,/home/shmad/NeoStats/,;t t
s,@prefix@,/home/fish/NeoStats/,;t t
s,@program_transform_name@,s,x,x,,;t t
s,@bindir@,${exec_prefix}/bin,;t t
s,@sbindir@,${exec_prefix}/sbin,;t t
@ -429,7 +429,7 @@ s,@ECHO_N@,-n,;t t
s,@ECHO_T@,,;t t
s,@LIBS@,,;t t
s,@CC@,gcc,;t t
s,@CFLAGS@, -O2 -Wall,;t t
s,@CFLAGS@, -O2 -Wall -ggdb,;t t
s,@LDFLAGS@,,;t t
s,@CPPFLAGS@,,;t t
s,@ac_ct_CC@,gcc,;t t
@ -438,7 +438,7 @@ s,@OBJEXT@,o,;t t
s,@INSTALL_PROGRAM@,${INSTALL},;t t
s,@INSTALL_SCRIPT@,${INSTALL},;t t
s,@INSTALL_DATA@,${INSTALL} -m 644,;t t
s,@DIRINST@,/home/shmad/NeoStats/,;t t
s,@DIRINST@,/home/fish/NeoStats/,;t t
CEOF
# Split the substitutions into bite-sized pieces for seds with

44
opsb.c
View file

@ -18,7 +18,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: opsb.c,v 1.5 2002/09/06 06:07:34 fishwaldo Exp $
** $Id: opsb.c,v 1.6 2002/10/24 09:27:58 fishwaldo Exp $
*/
@ -57,10 +57,12 @@ extern const char *opsb_help_status[];
extern const char *opsb_help_set[];
extern const char *opsb_help_exclude[];
int online;
Module_Info my_info[] = { {
"OPSB",
"A Open Proxy Scanning Bot",
"1.0Beta2"
"1.0RC1"
} };
@ -344,7 +346,22 @@ int do_set(User *u, char **av, int ac) {
return 0;
}
if (!strcasecmp(av[2], "TARGETIP")) {
if (!strcasecmp(av[2], "DISABLESCAN")) {
if (!strcasecmp(av[3], "0")) {
opsb.doscan = 1;
prefmsg(u->nick, s_opsb, "Scanning is now Enabled");
chanalert(s_opsb, "%s has Enabled Proxy Scanning", u->nick, av[3]);
} else if (!strcasecmp(av[3], "1")) {
opsb.doscan = 0;
prefmsg(u->nick, s_opsb, "Scanning is now Disabled");
chanalert(s_opsb, "%s has Disabled Proxy Scanning", u->nick, av[3]);
} else {
prefmsg(u->nick, s_opsb, "Invalid Setting (must be 1 or 0) in DISABLESCAN");
return 0;
}
opsb.confed = 1;
return 1;
} else if (!strcasecmp(av[2], "TARGETIP")) {
if (!inet_addr(av[3])) {
prefmsg(u->nick, s_opsb, "Invalid IP address (Can not be hostname) in TARGETIP");
return 0;
@ -441,6 +458,7 @@ int do_set(User *u, char **av, int ac) {
opsb.confed = 1;
return 0;
} else {
prefmsg(u->nick, s_opsb, "Proxy Scanning: %s", opsb.doscan == 1 ? "Yes" : "No");
prefmsg(u->nick, s_opsb, "TargetIP: %s", opsb.targethost);
prefmsg(u->nick, s_opsb, "TargetPort: %d", opsb.targetport);
prefmsg(u->nick, s_opsb, "OPM Domain: %s", opsb.opmdomain);
@ -477,7 +495,12 @@ int Online(char **av, int ac) {
}
add_mod_timer("cleanlist", "CleanProxyList", "opsb", 1);
add_mod_timer("savecache", "SaveProxyCache", "opsb", 600);
chanalert(s_opsb, "Open Proxy Scanning bot has started (Concurrent Scans: %d Sockets %d)", opsb.socks, opsb.socks *7);
if (opsb.doscan) {
chanalert(s_opsb, "Open Proxy Scanning bot has started (Concurrent Scans: %d Sockets %d)", opsb.socks, opsb.socks *7);
} else {
chanalert(s_opsb, "DNS Blacklist Lookup is only Enabled!! (No Open Proxy Scans)");
}
online = 1;
return 1;
};
@ -624,6 +647,7 @@ void savecache() {
fprintf(fp, "%d\n", opsb.bantime);
fprintf(fp, "%d\n", opsb.confed);
fprintf(fp, "%d\n", opsb.cachetime);
fprintf(fp, "%d\n", opsb.doscan);
/* exempts next */
node = list_first(exempt);
while (node) {
@ -680,6 +704,8 @@ void loadcache() {
opsb.confed = atoi(buf);
fgets(buf, 512, fp);
opsb.cachetime = atoi(buf);
fgets(buf, 512, fp);
opsb.doscan = atoi(buf);
while (fgets(buf, 512, fp)) {
if (!strcasecmp("#CACHE\n", buf)) {
gotcache = 1;
@ -734,7 +760,11 @@ static int ScanNick(char **av, int ac) {
lnode_t *scannode;
strcpy(segv_location, "OPSB:ScanNick");
/* don't do anything if NeoStats hasn't told us we are online yet */
if (!online)
return 0;
u = finduser(av[0]);
if (!u) {
log("OPSB: Ehhh, Can't find user %s", av[0]);
@ -769,6 +799,7 @@ static int ScanNick(char **av, int ac) {
strncpy(scandata->who, u->nick, MAXHOST);
strncpy(scandata->lookup, u->hostname, MAXHOST);
strncpy(scandata->server, u->server->name, MAXHOST);
strncpy(scandata->connectstring, recbuf, BUFSIZE);
scandata->ipaddr.s_addr = u->ipaddr.s_addr;
if (scandata->ipaddr.s_addr > 0) {
scandata->dnsstate = DO_OPM_LOOKUP;
@ -1060,7 +1091,7 @@ void _init() {
exempt = list_create(MAX_EXEMPTS);
online = 0;
sprintf(opsb.opmdomain, "%s", "opm.blitzed.org");
sprintf(opsb.targethost, "%s", me.uplink);
opsb.targetport = me.port;
@ -1072,6 +1103,7 @@ void _init() {
opsb.confed = 0;
opsb.cachetime = 3600;
opsb.bantime = 86400;
opsb.doscan = 1;
snprintf(opsb.lookforstring, 512, "*** Looking up your hostname...");
snprintf(opsb.scanmsg, 512, "Your Host is being Scanned for Open Proxies");
}

6
opsb.h
View file

@ -4,7 +4,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: opsb.h,v 1.4 2002/09/06 06:07:34 fishwaldo Exp $
** $Id: opsb.h,v 1.5 2002/10/24 09:27:58 fishwaldo Exp $
*/
@ -44,6 +44,7 @@ struct scanq {
list_t *socks;
time_t started;
int doneban;
char connectstring[BUFSIZE];
};
typedef struct scanq scaninfo;
@ -64,6 +65,7 @@ struct opsb {
int bantime;
int confed;
int cachetime;
int doscan;
} opsb;
struct sockinfo {
@ -72,7 +74,7 @@ struct sockinfo {
int flags;
int type;
int bytes;
char buf[1024];
char buf[1025];
};
typedef struct sockinfo socklist;

View file

@ -18,7 +18,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: opsb_help.c,v 1.3 2002/09/06 06:07:34 fishwaldo Exp $
** $Id: opsb_help.c,v 1.4 2002/10/24 09:27:58 fishwaldo Exp $
*/
#include "stats.h"
@ -37,7 +37,7 @@ NULL
const char *opsb_help_oper[] = {
"OPERTATOR COMMANDS:",
" CHECK STATUS SET EXCLUDE CACHETIME",
" CHECK STATUS SET EXCLUDE",
"",
NULL
};
@ -103,6 +103,8 @@ const char *opsb_help_set[] = {
" \2TARGETPORT\2 - Change the Port number we try to make proxies connect to",
" This should be a port that runs on your IRCD",
" \2CACHETIME\2 - This sets the amount of time (in Seconds) that a entry will be cached",
" \2DISABLESCAN\2 - This disables the actual proxy scan, and only does a lookup in the DNS",
" Blacklist to see if this host has been listed as a open proxy",
"\2Advanced Settings\2 - These settings should not be changed unless you know the effects in full",
" \2OPMDOMAIN\2 - Change the Domain we use to Lookup for Blacklists.",
" \2MAXBYTES\2 - This is the maximum number of bytes we recieve from a proxy before disconnecting it",

45
proxy.c
View file

@ -20,7 +20,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: proxy.c,v 1.5 2002/09/06 06:07:34 fishwaldo Exp $
** $Id: proxy.c,v 1.6 2002/10/24 09:27:58 fishwaldo Exp $
*/
@ -91,7 +91,7 @@ void do_ban(scaninfo *scandata) {
if (scandata->u) prefmsg(scandata->u->nick, s_opsb, "Banning %s (%s) for Open Proxy - %s(%d)", scandata->who, inet_ntoa(scandata->ipaddr), proxy_list[sockdata->type].type, proxy_list[sockdata->type].port);
sakill_cmd(inet_ntoa(scandata->ipaddr), "*", s_opsb, opsb.bantime, "Open Proxy found on your host. Please visit the following website for more info: www.blitzed.org/proxy?ip=%s", inet_ntoa(scandata->ipaddr));
if ((fp = fopen("logs/opsb.log", "a")) == NULL) return;
fprintf(fp, "%s:%s:%s\n", proxy_list[sockdata->type].type, inet_ntoa(scandata->ipaddr), sockdata->buf);
fprintf(fp, "%s:%s:%s\n", proxy_list[sockdata->type].type, inet_ntoa(scandata->ipaddr), scandata->connectstring);
fclose(fp);
socknode = list_next(scandata->socks, socknode);
}
@ -304,24 +304,26 @@ void start_proxy_scan(lnode_t *scannode) {
if (scandata->u) chanalert(s_opsb, "Starting proxy scan on %s (%s) by Request of %s", scandata->who, scandata->lookup, scandata->u->nick);
scandata->socks = list_create(NUM_PROXIES);
scandata->state = DOING_SCAN;
for (i = 0; i < NUM_PROXIES; i++) {
if ((opsb.doscan == 1) || (scandata->u)) {
for (i = 0; i < NUM_PROXIES; i++) {
#ifdef DEBUG
log("OPSB proxy_connect(): host %ul (%s), port %d", scandata->ipaddr,inet_ntoa(scandata->ipaddr), proxy_list[i].port);
log("OPSB proxy_connect(): host %ul (%s), port %d", scandata->ipaddr,inet_ntoa(scandata->ipaddr), proxy_list[i].port);
#endif
sockname = malloc(64);
sprintf(sockname, "%s %d", scandata->who, i);
j = proxy_connect(scandata->ipaddr.s_addr, proxy_list[i].port, sockname);
free(sockname);
if (j > 0) {
/* its ok */
sockdata = malloc(sizeof(socklist));
sockdata->sock = j;
sockdata->function = proxy_list[i].scan;
sockdata->flags = CONNECTING;
sockdata->type = i;
sockdata->bytes = 0;
socknode = lnode_create(sockdata);
list_append(scandata->socks, socknode);
sockname = malloc(64);
sprintf(sockname, "%s %d", scandata->who, i);
j = proxy_connect(scandata->ipaddr.s_addr, proxy_list[i].port, sockname);
free(sockname);
if (j > 0) {
/* its ok */
sockdata = malloc(sizeof(socklist));
sockdata->sock = j;
sockdata->function = proxy_list[i].scan;
sockdata->flags = CONNECTING;
sockdata->type = i;
sockdata->bytes = 0;
socknode = lnode_create(sockdata);
list_append(scandata->socks, socknode);
}
}
}
/* this is so we can timeout scans */
@ -486,8 +488,9 @@ int proxy_read(int socknum, char *sockname) {
log("OPSB proxy_read(): Got this: %s (%d)",buf, i);
#endif
/* we check if this might be a normal http server */
strncat(sockdata->buf, buf, 1024);
if (strstr(buf, "Method Not Allowed")) {
if (strstr(sockdata->buf, "Method Not Allowed")) {
#ifdef DEBUG
log("closing socket %d due to ok HTTP server", socknum);
#endif
@ -498,8 +501,8 @@ int proxy_read(int socknum, char *sockname) {
return -1;
}
/* this looks for the ban string */
if (strstr(buf, opsb.lookforstring)) {
/* this looks for the ban string or a throttle string */
if (strstr(sockdata->buf, opsb.lookforstring) || strstr(sockdata->buf, "ERROR :Your host is trying to (re)connect too fast -- throttled.") || strstr(sockdata->buf, "ERROR :Trying to reconnect too fast.")) {
if (scandata->u) prefmsg(scandata->u->nick, s_opsb, "Open %s Proxy Server on port %d", proxy_list[sockdata->type].type, proxy_list[sockdata->type].port);
strncpy(sockdata->buf, strtok(buf,"\n"), 1023);
++proxy_list[sockdata->type].noopen;