Created
May 22, 2017 14:55
-
-
Save und3fined/c720d914f36072e9df792b62d5733817 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import time | |
import ast | |
def main(): | |
backlog = open("eternalblue.replay").read().split("\n\n") | |
backlog = [ast.literal_eval(i) for i in backlog] | |
connections = [] | |
start = time.monotonic() | |
for i in backlog: | |
delta = i[-1] - (start - time.monotonic()) | |
print(i[0], delta) | |
if delta > 0: | |
time.sleep(delta) | |
start = time.monotonic() | |
if i[0] == "connect": | |
sock = socket.socket() | |
sock.connect(('192.168.10.80',445)) | |
connections.append({"socket":sock,"stream" : i[1]}) | |
if i[0] == "close": | |
[j['socket'].close() for j in connections if j["stream"] == i[1]] | |
if i[0] == "send": | |
[j['socket'].send(i[2]) for j in connections if j["stream"] == i[1]] | |
if i[0] == "recv": | |
[j['socket'].recv(2048) for j in connections if j['stream'] == i[1]] | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment