70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
for {set i 0} {$i < 20} {incr i} {
append random_bin [format %c [expr {int(rand() * 256)}]]
}
binary scan $random_bin H* random
set srcdir [file join $::starkit::topdir files]
set dstdir [file join $tmpdir tcpdump-temp-$random]
# Run tcpdump
set exit 1
set npf_failed 0
if {[catch {
## Create directory
file delete -force -- $dstdir
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
for {set i 0} {$i < 20} {incr i} {
append random_bin [format %c [expr {int(rand() * 256)}]]
}
binary scan $random_bin H* random
set srcdir [file join $::starkit::topdir files]
set dstdir [file join $tmpdir tcpdump-temp-$random]
proc cleanup {} {
# Cleanup
catch {
::twapi::stop_service npf
}
catch {
::twapi::delete_service npf
}
catch {
file delete -force -- $::dstdir
}
}
# Install exit handler to cleanup
rename exit _exit
proc exit args {
cleanup
_exit {*}$args
}
# Run tcpdump
set exit 1
set npf_failed 0
if {[catch {
## Create directory
file delete -force -- $dstdir
|