黑客软件编写基础知识锦囊(源码1)

作者在 2007-03-02 08:05:00 发布以下内容


源代码

#define UNICODE
#define _UNICODE

#i nclude <windows.h>
#i nclude <winnetwk.h>
#i nclude <tchar.h>
#i nclude "include\lmaccess.h"
#i nclude "include\lmserver.h"
#i nclude "include\lmshare.h"
#i nclude <lm.h>

#pragma comment (lib,"mpr")
#pragma comment (lib,"netapi32")

void start();
void usage();
int datetime(PTSTR server);
int fingerprint(PTSTR server);
int netbios(PTSTR server);
int users(PTSTR server);
int localgroup(PTSTR server);
int globalgroup(PTSTR server);
int transport(PTSTR server);
int session(PTSTR server);

int wmain(int argc,TCHAR *argv[])
{
NETRESOURCE nr;
DWORD ret;
TCHAR username[100]=_T("");
TCHAR password[100]=_T("");
TCHAR ipc[100]=_T("");

system("cls.exe");
start();
if(argc!=2)
{
usage();
return -1;
}
swprintf(ipc,_T("\\\\%s\\ipc$"),argv[1]);
nr.lpLocalName=NULL;
nr.lpProvider=NULL;
nr.dwType=RESOURCETYPE_ANY;
nr.lpRemoteName=ipc;
ret=WNetAddConnection2(&nr,username,password,0);
if(ret!=ERROR_SUCCESS)
{
_tprintf(_T("\nIPC$ Connect Failed.\n"));
return -1;
}

datetime(argv[1]);
fingerprint(argv[1]);
netbios(argv[1]);
users(argv[1]);
localgroup(argv[1]);
globalgroup(argv[1]);
transport(argv[1]);
session(argv[1]);

ret=WNetCancelConnection2(ipc,0,TRUE);
if(ret!=ERROR_SUCCESS)
{
_tprintf(_T("IPC$ Disconnect Failed.\n"));
return -1;
}
return 0;
}

void start()
{
_tprintf(_T("=====[ T-SMB Scan, by TOo2y ]=====\n"));
_tprintf(_T("=====[ E-mail: TOo2y@safechina.net ]=====\n"));
_tprintf(_T("=====[ HomePage: www.safechina.net ]=====\n"));
_tprintf(_T("=====[ Date: 12-12-2002 ]=====\n"));
}

void usage()
{
_tprintf(_T("\nUsage:\t T-SMB Remoteip"));
_tprintf(_T("\nRequest: Remote host must be opening port 445/tcp of Microsoft-DS.\n"));
}

int datetime(PTSTR server)
{
PTIME_OF_DAY_INFO pBuf=NULL;
NET_API_STATUS nStatus;
DWORD lerror;

_tprintf(_T("\n*** Date and Time ***\n"));
nStatus=NetRemoteTOD(server,(PBYTE*)&pBuf);
if(nStatus==NERR_Success)
{
if(pBuf!=NULL)
{
_tprintf(_T("\nCurrent date:\t%.2d-%.2d-%d"),pBuf->tod_month,pBuf->tod_day,pBuf->tod_year);
_tprintf(_T("\nCurrent time:\t%.2d:%.2d:%.2d.%.2d (GMT)"),pBuf->tod_hours,pBuf->tod_mins,pBuf->tod_secs,pBuf->tod_hunds);
pBuf->tod_hours=(pBuf->tod_hours+8)%24;
_tprintf(_T("\nCurrent time:\t%.2d:%.2d:%.2d.%.2d (GMT+08:00)\n"),pBuf->tod_hours,pBuf->tod_mins,pBuf->tod_secs,pBuf->tod_hunds);
}
}
else
{
lerror=GetLastError();
if(lerror==997)
{
_tprintf(_T("\nDateTime:\tOverlapped I/O operation is in progress. \n"));
}
else
{
_tprintf(_T("\nDatetime Error:\t%d\n"),lerror);
}
}
if(pBuf!=NULL)
{
NetApiBufferFree(pBuf);
}
return 0;
}

int fingerprint(PTSTR server)
{
DWORD dwlength;
DWORD dwLevel;
NET_API_STATUS nStatus;
PSERVER_INFO_101 pBuf;
DWORD lerror;

dwLevel=101;
pBuf=NULL;
dwlength=_tcslen(server);

_tprintf(_T("\n**** Fingerprint ****\n"));
nStatus=NetServerGetInfo(server,dwLevel,(PBYTE *)&pBuf);
if(nStatus==NERR_Success)
{
_tprintf(_T("\nComputername:\t%s"),pBuf->sv101_name);
_tprintf(_T("\nComment:\t%s"),pBuf->sv101_comment);
_tprintf(_T("\nPlatform:\t%d"),pBuf->sv101_platform_id);
_tprintf(_T("\nVersion:\t%d.%d"),pBuf->sv101_version_major,pBuf->sv101_version_minor);
_tprintf(_T("\nType:"));
if(pBuf->sv101_type & SV_TYPE_NOVELL)
{
_tprintf(_T("\t\tNovell server.\n"));
}
if(pBuf->sv101_type & SV_TYPE_XENIX_SERVER)
━╅点滴╆━ | 阅读 1668 次
文章评论,共0条
游客请输入验证码
浏览475022次