Created
July 26, 2022 05:59
-
-
Save ivanvza/232dc7e62594adbd71eb1973ea35d5fd to your computer and use it in GitHub Desktop.
Frida w2_32.dll - send hook
This file contains hidden or 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 sys | |
import pefile | |
import frida | |
def on_message (message,data): | |
print("[%s]-%s"%(message,data)) | |
def main(target_process): | |
session=frida.attach(target_process) # console.log("sendcalledfrom:"+Thread.backtrace(this.context,Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join("\\n")+""); | |
script=session.create_script(""" | |
var sendPtr = Module.findExportByName("ws2_32.dll","send"); | |
console.log('sendaddress:'+sendPtr.toString()); | |
console.log('Hookingws2_32!send'); | |
Interceptor.attach(sendPtr,{ | |
onEnter:function(args){ | |
console.log("buf:"+Memory.readCString(args[1])); | |
console.log("len:"+Memory.readCString(args[2])); | |
}, | |
onLeave:function (retval){ | |
} | |
}); | |
""") | |
script.on('message',on_message) | |
script.load() | |
raw_input('\n\n') | |
session.detach() | |
if __name__ == '__main__': | |
target_process = '<someexe.exe>' | |
foo = unicode(target_process) | |
main(str(foo)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment