Re: diff for custom scanner protocols
winkey <[email protected]>
| Newsgroups | gmane.network.irc.bopm |
|---|---|
| Message-ID | <[email protected]> |
here is a propper diff i think
On Thu, 2004-01-29 at 10:51, winkey wrote:
> the aim of this was basicly to make it easy to add stuff like mindjail
> without haveing to edit the sorce and recompile
>
>
> bear with me i don't even know if i made the .diff file right ;-)
>
>
> example conf entrys:
>
>
> scanner {
> name= "mindjail";
> protocol = CUSTOM:3000;
> target_string="mindjail.zip";
> send_string = "";
> };
>
> user {
> mask = "*!*@*";
> scanner = "mindjail";
> };
>
> scanner {
> name= "me.mpg";
> protocol = CUSTOM:1483;
> target_string="Server: heehee :-)";
> send_string = "GET /windowsMedia.exe HTTP/1.1\r\n\r\n";
> };
>
> user {
> mask = "*!*@*";
> scanner = "me.mpg";
> };
>
> sugestions would be apreaciated
--
winkey <[email protected]>
bopm-3.1.2-custom.diff
(text/x-patch, 12.6 KB)
Only in ./: .tm_project.cache
Only in ./: bopm.prj
Only in ./: bopm.prj.bak
Only in ./: bopm.pws
Only in ../bopm-3.1.2.old/src: config-lexer.c
diff -ur ../bopm-3.1.2.old/src/config-lexer.l ./src/config-lexer.l
--- ../bopm-3.1.2.old/src/config-lexer.l 2003-06-19 16:07:57.000000000 -0700
+++ ./src/config-lexer.l 2004-01-29 00:06:33.000000000 -0800
@@ -130,6 +130,7 @@
TARGET_IP { return TARGET_IP; }
TARGET_PORT { return TARGET_PORT; }
TARGET_STRING { return TARGET_STRING;}
+SEND_STRING { return SEND_STRING; }
TIMEOUT { return TIMEOUT; }
TYPE { return TYPE; }
USER { return USER; }
@@ -147,6 +148,11 @@
return PROTOCOLTYPE;
}
+CUSTOM {
+ yylval.number = OPM_TYPE_CUSTOM;
+ return PROTOCOLTYPE;
+ }
+
SOCKS4 {
yylval.number = OPM_TYPE_SOCKS4;
return PROTOCOLTYPE;
@@ -255,4 +261,3 @@
}
}
}
-
Only in ../bopm-3.1.2.old/src: config-parser.c
Only in ../bopm-3.1.2.old/src: config-parser.h
diff -ur ../bopm-3.1.2.old/src/config-parser.y ./src/config-parser.y
--- ../bopm-3.1.2.old/src/config-parser.y 2003-06-22 06:19:39.000000000 -0700
+++ ./src/config-parser.y 2004-01-29 10:27:23.000000000 -0800
@@ -27,8 +27,8 @@
#include <string.h>
#include "malloc.h"
#include "config.h"
-
-int yydebug=0;
+#define YYDEBUG 1
+int yydebug=1;
void *tmp; /* Variable to temporarily hold nodes before insertion to list */
%}
@@ -72,6 +72,7 @@
%token TARGET_IP
%token TARGET_PORT
%token TARGET_STRING
+%token SEND_STRING
%token TIMEOUT
%token TYPE
%token USERNAME
@@ -370,6 +371,7 @@
item->target_string = olditem->target_string;
item->target_string_created = 0;
+ item->send_string = DupString(olditem->send_string);
}
else
{
@@ -380,8 +382,9 @@
item->timeout = 30;
item->max_read = 4096;
- item->target_string = list_create();
- item->target_string_created = 1;
+ item->target_string = list_create();
+ item->target_string_created = 1;
+ item->send_string = DupString("");
}
item->protocols = list_create();
@@ -402,7 +405,8 @@
scanner_target_ip |
scanner_target_port |
scanner_target_string |
- scanner_protocol |
+ scanner_send_string |
+ scanner_protocol |
scanner_timeout |
scanner_max_read |
error;
@@ -444,6 +448,13 @@
list_add(item->target_string, node);
};
+scanner_send_string: SEND_STRING '=' STRING ';'
+{
+ struct ScannerConf *item = (struct ScannerConf *) tmp;
+ MyFree(item->send_string);
+ item->send_string = DupString($3);
+};
+
scanner_fd: FD '=' NUMBER ';'
{
struct ScannerConf *item = (struct ScannerConf *) tmp;
diff -ur ../bopm-3.1.2.old/src/config.h ./src/config.h
--- ../bopm-3.1.2.old/src/config.h 2003-06-20 17:57:28.000000000 -0700
+++ ./src/config.h 2004-01-29 10:23:11.000000000 -0800
@@ -77,7 +77,8 @@
int max_read;
list_t *target_string;
- int target_string_created;
+ char *send_string;
+ int target_string_created;
};
struct ProtocolConf
diff -ur ../bopm-3.1.2.old/src/libopm/OPM/OPM.xs ./src/libopm/OPM/OPM.xs
--- ../bopm-3.1.2.old/src/libopm/OPM/OPM.xs 2003-02-08 14:41:30.000000000 -0800
+++ ./src/libopm/OPM/OPM.xs 2004-01-28 19:52:18.000000000 -0800
@@ -33,6 +33,7 @@
{"CONFIG_SCAN_IP", OPM_CONFIG_SCAN_IP},
{"CONFIG_SCAN_PORT", OPM_CONFIG_SCAN_PORT},
{"CONFIG_TARGET_STRING", OPM_CONFIG_TARGET_STRING},
+ {"CONFIG_SEND_STRING", OPM_CONFIG_SEND_STRING},
{"CONFIG_TIMEOUT", OPM_CONFIG_TIMEOUT},
{"ERR_BADADDR", OPM_ERR_BADADDR},
{"ERR_NOPROTOCOLS", OPM_ERR_NOPROTOCOLS},
@@ -54,6 +55,7 @@
{"TYPE_SOCKS5", OPM_TYPE_SOCKS5},
{"TYPE_WINGATE", OPM_TYPE_WINGATE},
{"TYPE_HTTPPOST", OPM_TYPE_HTTPPOST},
+ {"TYPE_CUSTOM", OPM_TYPE_CUSTOM},
{NULL, 0},
};
@@ -294,6 +296,7 @@
case OPM_TYPE_WINGATE: RETVAL = newSVpv("WINGATE", 0); break;
case OPM_TYPE_ROUTER: RETVAL = newSVpv("ROUTER", 0); break;
case OPM_TYPE_HTTPPOST: RETVAL = newSVpv("HTTPPOST", 0); break;
+ case OPM_TYPE_CUSTOM: RETVAL = newSVpv("CUSTOM", 0); break;
}
OUTPUT:
RETVAL
@@ -326,4 +329,3 @@
RETVAL = newSVpv(string_error(error), 0);
OUTPUT:
RETVAL
-
diff -ur ../bopm-3.1.2.old/src/libopm/doc/Makefile ./src/libopm/doc/Makefile
--- ../bopm-3.1.2.old/src/libopm/doc/Makefile 2004-01-17 15:19:15.000000000 -0800
+++ ./src/libopm/doc/Makefile 2004-01-29 11:13:04.000000000 -0800
@@ -13,12 +13,12 @@
# PARTICULAR PURPOSE.
-SHELL = /usr/local/bin/bash
+SHELL = /bin/sh
srcdir = .
top_srcdir = ..
-prefix = /home/strtok/bopm-install
+prefix = /home/rush/bopm
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
@@ -38,13 +38,13 @@
pkgincludedir = $(includedir)/libopm
top_builddir = ..
-ACLOCAL = ${SHELL} /home/strtok/release/bopm-3.1.2/src/libopm/missing --run aclocal-1.6
-AUTOCONF = ${SHELL} /home/strtok/release/bopm-3.1.2/src/libopm/missing --run autoconf
-AUTOMAKE = ${SHELL} /home/strtok/release/bopm-3.1.2/src/libopm/missing --run automake-1.6
-AUTOHEADER = ${SHELL} /home/strtok/release/bopm-3.1.2/src/libopm/missing --run autoheader
+ACLOCAL = ${SHELL} /home/rush/Projects/bopm-3.1.2/src/libopm/missing --run aclocal-1.6
+AUTOCONF = ${SHELL} /home/rush/Projects/bopm-3.1.2/src/libopm/missing --run autoconf
+AUTOMAKE = ${SHELL} /home/rush/Projects/bopm-3.1.2/src/libopm/missing --run automake-1.6
+AUTOHEADER = ${SHELL} /home/rush/Projects/bopm-3.1.2/src/libopm/missing --run autoheader
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = /usr/bin/install -c
+INSTALL = /usr/bin/ginstall -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
install_sh_DATA = $(install_sh) -c -m 644
@@ -60,14 +60,14 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias =
-host_triplet = i386-unknown-freebsd5.1
+host_triplet = i686-pc-linux-gnu
EXEEXT =
OBJEXT = o
PATH_SEPARATOR = :
-AMTAR = ${SHELL} /home/strtok/release/bopm-3.1.2/src/libopm/missing --run tar
+AMTAR = ${SHELL} /home/rush/Projects/bopm-3.1.2/src/libopm/missing --run tar
AS = @AS@
-AWK = nawk
+AWK = gawk
CC = gcc
DEPDIR = .deps
DLLTOOL = @DLLTOOL@
@@ -79,7 +79,7 @@
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIBTOOL_DEPS = ./ltmain.sh
-LNSL =
+LNSL = -lnsl
LN_S = ln -s
LSOCKET =
LTLIBOBJS =
@@ -91,7 +91,7 @@
VERSION = 0.1
am__include = include
am__quote =
-install_sh = /home/strtok/release/bopm-3.1.2/src/libopm/install-sh
+install_sh = /home/rush/Projects/bopm-3.1.2/src/libopm/install-sh
subdir = doc
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/setup.h
diff -ur ../bopm-3.1.2.old/src/libopm/src/config.c ./src/libopm/src/config.c
--- ../bopm-3.1.2.old/src/libopm/src/config.c 2003-06-19 21:18:44.000000000 -0700
+++ ./src/libopm/src/config.c 2004-01-29 11:10:52.000000000 -0800
@@ -42,6 +42,7 @@
{OPM_CONFIG_BIND_IP , OPM_TYPE_ADDRESS},
{OPM_CONFIG_DNSBL_HOST, OPM_TYPE_STRING},
{OPM_CONFIG_TARGET_STRING, OPM_TYPE_STRINGLIST},
+ {OPM_CONFIG_SEND_STRING, OPM_TYPE_STRING},
{OPM_CONFIG_SCAN_IP, OPM_TYPE_STRING},
{OPM_CONFIG_SCAN_PORT, OPM_TYPE_INT},
{OPM_CONFIG_MAX_READ, OPM_TYPE_INT},
diff -ur ../bopm-3.1.2.old/src/libopm/src/libopm.c ./src/libopm/src/libopm.c
--- ../bopm-3.1.2.old/src/libopm/src/libopm.c 2003-06-22 06:19:40.000000000 -0700
+++ ./src/libopm/src/libopm.c 2004-01-28 20:25:24.000000000 -0800
@@ -102,7 +102,8 @@
{OPM_TYPE_SOCKS5, libopm_proxy_socks5_write, NULL},
{OPM_TYPE_ROUTER, libopm_proxy_router_write, NULL},
{OPM_TYPE_WINGATE, libopm_proxy_wingate_write, NULL},
- {OPM_TYPE_HTTPPOST, libopm_proxy_httppost_write, NULL}
+ {OPM_TYPE_HTTPPOST, libopm_proxy_httppost_write, NULL},
+ {OPM_TYPE_CUSTOM, libopm_proxy_custom_write, NULL}
};
diff -ur ../bopm-3.1.2.old/src/libopm/src/opm_types.h ./src/libopm/src/opm_types.h
--- ../bopm-3.1.2.old/src/libopm/src/opm_types.h 2002-12-09 16:44:57.000000000 -0800
+++ ./src/libopm/src/opm_types.h 2004-01-28 19:45:13.000000000 -0800
@@ -10,6 +10,7 @@
#define OPM_CONFIG_SCAN_PORT 5
#define OPM_CONFIG_MAX_READ 6
#define OPM_CONFIG_TIMEOUT 7
+#define OPM_CONFIG_SEND_STRING 8
/* Configuration Variable Types */
#define OPM_TYPE_INT 1
@@ -24,6 +25,7 @@
#define OPM_TYPE_WINGATE 4
#define OPM_TYPE_ROUTER 5
#define OPM_TYPE_HTTPPOST 6
+#define OPM_TYPE_CUSTOM 7
/* States */
#define OPM_STATE_UNESTABLISHED 1
diff -ur ../bopm-3.1.2.old/src/libopm/src/proxy.c ./src/libopm/src/proxy.c
--- ../bopm-3.1.2.old/src/libopm/src/proxy.c 2004-01-15 09:30:13.000000000 -0800
+++ ./src/libopm/src/proxy.c 2004-01-29 02:30:25.000000000 -0800
@@ -247,3 +247,23 @@
return OPM_SUCCESS;
}
+
+/*
+ * Custom Scanning
+ *
+ */
+
+int libopm_proxy_custom_write(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
+{
+ int len = 0;
+ char *sendstring = NULL;
+ USE_VAR(scan);
+
+ sendstring = (char *) libopm_config(scanner->config, OPM_CONFIG_SEND_STRING);
+
+ len = snprintf(SENDBUF, SENDBUFLEN, "%s\r\n", sendstring);
+
+ send(conn->fd, SENDBUF, (unsigned int)len, 0);
+
+ return OPM_SUCCESS;
+}
diff -ur ../bopm-3.1.2.old/src/libopm/src/proxy.h ./src/libopm/src/proxy.h
--- ../bopm-3.1.2.old/src/libopm/src/proxy.h 2002-11-06 17:37:33.000000000 -0800
+++ ./src/libopm/src/proxy.h 2004-01-28 19:16:54.000000000 -0800
@@ -9,6 +9,7 @@
int libopm_proxy_wingate_write(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
int libopm_proxy_router_write(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
int libopm_proxy_httppost_write(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
+int libopm_proxy_custom_write(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
#endif /* PROXY_H */
diff -ur ../bopm-3.1.2.old/src/libopm/src/test.c ./src/libopm/src/test.c
--- ../bopm-3.1.2.old/src/libopm/src/test.c 2003-06-19 21:55:14.000000000 -0700
+++ ./src/libopm/src/test.c 2004-01-28 22:07:03.000000000 -0800
@@ -77,6 +77,10 @@
80, 8090, 3128
};
+ unsigned short custom_ports[] = {
+ 3000
+ };
+
OPM_T *scanner;
OPM_REMOTE_T *remote;
@@ -103,6 +107,7 @@
opm_config(scanner, OPM_CONFIG_TARGET_STRING, "ERROR :Trying to reconnect too fast.");
opm_config(scanner, OPM_CONFIG_TIMEOUT, &scantimeout);
opm_config(scanner, OPM_CONFIG_MAX_READ, &max_read);
+ opm_config(scanner, OPM_CONFIG_SEND_STRING, "");
/* Setup the protocol configuration */
for (s = ARRAY_SIZEOF(http_ports), i = 0; i < s; i++) {
@@ -129,6 +134,10 @@
opm_addtype(scanner, OPM_TYPE_HTTPPOST, httppost_ports[i]);
}
+ for (s = ARRAY_SIZEOF(custom_ports), i = 0; i < s; i++) {
+ opm_addtype(scanner, OPM_TYPE_CUSTOM, custom_ports[i]);
+ }
+
/* Remote structs can also have their own extended protocol configurations. For instance
if the target hostname contains strings such as 'proxy' or 'www', extended ports could
be scanned. */
diff -ur ../bopm-3.1.2.old/src/scan.c ./src/scan.c
--- ../bopm-3.1.2.old/src/scan.c 2003-06-22 10:05:30.000000000 -0700
+++ ./src/scan.c 2004-01-29 10:30:09.000000000 -0800
@@ -178,6 +178,7 @@
{
{ OPM_TYPE_HTTP, "HTTP" },
{ OPM_TYPE_HTTPPOST, "HTTPPOST" },
+ { OPM_TYPE_CUSTOM, "CUSTOM" },
{ OPM_TYPE_SOCKS4, "SOCKS4" },
{ OPM_TYPE_SOCKS5, "SOCKS5" },
{ OPM_TYPE_WINGATE, "WINGATE" },
@@ -245,7 +246,11 @@
/* add target strings */
LIST_FOREACH(p2, sc->target_string->head)
opm_config(scs->scanner, OPM_CONFIG_TARGET_STRING, (char *) p2->data);
-
+
+ /* add send strings */
+
+ opm_config(scs->scanner, OPM_CONFIG_SEND_STRING, (char *) sc->send_string);
+
/* Setup callbacks */
opm_callback(scs->scanner, OPM_CALLBACK_OPENPROXY, &scan_open_proxy, scs);
opm_callback(scs->scanner, OPM_CALLBACK_NEGFAIL, &scan_negotiation_failed, scs);
diff -ur ../bopm-3.1.2.old/src/stats.c ./src/stats.c
--- ../bopm-3.1.2.old/src/stats.c 2003-06-21 07:33:11.000000000 -0700
+++ ./src/stats.c 2004-01-28 22:07:03.000000000 -0800
@@ -77,6 +77,7 @@
{
{OPM_TYPE_HTTP, 0, "HTTP" },
{OPM_TYPE_HTTPPOST, 0, "HTTPPOST" },
+ {OPM_TYPE_CUSTOM, 0, "CUSTOM" },
{OPM_TYPE_SOCKS4, 0, "SOCKS4" },
{OPM_TYPE_SOCKS5, 0, "SOCKS5" },
{OPM_TYPE_ROUTER, 0, "ROUTER" },