Answer the question
In order to leave comments, you need to log in
Unable to download file via socket, why?
trying to write a reverse shell, still learning...
link to server
link to client
The problem is with the download function in the client (presumably). When it is called on the server, the file is downloaded, but the file remains inaccessible until the socket is closed. Those. if you declare s.close() at the end of the function, then the file will be available, and the client will subsequently fly away with an error in the s.send(output.encode()) line.
If the socket is not closed, then upon exiting the download function, it falls into an infinite loop without returning anything to the server, but if the script is killed, the downloaded file will become available...
It is required that after downloading the file be available without explicitly closing the socket or shutdown (to one of the sides) ... and of course the client continued to work in the normal mode, continuing to execute further commands. But I just can’t understand what is my mistake and how can I implement my plan?!?
Answer the question
In order to leave comments, you need to log in
The main problem in tqdm. You can't use an iterator at the same time
progress = tqdm.tqdm(range(filesize) ... for _ in progress:
and manually update the progress, it will be terribly buggy (try it, write the simplest loop:r=tqdm.tqdm(range(100))
for i in r:
sleep(1)
r.update(10)
bytes_read = client_socket.recv(BUFFER_SIZE)
is blocked waiting for new data and everything hangs. if downloaded >= filesize:
break
received = client_socket.recv(BUFFER_SIZE).decode()
filename, filesize = received.split(SEPARATOR)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question