想做一个安全软件,比如打开网站http://www.xxx.com,这个网站让人挂了木马,我的软件已经检测出这个网站包含木马,需要用我的软件修改这个网站的内容,以提醒用户的目的,我要怎么去修改其中的内容,提供思路既可
function GetDocInterface(hwnd:THandle):IHtmlDocument2;
var
hInst: THandle;
hr:HResult;
lRes:Cardinal;
MSG: Integer;
spDisp:IDispatch;
spDoc:IHTMLDocument;
pDoc2:IHTMLDocument2;
spWin:IHTMLWindow2;
ObjectFromLresult: TObjectFromLresult;
begin
hInst := LoadLibrary('Oleacc.dll');
if hInst=0 then exit;
@ObjectFromLresult := GetProcAddress(hInst, 'ObjectFromLresult');
if @ObjectFromLresult <> nil then begin
try
MSG := RegisterWindowMessage('WM_HTML_GETOBJECT');
SendMessageTimeOut(Hwnd, MSG, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes);
hr:= ObjectFromLresult(lRes, IHTMLDocument2, 0, Result); //<<<<<
if not SUCCEEDED(hr) then Result := nil;
finally
FreeLibrary(hInst);
end;
end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
WndChild: HWND;
IE:IHtmlDocument2;
begin
WndChild:=1444824;//IE的句丙
IE:=GetDocInterface(WndChild);
ie.body.innerText:='1111wwww';
ie.body.innerHTML:='1111wwww';
end;上面的代码虽然能修改IE中的内容,但是是IE加载了木马网页以后才修改成功,那样木马实际还是在用户机器运行了,我要怎么在木马运行之前修改IE中的内容,,谢谢,
function GetDocInterface(hwnd:THandle):IHtmlDocument2;
var
hInst: THandle;
hr:HResult;
lRes:Cardinal;
MSG: Integer;
spDisp:IDispatch;
spDoc:IHTMLDocument;
pDoc2:IHTMLDocument2;
spWin:IHTMLWindow2;
ObjectFromLresult: TObjectFromLresult;
begin
hInst := LoadLibrary('Oleacc.dll');
if hInst=0 then exit;
@ObjectFromLresult := GetProcAddress(hInst, 'ObjectFromLresult');
if @ObjectFromLresult <> nil then begin
try
MSG := RegisterWindowMessage('WM_HTML_GETOBJECT');
SendMessageTimeOut(Hwnd, MSG, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes);
hr:= ObjectFromLresult(lRes, IHTMLDocument2, 0, Result); //<<<<<
if not SUCCEEDED(hr) then Result := nil;
finally
FreeLibrary(hInst);
end;
end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
WndChild: HWND;
IE:IHtmlDocument2;
begin
WndChild:=1444824;//IE的句丙
IE:=GetDocInterface(WndChild);
ie.body.innerText:='1111wwww';
ie.body.innerHTML:='1111wwww';
end;上面的代码虽然能修改IE中的内容,但是是IE加载了木马网页以后才修改成功,那样木马实际还是在用户机器运行了,我要怎么在木马运行之前修改IE中的内容,,谢谢,
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货