青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

S.l.e!ep.¢%

像打了激速一樣,以四倍的速度運(yùn)轉(zhuǎn),開心的工作
簡(jiǎn)單、開放、平等的公司文化;尊重個(gè)性、自由與個(gè)人價(jià)值;
posts - 1098, comments - 335, trackbacks - 0, articles - 1
  C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

HOOK SSDT Hide Process (五)

Posted on 2009-10-26 13:41 S.l.e!ep.¢% 閱讀(729) 評(píng)論(0)  編輯 收藏 引用 所屬分類: RootKit
對(duì) HOOK SSDT Hide Process (四) 的code改進(jìn)了一下,支持Display Process's Owner
在 XP 下進(jìn)行測(cè)試沒(méi)發(fā)現(xiàn)問(wèn)題,但在 Win7 下只能顯示當(dāng)前用戶的 Process, 其它用戶還有一些 NETWORK SERVICE
的進(jìn)程無(wú)法顯示出來(lái)

Code:
#include?<stdlib.h>
#include?
<stdio.h>
#include?
<windows.h>

typedef?
long?NTSTATUS;

#define?ULONG_PTR?ULONG

#define?STATUS_INFO_LENGTH_MISMATCH?((NTSTATUS)0xC0000004L)

#define?NT_SUCCESS(Status)?((NTSTATUS)(Status)>=0)?

//
//?Unicode?strings?are?counted?16-bit?character?strings.?If?they?are
//?NULL?terminated,?Length?does?not?include?trailing?NULL.
//

typedef?
struct?_UNICODE_STRING
{
????USHORT?Length;
????USHORT?MaximumLength;
????PWSTR??Buffer;

}?UNICODE_STRING,?
*PUNICODE_STRING;

//
//?Thread?priority
//

typedef?LONG?KPRIORITY;

//-----------------------------------------------------------------------------
//?Query?system?information

typedef?
enum?_SYSTEM_INFORMATION_CLASS
{
????SystemBasicInformation,?????????????????
//?0x00?SYSTEM_BASIC_INFORMATION
????SystemProcessorInformation,?????????????//?0x01?SYSTEM_PROCESSOR_INFORMATION
????SystemPerformanceInformation,???????????//?0x02
????SystemTimeOfDayInformation,?????????????//?0x03
????SystemPathInformation,??????????????????//?0x04
????SystemProcessInformation,???????????????//?0x05
????SystemCallCountInformation,?????????????//?0x06
????SystemDeviceInformation,????????????????//?0x07
????SystemProcessorPerformanceInformation,??//?0x08
????SystemFlagsInformation,?????????????????//?0x09
????SystemCallTimeInformation,??????????????//?0x0A
????SystemModuleInformation,????????????????//?0x0B?SYSTEM_MODULE_INFORMATION
????SystemLocksInformation,?????????????????//?0x0C
????SystemStackTraceInformation,????????????//?0x0D
????SystemPagedPoolInformation,?????????????//?0x0E
????SystemNonPagedPoolInformation,??????????//?0x0F
????SystemHandleInformation,????????????????//?0x10
????SystemObjectInformation,????????????????//?0x11
????SystemPageFileInformation,??????????????//?0x12
????SystemVdmInstemulInformation,???????????//?0x13
????SystemVdmBopInformation,????????????????//?0x14
????SystemFileCacheInformation,?????????????//?0x15
????SystemPoolTagInformation,???????????????//?0x16
????SystemInterruptInformation,?????????????//?0x17
????SystemDpcBehaviorInformation,???????????//?0x18
????SystemFullMemoryInformation,????????????//?0x19
????SystemLoadGdiDriverInformation,?????????//?0x1A
????SystemUnloadGdiDriverInformation,???????//?0x1B
????SystemTimeAdjustmentInformation,????????//?0x1C
????SystemSummaryMemoryInformation,?????????//?0x1D
????SystemNextEventIdInformation,???????????//?0x1E
????SystemEventIdsInformation,??????????????//?0x1F
????SystemCrashDumpInformation,?????????????//?0x20
????SystemExceptionInformation,?????????????//?0x21
????SystemCrashDumpStateInformation,????????//?0x22
????SystemKernelDebuggerInformation,????????//?0x23
????SystemContextSwitchInformation,?????????//?0x24
????SystemRegistryQuotaInformation,?????????//?0x25
????SystemExtendServiceTableInformation,????//?0x26
????SystemPrioritySeperation,???????????????//?0x27
????SystemPlugPlayBusInformation,???????????//?0x28
????SystemDockInformation,??????????????????//?0x29
????
//SystemPowerInformation,???????????????//?0x2A
????
//SystemProcessorSpeedInformation,??????//?0x2B
????
//SystemCurrentTimeZoneInformation,?????//?0x2C
????
//SystemLookasideInformation????????????//?0x2D

}?SYSTEM_INFORMATION_CLASS,?
*PSYSTEM_INFORMATION_CLASS;

//
//?Process?information
//?NtQuerySystemInformation?with?SystemProcessInformation
//

typedef?
struct?_SYSTEM_PROCESS_INFORMATION?{
????ULONG?NextEntryOffset;
????ULONG?NumberOfThreads;
????LARGE_INTEGER?SpareLi1;
????LARGE_INTEGER?SpareLi2;
????LARGE_INTEGER?SpareLi3;
????LARGE_INTEGER?CreateTime;
????LARGE_INTEGER?UserTime;
????LARGE_INTEGER?KernelTime;
????UNICODE_STRING?ImageName;
????KPRIORITY?BasePriority;
????ULONG_PTR?UniqueProcessId;
????ULONG_PTR?InheritedFromUniqueProcessId;
????ULONG?HandleCount;
????
//?Next?part?is?platform?dependent

}?SYSTEM_PROCESS_INFORMATION,?
*PSYSTEM_PROCESS_INFORMATION;

typedef?NTSTATUS?
?(NTAPI?
*PNFNtQuerySystemInformation)(
????IN?SYSTEM_INFORMATION_CLASS?SystemInformationClass,
????OUT?PVOID?SystemInformation,
????IN?ULONG?SystemInformationLength,
????OUT?PULONG?ReturnLength
????);

PNFNtQuerySystemInformation?pNtQuerySystemInformation;

