论坛短消息攻击机关键代码

procedure TForm1.Button4Click(Sender: TObject);
var
  i: Word;
  Document: IHtmlDocument2;
  str: string;
begin
  for i := 0 to WebBrowse1.OleObject.Document.Images.Length - 1 do
  begin
    Document := WebBrowse1.Document as IHtmlDocument2;
    Str := (Document.Images.Item(i, 0) as IHTMLImgElement).Href;
    if Pos('msg-send.gif', str) <> 0 then
    begin
      ((Document.Images.Item(i, 0) as IHTMLImgElement) as IHTMLElement).Click;
    end;
  end;
myflag:=false;//提交之后设置标记
end;

-----------------------------------------------

procedure TForm1.Button1Click(Sender: TObject);
var
  hform:IHTMLFormelement;
  hdoc:ihtmldocument2;
  hall,hall2:ihtmlelementcollection;
  Hinput:IHTMLinputelement;
  iw:iwebbrowser2;
  hlen,tmploop:integer;
  vk:oleVariant;
  dispatch:IDispatch;
  mydate:tdate;
  MyTime:TSystemTime;
  i: Word;
  Document: IHtmlDocument2;
  str: string;
begin

if Assigned(webbrowse1) then ///保证网页里有内容;即已经打开一个网页!
   begin
    ////将浏览器控件里的内容赋给hdoc.取其所有标识,并算出总数;
    hdoc:=webbrowse1.document as ihtmldocument2;
    hall:=hdoc.get_all;
    hall2:=hall;
    hlen:=hall.get_length;
       ////下面的操作为:按总数循环找到用户名和密码的edit;并赋值;
           for tmploop:=0 to hlen-1 do
               begin
                vk:=tmploop;
                dispatch:=hall.item(vk,0);
                  if succeeded(Dispatch.QueryInterface(IHTMLInputelement,hinput)) then ///如果此标识是一个edit控件.....
                     begin ////下面这里的uppercase是必需的!防止因大小写的不同而判断失误!
                          ///下面的"TEXT"是由网页里的内容来确定的.也就是说你要判断就必需根据具体网页代码来!
                       if uppercase(hinput.Type_)='TEXT' then hinput.value:=edit2.Text;
                     end;
                  if succeeded(Dispatch.QueryInterface(IHTMLTextAreaElement,hinput)) then
                     begin ///下面是水贴正文内容。
                       mydate:=date();
                       (hall2.item('message', 0) as IHTMLTextAreaElement).value :=memo1.Text+'鲁南论坛短消息攻击机自动发布于'+formatDateTime('YYYY',mydate)+'年'+formatDateTime('M',mydate)+'月'+formatDateTime('D',mydate)+'日';
                       myflag:=true;//短消息准备完毕标记
                     end;
            end; ////for end;
      end ;//if end;
end;

-----------------------------------------------

你可能感兴趣的:(论坛短消息攻击机关键代码)