Skip to content

Commit 7da7e4f

Browse files
Fixed Checksum Check bug
1 parent 0f59f83 commit 7da7e4f

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

SFT

-6.22 MB
Binary file not shown.

one.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ def warn_md5():
1010
print("This means that either the transfer went wrong, or the file ")
1111
keep = input("Has been incerpeted by attackers, and is compromised. Keep file? (y/N)? ")
1212
if keep.lower() == 'n':
13-
os.delete(filename)
14-
13+
os.remove(filename)
1514

1615
modes = ['transmit', 'receive','whomadethis?']
1716
if len(sys.argv) == 1:
@@ -65,8 +64,11 @@ def warn_md5():
6564
s.sendall(bytes_read)
6665
progress.update(len(bytes_read))
6766
s.close()
68-
elif sys.argv[1] == 'receive':
6967

68+
69+
70+
elif sys.argv[1] == 'receive':
71+
global sent_hash
7072
SERVER_HOST = '0.0.0.0'
7173
SERVER_PORT = 9001
7274
BUFFER_SIZE = 4096
@@ -118,6 +120,7 @@ def warn_md5():
118120
progress.update(len(bytes_read))
119121
client_socket.close()
120122
s.close()
123+
progress.close()
121124
new_hash = hashlib.md5(open(filename,'rb').read()).hexdigest()
122125
if not new_hash == sent_hash:
123126
warn_md5()

0 commit comments

Comments
 (0)