tickrom
1.92 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
mktick=$ROOT/usr/sbin/mkTicket
apptick=$ROOT/usr/sbin/appTicketFile
gen_cert=/tmp/cert$$
tmp_tick=/tmp/tick$$
CID_LIST="sm 0x00000001\n
sm_e 0x00001001\n
wr 0x00000002\n
wr_j 0x00001002\n
mk 0x00000003\n
mk_e 0x00001003\n
sf 0x00000004\n
sf_e 0x00001004\n
f0x 0x00000005\n
f0x_e 0x00001005\n
zelda 0x00000006\n
zelda_e 0x00001006\n
dm 0x00000007\n
dm_e 0x00001007\n
usbmon 0x00000008\n
batman 0x00000009\n
hydro 0x0000000a\n
quake2 0x0000000b\n
sfrush 0x0000000c\n
rogue 0x0000000d\n
naboo 0x0000000e\n
golden 0x0000000f\n
iqueclub 0x0000ffff\n
end xxxxxxxx\n"
function find_cid {
echo -e $CID_LIST | while read name value; do
if [ $1 == $name ]; then
echo $value
return 1;
elif [ $name == end ]; then
echo $1;
return 1;
fi
done
}
bbid=1
cert= cmd= tid= limit= signer_key=
while getopts "c:b:m:t:l:S:L:" a
do
case $a in
b) bbid=$OPTARG;;
c) cert=$OPTARG;;
m) cmd=$OPTARG;;
t) tid="-t $OPTARG";;
l) limit="-l $OPTARG";;
L) tsCrlVersion="-L $OPTARG";;
S) signer_key="-S $OPTARG";;
*) usage; exit;;
esac
done
shift `expr $OPTIND - 1`
if [ $# != 2 ]; then
echo "Usage: tickrom [-t tid ] [-l code:limit] [-b bbid | -c bbcert] [-m cmd] [-L tsCrlVersion] cid ticket_file"
exit 1
fi
cid=`find_cid $1`
name=`perl -e 'printf "%08x\n", '$cid;`
[ -z "$cmd" ] && cmd=$name.cmd
cmd=$name.cmd
# generate bb_cert
if [ -z "$cert" ]; then
cert=$gen_cert
$ROOT/usr/sbin/bbcert -b $bbid -p a81902767e25db170f3449c5d94b162fa81902767e25db170f3449c5d94b162f $cert
fi
echo $mktick $signer_key $tid $limit $tsCrlVersion $cmd null $tmp_tick $cert
[ -f $tmp_tick ] && $apptick -p $2 $tmp_tick
$mktick $signer_key $tid $limit $tsCrlVersion $cmd null $tmp_tick $cert
[ -f $tmp_tick ] && $apptick -p $2 $tmp_tick
rm -f $gen_cert $tmp_tick