?? mainunit.pas
字號:
TmpADOQuery.Sql.Text := 'select * from ' + TabName; {連接指定的數據表}
TmpADOQuery.Open;
while not TmpADOQuery.Eof do {歷遍查詢}
begin
ChkBox.Items.Add(TmpADOQuery.FieldByName(FieName).asstring);
TmpADOQuery.Next;
end;
Gbox.Caption := Gbox.Caption + inttostr(ChkBox.Items.Count) + '個'; {提示記錄的數量}
for i := 0 to ChkBox.Items.Count - 1 do {依次將他們全部選中}
ChkBox.Checked[i] := True;
except
end;
end;
procedure TMainForm.FormCreate(Sender: TObject); {窗體創建時執行的代碼}
var
i: integer;
begin
// TFrmLogin.Create(Application).ShowModal; {創建登陸窗口}
// TFrmLogin.Create(Application).Free;
WebBrowser1.Navigate('about:blank');
try
ADOQuery2.Close;
ADOQuery2.Sql.Text := 'select * from Scan_UpFile'; {連接數據庫,讀出Scan_UpFile表中的記錄}
ADOQuery2.Open;
while not ADOQuery2.Eof do
begin
ClbPage.Items.Add(ADOQuery2.FieldByName('UpFilePage').asstring); {歷遍查詢}
ADOQuery2.Next;
end;
{SQL注入檢測 - 設置專區}
ReadData(ADOQuery2, ChkBoxTable, 'Sql_TableName', 'TableName', GroupBox1); {讀出所有表名}
ReadData(ADOQuery2, ChkBoxField, 'Sql_FieldName', 'FieldName', GroupBox2); {讀出所有列名}
ReadData(ADOQuery2, ChkBoxAdminLogin, 'Scan_AdminLogin', 'AdminPage', GroupBox3); {讀出所有后臺地址}
try
ADOLinkCount.Close;
ADOLinkCount.SQL.Text := 'select * from setup';
ADOLinkCount.Open;
SpinEdit1.Value := ADOLinkCount.fieldbyname('linkcount').AsInteger;
except
end;
{連接數據庫出錯時提示下載新的數據庫文件}
except
application.MessageBox('找不到SetData.mdb數據庫,請到以下地址下載,并覆蓋到同一目錄下,雙擊安裝既可!' + #13 +
'SetData.mdb下載地址: http://www.hackdiy.com/SetData.exe', '連接出錯', 48);
application.Terminate; {銷毀程序}
Exit;
end;
for i := 0 to 4 do
ClbPage.Checked[i] := True; {第一次運行選中前5個上傳頁面}
GbShowPageCount.Caption := '共' + inttostr(ClbPage.Items.Count) + '個頁面'; {提示上傳頁面的數量}
{初始化SQL注入部分的界面}
StringGrid1.Rows[0].Text := '排序';
StringGrid1.ColWidths[0] := 35;
btnUpFile.Visible := True;
btnQuery.Enabled := True;
btnStartScan.Visible := True;
PageControl2.Visible := True;
application.Title := 'Domain3.0';
Caption := FmSub;
ReadLink_Panel.Align := AlClient;
ScanInject_Panel.Align := AlClient;
Sql_Panel.Align := AlClient;
ScanLogin_Panel.Align := AlClient;
SqlSetUp_Panel.Align := AlClient;
Sql_AboutPanel.Align := AlClient;
if (Login_Bool) or (Caption <> FmSub) or (Pos('黑客動畫吧出品 - 明小子', Caption) = 0) then //判斷是否通過單擊"登陸"按鈕進行登陸
begin
MainForm.BorderStyle := BsNone;
MainForm.Width := 0;
MainForm.Height := 0;
application.Terminate;
end;
end;
procedure GetIP(RUL: string); {域名轉IP地址的函數}
type
TaPInAddr = array[0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe: PHostEnt;
pptr: PaPInAddr;
I: Integer;
GInitData: TWSADATA;
begin
try
WSAStartup($101, GInitData);
phe := GetHostByName(PChar(RUL)); {設置需要轉換的域名}
pptr := PaPInAddr(Phe^.h_addr_list);
MainForm.EdIP.Text := StrPas(inet_ntoa(pptr^[0]^)); {得到IP地址}
WSACleanup;
except
MainForm.Pane1.Caption := '請檢測域名是否輸入正確,或網絡連接是否正常!';
Exit;
end;
MainForm.EdIP.SetFocus; {轉換成功,將鼠標焦點轉換到EdIP上}
MainForm.EdIP.SelStart := 20;
MainForm.Pane1.Caption := '域名解析成功!';
end;
function CutHostStr(URL: string): string; {分解URL中的主機地址的自定義函數}
var
p: integer;
begin
URL := StringReplace(LowerCase(URL), 'http://', '', [rfIgnoreCase]);
if Pos('/', URL) > 1 then
begin
P := Pos('/', URL);
URL := Copy(URL, 1, P - 1);
end;
Result := URL;
end;
procedure TMainForm.EdSiteKeyPress(Sender: TObject; var Key: Char); {回車后執行域名轉IP}
begin
if Key = #13 then
begin
if EdSite.Text = '' then
begin
Pane1.Caption := '提示:請先輸入你所要查詢的網址!';
Exit;
end;
GetIP(CutHostStr(EdSite.Text));
end;
end;
procedure TMainForm.SpBtnGetIPClick(Sender: TObject); {單擊轉換按鈕時執行域名轉IP}
begin
if Trim(EdSite.Text) = '' then
begin
Pane1.Caption := '提示:請先輸入你所要查詢的網址!';
Exit;
end;
GetIP(CutHostStr(EdSite.Text));
end;
function CutSiteStr(HTML: string): string; {分解虛擬主機網址的自定義函數}
var
P1, p2: integer;
SList: TStrings;
FlagNum: integer;
begin
try
with MainForm do
begin
FlagNum := 0;
LbShowprogress.Caption := '程序查詢完畢!';
if Pos('Enter the security', HTML) > 1 then {判斷是否需要輸入驗證碼}
begin
Timer1.Enabled := False;
Gauge1.Progress := 0;
WebBrowser1.Navigate('http://whois.webhosting.info/' + MainForm.EdIP.Text); {需要輸入驗證碼}
application.MessageBox('暫時無法進行查詢!' + #13#10 + '請手動輸入驗證碼后再進行查詢', '提示', 48);
btnQuery.Enabled := True;
btnDownPage.Enabled := True;
Result := MainForm.SiteList.Items.Text;
Exit;
end;
if Pos('Details', HTML) > 1 then {判斷是否沒有綁定任何國際域名}
begin
Timer1.Enabled := False;
Gauge1.Progress := 0;
Result := MainForm.SiteList.Items.Text;
btnQuery.Enabled := True;
application.MessageBox('該IP地址沒有綁定任何國際域名!', '提示', 48);
Exit;
end;
SList := TStringList.Create;
while Pos('.">', HTML) > 1 do {開始分解虛擬主機的網址}
begin
FlagNum := FlagNum + 1;
P1 := Pos('.">', HTML) + 3;
P2 := Pos('.</a>', HTML);
SList.Add('www.' + LowerCase(Copy(HTML, P1, P2 - P1)));
HTML := StringReplace(HTML, '.">', '', [rfIgnoreCase]);
HTML := StringReplace(HTML, '.</a>', '', [rfIgnoreCase]);
end;
Result := SList.Text;
SList.Free;
end;
except
end;
end;
function GetSiteCount(HTML: string): string; {分解HTML代碼中虛擬主機的總數的函數}
var
P1, p2: integer;
begin
if Pos('</b> Total', HTML) < 1 then Exit;
P1 := Pos('hosts <b>', HTML) + 9;
P2 := Pos('</b> Total', HTML);
Result := Copy(HTML, P1, P2 - P1);
end;
procedure proQuerySite; {查詢IP上綁定多少域名的過程}
var
HTMLCode: string;
SiteSumCount: string;
i, j, N: integer;
begin
try
with MainForm do
begin
HTMLCode := UrlGetStr('http://whois.webhosting.info/' + EdIP.Text +
'?pi=' + inttostr(PageNum) + '&ob=SLD&oo=ASC');
SiteSumCount := GetSiteCount(HTMLCode);
LbCount.Caption := '共有站點:' + SiteSumCount; {得到網站數量}
SiteList.Items.Text := CutSiteStr(HTMLCode); {得到該頁網址}
if ChkLoadUrl.Checked then
begin
if SiteList.Items.Count >= 1 then
begin
ScanListBox.Clear;
for n := 0 to SiteList.Items.Count - 1 do
ScanListBox.Items.Add('http://' + SiteList.Items[n]);
GBWaitScanLst.Caption := Format('待檢測網址: 1 - %d', [ScanListBox.Items.Count]);
end;
end;
LbPageShow.Caption := Format('本頁顯示: 1 - %d', [SiteList.Items.Count]);
LbPage.Caption := Format('當前頁面:%d頁', [PageNum]);
i := strtoint(SiteSumCount);
Timer1.Enabled := False;
Gauge1.Progress := 0;
if i < (50 * PageNum) then
MainForm.btnDownPage.Enabled := False
else
MainForm.btnDownPage.Enabled := True;
if PageNum = 1 then
btnUpPage.Enabled := False
else
btnUpPage.Enabled := True;
btnQuery.Enabled := True;
end;
except
end;
end;
procedure TMainForm.btnQueryClick(Sender: TObject); {查詢 & 上一頁 & 下一頁的執行過程}
var
D: DWORD;
begin
try
PageControl2.TabIndex := 0;
if Length(Trim(EdIP.Text)) < 8 then
begin
Pane1.Caption := '請輸入IP地址';
Exit;
end;
btnUpPage.Enabled := False; {不可執行}
btnDownPage.Enabled := False;
btnQuery.Enabled := False;
Gauge1.MaxValue := 100; {設置進度條最大值}
Timer1.Enabled := True;
LbShowprogress.Caption := '正在查詢中...';
case TButton(Sender).Tag of
0:
begin
PageNum := 1; {初始化翻頁的值為1}
BeginThread(nil, 0, @proQuerySite, nil, 0, D); {創建查詢虛擬主機的線程}
end;
1:
begin
if PageNum = 1 then Exit;
PageNum := PageNum - 1; {上一頁查詢}
BeginThread(nil, 0, @proQuerySite, nil, 0, D); {創建上一頁查詢的線程}
end;
2:
begin
PageNum := PageNum + 1; {下一頁頁查詢}
BeginThread(nil, 0, @proQuerySite, nil, 0, D); {創建下一頁查詢的線程}
end;
end;
except
end;
end;
procedure TMainForm.EdIPKeyPress(Sender: TObject; var Key: Char); {回車后同樣執行查詢過程}
var
D: DWORD;
begin
if key = #13 then
begin
PageControl2.TabIndex := 0;
if Length(Trim(EdIP.Text)) < 8 then
begin
Pane1.Caption := '請輸入IP地址';
Exit;
end;
btnUpPage.Enabled := False;
btnDownPage.Enabled := False;
btnQuery.Enabled := False;
Gauge1.MaxValue := 100; {設置進度條最大值}
Timer1.Enabled := True;
PageNum := 1;
LbShowprogress.Caption := '正在查詢中...';
BeginThread(nil, 0, @proQuerySite, nil, 0, D); {回車后創建查詢虛擬主機的線程}
end;
end;
procedure TMainForm.Timer2Timer(Sender: TObject); {自動關閉彈出的腳本提示窗口}
var
h: HWND;
begin
H := FindWindow('Internet Explorer_TridentDlgFrame', nil);
if H > 1 then
SendMessage(H, WM_CLOSE, 0, 0);
end;
procedure TMainForm.WebBrowser1DownloadBegin(Sender: TObject); {旁注檢測 - 重新瀏覽網頁時執行}
var
i: integer;
begin
if Chkinject.Checked then {判斷是否需要在瀏覽網頁時檢測注入點}
begin
Web_Scan_inject_Num := 0;
ScanInjectTimer.Enabled := True;
Web_Scan_Inject_bool := True;
Web_Scan_Inject_bool2 := True;
try
for i := 0 to 4 do {銷毀檢測注入點的線程}
// Web_Scan_Inject[i].Terminate;
except
end;
end;
end;
procedure TMainForm.Web_Scan_inject_Exit(sender: TObject); {旁注檢測 - 瀏覽網頁自檢測注入點線程退出后執行}
begin
Inc(Web_Scan_inject_Num);
if Web_Scan_inject_Num >= 5 then
begin
LbShowprogress.Caption := '提示:注入點檢測完畢!';
ScanInjectTimer.Enabled := False;
end;
end;
procedure TMainForm.WebBrowser1DocumentComplete(Sender: TObject; {旁注檢測 - 讀取Cookies及檢測注入點}
const pDisp: IDispatch; var URL: OleVariant);
var
All: IHTMLElementCollection;
Len, i, j: integer;
Item: OleVariant;
begin
try
if (Webbrowser1.LocationURL <> 'about:blank') and (Web_Scan_Inject_bool2) and
(Chkinject.Checked) and (Web_Scan_Inject_bool) then
begin
Timer2.Enabled := True;
LbShowprogress.Caption := '讀取連接地址中...';
end;
if not Webbrowser1.Busy then {瀏覽器已不在工作時讀取瀏覽器中的Cookies}
begin
Doc := WebBrowser1.Document as IHTMLDocument2;
if ChkCookies.Checked then {判斷是否需要在瀏覽網頁時自動讀取Cookies}
EditCookie.Text := Doc.cookie;
ListBox1.Items.Clear;
Timer2.Enabled := False;
All := Doc.Get_Links; {得到連接地址}
Len := All.length; {得到連接地址的數量}
if Chkinject.Checked then
begin
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -