📄 main.cpp
字号:
void __fastcall Tmain_f::tree_shareDblClick(TObject *Sender)
{
if (PageControl2->Left!=3)
{
PageControl2->Left=3;
PageControl2->Width=550;
} else
{
PageControl2->Left=280;
PageControl2->Width=270;
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::check_systemClick(TObject *Sender)
{
lookup_system=check_system->Checked;//查找系统信息
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::check_ServicesClick(TObject *Sender)
{
lookup_Services=check_Services->Checked;//查找系统信息
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::check_userClick(TObject *Sender)
{
lookup_user=check_user->Checked;//查找用户信息
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::BitBtn6Click(TObject *Sender)
{
thread_run=false;
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::BitBtn5Click(TObject *Sender)
{
do_select=true;
BitBtn4Click(NULL);
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::Button3Click(TObject *Sender)
{
int i=0;
if ((share_thread_no!=0)||(ping_thread_no!=0)||(scan_thread_no!=0))
{
ShowMessage("目前有线程在运行,不能继续");
return;
}
cur_ip=0; scan_port_ip=0; share_ip_no=0;
//取IP地址
main_list->Clear();
if (do_select)
main_list->Add(tree_ping->Selected->Text);
else
{
for (i=0;i<main_f->tree_ping->Items->Count;i++)
{
main_list->Add(main_f->tree_ping->Items->Item[i]->Text);
}
}
do_select=false;
if (main_list->Count==0)
{
ShowMessage("没有可检测的IP地址!不能继续");
return;
}
//用户
if (dict_f->user_list->Lines->Count==0)
{
dict_f->user_list->Lines->Add("Administrator");
}
//密码列表
port_lists->Clear();
port_lists->AddStrings(dict_f->pass_list->Lines);
port_lists->Insert(0,"");
report_f->Show(); //弹出结果窗体
report_f->Edit9->Text="0";
report_f->Edit1->Text="0";
i=StrToInt(Edit15->Text);
thread_run=true;
while (i>0)
{
if (share_thread_no<main_list->Count)
creat_share_pass();
i--;
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::Button5Click(TObject *Sender)
{
do_select=true;
Button3Click(NULL);
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::Button10Click(TObject *Sender)
{
int i=0;
if ((share_thread_no!=0)||(ping_thread_no!=0)||(scan_thread_no!=0))
{
ShowMessage("目前有线程在运行,不能继续");
return;
}
cur_ip=0; scan_port_ip=0; share_ip_no=0;
//取IP地址
main_list->Clear();
if (do_select)
{
for (i=0;i<main_f->ListBox2->Items->Count;i++)
if (ListBox2->Selected[i])
main_list->Add(main_f->ListBox2->Items->Strings[i]);
}
else
{
main_list->AddStrings(main_f->ListBox2->Items);
}
do_select=false;
if (main_list->Count==0)
{
ShowMessage("没有可检测的IP地址!不能继续");
return;
}
//用户
if (dict_f->user_list->Lines->Count==0)
{
dict_f->user_list->Lines->Add("sa");
}
//密码列表
port_lists->Clear();
port_lists->AddStrings(dict_f->pass_list->Lines);
port_lists->Insert(0,"");
report_f->Show(); //弹出结果窗体
report_f->Edit9->Text="0";
report_f->Edit1->Text="0";
i=StrToInt(Edit33->Text);//端口线程
thread_run=true;
thread_type=100;//100代表是检测sql密码的线程
while (i>0)
{
creat_sql_pass();
i--;
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::Button12Click(TObject *Sender)
{
do_select=true;
Button10Click(NULL);
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::ado_pubConnectComplete(TADOConnection *Connection,
const Error *Error, TEventStatus &EventStatus)
{
sql_cmd->Lines->Add(Error->_scw_Get_Description());
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::BitBtn7Click(TObject *Sender)
{
if ((share_thread_no!=0)||(ping_thread_no!=0)||(scan_thread_no!=0))
{
ShowMessage("目前有线程在运行,不能转换");
return;
}
int i=0,len;
switch (PageControl2->ActivePageIndex){
case 0 :for(i=0;i<tree_share->Items->Count;i++)
if (tree_share->Items->Item[i]->Level==0){
tree_ping->Items->Add(NULL,tree_share->Items->Item[i]->Text);
Edit9->Text=IntToStr(StrToInt(Edit9->Text)+1);
}
break;
case 1 :for(i=0;i<share_user->Items->Count;i++)
if (share_user->Items->Item[i]->Level==0){
tree_ping->Items->Add(NULL,share_user->Items->Item[i]->Text);
Edit9->Text=IntToStr(StrToInt(Edit9->Text)+1);
}
break;
case 2 :for(i=0;i<share_svr->Items->Count;i++)
if (share_svr->Items->Item[i]->Level==0){
tree_ping->Items->Add(NULL,share_svr->Items->Item[i]->Text);
Edit9->Text=IntToStr(StrToInt(Edit9->Text)+1);
}
break;
case 4 :for(i=0;i<share_system->Items->Count;i++)
if (share_system->Items->Item[i]->Level==0){
tree_ping->Items->Add(NULL,share_system->Items->Item[i]->Text);
Edit9->Text=IntToStr(StrToInt(Edit9->Text)+1);
}
break;
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::Button6Click(TObject *Sender)
{
report_f->Show(); //弹出结果窗体
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::TabSheet4Show(TObject *Sender)
{
Timer1->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::TabSheet4Hide(TObject *Sender)
{
Timer1->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::Timer1Timer(TObject *Sender)
{
Edit34->Text=IntToStr(this->ComponentCount);
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::thread_timeTimer(TObject *Sender)
{
int i;
thread_time->Enabled=false;
if (!thread_run) return;
switch (thread_type){
case 10:
i=StrToInt(Edit26->Text)-scan_thread_no;//端口线程
creat_scan_port(i);
break;
case 100:
i=StrToInt(Edit33->Text)-share_thread_no;//100代表是检测sql密码的线程
while (i>0){
if (cur_ip<main_list->Count){
creat_sql_pass();
i--;
}
else return;
} break;
case 110: creat_pop3_detect();//110代表是检测POP3的线程
break;
default :break;
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::BitBtn11Click(TObject *Sender)
{
Edit35->Text=IntToStr(this->ComponentCount);
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::share_conClick(TObject *Sender)
{
TTreeNode *SelNode =((TTreeView *)share_tree_m->PopupComponent)->Selected;
if (SelNode==NULL) return;
if (SelNode->Level!=0)
SelNode = SelNode->Parent;
AnsiString str="explorer.exe \\\\"+SelNode->Text;
WinExec(str.c_str(),SW_SHOW);
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::Tree_portKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
TClipboard * clip_text=new TClipboard();
if ((Key==67)&&Shift.Contains(ssCtrl))
{
clip_text->AsText=((TTreeView*)Sender)->Selected->Text;
}
if ((Key==86)&&Shift.Contains(ssCtrl))
{
if (((TTreeView*)Sender)->Selected!=NULL)
((TTreeView*)Sender)->Items->AddChild(((TTreeView*)Sender)->Selected,clip_text->AsText);
else
((TTreeView*)Sender)->Items->Add(NULL,clip_text->AsText);
}
clip_text->Free();
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::ListBox2KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
TClipboard * clip_text=new TClipboard();
if ((Key==67)&&Shift.Contains(ssCtrl))
{
clip_text->AsText=((TListBox*)Sender)->Items->Strings[ListBox2->ItemIndex];
}
if ((Key==86)&&Shift.Contains(ssCtrl))
{
((TListBox*)Sender)->Items->Add(clip_text->AsText);
}
clip_text->Free();
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::TabSheet1Show(TObject *Sender)
{
share_con->Visible=false;
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::TabSheet1Hide(TObject *Sender)
{
share_con->Visible=true;
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::Button9Click(TObject *Sender)
{
if (!(check_ip(Edit36->Text)&&check_ip(Edit37->Text)))
return;//检查IP是否合法
ping_ip_start=strtoip(Edit36->Text); ping_ip_stop=strtoip(Edit37->Text);
Bar->Max=ping_ip_stop-ping_ip_start;
thread_run=true;
thread_type=110;//110代表是检测POP3的线程
main_list->Clear();//即时取用户与密码列表
main_list->AddStrings(dict_f->user_list->Lines);
port_lists->Clear();//即时取用户与密码列表
port_lists->AddStrings(dict_f->pass_list->Lines);
if (pop3_auto->Checked)//自动查找
{
share_thread_no=0;//detect线程数量
share_ip_no=0;//detect_ip的位置指示
scan_thread_no=0;//detect_user位置指示
scan_port_no=0;//detect_Pass当前的端口号
Edit46->Text="0";Edit41->Text="0";
pass_no=0;
}
cur_ip=0;
if (CheckBox8->Checked)
creat_pop3_scan(StrToInt(Edit45->Text)); //建立线程
else
{
pop3_list->Items->Clear();Edit42->Text="0";Edit40->Text="0";
creat_pop3_scan(StrToInt(Edit45->Text)); //建立线程
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::BitBtn12Click(TObject *Sender)
{
share_thread_no=0;//detect线程数量
share_ip_no=0;//detect_ip的位置指示
scan_port_ip=0;//detect_user位置指示
scan_port_no=0;//detect_Pass当前的端口号
Edit46->Text="0";Edit41->Text="0";
pass_no=0;
thread_run=true;
do_select=false;
main_list->Clear();
main_list->AddStrings(dict_f->user_list->Lines);
port_lists->Clear();
port_lists->AddStrings(dict_f->pass_list->Lines);
Bar->Max=main_list->Count*port_lists->Count*pop3_list->Items->Count;
creat_pop3_detect();
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::pop3_autoClick(TObject *Sender)
{
BitBtn12->Enabled=!pop3_auto->Checked;
BitBtn16->Enabled=!pop3_auto->Checked;
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::BitBtn16Click(TObject *Sender)
{
share_thread_no=0;//detect线程数量
share_ip_no=0;//detect_ip的位置指示
scan_port_ip=0;//detect_user位置指示
scan_port_no=0;//detect_Pass当前的端口号
Edit46->Text="0";Edit41->Text="0";
pass_no=0;
thread_run=true;
do_select=true;
main_list->Clear();
main_list->AddStrings(dict_f->user_list->Lines);
port_lists->Clear();
port_lists->AddStrings(dict_f->pass_list->Lines);
Bar->Max=main_list->Count*port_lists->Count;
creat_pop3_detect();
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::BitBtn13Click(TObject *Sender)
{
if (pop3_list->Items->IndexOf(new_pop3->Text)==-1)
{
pop3_list->Items->Add(new_pop3->Text);
new_pop3->SelectAll();
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::pop3_infoDblClick(TObject *Sender)
{
if (PageControl3->Left!=3)
{
PageControl3->Left=3;
PageControl3->Width=550;
} else
{
PageControl3->Left=259;
PageControl3->Width=298;
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain_f::N8Click(TObject *Sender)
{
((TListBox *)listbox_m->PopupComponent)->Items->Clear();
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -