首页 > 编程语言 > AAuto > hook webform获取网页加载的资源url
2015
05-30

hook webform获取网页加载的资源url

ie11采用了unicode的api.

import win.ui;
/*DSG{{*/
var winform = ..win.form(text="Web Form";right=599;bottom=399)
winform.add()
/*}}*/

import console;
import raw.apiHook
import web.form;

var host;
hookHttpOpenRequest = function(hConnect,lpszVerb,lpszObjectName,lpszVersion,lpszReferrer,lplpszAcceptTypes,dwFlags,dwContext){
	console.log(host ++ string.fromUnicode(lpszObjectName,0,true))
	return owner.callApi( hConnect,(lpszVerb),(lpszObjectName),(lpszVersion),(lpszReferrer),lplpszAcceptTypes,dwFlags,dwContext )
}

hookInternetConnect = function(hInet,serverName, serverPort, userName, password, service, flags, context){
	host = string.fromUnicode(serverName,0,true)
	return owner.callApi(hInet,(serverName), serverPort, userName, password, service, flags, context); 
}

hook = raw.apiHook("Wininet.dll", "HttpOpenRequestW", "pointer(pointer hConnect,pointer lpszVerb,pointer lpszObjectName,pointer lpszVersion,pointer lpszReferrer,pointer lplpszAcceptTypes,INT dwFlags,INT dwContext)", hookHttpOpenRequest).install()
hook2 = raw.apiHook("Wininet.dll", "InternetConnectW","pointer(pointer hInet,pointer serverName,INT serverPort,pointer userName,pointer password,INT service,INT flags,INT context)",hookInternetConnect).install();

var wb = web.form( winform );
wb.noScriptErr = true;
winform.show(); //显示窗体

//打开目标网站
wb.go("https://www.baidu.com/") 
wb.wait(""); //等待指定网址,可以使用模式匹配语法

/*
hook.unInstall()
hook2.unInstall()
*/
//启动消息循环
win.loopMessage();
最后编辑:
作者:NINE
这个作者貌似有点懒,什么都没有留下。