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

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>
            亚洲国内自拍| 国产午夜精品一区二区三区视频| 欧美激情一区二区三区成人| 欧美在线观看视频在线| 欧美一区二区精美| 久久久久中文| 美女精品国产| 亚洲国产91| 在线亚洲欧美视频| 午夜日韩电影| 麻豆av一区二区三区久久| 欧美激情视频一区二区三区在线播放 | 亚洲欧美中文日韩v在线观看| 亚洲精品精选| 亚洲欧美日韩一区在线| 久久久精品五月天| 欧美激情第五页| 欧美视频一区二区| 国产在线欧美日韩| 亚洲美女中出| 久久精品国产久精国产爱| 欧美高清不卡在线| 亚洲日本中文| 久久精品72免费观看| 欧美国产日韩一区二区在线观看| 在线一区二区三区做爰视频网站 | 麻豆精品视频在线观看| 亚洲国产天堂久久综合网| 亚洲调教视频在线观看| 久久视频一区| 国产精品色婷婷久久58| 亚洲久久一区二区| 久久国产精品免费一区| 亚洲日本中文字幕免费在线不卡| 亚洲午夜在线| 欧美日韩不卡一区| 激情文学一区| 亚洲一区二区欧美| 亚洲日本va午夜在线电影| 久久国产精品亚洲77777| 欧美日韩国产va另类| 国产一区二区久久| 欧美一级视频一区二区| 99国产精品99久久久久久| 久久久噜噜噜久久中文字免| 国产精品久久久久天堂| 日韩一区二区久久| 狂野欧美激情性xxxx欧美| 亚洲免费一区二区| 国产精品久久久久一区二区三区共 | 亚洲影视中文字幕| 亚洲精品黄色| 欧美大胆a视频| 极品日韩av| 久久丁香综合五月国产三级网站| 日韩午夜在线| 欧美三级午夜理伦三级中文幕 | 99国产精品国产精品久久| 久久婷婷影院| 欧美一区二区三区电影在线观看| 欧美三日本三级少妇三2023| 日韩系列欧美系列| 亚洲第一精品影视| 免费亚洲电影| 亚洲精品免费网站| 亚洲人成网站777色婷婷| 欧美电影免费观看| 亚洲少妇诱惑| 香蕉成人久久| 国内精品亚洲| 老司机67194精品线观看| 久久久久久伊人| 亚洲另类黄色| 国内一区二区在线视频观看 | 久久夜色精品亚洲噜噜国产mv| 亚洲欧美日韩精品久久| 国产一区二区中文| 麻豆精品网站| 欧美精品在线一区二区| 亚洲一区在线观看视频| 亚洲欧美精品| 亚洲激情影院| 亚洲色图在线视频| 国产在线拍揄自揄视频不卡99 | 久热re这里精品视频在线6| 美女诱惑黄网站一区| 亚洲免费激情| 亚洲一区二区三区四区在线观看| 国产精品综合网站| 欧美成人黑人xx视频免费观看| 欧美—级高清免费播放| 欧美亚洲免费电影| 麻豆精品传媒视频| 亚洲影院免费观看| 麻豆精品网站| 欧美综合77777色婷婷| 美腿丝袜亚洲色图| 午夜老司机精品| 欧美aaa级| 久久精品国产精品亚洲| 欧美成人中文| 久久久水蜜桃| 国产精品av久久久久久麻豆网| 久久久久在线| 国产精品久久久久久模特| 欧美成人午夜激情视频| 国产麻豆精品视频| 亚洲经典自拍| 国产在线精品一区二区中文 | 亚洲精品久久久久久久久久久久| 国产精品爽爽ⅴa在线观看| 欧美成人黄色小视频| 国产欧美日韩精品专区| 亚洲看片免费| 亚洲国产电影| 久久精品欧美日韩| 午夜激情综合网| 欧美黄污视频| 亚洲第一精品影视| 一区在线观看视频| 性做久久久久久久免费看| 这里只有精品在线播放| 美女视频黄 久久| 久久婷婷亚洲| 韩国成人理伦片免费播放| 一本色道久久综合狠狠躁篇怎么玩 | 一本大道久久a久久综合婷婷| 韩国女主播一区| 午夜天堂精品久久久久| 中文国产一区| 欧美日韩亚洲综合一区| 亚洲国产成人精品久久| 性欧美激情精品| 久久综合色播五月| 久久青草欧美一区二区三区| 国产精品主播| 亚洲欧美日韩在线高清直播| 亚洲综合欧美| 国产精品欧美久久| 亚洲私人影院| 亚洲欧美成人| 国产精品一区在线播放| 午夜在线精品偷拍| 久久久久国产精品一区| 国内视频精品| 可以免费看不卡的av网站| 欧美波霸影院| 亚洲国产精品123| 欧美不卡视频一区| 亚洲理论在线观看| 亚洲欧美综合网| 国内精品久久久| 美日韩丰满少妇在线观看| 亚洲欧洲日本一区二区三区| 日韩一级二级三级| 国产精品白丝jk黑袜喷水| 性欧美办公室18xxxxhd| 欧美大香线蕉线伊人久久国产精品| 在线日本高清免费不卡| 美女成人午夜| 一区二区三区欧美成人| 久久精品人人做人人综合| 精品动漫3d一区二区三区免费版 | 欧美性色aⅴ视频一区日韩精品| 亚洲视频中文| 久久在线免费观看| aa日韩免费精品视频一| 国产视频一区欧美| 欧美成人中文| 亚洲尤物视频网| 欧美成人精品福利| 亚洲欧美日韩精品| 精品999成人| 欧美日韩在线精品一区二区三区| 亚洲男女毛片无遮挡| 久久综合久久综合九色| 一区二区三区**美女毛片| 国内偷自视频区视频综合| 欧美日韩1区2区3区| 香蕉成人伊视频在线观看| 欧美激情免费在线| 欧美在线999| 99国产精品99久久久久久粉嫩| 国产乱码精品一区二区三区av| 欧美r片在线| 久久国产毛片| 亚洲色图制服丝袜| 最新中文字幕一区二区三区| 久久精品水蜜桃av综合天堂| 日韩一级黄色大片| 在线不卡中文字幕播放| 国产精品亚洲综合天堂夜夜| 久久一区二区视频| 亚洲欧美日韩一区二区在线| 亚洲精品中文字幕有码专区| 狂野欧美激情性xxxx欧美| 欧美一区二视频| 亚洲综合日韩在线| 亚洲私人影院在线观看| 一本色道久久88综合日韩精品|