-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendss.py
More file actions
28 lines (22 loc) · 716 Bytes
/
sendss.py
File metadata and controls
28 lines (22 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import socket, tqdm, os
class dedess:
def __init__(self, host, port):
self.HOST = host; self.PORT = port
self.BUFFER = 4096
self.size = os.path.getsize("screenShots/secret.png")
self.s = socket.socket()
self.s.connect((self.HOST, self.PORT))
self.s.send(bytes(str(self.size), encoding = "utf8"))
def send(self):
prgs = tqdm.tqdm(range(self.size), "Sending... ", unit = "B", unit_scale = True, unit_divisor = 1024)
with open("screenShots/secret.png", "rb") as f:
while True:
block = f.read(self.BUFFER)
if not block:
break
self.s.sendall(block)
prgs.update(len(block))
self.s.close()
if __name__ == "__main__":
sender = dedess("172.16.120.153", 6677)
sender.send()