File: make_testusers.sh

package info (click to toggle)
bnetd 0.4.25-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,516 kB
  • ctags: 7,224
  • sloc: ansic: 67,547; sh: 3,142; makefile: 796; python: 304; perl: 211; awk: 73
file content (38 lines) | stat: -rwxr-xr-x 746 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

# creates massive numbers of dummy "test" accounts


# number of accounts to connect with
numaccts=400

# "prefix" of account names
name="bob"

# account password
pass="bob"

# number of zero-padded columns in suffix
padding=6

# "users" directory
users=/usr/local/bnetd/var/users

# bnpass command
bnpass=/usr/local/bnetd/bin/bnpass


hash="`echo \"${pass}\" | \"${bnpass}\" | sed -e 's/^.*"\([0-9a-f]*\)"/\1/'`"

num=0
while [ "${num}" -lt 400 ]; do
    num="`expr \"${num}\" '+' '1'`"
    form="`printf \"%06d\" \"${num}\"`"
    (
        echo '"BNET\\acct\\username"="'"${name}${form}"'"'
        echo '"BNET\\acct\\passhash1"="'"${hash}"'"'
        echo '"BNET\\acct\\userid"="'"${num}"'"'
    ) > "${users}/${form}"
done

exit 0