Skip to content

Commit 97c2817

Browse files
author
linjun
committed
hook dynamic loaded api ok.
1 parent 49c23f5 commit 97c2817

File tree

3 files changed

+43
-37
lines changed

3 files changed

+43
-37
lines changed

.idea/workspace.xml

Lines changed: 20 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MW.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,28 @@ def _process_message(self, message, data):
1515
"""
1616
Frida COMMS
1717
"""
18-
if message['type'] == 'send':
19-
stanza = message['payload']
20-
if stanza['name'] == '+log':
21-
msg=str(stanza["payload"])
22-
logl("["+str(self.pid)+"]\t"+msg)
23-
try:
24-
self.extract.post({ 'type': '+log-ack' })
25-
except Exception as e:
26-
pass
27-
28-
elif stanza['name'] == '+pkill':
29-
logl( "Kill Sub-Process: " + str(stanza['payload']))
30-
31-
else:
32-
logl( "==========ERROR==========")
33-
logl(message)
34-
logl("=========================")
18+
try:
19+
if message['type'] == 'send':
20+
stanza = message['payload']
21+
if stanza['name'] == '+log':
22+
msg = str(stanza["payload"])
23+
logl("[" + str(self.pid) + "]\t" + msg)
24+
try:
25+
self.extract.post({'type': '+log-ack'})
26+
except Exception as e:
27+
pass
28+
29+
elif stanza['name'] == '+pkill':
30+
logl("Kill Sub-Process: " + str(stanza['payload']))
31+
32+
else:
33+
logl("==========ERROR==========")
34+
logl(message)
35+
logl("=========================")
36+
except Exception as ae:
37+
logl("exception on _process_message")
38+
pass
39+
3540

3641
def inject_script(self,jsfile):
3742
# TODO: upgade to use frida-compile

mw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var ptrMessageBoxA = Module.findExportByName("user32.dll","MessageBoxA");
1515
var MessageBoxA=new NativeFunction(ptrMessageBoxA,'int',['int','pointer','pointer','int'],'stdcall');
1616
log("ptrMessageBoxA :"+ptrMessageBoxA);
1717
Interceptor.replace(ptrMessageBoxA,new NativeCallback(function (hwnd,pText,pTitle,type) {
18-
strText=Memory.readnsiString(pText);
18+
strText=Memory.readAnsiString(pText);
1919
strTitle=Memory.readAnsiString(pTitle);
2020
log("MessageBoxA "+strText+" with title "+strTitle);
2121
strHook=Memory.allocAnsiString("hooked!");

0 commit comments

Comments
 (0)