Add debug mode to simulate a capture

This commit is contained in:
2021-03-10 17:37:01 -07:00
parent 15023b0e24
commit ec8128d96a
3 changed files with 15 additions and 0 deletions
+10
View File
@@ -5,7 +5,17 @@ import paramiko
import time
paramiko.util.log_to_file('paramiko.log')
def fake_download(dest):
import requests, random
rnd = str(random.randint(1, 10000))
r = requests.get('https://picsum.photos/400/300?random=' + rnd)
with open(dest / (rnd + '.jpg'), 'wb') as f:
f.write(r.content)
def download(ip, dest):
if settings.DEBUG:
fake_download(dest)
print('Downloading from', ip)
port = 22