Last active
April 30, 2020 21:23
-
-
Save Hexcles/f957d7406036ff20e5397ab94fb5e70c to your computer and use it in GitHub Desktop.
Test dl.google.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On the host VM (run as root): | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
apt-get install -qy docker-ce | |
systemctl daemon-reload && systemctl start docker.service | |
docker run -it ubuntu:latest bash | |
# In the Docker container: | |
apt-get -qy update && apt-get -qy install curl tcpdump python | |
curl https://gist.githubusercontent.com/Hexcles/f957d7406036ff20e5397ab94fb5e70c/raw/66bf8e2385b36087e6bf586ff5127a907bb17783/download.py > download.py | |
python2 download.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import sys | |
import socket | |
import subprocess | |
import time | |
import urllib2 | |
while True: | |
process = subprocess.Popen(["tcpdump", "-w", "capture.pcap", "port 443"]) | |
time.sleep(5) | |
f = urllib2.urlopen("https://dl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb") | |
sockno = f.fileno() | |
sock = socket.fromfd(sockno, socket.AF_INET, socket.SOCK_STREAM) | |
print sock.getpeername() | |
try: | |
print len(f.read()) | |
except IOError as e: | |
print e | |
time.sleep(5) | |
process.terminate() | |
process.wait() | |
sys.exit(0) | |
process.kill() | |
process.wait() | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment