?? 網(wǎng)絡評估view.cpp
字號:
// 網(wǎng)絡評估View.cpp : implementation of the CMyView class
//
#include "stdafx.h"
#include "網(wǎng)絡評估.h"
#include "網(wǎng)絡評估Doc.h"
#include "網(wǎng)絡評估View.h"
#include "MainFrm.h"
#include "madedlg.h"
/////////////////111111111111111
#include "fstream.h"
#include <lm.h>
#include <windows.h>
#include <assert.h>
#include <sql.h>
#include <sqlext.h>
#include <afxmt.h>
/////////11
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyView所有的全局函數(shù)
////////////////////////11111111111111111111111111111111111111
#define WM_REDRAW (WM_USER+1)
#define ID_LISTCTRL (WM_USER+2)
struct cgi{
char *rmt_host;
CMyView *pView;
char *url;
int n;
};
CEvent fEvent;
CWinThread* Thread[10];
HANDLE hThread[10];
typedef UINT (CALLBACK* LPFNDLLFUNC1)(LPWSTR,LPBYTE *);
LPFNDLLFUNC1 NetRemoteTOD_dll;
typedef UINT (CALLBACK* LPFNDLLFUNC2)(LPWSTR,DWORD,
LPBYTE *,DWORD,
LPDWORD,LPDWORD,LPDWORD);
LPFNDLLFUNC2 NetServerTransportEnum_dll;
typedef UINT (CALLBACK* LPFNDLLFUNC3)(LPWSTR,unsigned long,
unsigned long,unsigned long,
unsigned long,unsigned long*,PVOID *);
LPFNDLLFUNC3 NetQueryDisplayInformation_dll;
typedef UINT (CALLBACK* LPFNDLLFUNC4)(LPWSTR,unsigned long,
LPBYTE *,unsigned long,
unsigned long*,unsigned long*,unsigned long *);
LPFNDLLFUNC4 NetShareEnum_dll;
typedef UINT (CALLBACK* LPFNDLLFUNC5)(PSHARE_INFO_502);
LPFNDLLFUNC5 NetApiBufferFree_dll;
typedef UINT (CALLBACK* LPFNDLLFUNC6)(PSHARE_INFO_1);
LPFNDLLFUNC6 NetApiBufferFree_dll1;
typedef UINT (CALLBACK* LPFNDLLFUNC7)(PNET_DISPLAY_USER);
LPFNDLLFUNC7 NetApiBufferFree_dll2;
typedef UINT (CALLBACK* LPFNDLLFUNC8)(PNET_DISPLAY_GROUP);
LPFNDLLFUNC8 NetApiBufferFree_dll3;
typedef UINT (CALLBACK* LPFNDLLFUNC9)(LPSERVER_TRANSPORT_INFO_0);
LPFNDLLFUNC9 NetApiBufferFree_dll4;
typedef UINT (CALLBACK* LPFNDLLFUNC10)(LPTIME_OF_DAY_INFO);
LPFNDLLFUNC10 NetApiBufferFree_dll5;
typedef UINT (CALLBACK* LPFNDLLFUNC11)(LPTSTR, DWORD,LPBYTE *);
LPFNDLLFUNC11 NetServerGetInfo_dll;
typedef UINT (CALLBACK* LPFNDLLFUNC12)(LPTSTR, DWORD,LPBYTE *);
LPFNDLLFUNC12 NetWkstaGetInfo_dll;
typedef UINT (CALLBACK* LPFNDLLFUNC13)(LPSERVER_INFO_101);
LPFNDLLFUNC13 NetApiBufferFree_dll6;
typedef UINT (CALLBACK* LPFNDLLFUNC14)(LPWKSTA_INFO_102);
LPFNDLLFUNC14 NetApiBufferFree_dll7;
typedef UINT (CALLBACK* LPFNDLLFUNC15)(
LPWSTR ,
DWORD ,
LPBYTE,
LPDWORD
);
LPFNDLLFUNC15 NetUseAdd_dll;
typedef UINT (CALLBACK* LPFNDLLFUNC16)(LPTSTR, LPTSTR, DWORD);
LPFNDLLFUNC16 NetUseDel_dll;
//const CStringList & operator = (const CStringList & a);
/*CStringList& operator = (CStringList& a)
{
CStringList b;
// b=new CStringList;
CString str;
POSITION pos=a.GetHeadPosition();
while(pos)
{
str=a.GetNext(pos);
b.AddTail(str);
}
return b;
}*/
/*UINT pScan(LPVOID pParam)
{
struct port* tport=(struct port *)pParam;
int port=tport->p;
int num=tport->n;
char *rmt_host=tport->rmt_host;
SOCKET sockfd;
SOCKADDR_IN addr;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
{
exit(0);
}
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = inet_addr(rmt_host);
int r = connect(sockfd,(struct sockaddr *) &addr, sizeof(addr));
closesocket(sockfd);
if (r!=-1)
{
::PostMessage(hWnd,WM_DISPLAY,port,0);
}
return 0;
}*/
UINT scanports(void *lParam)
{
CMyView*pView=(CMyView*)lParam;
pView->AddString("開始端口掃描.....");
CString strlist;
BOOL m_winb=TRUE;
m_winb=ScanPorts(pView->m_destIp,strlist,pView->m_stringPorts);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkPortsnum," OPEN PORTS",pView->bright);
else
pView->updatelist(pView->m_checkPortsnum," OPEN PORTS",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 1;
}
UINT sharesscan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=SharesScan(pView->m_destIp,strlist,pView->m_stringShares);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkSharesnum," SHARES",pView->bright);
else
pView->updatelist(pView->m_checkSharesnum," SHARES",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
UINT usersscan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=UsersScan(pView->m_destIp,strlist,pView->m_stringUsers);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkUsersnum," USERS",pView->bright);
else
pView->updatelist(pView->m_checkUsersnum," USERS",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
UINT groupsScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=GroupsScan(pView->m_destIp,strlist,pView->m_stringGroups);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkGroupsnum," GROUPS",pView->bright);
else
pView->updatelist(pView->m_checkGroupsnum," GROUPS",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
UINT transportsScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=TransportsScan(pView->m_destIp,strlist,pView->m_stringTransports);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkTransportsnum," TRANSPORTS",pView->bright);
else
pView->updatelist(pView->m_checkTransportsnum," TRANSPORTS",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
UINT datetimeScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=DatetimeScan(pView->m_destIp,strlist,pView->m_stringDateTime);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkDateTimenum," DATETIME",pView->bright);
else
pView->updatelist(pView->m_checkDateTimenum," DATETIME",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
UINT servicesScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=ServicesScan(pView->m_destIp,strlist,pView->m_stringServices);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkServicesnum," SERVICES",pView->bright);
else
pView->updatelist(pView->m_checkServicesnum," SERVICES",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
UINT sessionsScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=SessionsScan(pView->m_destIp,strlist,pView->m_stringSessions);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkSessionsnum," SESSIONS",pView->bright);
else
pView->updatelist(pView->m_checkSessionsnum," SESSIONS",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
UINT registryScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=RegistryScan(pView->m_destIp,strlist,pView->m_stringRegistry);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkRegistrynum," REGISTRY",pView->bright);
else
pView->updatelist(pView->m_checkRegistrynum," REGISTRY",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
UINT massScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
LPTSTR ServerName=NULL;
LPWSTR ServerName1=NULL;
wchar_t Temp[100]=L"";
swprintf(Temp,L"\\\\%S",(LPCTSTR)pView->m_destIp);
ServerName = (LPTSTR)Temp;
ServerName1 = (LPWSTR)Temp;
EstablishNullSession(ServerName1,TRUE);
stormscan(ServerName,(LPVOID)pView);
EstablishNullSession(ServerName1,FALSE);
Sleep(1000);
fEvent.SetEvent();
return 0;
}
UINT fScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=FScan(pView->m_destIp,strlist,pView->m_stringFtp);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkFtpnum," FTP",pView->bright);
else
pView->updatelist(pView->m_checkFtpnum," FTP",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
p->m_wndStatusBar.SetPaneText(2,str);
p->m_wndStatusBar.Invalidate();
}
pView->stopupdate();//停止動畫
return 0;
}
//SMTP漏洞掃描線程
UINT sScan(LPVOID lParam)
{
CMyView*pView=(CMyView*)lParam;
CString strlist;
BOOL m_winb=TRUE;
m_winb=SmtpScan(pView->m_destIp,strlist,pView->m_stringSMTP);
pView->AddString(strlist);
if(m_winb==TRUE)
pView->updatelist(pView->m_checkSMTPnum," SMTP",pView->bright);
else
pView->updatelist(pView->m_checkSMTPnum," SMTP",pView->bwrong);
CMainFrame*p=(CMainFrame*)AfxGetApp()->GetMainWnd();
CString str="";
if(m_winb==TRUE)
{
//pView->wrong++;
str.Format(" 當前掃描系統(tǒng)漏洞數(shù): %d/%d",pView->wrong,pView->wrong);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -