return [expr {$cs & 0xffff}]
}
+proc packet-fromstring {s} {
+ binary scan $s H* y
+ return $y
+}
namespace eval Random-Bytes {
namespace export random-bytes random-bytes-init
set h $fh; unset fh; close $h
error "openssl bf-ofb exited unexpectedly"
}
- binary scan $x H* y
+ set y [packet-fromstring $x]
if {[string length $y] != $n*2} { error "binary format failed $n $y" }
return $y
}
return $rv
}
+proc get/hex {s v min max} {
+ set rv [choice-int $min $max]
+ getlog [format %s=0x%x $v $rv]
+ return $rv
+}
+
proc get/flag {s v defprob} {
set rv [choice-prob $s-$v $defprob]
if {$rv} { getlog "$v" } else { getlog "!$v" }
set now $rest
}
getlog "$v=\"$o\""
- return $o
+ return [packet-fromstring $o]
}
upvar #0 ip_dest dest
get-for ip
set version 4
- get tos number 0x00 0xff
- get id number 0x0000 0xffff
+ get tos hex 0x00 0xff
+ get id hex 0x0000 0xffff
get df flag 0.5
if {$df} {
set mf 0
proc icmp-echo {mbl} {
get-for icmp-echo
get code enum 0 255 0.4
- get id number 0 0xffff
- get seq number 0 0xffff
+ get id hex 0 0xffff
+ get seq hex 0 0xffff
assemble body {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Id | Seq |
proc icmp-timestamp {} {
get-for icmp-timestamp
get code enum 0 255 0.4
- get id number 0 0xffff
- get seq number 0 0xffff
+ get id hex 0 0xffff
+ get seq hex 0 0xffff
get originate ip-timestamp
get receive ip-timestamp
get transmit ip-timestamp
proc icmp-inforeq {} {
get-for icmp-inforeq
get code enum 0 255 0.4
- get id number 0 0xffff
- get seq number 0 0xffff
+ get id hex 0 0xffff
+ get seq hex 0 0xffff
assemble body {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Id | Seq |
set csum [packet-csum-ip $udp]
if {!$csum} { set csum 0xffff }
if {"$checksum" == "bad"} {
- get error number 1 0xffff
+ get error hex 1 0xffff
set csum [expr {$csum ^ $error}]
}
} else {
get user rand 0 [expr {$mtu - 4}]
}
req-auth {
- get auth enum 0 31
- set user [depending-on auth {$mtu - 4}]
+ get auth enum 0 31 0.5
+ set user [depending-on remailck auth $mtu -4]
}
resp-auth {
- get auth number 0 0xffff
+ get auth hex 0 0xffff
set modified 0
set read 0
}
return $packet
}
+define remailck-auth 31 passwd {mtu} {
+ get-for remailck-passwd
+ get passwd string 6 8 \
+ 0123456789abcdefghijklmnopqrstuvxwyz \
+ 0123456789abcdefghijklmnopqrstuvxwyz
+ return $passwd
+}
+
+
proc emit {count} {
global getlog_log errorInfo
if {[catch {