summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorericj <>2002-02-19 22:25:26 +0000
committerericj <>2002-02-19 22:25:26 +0000
commit4d66c8927e7163b848b6cc239cd530a030001e00 (patch)
tree16221f31f04dd295bb09602fb213e2fa8b4ad221 /src
parent0be1f7d80eff8e3e86b037958be3ab5217ce9b59 (diff)
downloadopenbsd-4d66c8927e7163b848b6cc239cd530a030001e00.tar.gz
openbsd-4d66c8927e7163b848b6cc239cd530a030001e00.tar.bz2
openbsd-4d66c8927e7163b848b6cc239cd530a030001e00.zip
remove old cruft
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/nc/data/Makefile12
-rw-r--r--src/usr.bin/nc/data/README9
-rw-r--r--src/usr.bin/nc/data/data.c276
-rw-r--r--src/usr.bin/nc/data/dns-any.d38
-rw-r--r--src/usr.bin/nc/data/nfs-0.d61
-rw-r--r--src/usr.bin/nc/data/pm.d10
-rw-r--r--src/usr.bin/nc/data/pmap-dump.d62
-rw-r--r--src/usr.bin/nc/data/pmap-mnt.d80
-rw-r--r--src/usr.bin/nc/data/rip.d54
-rw-r--r--src/usr.bin/nc/data/rservice.c70
-rw-r--r--src/usr.bin/nc/data/showmount.d65
-rw-r--r--src/usr.bin/nc/data/xor.c94
12 files changed, 0 insertions, 831 deletions
diff --git a/src/usr.bin/nc/data/Makefile b/src/usr.bin/nc/data/Makefile
deleted file mode 100644
index 817cbabca9..0000000000
--- a/src/usr.bin/nc/data/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
1# $OpenBSD: Makefile,v 1.2 2001/01/29 01:58:11 niklas Exp $
2
3all: data rservice xor
4
5data: data.c
6 cc -s -O -o data data.c
7rservice: rservice.c
8 cc -s -O -o rservice rservice.c
9xor: xor.c
10 cc -s -O -o xor xor.c
11clean:
12 rm -f *.o data rservice xor
diff --git a/src/usr.bin/nc/data/README b/src/usr.bin/nc/data/README
deleted file mode 100644
index 7e4b9fbf63..0000000000
--- a/src/usr.bin/nc/data/README
+++ /dev/null
@@ -1,9 +0,0 @@
1For now, read the header comments inside each of these for documentation.
2The programs are simple enough that they don't really need a Makefile any more
3complex than the one given; ymmv. Data and xor may also be useful on DOS,
4which is why there are hooks for it in the code.
5
6data.c a primitive atob / btoa byte generator
7*.d example input to "data -g"
8rservice.c a utility for scripting up rsh/rexec attacks
9xor.c generic xor handler
diff --git a/src/usr.bin/nc/data/data.c b/src/usr.bin/nc/data/data.c
deleted file mode 100644
index e1936d538c..0000000000
--- a/src/usr.bin/nc/data/data.c
+++ /dev/null
@@ -1,276 +0,0 @@
1/* $OpenBSD: data.c,v 1.4 2001/11/19 19:02:15 mpech Exp $ */
2
3/* primitive arbitrary-data frontend for netcat. 0.9 960226
4 only handles one value per ascii line, but at least parses 0xNN too
5 an input line containing "%r" during "-g" generates a random byte
6
7 todo:
8 make work on msloss jus' for kicks [workin' on it...]
9
10 syntax: data -X [limit]
11 where X is one of
12 d: dump raw bytes to ascii format
13 g: generate raw bytes from ascii input
14 c: generate ??? of value -- NOTYET
15 r: generate all random bytes
16 and limit is how many bytes to generate or dump [unspecified = infinite]
17
18 *Hobbit*, started 951004 or so and randomly screwed around with since */
19
20#include <stdio.h>
21
22#ifdef MSDOS /* for MSC only at the moment... */
23#include <fcntl.h>
24#else /* MSDOS */
25#include <sys/file.h>
26#define HAVE_RANDOM /* XXX: might have to change */
27#endif /* MSDOS */
28
29static char buf_in [128];
30static char buf_raw [8192];
31static char surveysez[] = "survey sez... XXX\n";
32
33/* fgetss :
34 wrapper for fgets, that yanks trailing newlines. Doing the work ourselves
35 instead of calling strchr/strlen/whatever */
36char * fgetss (buf, len, from)
37 char * buf;
38 size_t len;
39 FILE * from;
40{
41 int x;
42 char * p, * q;
43 p = fgets (buf, len, from); /* returns ptr to buf */
44 if (! p)
45 return (NULL);
46 q = p;
47 for (x = 0; x < len; x++) {
48 *p = (*p & 0x7f); /* rip parity, just in case */
49 switch (*p) {
50 case '\n':
51 case '\r':
52 case '\0':
53 *p = '\0';
54 return (q);
55 } /* switch */
56 p++;
57 } /* for */
58} /* fgetss */
59
60/* randint:
61 swiped from rndb.c. Generates an INT, you have to mask down to char. */
62int randint()
63{
64 int q;
65 int x;
66
67#ifndef HAVE_RANDOM
68 q = rand();
69#else
70 q = random();
71#endif
72 x = ((q >> 8) & 0xff); /* perturb low byte using some higher bits */
73 x = q ^ x;
74 return (x);
75}
76
77main (argc, argv)
78 int argc;
79 char ** argv;
80{
81 unsigned char * p;
82 char * q;
83 int x;
84 int bc = 0;
85 int limit = 0; /* num to gen, or 0 = infinite */
86 int xlimit; /* running limit */
87 FILE * txt; /* line-by-line ascii file */
88 int raw; /* raw bytes fd */
89 int dumping = 0; /* cmd flags ... */
90 int genning = 0;
91 int randing = 0;
92
93 memset (buf_in, 0, sizeof (buf_in));
94 memset (buf_raw, 0, sizeof (buf_raw));
95
96 xlimit = 1; /* doubles as "exit flag" */
97 bc = 1; /* preload, assuming "dump" */
98 x = getpid() + 687319;
99/* if your library doesnt have srandom/random, use srand/rand. [from rnd.c] */
100#ifndef HAVE_RANDOM
101 srand (time(0) + x);
102#else
103 srandom (time(0) + x);
104#endif
105
106#ifdef O_BINARY
107/* DOS stupidity */
108/* Aha: *here's* where that setmode() lib call conflict in ?BSD came from */
109 x = setmode (0, O_BINARY); /* make stdin raw */
110 if (x < 0) {
111 fprintf (stderr, "stdin binary setmode oops: %d\n", x);
112 exit (1);
113 }
114 x = setmode (1, O_BINARY); /* make stdout raw */
115 if (x < 0) {
116 fprintf (stderr, "stdout binary setmode oops: %d\n", x);
117 exit (1);
118 }
119#endif /* O_BINARY */
120
121 if (argv[1]) {
122 p = argv[1]; /* shit-simple single arg parser... */
123 if (*p == '-') /* dash is optional, we'll deal */
124 p++;
125 if (*p == 'd')
126 dumping++;
127 if (*p == 'g')
128 genning++;
129 if (*p == 'r')
130 randing++;
131 } /* if argv 1 */
132
133/* optional second argument: limit # of bytes shoveled either way */
134 if (argv[2]) {
135 x = atoi (argv[2]);
136 if (x)
137 limit = x;
138 else
139 goto wrong;
140 xlimit = limit;
141 }
142
143/* Since this prog would likely best be written in assmbler, I'm gonna
144 write it *like* assembler. So there. */
145
146 if (randing)
147 goto do_rand;
148
149nextbuf: /* loop sleaze */
150
151 if (dumping) { /* switch off to wherever */
152 if (genning)
153 goto wrong;
154 goto do_dump;
155 }
156 if (genning)
157 goto do_gen;
158wrong:
159 fprintf (stderr, "%s", surveysez); /* if both or neither */
160 exit (1);
161
162do_gen:
163/* here if genning -- original functionality */
164 q = buf_raw;
165 bc = 0;
166/* suck up lines until eof or buf_raw is full */
167 while (1) {
168 p = fgetss (buf_in, 120, stdin);
169 if (! p)
170 break; /* EOF */
171/* super-primitive version first: one thingie per line */
172 if (*p == '#') /* comment */
173 continue;
174 if (*p == '\0') /* blank line */
175 continue;
176 if (*p == '%') { /* escape char? */
177 p++;
178 if (*p == 'r') { /* random byte */
179 x = randint();
180 goto stuff;
181 } /* %r */
182 } /* if "%" escape */
183 if (*p == '0')
184 if (*(p+1) == 'x') /* 0x?? */
185 goto hex;
186 x = atoi (p); /* reg'lar decimal number */
187 goto stuff;
188
189hex:
190/* A 65 a 97 */
191/* xxx: use a conversion table for this or something. Since we ripped the
192 parity bit, we only need a preset array of 128 with downconversion factors
193 loaded in *once*. maybe look at scanf... */
194 p++; p++; /* point at hex-chars */
195 x = 0;
196 if ((*p > 96) && (*p < 123)) /* a-z */
197 *p = (*p - 32); /* this is massively clumsy */
198 if ((*p > 64) && (*p < 71)) /* A-F */
199 x = (*p - 55);
200 if ((*p > 47) && (*p < 58)) /* digits */
201 x = (*p - 48);
202 p++;
203 if (*p) /* another digit? */
204 x = (x << 4); /* shift to hi half */
205 if ((*p > 96) && (*p < 123)) /* a-z */
206 *p = (*p - 32);
207 if ((*p > 64) && (*p < 71)) /* A-F */
208 x = (x | (*p - 55)); /* lo half */
209 if ((*p > 47) && (*p < 58)) /* digits */
210 x = (x | (*p - 48));
211
212/* fall thru */
213stuff: /* cvt to byte and add to buffer */
214 *q = (x & 0xff);
215 q++;
216 bc++;
217 if (limit) {
218 xlimit--;
219 if (xlimit == 0) /* max num reached */
220 break;
221 } /* limit */
222 if (bc >= sizeof (buf_raw)) /* buffer full */
223 break;
224 } /* while 1 */
225
226/* now in theory we have our buffer formed; shovel it out */
227 x = write (1, buf_raw, bc);
228 if (x <= 0) {
229 fprintf (stderr, "write oops: %d\n", x);
230 exit (1);
231 }
232 if (xlimit && p)
233 goto nextbuf; /* go get some more */
234 exit (0);
235
236do_dump:
237/* here if dumping raw stuff into an ascii file */
238/* gad, this is *so* much simpler! can we say "don't rewrite printf"? */
239 x = read (0, buf_raw, 8192);
240 if (x <= 0)
241 exit (0);
242 q = buf_raw;
243 for ( ; x > 0; x--) {
244 p = q;
245 printf ("%-3.3d # 0x%-2.2x # ", *p, *p);
246 if ((*p > 31) && (*p < 127))
247 printf ("%c %d\n", *p, bc);
248 else
249 printf (". %d\n", bc);
250 q++;
251 bc++;
252 if (limit) {
253 xlimit--;
254 if (xlimit == 0) {
255 fflush (stdout);
256 exit (0);
257 }
258 } /* limit */
259 } /* for */
260 goto nextbuf;
261
262do_rand:
263/* here if generating all-random bytes. Stays in this loop */
264 p = buf_raw;
265 while (1) {
266 *p = (randint() & 0xff);
267 write (1, p, 1); /* makes very slow! */
268 if (limit) {
269 xlimit--;
270 if (xlimit == 0)
271 break;
272 }
273 } /* while */
274 exit (0);
275
276} /* main */
diff --git a/src/usr.bin/nc/data/dns-any.d b/src/usr.bin/nc/data/dns-any.d
deleted file mode 100644
index 40ef3cba48..0000000000
--- a/src/usr.bin/nc/data/dns-any.d
+++ /dev/null
@@ -1,38 +0,0 @@
1# $OpenBSD: dns-any.d,v 1.2 2001/01/29 01:58:11 niklas Exp $
2
3# dns "any for ." query, to udp 53
4# if tcp: precede with 2 bytes of len:
5# 0
6# 17
7# you should get at least *one* record back out
8
9# HEADER:
100 # query id = 2
112
12
131 # flags/opcodes = query, dorecurse
140
15
160 # qdcount, i.e. nqueries: 1
171
18
190 # ancount: answers, 0
200
21
220 # nscount: 0
230
24
250 # addl records: 0
260
27
28# end of fixed header
29
300 # name-len: 0 for ".", lenbyte plus name-bytes otherwise
31
320 # type: any, 255
330xff
34
350 # class: IN
361
37
38# i think that's it..
diff --git a/src/usr.bin/nc/data/nfs-0.d b/src/usr.bin/nc/data/nfs-0.d
deleted file mode 100644
index c6d51827b7..0000000000
--- a/src/usr.bin/nc/data/nfs-0.d
+++ /dev/null
@@ -1,61 +0,0 @@
1# $OpenBSD: nfs-0.d,v 1.2 2001/01/29 01:58:11 niklas Exp $
2
3# UDP NFS null-proc call; finds active NFS listeners on port 2049.
4# If you get *something* back, there's an NFS server there.
5
6000 # XID: 4 trash bytes
7001
8002
9003
10
11000 # CALL: 0
12000
13000
14000
15
16000 # RPC version: 2
17000
18000
19002
20
21000 # nfs: 100003
22001
230x86
240xa3
25
26000 # version: 1
27000
28000
29001
30
31000 # procedure number: 0
32000
33000
34000
35
36000 # port: junk
37000
38000
39000
40
41000 # auth trash
42000
43000
44000
45
46000 # auth trash
47000
48000
49000
50
51000 # auth trash
52000
53000
54000
55
56000 # extra auth trash? probably not needed
57000
58000
59000
60
61# that's it!
diff --git a/src/usr.bin/nc/data/pm.d b/src/usr.bin/nc/data/pm.d
deleted file mode 100644
index 2d006a032f..0000000000
--- a/src/usr.bin/nc/data/pm.d
+++ /dev/null
@@ -1,10 +0,0 @@
1# $OpenBSD: pm.d,v 1.2 2001/01/29 01:58:11 niklas Exp $
2
3# obligatory duplicate of dr delete's Livingston portmaster crash, aka
4# telnet break. Fire into its telnet listener. An *old* bug by now, but
5# consider the small window one might obtain from a slightly out-of-rev PM
6# used as a firewall, that starts routing IP traffic BEFORE its filter sets
7# are fully loaded...
8
9255 # 0xff # . 1
10243 # 0xf3 # . 2
diff --git a/src/usr.bin/nc/data/pmap-dump.d b/src/usr.bin/nc/data/pmap-dump.d
deleted file mode 100644
index 98d6142001..0000000000
--- a/src/usr.bin/nc/data/pmap-dump.d
+++ /dev/null
@@ -1,62 +0,0 @@
1# $OpenBSD: pmap-dump.d,v 1.2 2001/01/29 01:58:11 niklas Exp $
2
3# portmap dump request: like "rpcinfo -p" but via UDP instead
4# send to UDP 111 and hope it's not a logging portmapper!
5# split into longwords, since rpc apparently only deals with them
6
7001 # 0x01 # . # XID: 4 trash bytes
8002 # 0x02 # .
9003 # 0x03 # .
10004 # 0x04 # .
11
12000 # 0x00 # . # MSG: int 0=call, 1=reply
13000 # 0x00 # .
14000 # 0x00 # .
15000 # 0x00 # .
16
17000 # 0x00 # . # pmap call body: rpc version=2
18000 # 0x00 # .
19000 # 0x00 # .
20002 # 0x02 # .
21
22000 # 0x00 # . # pmap call body: prog=PMAP, 100000
23001 # 0x01 # .
24134 # 0x86 # .
25160 # 0xa0 # .
26
27000 # 0x00 # . # pmap call body: progversion=2
28000 # 0x00 # .
29000 # 0x00 # .
30002 # 0x02 # .
31
32000 # 0x00 # . # pmap call body: proc=DUMP, 4
33000 # 0x00 # .
34000 # 0x00 # .
35004 # 0x04 # .
36
37# with AUTH_NONE, there are 4 zero integers [16 bytes] here
38
39000 # 0x00 # . # auth junk: cb_cred: auth_unix = 1; NONE = 0
40000 # 0x00 # .
41000 # 0x00 # .
42000 # 0x00 # .
43
44000 # 0x00 # . # auth junk
45000 # 0x00 # .
46000 # 0x00 # .
47000 # 0x00 # .
48
49000 # 0x00 # . # auth junk
50000 # 0x00 # .
51000 # 0x00 # .
52000 # 0x00 # .
53
54000 # 0x00 # . # auth junk
55000 # 0x00 # .
56000 # 0x00 # .
57000 # 0x00 # .
58
59# The reply you get back contains your XID, int 1 if "accepted", and
60# a whole mess of gobbledygook containing program numbers, versions,
61# and ports that rpcinfo knows how to decode. For the moment, you get
62# to wade through it yourself...
diff --git a/src/usr.bin/nc/data/pmap-mnt.d b/src/usr.bin/nc/data/pmap-mnt.d
deleted file mode 100644
index 0dc3ffc55e..0000000000
--- a/src/usr.bin/nc/data/pmap-mnt.d
+++ /dev/null
@@ -1,80 +0,0 @@
1# $OpenBSD: pmap-mnt.d,v 1.2 2001/01/29 01:58:11 niklas Exp $
2
3# portmap request for mountd [or whatever; see where prog=MOUNT]
4# send to UDP 111 and hope it's not a logging portmapper!
5# split into longwords, since rpc apparently only deals with them
6
7001 # 0x01 # . # XID: 4 trash bytes
8002 # 0x02 # .
9003 # 0x03 # .
10004 # 0x04 # .
11
12000 # 0x00 # . # MSG: int 0=call, 1=reply
13000 # 0x00 # .
14000 # 0x00 # .
15000 # 0x00 # .
16
17000 # 0x00 # . # pmap call body: rpc version=2
18000 # 0x00 # .
19000 # 0x00 # .
20002 # 0x02 # .
21
22000 # 0x00 # . # pmap call body: prog=PMAP, 100000
23001 # 0x01 # .
24134 # 0x86 # .
25160 # 0xa0 # .
26
27000 # 0x00 # . # pmap call body: progversion=2
28000 # 0x00 # .
29000 # 0x00 # .
30002 # 0x02 # .
31
32000 # 0x00 # . # pmap call body: proc=GETPORT, 3
33000 # 0x00 # .
34000 # 0x00 # .
35003 # 0x03 # .
36
37# with AUTH_NONE, there are 4 zero integers [16 bytes] here
38
39000 # 0x00 # . # auth junk: cb_cred: auth_unix = 1; NONE = 0
40000 # 0x00 # .
41000 # 0x00 # .
42000 # 0x00 # .
43
44000 # 0x00 # . # auth junk
45000 # 0x00 # .
46000 # 0x00 # .
47000 # 0x00 # .
48
49000 # 0x00 # . # auth junk
50000 # 0x00 # .
51000 # 0x00 # .
52000 # 0x00 # .
53
54000 # 0x00 # . # auth junk
55000 # 0x00 # .
56000 # 0x00 # .
57000 # 0x00 # .
58
59000 # 0x00 # . # prog=MOUNT, 100005
60001 # 0x01 # .
61134 # 0x86 # .
62165 # 0xa5 # .
63
64000 # 0x00 # . # progversion=1
65000 # 0x00 # .
66000 # 0x00 # .
67001 # 0x01 # .
68
69000 # 0x00 # . # protocol=udp, 17
70000 # 0x00 # .
71000 # 0x00 # .
72017 # 0x11 # .
73
74000 # 0x00 # . # proc num = junk
75000 # 0x00 # .
76000 # 0x00 # .
77000 # 0x00 # .
78
79# The reply you get back contains your XID, int 1 if "accepted", and
80# mountd's port number at the end or 0 if not registered.
diff --git a/src/usr.bin/nc/data/rip.d b/src/usr.bin/nc/data/rip.d
deleted file mode 100644
index 51be878454..0000000000
--- a/src/usr.bin/nc/data/rip.d
+++ /dev/null
@@ -1,54 +0,0 @@
1# $OpenBSD: rip.d,v 1.2 2001/01/29 01:58:11 niklas Exp $
2
3# struct netinfo {
4# struct sockaddr rip_dst; /* destination net/host */
5# int rip_metric; /* cost of route */
6# };
7# struct rip {
8# u_char rip_cmd; /* request/response */
9# u_char rip_vers; /* protocol version # */
10# u_char rip_res1[2]; /* pad to 32-bit boundary */
11# union {
12# struct netinfo ru_nets[1]; /* variable length... */
13# char ru_tracefile[1]; /* ditto ... */
14# } ripun;
15#define rip_nets ripun.ru_nets
16#define rip_tracefile ripun.ru_tracefile
17#define RIPCMD_REQUEST 1 /* want info */
18#define RIPCMD_RESPONSE 2 /* responding to request */
19#define RIPCMD_TRACEON 3 /* turn tracing on */
20#define RIPCMD_TRACEOFF 4 /* turn it off */
21#define HOPCNT_INFINITY 16 /* per Xerox NS */
22#define MAXPACKETSIZE 512 /* max broadcast size */
23
24### RIP packet redux
25### UDP send FROM clued-rtr/520 to target/520
262 # RIPCMD_RESPONSE
271 # version
280 # padding
290
30
31# sockaddr-plus-metric structs begin, as many as necessary...
320 # len
332 # AF_INET
340 # port
350
36# addr bytes:
37X
38Y
39Z
40Q
410 # filler, out to 16 bytes [sizeof (sockaddr)] ...
420
430
440
450
460
470
480
490 # metric: net-order integer
500
510
521
53
54## that's it
diff --git a/src/usr.bin/nc/data/rservice.c b/src/usr.bin/nc/data/rservice.c
deleted file mode 100644
index 83c935537b..0000000000
--- a/src/usr.bin/nc/data/rservice.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/* $OpenBSD: rservice.c,v 1.3 2001/11/19 19:02:15 mpech Exp $ */
2
3/* generate ^@string1^@string2^@cmd^@ input to netcat, for scripting up
4 rsh/rexec attacks. Needs to be a prog because shells strip out nulls.
5
6 args:
7 locuser remuser [cmd]
8 remuser passwd [cmd]
9
10 cmd defaults to "pwd".
11
12 ... whatever. _H*/
13
14#include <stdio.h>
15
16/* change if you like; "id" is a good one for figuring out if you won too */
17static char cmd[] = "pwd";
18
19static char buf [256];
20
21main(argc, argv)
22 int argc;
23 char * argv[];
24{
25 int x;
26 int y;
27 char * p;
28 char * q;
29
30 p = buf;
31 memset (buf, 0, 256);
32
33 p++; /* first null */
34 y = 1;
35
36 if (! argv[1])
37 goto wrong;
38 x = strlen (argv[1]);
39 memcpy (p, argv[1], x); /* first arg plus another null */
40 x++;
41 p += x;
42 y += x;
43
44 if (! argv[2])
45 goto wrong;
46 x = strlen (argv[2]);
47 memcpy (p, argv[2], x); /* second arg plus null */
48 x++;
49 p += x;
50 y += x;
51
52 q = cmd;
53 if (argv[3])
54 q = argv[3];
55 x = strlen (q); /* not checked -- bfd */
56 memcpy (p, q, x); /* the command, plus final null */
57 x++;
58 p += x;
59 y += x;
60
61 memcpy (p, "\n", 1); /* and a newline, so it goes */
62 y++;
63
64 write (1, buf, y); /* zot! */
65 exit (0);
66
67wrong:
68 fprintf (stderr, "wrong! needs 2 or more args.\n");
69 exit (1);
70}
diff --git a/src/usr.bin/nc/data/showmount.d b/src/usr.bin/nc/data/showmount.d
deleted file mode 100644
index 77700a70ce..0000000000
--- a/src/usr.bin/nc/data/showmount.d
+++ /dev/null
@@ -1,65 +0,0 @@
1# $OpenBSD: showmount.d,v 1.2 2001/01/29 01:58:12 niklas Exp $
2
3# UDP mountd call. Use as input to find mount daemons and avoid portmap.
4# Useful proc numbers are 2, 5, and 6.
5# UDP-scan around between 600-800 to find most mount daemons.
6# Using this with "2", plugged into "nc -u -v -w 2 victim X-Y" will
7# directly scan *and* dump the current exports when mountd is hit.
8# combine stdout *and* stderr thru "strings" or something to clean it up
9
10000 # XID: 4 trash bytes
11001
12002
13003
14
15000 # CALL: 0
16000
17000
18000
19
20000 # RPC version: 2
21000
22000
23002
24
25000 # mount: 100005
26001
270x86
280xa5
29
30000 # mount version: 1
31000
32000
33001
34
35000 # procedure number -- put what you need here:
36000 # 2 = dump [showmount -e]
37000 # 5 = exportlist [showmount -a]
38xxx # "sed s/xxx/$1/ | data -g | nc ..." or some such...
39
40000 # port: junk
41000
42000
43000
44
45000 # auth trash
46000
47000
48000
49
50000 # auth trash
51000
52000
53000
54
55000 # auth trash
56000
57000
58000
59
60000 # extra auth trash? probably not needed
61000
62000
63000
64
65# that's it!
diff --git a/src/usr.bin/nc/data/xor.c b/src/usr.bin/nc/data/xor.c
deleted file mode 100644
index 2fed291173..0000000000
--- a/src/usr.bin/nc/data/xor.c
+++ /dev/null
@@ -1,94 +0,0 @@
1/* $OpenBSD: xor.c,v 1.3 2001/11/19 19:02:15 mpech Exp $ */
2
3/* Generic xor handler.
4
5 With no args, xors stdin against 0xFF to stdout. A single argument is a
6 file to read xor-bytes out of. Any zero in the xor-bytes array is treated
7 as the end; if you need to xor against a string that *includes* zeros,
8 you're on your own.
9
10 The indirect file can be generated easily with data.c.
11
12 Written because there are so many lame schemes for "masking" plaintext
13 passwords and the like floating around, and it's handy to just run an
14 obscure binary-format configuration file through this and look for strings.
15
16 *Hobbit*, 960208 */
17
18#include <stdio.h>
19#include <fcntl.h>
20
21char buf[8192];
22char bytes[256];
23char * py;
24
25/* do the xor, in place. Uses global ptr "py" to maintain "bytes" state */
26xorb (buf, len)
27 char * buf;
28 int len;
29{
30 int x;
31 char * pb;
32
33 pb = buf;
34 x = len;
35 while (x > 0) {
36 *pb = (*pb ^ *py);
37 pb++;
38 py++;
39 if (! *py)
40 py = bytes;
41 x--;
42 }
43} /* xorb */
44
45/* blah */
46main (argc, argv)
47 int argc;
48 char ** argv;
49{
50 int x = 0;
51 int y;
52
53/* manually preload; xor-with-0xFF is all too common */
54 memset (bytes, 0, sizeof (bytes));
55 bytes[0] = 0xff;
56
57/* if file named in any arg, reload from that */
58#ifdef O_BINARY /* DOS shit... */
59 x = setmode (0, O_BINARY); /* make stdin raw */
60 if (x < 0) {
61 fprintf (stderr, "stdin binary setmode oops: %d\n", x);
62 exit (1);
63 }
64 x = setmode (1, O_BINARY); /* make stdout raw */
65 if (x < 0) {
66 fprintf (stderr, "stdout binary setmode oops: %d\n", x);
67 exit (1);
68 }
69#endif /* O_BINARY */
70
71 if (argv[1])
72#ifdef O_BINARY
73 x = open (argv[1], O_RDONLY | O_BINARY);
74#else
75 x = open (argv[1], O_RDONLY);
76#endif
77 if (x > 0) {
78 read (x, bytes, 250); /* nothin' fancy here */
79 close (x);
80 }
81 py = bytes;
82 x = 1;
83 while (x > 0) {
84 x = read (0, buf, sizeof (buf));
85 if (x <= 0)
86 break;
87 xorb (buf, x);
88 y = write (1, buf, x);
89 if (y <= 0)
90 exit (1);
91 }
92 exit (0);
93}
94