Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cecylia Bocovich
probetest
Commits
df955326
Commit
df955326
authored
Dec 06, 2019
by
Cecylia Bocovich
Browse files
Fix some bugs in snowflake test
parent
464a823d
Changes
1
Hide whitespace changes
Inline
Side-by-side
snowflaketest
View file @
df955326
#!/usr/bin/env python3
from
datetime
import
datetime
import
errno
import
logging
import
os
...
...
@@ -37,7 +38,7 @@ def download_file(socks_port):
try
:
start
=
time
.
time
()
# Download a ~1MB file
subprocess
.
run
([
"
/usr/bin/
torsocks"
,
"-P"
,
str
(
socks_port
),
"wget"
,
"-O"
,
"/dev/null"
,
"https://mirror.csclub.uwaterloo.ca/ubuntu/dists/xenial/main/binary-amd64/Packages.xz"
],
check
=
True
)
subprocess
.
run
([
"torsocks"
,
"-P"
,
str
(
socks_port
),
"wget"
,
"-O"
,
"/dev/null"
,
"https://mirror.csclub.uwaterloo.ca/ubuntu/dists/xenial/main/binary-amd64/Packages.xz"
],
check
=
True
)
stop
=
time
.
time
()
download_time
=
stop
-
start
except
subprocess
.
CalledProcessError
as
e
:
...
...
@@ -118,8 +119,8 @@ for x in range(0, 100):
try
:
logging
.
info
(
"starting tcpdump for bridge %r"
%
nickname
)
try
:
tcpdump_lo_proc
=
start_tcpdump
(
nickname
,
lo
)
tcpdump_eth0_proc
=
start_tcpdump
(
nickname
,
eth0
)
tcpdump_lo_proc
=
start_tcpdump
(
nickname
,
"
lo
"
)
tcpdump_eth0_proc
=
start_tcpdump
(
nickname
,
"
eth0
"
)
except
OSError
as
e
:
logging
.
info
(
"failed to start tcpdump, stopping snowflake probe: %s"
,
e
)
#these tests break if we can't find the proxy ip address
...
...
@@ -148,7 +149,7 @@ for x in range(0, 100):
#give data to log file
timestamp
=
datetime
.
utcnow
().
strftime
(
"%b %d %H:%M:%S.%f"
)
output
.
write
(
timestamp
+
"
\n
"
)
subprocess
.
Popen
([
"/usr/bin/tshark"
,
"-q"
,
"-Xlua_script:../../../snowflake-stage.lua"
,
"-r"
,
"%s.pcap"
%
nickname
],
subprocess
.
Popen
([
"/usr/bin/tshark"
,
"-q"
,
"-Xlua_script:../../../
../
snowflake-stage.lua"
,
"-r"
,
"%s.pcap"
%
nickname
],
stdout
=
output
).
communicate
()[
0
]
logging
.
info
(
"Probed snowflake proxy %d time(s)"
%
(
x
+
1
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment