/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1998-1999,2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include "snoop.h"
int
int flags;
char *line;
int fraglen;
{
char *cp;
int i, n;
cp = get_sum_line();
if (fraglen >= 2) {
switch (buf[0]) {
case 4: /* SOCKS4 */
n = buf[1];
switch (n) {
case 1:
case 2:
if (fraglen >= 8) {
sizeof (ipaddr));
"SOCKS4 %s %s:%u",
(n == 1)? "CONNECT": "BIND",
if (fraglen > 8) {
for (i = 8;
i < 40 && i < fraglen;
++i) {
if (buf[i] == '\0')
break;
}
if (i == 40) {
*cp++ = '.';
*cp++ = '.';
*cp++ = '.';
}
*cp = '\0';
}
}
break;
default:
}
break;
case 5: /* SOCKS5 */
n = buf[1];
if (2 + n == fraglen) {
"SOCKS5 CONTACT NMETHODS=%d:", n);
for (i = 0; i < n && 2 + i < fraglen; ++i) {
}
const char *cmd;
if (n < 1 || n > 3) {
"SOCKS (send data): %s",
} else {
switch (n) {
case 1:
cmd = "CONNECT";
break;
case 2:
cmd = "BIND";
break;
case 3:
cmd = "ASSOCIATE_UDP";
break;
}
fraglen - 3);
}
} else {
}
break;
default:
}
} else {
}
} /* if (flags & F_SUM) */
show_space();
if (fraglen >= 2) {
switch (buf[0]) {
case 4:
n = buf[1];
switch (n) {
case 1:
case 2:
"Operation = %s",
(n == 1)? "CONNECT": "BIND");
if (fraglen >= 8) {
sizeof (ipaddr));
"Destination = %s:%u",
&ipaddr),
if (fraglen > 8) {
"User = ");
for (i = 8;
i < 40; ++i) {
if
(buf[i] == '\0')
break;
}
if (i == 40) {
*cp++ = '.';
*cp++ = '.';
*cp++ = '.';
}
*cp = '\0';
}
}
break;
default:
"Operation = %u (unknown)", n);
}
break;
case 5: /* SOCKS5 */
n = buf[1];
if (2 + n == fraglen) {
"Number of methods = %u", n);
for (i = 0;
i < n && 2 + i < fraglen; ++i) {
"Method %3u =", i);
}
const char *cmd;
if (n < 1 || n > 3) {
"SOCKS (send data): %s",
fraglen, 20));
} else {
switch (n) {
case 1:
cmd = "CONNECT";
break;
case 2:
cmd = "BIND";
break;
case 3:
cmd = "ASSOCIATE_UDP";
break;
}
"Operation = %s ", cmd);
put_socks5_addr(get_line(0, 0),
break;
}
} else
" SOCKS (send data): %s",
20));
break;
default:
"SOCKS (send data): %s",
}
show_space();
} else
"SOCKS (send data): %s",
}
out:
return (fraglen);
}
int
int flags;
char *line;
int fraglen;
{
char *cp;
cp = get_sum_line();
if (fraglen >= 2) {
switch (buf[0]) {
case 0:
if (fraglen >= 8) {
sizeof (ipaddr));
}
/* reply version, no SOCKS version in v4 */
break;
case 5:
break;
default:
}
} else
}
show_space();
if (fraglen >= 2) {
switch (buf[0]) {
case 0:
/* reply version, no SOCKS version in v4 */
"Reply version = 0 (SOCKS version 4)");
if (fraglen >= 8) {
sizeof (ipaddr));
"Destination %s:%u ",
}
break;
case 5:
if (fraglen == 2) {
put_socks5_addr(get_line(0, 0),
}
break;
default:
}
} else
show_space();
}
out:
return (fraglen);
}
static void
{
switch (method) {
case 0:
break;
case 1:
break;
case 2:
break;
case 255:
break;
default:
}
}
static void
{
int i;
switch (buf[0]) {
case 1:
/* IPv4 */
} else
break;
case 3:
/* domain name */
else
*cp = '\0';
break;
case 4:
/* IPv6 */
for (i = 0; i < 16; ++i) {
if (i > 0)
*cp++ = '.';
}
}
} else
break;
default:
}
}
static void
{
switch (code) {
case 90:
break;
case 91:
break;
case 92:
break;
case 93:
break;
default:
}
}
static void
{
switch (code) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
default:
}
}