added a reason, and who added the entry to exclusion. Include the actual string found when creating opsb.log for OPM submission
This commit is contained in:
parent
8481897fb7
commit
fc3b66a3f1
6 changed files with 39 additions and 14 deletions
|
@ -6,6 +6,8 @@ Open Proxy Scanning Bot Module for NeoStats Changelog.
|
|||
- Stopped setting Glines multiple times if we find a multiple open proxies, or host is listed in OPM
|
||||
- Think I finally fixed the socket/checklist bug
|
||||
- Fixed a few mem leaks I believe
|
||||
- Added actual string to opsb.log for detection and OPM reporting
|
||||
- added to exclusion list who added the exclusion, and the reason
|
||||
|
||||
* Version 1.0Beta1 * 31/8/2002 * Fish
|
||||
- Initial Release
|
|
@ -1,4 +1,4 @@
|
|||
Open Proxy Scanning Bot Version 1.0 Beta1 - fish@dynam.ac
|
||||
Open Proxy Scanning Bot Version 1.0 Beta2 - fish@dynam.ac
|
||||
+++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Thanks for Downloading opsb. opsb is a bot for the NeoStats IRC services
|
||||
|
@ -106,13 +106,14 @@ What you should change from defaults:
|
|||
user re-connects within the cache time, they will not be scanned again. it
|
||||
is default to 1 hour.
|
||||
|
||||
/msg opsb exclude add <serviceshostname> 1
|
||||
/msg opsb exclude add <serviceshostname> 1 <reason>
|
||||
opsb scans every user that joins the network, including users that
|
||||
come from your services host. (such as ChanServ or
|
||||
Reserved Nicks). You *SHOULD* add a exclusion, so that users from your
|
||||
services server are not scanned. servershostname is the name of your
|
||||
services as seen on IRC. (eg, in /map or /links)
|
||||
The "1" specifies a IRC server, a 0 specifies a true internet hostname.
|
||||
The reason field allows you to add a comment to the exclusion for reference.
|
||||
|
||||
There are many other options that you configure, though you should consult
|
||||
the help interface to what they do (/msg opsb help set and /msg opsb
|
||||
|
|
28
opsb.c
28
opsb.c
|
@ -18,7 +18,7 @@
|
|||
** USA
|
||||
**
|
||||
** NeoStats CVS Identification
|
||||
** $Id: opsb.c,v 1.4 2002/09/06 04:33:28 fishwaldo Exp $
|
||||
** $Id: opsb.c,v 1.5 2002/09/06 06:07:34 fishwaldo Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ extern const char *opsb_help_exclude[];
|
|||
Module_Info my_info[] = { {
|
||||
"OPSB",
|
||||
"A Open Proxy Scanning Bot",
|
||||
"1.0Beta1"
|
||||
"1.0Beta2"
|
||||
} };
|
||||
|
||||
|
||||
|
@ -93,6 +93,7 @@ int __Bot_Message(char *origin, char **argv, int argc)
|
|||
scaninfo *scandata;
|
||||
exemptinfo *exempts;
|
||||
int lookuptype, i;
|
||||
char *buf;
|
||||
|
||||
strcpy(segv_location, "OPSB:Bot_Message");
|
||||
|
||||
|
@ -134,6 +135,11 @@ int __Bot_Message(char *origin, char **argv, int argc)
|
|||
send_status(u);
|
||||
return 1;
|
||||
} else if (!strcasecmp(argv[1], "lookup")) {
|
||||
if (UserLevel(u) < 50) {
|
||||
prefmsg(u->nick, s_opsb, "Access Denied");
|
||||
chanalert(s_opsb, "%s tried to use lookup, but is not a operator", u->nick);
|
||||
return 1;
|
||||
}
|
||||
if (argc < 3) {
|
||||
prefmsg(u->nick, s_opsb, "Invalid Syntax. /msg %s help lookup for more help", s_opsb);
|
||||
return 0;
|
||||
|
@ -233,6 +239,11 @@ int __Bot_Message(char *origin, char **argv, int argc)
|
|||
|
||||
return 1;
|
||||
} else if (!strcasecmp(argv[1], "EXCLUDE")) {
|
||||
if (UserLevel(u) < 50) {
|
||||
prefmsg(u->nick, s_opsb, "Access Denied");
|
||||
chanalert(s_opsb, "%s tried to use exclude, but is not a operator", u->nick);
|
||||
return 1;
|
||||
}
|
||||
if (argc < 3) {
|
||||
prefmsg(u->nick, s_opsb, "Syntax Error. /msg %s help exclude", s_opsb);
|
||||
return 0;
|
||||
|
@ -243,14 +254,14 @@ int __Bot_Message(char *origin, char **argv, int argc)
|
|||
prefmsg(u->nick, s_opsb, "Exception List:");
|
||||
while (lnode) {
|
||||
exempts = lnode_get(lnode);
|
||||
prefmsg(u->nick, s_opsb, "%d) %s %s", i, exempts->host, (exempts->server ? "(Server)" : "(Client)"));
|
||||
prefmsg(u->nick, s_opsb, "%d) %s %s Added by %s for %s", i, exempts->host, (exempts->server ? "(Server)" : "(Client)"), exempts->who, exempts->reason);
|
||||
++i;
|
||||
lnode = list_next(exempt, lnode);
|
||||
}
|
||||
prefmsg(u->nick, s_opsb, "End of List.");
|
||||
chanalert(s_opsb, "%s requested Exception List", u->nick);
|
||||
} else if (!strcasecmp(argv[2], "ADD")) {
|
||||
if (argc < 5) {
|
||||
if (argc < 6) {
|
||||
prefmsg(u->nick, s_opsb, "Syntax Error. /msg %s help exclude", s_opsb);
|
||||
return 0;
|
||||
}
|
||||
|
@ -268,6 +279,10 @@ int __Bot_Message(char *origin, char **argv, int argc)
|
|||
exempts->server = 1;
|
||||
else
|
||||
exempts->server = 0;
|
||||
snprintf(exempts->who, MAXNICK, "%s", u->nick);
|
||||
buf = joinbuf(argv, argc, 5);
|
||||
snprintf(exempts->reason, MAXHOST, "%s", buf);
|
||||
free(buf);
|
||||
lnode = lnode_create(exempts);
|
||||
list_append(exempt, lnode);
|
||||
prefmsg(u->nick, s_opsb, "Added %s (%s) exception to list", exempts->host, (exempts->server ? "(Server)" : "(Client)"));
|
||||
|
@ -613,7 +628,7 @@ void savecache() {
|
|||
node = list_first(exempt);
|
||||
while (node) {
|
||||
exempts = lnode_get(node);
|
||||
fprintf(fp, "%s %d\n", exempts->host, exempts->server);
|
||||
fprintf(fp, "%s %d %s %s\n", exempts->host, exempts->server, exempts->who, exempts->reason);
|
||||
node = list_next(exempt, node);
|
||||
}
|
||||
fprintf(fp, "#CACHE\n");
|
||||
|
@ -675,6 +690,8 @@ void loadcache() {
|
|||
exempts = malloc(sizeof(exemptinfo));
|
||||
snprintf(exempts->host, MAXHOST, "%s", strtok(buf, " "));
|
||||
exempts->server = atoi(strtok(NULL, " "));
|
||||
snprintf(exempts->who, MAXNICK, "%s", strtok(NULL, " "));
|
||||
snprintf(exempts->reason, MAXHOST, "%s", strtok(NULL, "\n"));
|
||||
node = lnode_create(exempts);
|
||||
list_prepend(exempt, node);
|
||||
} else {
|
||||
|
@ -1061,7 +1078,6 @@ void _init() {
|
|||
|
||||
|
||||
void _fini() {
|
||||
globops(me.name, "OPSB Module Unloaded");
|
||||
};
|
||||
|
||||
|
||||
|
|
5
opsb.h
5
opsb.h
|
@ -4,7 +4,7 @@
|
|||
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
|
||||
*
|
||||
** NetStats CVS Identification
|
||||
** $Id: opsb.h,v 1.3 2002/09/06 04:33:28 fishwaldo Exp $
|
||||
** $Id: opsb.h,v 1.4 2002/09/06 06:07:34 fishwaldo Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -72,6 +72,7 @@ struct sockinfo {
|
|||
int flags;
|
||||
int type;
|
||||
int bytes;
|
||||
char buf[1024];
|
||||
};
|
||||
|
||||
typedef struct sockinfo socklist;
|
||||
|
@ -97,6 +98,8 @@ list_t *cache;
|
|||
struct exempts {
|
||||
char host[MAXHOST];
|
||||
int server;
|
||||
char who[MAXNICK];
|
||||
char reason[MAXHOST];
|
||||
};
|
||||
|
||||
typedef struct exempts exemptinfo;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
** USA
|
||||
**
|
||||
** NeoStats CVS Identification
|
||||
** $Id: opsb_help.c,v 1.2 2002/09/04 08:52:34 fishwaldo Exp $
|
||||
** $Id: opsb_help.c,v 1.3 2002/09/06 06:07:34 fishwaldo Exp $
|
||||
*/
|
||||
|
||||
#include "stats.h"
|
||||
|
@ -95,7 +95,8 @@ const char *opsb_help_set[] = {
|
|||
"Usage: \2SET <OPTIONS> <SETTING>\2",
|
||||
"",
|
||||
"This command will set various options relating to OPSB.",
|
||||
"The Settings take effect imediatly",
|
||||
"You can view the settings by typing \2SET LIST\2",
|
||||
"The Settings take effect straight away",
|
||||
"The Options are:",
|
||||
" \2TARGETIP\2 - Change the IP address we try to make the proxies connect to",
|
||||
" This should be set to a IP address of on of your IRC Servers.",
|
||||
|
@ -126,10 +127,11 @@ const char *opsb_help_exclude[] = {
|
|||
"The Options are:",
|
||||
" \2LIST\2 - This will list the current exceptions and the positions in the list",
|
||||
" If you wish to remove a entry, you must exaime the list position first",
|
||||
" \2ADD <hostname> <1/0>\2",
|
||||
" \2ADD <hostname> <1/0> <reason>\2",
|
||||
" - This option will add a entry of <hostname> to the exception list",
|
||||
" a Value of 1 after the hostname indicates a Servername (eg, services.irc-chat.net)",
|
||||
" a Value of 0 after the hostname indicates a hostname (eg, *.adsl.home.com)",
|
||||
" The final portion of the string is a description of the exclusion for future reference",
|
||||
" Wildcards such as * and ? may be used in the hostname portion",
|
||||
" \2DEL <NUM>\2 - This will delete entry numbered <NUM> in the list from the exclusions"
|
||||
"",
|
||||
|
|
5
proxy.c
5
proxy.c
|
@ -20,7 +20,7 @@
|
|||
** USA
|
||||
**
|
||||
** NeoStats CVS Identification
|
||||
** $Id: proxy.c,v 1.4 2002/09/06 04:33:28 fishwaldo Exp $
|
||||
** $Id: proxy.c,v 1.5 2002/09/06 06:07:34 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\n", proxy_list[sockdata->type].type, inet_ntoa(scandata->ipaddr));
|
||||
fprintf(fp, "%s:%s:%s\n", proxy_list[sockdata->type].type, inet_ntoa(scandata->ipaddr), sockdata->buf);
|
||||
fclose(fp);
|
||||
socknode = list_next(scandata->socks, socknode);
|
||||
}
|
||||
|
@ -501,6 +501,7 @@ int proxy_read(int socknum, char *sockname) {
|
|||
/* this looks for the ban string */
|
||||
if (strstr(buf, opsb.lookforstring)) {
|
||||
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;
|
||||
scandata->state = GOTOPENPROXY;
|
||||
sockdata->flags = OPENPROXY;
|
||||
|
|
Reference in a new issue