//???
//?GetProcessUsername()???
//???
/*

While?I?have?not?yet?had?time?to?thoroughly?test?this?solution,?
it's?working?well?for?me?so?far?(I?just?finished?this?initial?version?in?the?last?couple?of?hours).?Posting?here?because?I?searched?all?over?before?deciding?to?try?a?different?approach,?and?could?not?find?one.?It?seems?that?the?DEBUG?privilege?will?allow?you?to?open?a?process?handle,?but?not?necessairly?the?process?tokens.?No?back?door?for?that!
I?have?been?able?to?use?GetUserObjectSecurity()?from?an?Admin?account?to?get?the?Owner?SID?for?the?process,?and?that?generally?turns?out?to?be?the?user?who?started?the?process.?Several?system?processes?show?"Builtin\Administrators"?for?their?owner?for?my?purposes?I?return?NULL?for?those?(other?code?then?defaults?the?user?to?"SYSTEM"?to?match?TaskMgr).?You?will?still?need?the?DEBUG?privilege?for?this?to?work?(else?OpenProcess?could?fail).
I?adapted?this?code?from?another?post?I?found?that?used?the?well-known?OpenProcessToken?pathway.?It?isn't?very?pretty,?but?as?I?said?I?just?got?it?working.?Note?the?need?for?STANDARD_RIGHTS_READ?on?the?hProcess.?I?also?have?PROCESS_QUERY_INFORMATION?and?PROCESS_VM_READ?included?in?my?calling?code?(for?access?to?other?process?information)?and?have?not?tried?calling?GetProcessUsername()?on?a?handle?without?these?set?to?see?if?that?works?or?not.
NOTE?THAT?THE?RESULT?IS?RETURNED?AS?A?STATIC!!?It?would?be?cleaner?to?let?the?caller?pass?in?a?buffer?(in?fact?there?are?lots?of?things?that?should?be?cleaned?up?in?this?sample).?It?nonetheless?demonstrates?the?concept.
Since?I?just?came?up?with?this?and?have?had?limited?time?to?test?it,?if?you?use?it?please?let?me?know?if?it?works?(or?doesn't)?for?your?application:
*/
//?Get?username?and?domain?from?a?supplied?process?handle.???
//???
//?hProcess?:?is?the?process?handle?of?which???
//???to?get?the?username?from.???
//???
//?bIncDomain?:?if?true?will?prepend?the?DOMAIN?and??to????
//???the?returned?string.???
//???
//?Returns?a?reference?to?a?static?string?containing?the????
//?username?or?NULL?on?error.???
//????
//???
char*?GetProcessUsername(HANDLE?hProcess,?BOOL?bIncDomain)???
{???
????
static?char?sname[300];???
????
char?name[300],?dom[300],?*pret?=?0;???
????SECURITY_DESCRIPTOR?
*psd?=?NULL;???
????BOOL?b;???
????
int?iUse,?rc;???
????DWORD?d;???
????SECURITY_INFORMATION?SecInfo?
=?OWNER_SECURITY_INFORMATION;???
????
????
//?This?Is?a?round-about?method?I?discovered.?Instead?of?OpenProcessToken?and?GetTokenInformation?use?GetUserObjectSecurity?and?pull???
????
//?the?OWNER?information.?Ignore?BUILTIN?Administrators?group?as?an?owner?(we?want?that?to?show?up?as?SYSTEM).?Using?the?tokens?is???
????
//?subject?to?ACCESS?DENIED?errors?on?OpenProcessToken,?even?for?administrators.?This?work?around?seems?to?work?regardless.?Unclear????
????
//?what?the?diff?between?GetUserObjectSecurity?and?GetKernelObjectSecurity?is.?So?stick?with?GetUserObjectSecurity?for?now.???
????
//?Requires?STANDARD_RIGHTS_READ?on?hProcess?(in?OpenProcess?call).???
????
????
//b?=?GetKernelObjectSecurity(hProcess,?SecInfo,?psd,?0,?&d);???
????b?=?GetUserObjectSecurity(hProcess,?&SecInfo,?psd,?0,?&d);???
????rc?
=?GetLastError();???
????psd?
=?(SECURITY_DESCRIPTOR?*)malloc(d);???
????
if?(psd?!=?NULL)???
????{???
????????memset?(psd,?
0,?d);???
????????
//b?=?GetKernelObjectSecurity(hProcess,?SecInfo,?psd,?d,?&d);???
????????b?=?GetUserObjectSecurity(hProcess,?&SecInfo,?psd,?d,?&d);???
????????
if?(b)???
????????{???
????????????PSID?psidOwner;???
????????????BOOL?bDefaulted;???
????????????b?
=?GetSecurityDescriptorOwner(psd,?&psidOwner,?&bDefaulted);???
????????????
if?(IsValidSid(psidOwner)?)???
????????????{???
????????????????
//?We?have?a?valid?Owner?SID.?Decode?it???
????????????????DWORD?dlen?=?sizeof(dom);???
????????????????DWORD?nlen?
=?sizeof(name);???
????????????????b?
=?LookupAccountSid(0,?psidOwner,?name,?&nlen,?dom,?&dlen,?(PSID_NAME_USE)&iUse);???
????????????????
if?(b?&&?lstrcmpi(dom,?"Builtin")?!=?0?&&?lstrcmpi(dom,?"Administrators")?!=?0)???
????????????????{???
????????????????????
//copy?info?to?our?static?buffer???
????????????????????if?(dlen?&&?bIncDomain)???
????????????????????{???
????????????????????????lstrcpy(sname,dom);???
????????????????????????lstrcat(sname,
"\\");???
????????????????????????lstrcat(sname,name);???
????????????????????}????
????????????????????
else???
????????????????????????lstrcpy(sname,name);???
????????????????????
//set?our?return?variable???
????????????????????pret?=?sname;???
????????????????}???
????????????????
else???
????????????????????rc?
=?GetLastError();???
????????????}???
????????}???
????????
else???
????????????rc?
=?GetLastError();???
????}???
????
????
if?(psd?!=?NULL)???
????????free?(psd);???
????
return?pret;???
}???

BOOL?QueryThreadInfo()
{
????HMODULE?hMod?
=?GetModuleHandle("ntdll.dll");

????
if?(hMod?==?NULL)
????{
????????hMod?
=?LoadLibrary("ntdll.dll");
????????
if?(hMod?==?NULL)
????????{
????????????printf(
"LoadLibrary?Error:?%d\n",?GetLastError());
????????????
return?FALSE;
????????}
????}

????pNtQuerySystemInformation?
=?(PNFNtQuerySystemInformation)GetProcAddress(hMod,?"NtQuerySystemInformation");

????
if(?pNtQuerySystemInformation?==?NULL?)
????{
????????printf(
"GetProcAddress?for?NtQuerySystemInformation?Error:?%d\n",?GetLastError());
????????
return?FALSE;
????}

//?????ULONG?dwNumberBytes?=?0x8000;
//?????char*?pBuf?=?(char*)malloc(dwNumberBytes);
//?????PSYSTEM_PROCESS_INFORMATION?pProcessInfo?=?(PSYSTEM_PROCESS_INFORMATION)pBuf;
????ULONG?nNeedSize?=?0;
????
????NTSTATUS?nStatus?
=?pNtQuerySystemInformation(SystemProcessInformation,?NULL,?NULL,?&nNeedSize);
????
????
if?(STATUS_INFO_LENGTH_MISMATCH?!=?nStatus)
????{
????????
return?FALSE;
????}

????PVOID?lpBuffer?
=?LocalAlloc(LPTR,?nNeedSize);

????
if?(NULL?==?lpBuffer)
????{
????????
return?FALSE;
????}

????nStatus?
=?pNtQuerySystemInformation(SystemProcessInformation,?lpBuffer,?nNeedSize,?0);

????
if?(NT_SUCCESS(nStatus))
????{
????????PSYSTEM_PROCESS_INFORMATION?ProcessInfo?
=?(PSYSTEM_PROCESS_INFORMATION)lpBuffer;

????????
while(?NULL?!=?ProcessInfo?)?
????????{????????
????????????
char?szANSIString[MAX_PATH];???
????????????memset(szANSIString,?
0,?MAX_PATH);
????????????WideCharToMultiByte(CP_ACP,?
????????????????WC_COMPOSITECHECK,
????????????????ProcessInfo
->ImageName.Buffer,
????????????????
-1,?
????????????????szANSIString,?
????????????????
sizeof(szANSIString),?
????????????????NULL,
????????????????NULL);

????????????printf(
"%d??",?ProcessInfo->UniqueProcessId);
????????????printf(
"%s??",?szANSIString);

????????????HANDLE?hProcess?
=?::OpenProcess(PROCESS_ALL_ACCESS,?FALSE,?ProcessInfo->UniqueProcessId);
????????????printf(
"%s??",?GetProcessUsername(hProcess,?FALSE));
????????????CloseHandle(hProcess);
????????????printf(
"\n");

????????????
if?(?ProcessInfo->NextEntryOffset?)
????????????{
????????????????ProcessInfo?
=??(PSYSTEM_PROCESS_INFORMATION)
????????????????????((DWORD)ProcessInfo?
+?(DWORD)(ProcessInfo->NextEntryOffset));
????????????}
????????????
else
????????????{
????????????????ProcessInfo?
=?NULL;
????????????}
????????}

????????
return?TRUE;
????}
????
else
????{
????????LocalFree(lpBuffer);
????????
return?FALSE;
????}

????
return?FALSE;
}

int?main()
{
????
if(?!QueryThreadInfo()?)
????{
????????printf(
"QueryThreadInfo?Error!\n");
????????
return?0;
????}

????
return?0;
}


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            宅男噜噜噜66一区二区| 久久综合伊人| 亚洲在线一区| 亚洲美女毛片| 一区二区三区黄色| 日韩午夜av电影| 一区二区福利| 欧美一区二区三区视频免费| 久久er精品视频| 久久久久久亚洲精品中文字幕| 久久精品一区二区国产| 久久免费高清| 欧美日韩精品在线播放| 国产精品v日韩精品| 国模叶桐国产精品一区| 亚洲人成网站精品片在线观看| 亚洲美女啪啪| 亚洲在线一区| 麻豆成人小视频| 日韩午夜激情| 亚洲欧美影音先锋| 麻豆精品一区二区综合av| 欧美成人免费小视频| 欧美精品一区二区三区在线看午夜| 欧美成人午夜剧场免费观看| 欧美丝袜一区二区| 国产欧美精品国产国产专区| 国产精品日韩精品| 在线精品亚洲| 日韩一级免费| 欧美一区二区三区免费视| 欧美亚洲一区在线| 美女精品在线| 99日韩精品| 久久精品国产精品亚洲| 欧美激情1区2区| 欧美午夜精品一区| 国产一二三精品| 欧美日韩国产综合视频在线观看中文 | 欧美在线999| 久久婷婷国产综合国色天香| 美女精品网站| 亚洲视频网在线直播| 久久精品国产一区二区三区| 欧美国产日韩一区| 国产精品一级久久久| 在线观看中文字幕不卡| aa亚洲婷婷| 久久久免费观看视频| 亚洲日本中文| 欧美亚洲综合网| 欧美理论在线| 黄色成人在线网址| 99在线精品免费视频九九视| 久久久久久网址| 欧美精品免费在线| 亚洲午夜激情在线| 久久一区二区精品| 国产精品久久国产愉拍 | 久久久人成影片一区二区三区| 欧美激情精品久久久久久久变态| 国产精品日韩精品| 国产欧美日韩在线播放| 一区在线免费观看| 宅男噜噜噜66国产日韩在线观看| 欧美一区二区播放| 亚洲国产日韩一区| 久久精品成人一区二区三区蜜臀| 欧美日本一区二区三区| 亚洲电影网站| 久久久久久久久伊人| 亚洲视频一区二区免费在线观看| 老司机一区二区| 国产亚洲欧洲997久久综合| 在线中文字幕日韩| 亚洲福利视频一区二区| 久久久久国内| 激情av一区二区| 久久久久91| 欧美综合国产精品久久丁香| 国产日韩欧美一二三区| 亚洲欧美国产高清va在线播| 99re6热在线精品视频播放速度| 欧美成人首页| 亚洲精品在线一区二区| 久久精品官网| 久久国产夜色精品鲁鲁99| 欧美亚洲动漫精品| 亚洲视频在线二区| 一本色道精品久久一区二区三区| 女人香蕉久久**毛片精品| 一区二区三区在线高清| 老司机午夜精品视频| 久久在精品线影院精品国产| 激情亚洲网站| 欧美高清在线精品一区| 欧美福利电影网| 日韩一区二区精品| 亚洲免费电影在线| 欧美日韩在线观看视频| 欧美亚洲日本一区| 亚洲欧美日韩精品久久久| 欧美区视频在线观看| 欧美一区二区三区四区视频| 亚洲欧美成人在线| 国产午夜精品美女毛片视频| 久久久久一区| 久久尤物视频| 亚洲一区二区在线免费观看| 亚洲午夜一区| 在线观看一区| 亚洲精品精选| 国产精品亚发布| 免费亚洲一区二区| 欧美资源在线| 欧美激情一区二区三区全黄 | 久久久久久久久久久久久久一区| 一区二区三区在线观看视频| 欧美成人免费va影院高清| 欧美韩日亚洲| 欧美亚洲视频在线观看| 久久久久久综合| 宅男噜噜噜66一区二区66| 亚洲主播在线观看| 亚洲国产日韩欧美在线动漫| 一区二区三区导航| 在线欧美福利| 亚洲最黄网站| 亚洲激情第一页| 欧美一区二区大片| 国产一区二区三区成人欧美日韩在线观看 | 国产日韩欧美制服另类| 欧美电影免费观看高清| 国产精品黄色在线观看| 欧美顶级大胆免费视频| 国产精品综合| 亚洲理伦电影| 久久国产主播精品| 亚洲一区二区三| 欧美不卡一区| 亚洲精品乱码久久久久久| 国产伦精品一区二区三区在线观看 | 欧美中文字幕精品| 欧美日韩一区二区三区四区在线观看| 久久精品综合网| 国产精品久久二区二区| 亚洲激情国产精品| 影音先锋中文字幕一区| 欧美一级免费视频| 亚洲欧美激情视频在线观看一区二区三区| 亚洲免费婷婷| 亚洲国产欧美日韩| 噜噜噜噜噜久久久久久91| 在线不卡视频| 久久亚洲春色中文字幕| 久久综合狠狠综合久久综合88| 国产精品午夜在线观看| 亚洲日本黄色| 99在线热播精品免费| 免费欧美在线视频| 欧美高清你懂得| 亚洲人成绝费网站色www| 裸体歌舞表演一区二区| 美女诱惑黄网站一区| 精品69视频一区二区三区| 欧美专区福利在线| 麻豆久久婷婷| 亚洲人成网在线播放| 亚洲深夜av| 欧美精品麻豆| 欧美激情一区二区三区在线视频观看| 一区精品在线播放| 久久激情视频免费观看| 久久久蜜臀国产一区二区| 经典三级久久| 欧美成人一区二区三区在线观看| 亚洲第一综合天堂另类专| 最新日韩在线视频| 欧美日韩天天操| 亚洲一二三区在线| 在线综合亚洲| 欧美日韩一区二区三| 午夜久久福利| 免费成人激情视频| 一本色道久久综合| 国产精品免费福利| 久久精品视频亚洲| 欧美激情视频网站| 亚洲永久精品国产| 激情综合五月天| 欧美激情一区在线观看| 亚洲少妇最新在线视频| 久久一二三四| 99re8这里有精品热视频免费| 欧美午夜精品伦理| 久久久久久久一区二区| 91久久亚洲| 久久视频精品在线| 亚洲免费高清| 国产老肥熟一区二区三区|