Re: [bopm] Socks4/5 Detect Issue.
| Newsgroups | gmane.network.irc.bopm |
|---|---|
| Message-ID | <[email protected]> |
Erik, At last i found the problem, is a bug in the code of libopm_proxy_socks4_write and libopm_proxy_socks5_write c functions (bopm-3.1.1/src/libopm/src/proxy.c), the scanner for socks 4 and 5 was broken... Now my bopm is detecting socks 4 and 5. A trivial patch is attached. Ezequiel,
bopm_3.1.1_socks_proxy.patch
(application/octet-stream, 2.1 KB)
--- proxy.c Sat Jun 21 01:27:32 2003
+++ /tmp/proxy.c Thu Jan 15 01:09:50 2004
@@ -72,7 +72,6 @@
int libopm_proxy_socks4_write(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
{
- struct in_addr addr;
unsigned long laddr;
int len, scan_port;
char *scan_ip;
@@ -81,13 +80,13 @@
scan_ip = (char *) libopm_config(scanner->config, OPM_CONFIG_SCAN_IP);
scan_port = *(int *) libopm_config(scanner->config, OPM_CONFIG_SCAN_PORT);
- laddr = htonl(addr.s_addr);
+ laddr = inet_addr(scan_ip);
len = snprintf(SENDBUF, SENDBUFLEN, "%c%c%c%c%c%c%c%c%c", 4, 1,
(((unsigned short) scan_port) >> 8) & 0xFF,
(((unsigned short) scan_port) & 0xFF),
- (char) (laddr >> 24) & 0xFF, (char) (laddr >> 16) & 0xFF,
- (char) (laddr >> 8) & 0xFF, (char) laddr & 0xFF, 0);
+ (char) (laddr >> 0) & 0xFF, (char) (laddr >> 8) & 0xFF,
+ (char) (laddr >> 16) & 0xFF, (char) laddr & 0xFF, 24);
send(conn->fd, SENDBUF, (unsigned int)len, 0);
@@ -137,7 +136,6 @@
int libopm_proxy_socks5_write(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
{
- struct in_addr addr;
unsigned long laddr;
int len, scan_port;
char *scan_ip;
@@ -146,7 +144,7 @@
scan_ip = (char *) libopm_config(scanner->config, OPM_CONFIG_SCAN_IP);
scan_port = *(int *) libopm_config(scanner->config, OPM_CONFIG_SCAN_PORT);
- laddr = htonl(addr.s_addr);
+ laddr = inet_addr(scan_ip);
/* Form authentication string */
/* Version 5, 1 number of methods, 0 method (no auth). */
@@ -159,8 +157,8 @@
* as socks5 is ipv6 compatible
*/
len = snprintf(SENDBUF, SENDBUFLEN, "%c%c%c%c%c%c%c%c%c%c", 5, 1, 0, 1,
- (char) (laddr >> 24) & 0xFF, (char) (laddr >> 16) & 0xFF,
- (char) (laddr >> 8) & 0xFF, (char) laddr & 0xFF,
+ (char) (laddr >> 0) & 0xFF, (char) (laddr >> 8) & 0xFF,
+ (char) (laddr >> 16) & 0xFF, (char) (laddr >> 24) & 0xFF,
(((unsigned short) scan_port) >> 8) & 0xFF,
(((unsigned short) scan_port) & 0xFF));