File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
1615modes = ['transmit' , 'receive' ,'whomadethis?' ]
1716if 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 ()
121124new_hash = hashlib .md5 (open (filename ,'rb' ).read ()).hexdigest ()
122125if not new_hash == sent_hash :
123126 warn_md5 ()
You can’t perform that action at this time.
0 commit comments