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

作者在 2007-03-02 08:06:00 发布以下内容
while(nStatus==ERROR_MORE_DATA);
return 0;
}

int users(PTSTR server)
{
PNET_DISPLAY_USER pBuf,pBuffer;
DWORD nStatus;
DWORD dwRec;
DWORD i=0;
DWORD lerror;
DWORD dwLevel;

dwLevel=1;

_tprintf(_T("\n******* Users *******\n"));
do
{
nStatus=NetQueryDisplayInformation(server,dwLevel,i,100,0xFFFFFFFF,&dwRec,(PVOID *)&pBuf);
if((nStatus==ERROR_SUCCESS) || (nStatus==ERROR_MORE_DATA))
{
pBuffer=pBuf;
for(;dwRec>0;dwRec--)
{
_tprintf(_T("\nName:\t\t%s"),pBuffer->usri1_name);
_tprintf(_T("\nFull Name:\t%s"),pBuffer->usri1_full_name);
_tprintf(_T("\nUser ID:\t%u"),pBuffer->usri1_user_id);
_tprintf(_T("\nComment: \t%s"),pBuffer->usri1_comment);
_tprintf(_T("\nFlag:"));
if(pBuffer->usri1_flags & UF_ACCOUNTDISABLE)
{
_tprintf(_T("\t\tThe users account is disabled.\n"));
}
if(pBuffer->usri1_flags & UF_TRUSTED_FOR_DELEGATION)
{
_tprintf(_T("\t\tThe account is enabled for delegation. \n"));
}
if(pBuffer->usri1_flags & UF_LOC口T)
{
_tprintf(_T("\t\tThe account is currently locked out (blocked).\n"));
}
if(pBuffer->usri1_flags & UF_SMARTCARD_REQUIRED)
{
_tprintf(_T("\t\tRequires the user to log on to the user account with a smart card. \n"));
}
if(pBuffer->usri1_flags & UF_DONT_REQUIRE_PREAUTH)
{
_tprintf(_T("\t\tThis account does not require Kerberos preauthentication for logon.\n"));
}
if(pBuffer->usri1_flags & UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED)
{
_tprintf(_T("\t\tThe users password is stored under reversible encryption in the Active Directory. \n"));
}
if(pBuffer->usri1_flags & UF_NOT_DELEGATED)
{
_tprintf(_T("\t\tMarks the account as \"sensitive\"; other users cannot act as delegates of this user account.\n"));
}
if(pBuffer->usri1_flags & UF_USE_DES_KEY_ONLY)
{
_tprintf(_T("\t\tRestrict this principal to use only Data Encryption Standard (DES) encryption types for keys.\n"));
}
if(pBuffer->usri1_flags & UF_HOMEDIR_REQUIRED)
{
_tprintf(_T("\t\tThe home directory is required. Windows NT/Windows 2000/Windows XP ignores this value.\n"));
}
if(pBuffer->usri1_flags & UF_SCRIPT)
{
_tprintf(_T("\t\tThe logon script executed. This value must be set for LAN Manager 2.0 and Windows NT/2000/XP.\n"));
}
i=pBuffer->usri1_next_index;
pBuffer++;
}
}
else
{
lerror=GetLastError();
if(lerror==997)
{
_tprintf(_T("\nUsers:\t\tOverlapped I/O operation is in progress.\n"));
}
else
{
_tprintf(_T("\nUsers Error:\t%d\n"),lerror);
}
}
if(pBuf!=NULL)
{
NetApiBufferFree(pBuf);
}
}while(nStatus==ERROR_MORE_DATA);
return 0;
}

int localgroup(PTSTR server)
{
NET_API_STATUS nStatus;
PLOCALGROUP_INFO_1 pBuf,pBuffer;
DWORD i,dwLevel;
DWORD er,tr,resume;
DWORD lerror;

resume=0;
dwLevel=1;

_tprintf(_T("\n**** Local Group ****\n"));
do
{
nStatus=NetLocalGroupEnum(server,dwLevel,(PBYTE *)&pBuf,MAX_PREFERRED_LENGTH,&er,&tr,&resume);
if((nStatus==NERR_Success) || (nStatus==ERROR_MORE_DATA))
{
pBuffer=pBuf;
for(i=1;i<=er;i++)
{
_tprintf(_T("\nName:\t\t%s"),pBuffer->lgrpi1_name);
_tprintf(_T("\nComment:\t%s"),pBuffer->lgrpi1_comment);
_tprintf(_T("\n"));
pBuffer++;
}
}
else
{
lerror=GetLastError();
if(lerror==997)
{
_tprintf(_T("\nLocal Group:\tOverlapped I/O operation is in progress.\n"));
}
else
{
_tprintf(_T("\nLocal Group Error:\t%d\n"),lerror);
}
}
if(pBuf!=NULL)
{
NetApiBufferFree(pBuf);
}
}while(nStatus==ERROR_MORE_DATA);
return 0;
}

int globalgroup(PTSTR server)
{
PNET_DISPLAY_GROUP pGBuf,pGBuffer;
PGROUP_USERS_INFO_0 pUBuf,pUBuffer;
DWORD nGStatus,nUStatus;
DWORD i;
DWORD dwLevel,d
━╅点滴╆━ | 阅读 1471 次
文章评论,共0条
游客请输入验证码
浏览458470次