Skip to content

Instantly share code, notes, and snippets.

Created May 15, 2017 10:09
Show Gist options
  • Save anonymous/aed627defa0dc094e04bb688fb1acaed to your computer and use it in GitHub Desktop.
Save anonymous/aed627defa0dc094e04bb688fb1acaed to your computer and use it in GitHub Desktop.
Wannacrypt proxy use checker
#!/usr/bin/env python3
import sys
import ctypes
target_url = sys.argv[1]
buffer_url = ctypes.c_char_p(bytes(target_url,"ascii"))
print("{:20s} : {}".format("Input URL object",buffer_url))
HINTERNET = ctypes.windll.wininet.InternetOpenA(0,1,0,0,0)
result = ctypes.windll.wininet.InternetOpenUrlA(HINTERNET,buffer_url,0,0,0x84000000,0)
print("{:20s} : {:08x}".format("Internet Handle",HINTERNET))
print("{:20s} : {}".format("Accessed URL",target_url))
print("{:20s} : {}".format("Result",result))
if result == 0:
action = "Detonation"
error_code = ctypes.GetLastError()
print("{:20s} : {}".format("Win32 error",error_code))
print("{:20s} : {}".format("Win32 error message",ctypes.FormatError(error_code)))
else:
action = "Malware won't run"
print("{:20s} : {}".format("Action",action))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment