Jump to content
Sign in to follow this  
Manko

ProDLLer: Unknown code running? Befriend or Kill!

Recommended Posts

post-28581-0-99756400-1317831005_thumb.j

Know your system!

Prod your system for unwanted code! (virus/malware)

Please report bugs/requests/criticism or whatever!

ProDLLer v0.503

Update: 23rd of October 2011

ProDLLer.rar

Earlier versions downloaded: 2726 times.

Most Recent changes...
 
; 0.503
; Fixed: Don't leave icon in tray when leaving, XP/7.
; Fixed: Don't leave them after crash either.
; Added: Don't allow shutdown or standby while ProDLLing in XP, Thanks to Prog@ndy. Vista/7, dont alow shutdown.
; Added: Don't let ProDLLer be put to sleep by idletimers in xp/vista/7.
; Fixed: Lockup when returning from sleep in vista/7, . (if "Noprocs" running then disable "noprocs" and resume all procs.)
; Change: No suspending of "theme"-service in XP. On crash, just resume all processes... like we have to in vista/7...
 
; 0.502
; Fixed: Gui-problem fixed by BeginPaint/endpaint... tested on win7
; Fixed: "Crashnet" and SuspendAll. In the unlikely event that this happens. All procs will be resumed on vist and win7.
; Fixed: Fixed false positives in SSDTshadow on vista/win7.
 
; 0.501
; Added: SSDTshadow - not complete, but fully functional. = lacking names. (Logic is painful; need to guard against faults...)
; Fixed: Lockup in crashnet if "Services.exe" and "System" is suspended. Just resume them... You can suspend again...
; Fixed: Further lockups, same, to do with themes and "lsass.exe"...
 
; 0.500
; Added: Startup-killing... to take a load off the GUI... it will ask...
; Fixed: Slowdown because I accidentaly changed ProDLLer to itterate processes every second...
; Fixed: Process-CPU-utilization. Movement of abandoned children... I cheat. Just load up new list...
; Fixed: Got rid of the Adlib. There were too many possible problems...
; Fixed: CPU-load. Is again aligned...
 
; 0.499
; Added: If over 16 procs start from 1 sec to another or if a total of 40 procs have started; "NoProcsAllowed" is activated.
; Added: Crash-recovery... Just start a new instance of ProDLLer... :)
; Change: No loading of moduleinfo at start.
; Added: Refresh moduleinfo when we need it. KINDA CLUNKY SINCE I ITERATE ALL OF THEM, RIGHT NOW....
; Added: On start of app. Disallow new procs. "NoProcsAllowed" is activated.
; Fixed: A number of bugs that crash Prodller if insane amounts of processes start and stop...
 
; 0.498
; Fixed: "KernelNot.". When disabling callbacks; adjacent CBs of same type would sometimes vanish. Famous anti-rootkit had same faulty behavior.
 
; 0.497
; Fixed: Lockup when suspending some procs during modules-itteration. Context-menu disabled during itteration.
; Fixed: Lockup after thread-view due to excessive killing of already terminated security-threads... Now checking IF it needs killing...
; Fixed: Lockup when trying to change state of services while it is already working with your earlier request. Disable display.

Thanks for functions:

Thanks to "Smoke_N" for his "_ProcessListModules()"! Apparently i borrowed it a looooong time ago. :)

Thanks to "Engine" for his GREAT "Windows Services UDF"!!!

Thanks to JScript, Larry, SmOke_N, mrRevoked for _ProcessGetPath. I used this because I'm too lazy to do one myself. :)

Special thanks to:

Thanks to wraithdu for help and support!

Thanks to Ascend4nt for support and friendship!

Thanks to trancexx for good talks and friendship!

Thanks also to this great community! I really feel empowered!

/Manko [EDIT: New version.]

Edited by Manko

Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

Nice idea. However, if you want people to be able to compile / play with it, you'll have to provide the "service.au3" and "skeleton.sys" files. Of course that's totally up to you :)

Edited by wraithdu

Share this post


Link to post
Share on other sites

Nice idea. However, if you want people to be able to compile / play with it, you'll have to provide the "service.au3" and "skeleton.sys" files. Of course that's totally up to you :)

Thanks! Files now included in first post! I will however not be ferreting out all files for compiling driver in masm32. :)

They are all standard/unmodified but you need the update and the DDK and maybe something else...?

Well if a need arises and it's impossible to find some masm_includefile or other... maybe... PM me...

But driver is included, so it should not be necessary for most.

/Manko


Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

I took your ColdBoot code out of here, and why doesn't it work just standalone?

#include <service.au3>

FileInstall("c:\skeleton.sys","c:\")
_StopService(".","skeleton")
_DeleteService(".","skeleton")
My_Service_Create("skeleton","Skeleton Driver","c:\skeleton.sys",$SERVICE_KERNEL_DRIVER,$SERVICE_DEMAND_START,$SERVICE_ERROR_IGNORE,0)
_StartService("skeleton")
_DeleteService(".","skeleton")
$test=DllStructCreate("char a[128]")
DllStructSetData($test,1,"\\.\skeleton")


$hColdBoot=DllCall("kernel32.dll", "int", "CreateFile", "ptr", DllStructGetPtr($test), "dword", 0xc0000000, "dword", 0, "dword", 0, "dword", 3, "dword", 0, "dword", 0)
DllCall("kernel32.dll", "int", "DeviceIoControl", "dword", $hColdBoot,"dword", 0x00226000, "ptr", 0, "dword", 0, "ptr", 0, "dword", 4, "dword*", 0, "ptr", 0)

Func My_Service_Create($sServiceName, _
                    $sDisplayName, _
                    $sBinaryPath, _
                    $nServiceType = 0x00000010, _
                    $nStartType = 0x00000002, _
                    $nErrorType = 0x00000001, _
                    $nDesiredAccess = 0x000f01ff)
   Local $hAdvapi32
   Local $hKernel32
   Local $arRet
   Local $hSC
   Local $lError = -1   

   $hAdvapi32 = DllOpen("advapi32.dll")
   If $hAdvapi32 = -1 Then Return 0
   $hKernel32 = DllOpen("kernel32.dll")
   If $hKernel32 = -1 Then Return 0
   $arRet = DllCall($hAdvapi32, "long", "OpenSCManager", _
                    "str", ".", _
                    "str", "ServicesActive", _
                    "long", $SC_MANAGER_ALL_ACCESS)
   If $arRet[0] = 0 Then
      $arRet = DllCall($hKernel32, "long", "GetLastError")
      $lError = $arRet[0]
   Else
      $hSC = $arRet[0]
      $arRet = DllCall($hAdvapi32, "long", "OpenService", _
                       "long", $hSC, _
                       "str", $sServiceName, _
                       "long", $SERVICE_INTERROGATE)
      If $arRet[0] = 0 Then
         $arRet = DllCall($hAdvapi32, "long", "CreateService", _
                          "long", $hSC, _
                          "str", $sServiceName, _
                          "str", $sDisplayName, _
                          "long", $nDesiredAccess, _
                          "long", $nServiceType, _
                          "long", $nStartType, _
                          "long", $nErrorType, _
                          "str", $sBinaryPath, _
                          "int", 0, _
                          "ptr", 0, _
                          "int", 0, _
                          "int", 0, _
                          "int", 0)
         If $arRet[0] = 0 Then          
            $arRet = DllCall($hKernel32, "long", "GetLastError")
            $lError = $arRet[0]
         Else
            DllCall($hAdvapi32, "int", "CloseServiceHandle", "long", $arRet[0])
         EndIf
      Else
         DllCall($hAdvapi32, "int", "CloseServiceHandle", "long", $arRet[0])
      EndIf   
      DllCall($hAdvapi32, "int", "CloseServiceHandle", "long", $hSC)
   EndIf
   DllClose($hAdvapi32)
   DllClose($hKernel32)   
   If $lError <> -1 Then 
      SetError($lError)
      Return 0
   EndIf
   Return 1
EndFunc

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

1. I took your ColdBoot code out of here, and why doesn't it work just standalone?

2. I do like it. It's something I've never thought to do before. But I can't see where/how I would really use it.

Hi!

1. Because a DllCall returns an array and you took out this part:

if $hColdBoot[0] = -1 Then 
    msgbox(0,"","Could not aquire cold boot handle!",5)
    $hColdboot=0
Else
    $hColdboot=$hColdBoot[0] ; ###### - Gets the result from the first arrayparameter into the single variable... - ####### 
EndIfoÝ÷ Øò¢çhmÁ©íjYm«r¢çȦ¦©àzÚ-+ºÚ"µÍØ[
    ][ÝÚÙ[Ì ][ÝË  ][ÝÚ[ ][ÝË  ][ÝÑ]XÙR[ÐÛÛÛ    ][ÝË  ][ÝÙÛÜ  ][ÝË  ÌÍÚÛÛÛÝÌK   ][ÝÙÛÜ  ][ÝË  ][ÝÜ][ÝË    ][ÝÙÛÜ  ][ÝË  ][ÝÜ][ÝË    ][ÝÙÛÜ  ][ÝË
    ][ÝÙÛÜ
][ÝË  ][ÝÜ][ÝË
oÝ÷ ÛeX­ßÛ¶%~Ýz׶)àjwkzj/x&j­çeÌ!Èkz¨Ê&zIèÂWçë¢kaz^­«h®ÊZ®Óµéæj­è§}ç-³*.®Ì¬µéÊ)ãyËbe)í£*.®Úî²×¦ºz˱©Ý²Ö²¶«xZ½êÞrÞ­çfj|¬ÊË^ÆòiÊ&n)Ú¶*'¡ûh¢[ºÚ/z¹h¢F§uæ¬zî±èZ±·ªk¡¹^«¶'.ªåÉú+¶¬¥ªí¡ûaz·¦¢ö¥¦ºzË·ljȦ¦WiËm«Zد»¬jlv÷öÖ¥Á¬¬vaz*ã¡´¨!Ú'ßÛkz¨Ø^»p!Øm¶§-Yai×(uè§~ì¶b§u×¥zاǫ¾'ANDG+y«b§vËZ®Ø§pjÈî²Û(ëax¦ëb«hëbëhëk¢éݶiËm«HÁ«©àz)ථ+Þ¬­Ø½é¦ºé¬Z²²­¶)ජajwex"[Zè­¢ëpéÈìm«Þj{©u«^÷öÙ'£!z{ajÜ"VÞ6m«_ºYh~'^jÆ®¶­sdfÆTç7FÆÂgV÷C¶3¢b3#·6¶VÆWFöâç72gV÷C²ÂgV÷C¶3¢b3#²gV÷C²¥õ7F÷6W'f6RgV÷C²âgV÷C²ÂgV÷C·6¶VÆWFöâgV÷C²²222222222ÒDTÄUDRD2ÄäRÒ2222222220¥ôFVÆWFU6W'f6RgV÷C²âgV÷C²ÂgV÷C·6¶VÆWFöâgV÷C²²222222222ÒDTÄUDRD2ÄäRÒ2222222220¤×õ6W'f6Uô7&VFRgV÷C·6¶VÆWFöâgV÷C²ÂgV÷Cµ6¶VÆWFöâG&fW"gV÷C²ÂgV÷C¶3¢b3#·6¶VÆWFöâç72gV÷C²Âb33cµ4U%d4Uô´U$äTÅôE$dU"Âb33cµ4U%d4UôDTÔäEõ5D%BÂb33cµ4U%d4UôU%$õ%ôtäõ$RÃ¥õ7F'E6W'f6RgV÷C·6¶VÆWFöâgV÷C²¥ôFVÆWFU6W'f6RgV÷C²âgV÷C²ÂgV÷C·6¶VÆWFöâgV÷C²¢b33c·FW7CÔFÆÅ7G'V7D7&VFRgV÷C¶6"³#ÒgV÷C²¤FÆÅ7G'V7E6WDFFb33c·FW7BÃÂgV÷C²b3#²b3#²âb3#·6¶VÆWFöâgV÷C²

/Manko


Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

AWESOME and UNBELIEVABLE ! When i first saw the title , i thought that it'll never be possible but ..

*Loss of words*..

Thanks for sharing !

Share this post


Link to post
Share on other sites

Thanks for sharing !

Thanks for the high praise! Hope it will be useful for you!

Have updated app in first post.

Now it lists processes in parent/child order with indentation. Now you can see what proc started which proc. +it gets easier to read.

(On the downside, it sortof broke sorting of that column... but I wanted to release now and maybe fix later.)

Added info on Company/description/priority/full path

Proclistwindow is larger and it is resizeable!

/Manko


Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

way cool! It's not like I'll be using it daily but there are situations when I really need this sort of app...

Bug thing: when resizing the window or moving the lists separator the whole thing flickers and the left list goes over the right one until i release the mouse button... not sure if this is because my cpu has only 1500 mhz

thx for sharing

Share this post


Link to post
Share on other sites

way cool! It's not like I'll be using it daily but there are situations when I really need this sort of app...

Bug thing: when resizing the window or moving the lists separator the whole thing flickers and the left list goes over the right one until i release the mouse button... not sure if this is because my cpu has only 1500 mhz

thx for sharing

Hi!

It's more like, I'm a crappy programmer. I actually don't know how to make it resize prettily... Ie tracking the mouse, making changes...

App worked in other respects, so I didn't bother. *blush*

Thanks for taking time and effort to comment!

/Manko

[EDIT: Have fixed much prettier resizing... (both listviews follow mouse like they should) Will not release and bump thread now though...]

Edited by Manko

Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

Problem resolved with new function!

A WARNING to potential users. Since I have a very clean system. I have not realised just how REALLY dangerous suspending threads can be. I just thought that if I kept updating lists of exceptions like for:

"csrss.exe" - NEVER supend on winXP, as this handles keyboard and mouse, and you would not be able to do anything else.

"ctfmon.exe" - App would be unresponsive, and might lock...

"fsgk.exe" - F-Secure antivirus. App would lock. This is used at work. BLODY SLOW AND USELESS...

...all would be good... But then I discovered lots more on laptops and readyinstalled package - brand name - systems... These procs all locked the system... They were too many!!! I had to find the cause.... And discovered it in Global message hooks. (SetWindowsHookEx)

So I started researching a way to warn the user of which processes had set these hooks. A possible way was to set a hook one self that would monitor hooks. WH_DEBUG which would return among others what sort of hook would be called and which process had installed it.

LRESULT CALLBACK DebugProc(   
    int nCode,
    WPARAM wParam,; Returns what sort of hook will be called
    LPARAM lParam   ; Returns below struct...
);

The lParam would return a pointer to the below struct.

typedef struct {
    DWORD idThread;
    DWORD idThreadInstaller;    THIS would return what I wanted. But always return 0. !!!! :( 
    LPARAM lParam;
    WPARAM wParam;
    int code;
} DEBUGHOOKINFO, *PDEBUGHOOKINFO;

Problem resolved with new function!

No matter what I did... It did not work. All the other fields in the struct is filled, but NOT the one I needed. (Of course I had put it in dll... And fiddled with security descriptors and such... no game!)I googled for days, only to find that noone could solve this and all had the same problem. :) I have continued to google and am on the track of a solution involving kernel drivers and undocumented structures deep in kernelspace... My Leads are:

http://www.experts-exchange.com/Programmin...Q_22405364.html

http://zairon.wordpress.com/2006/12/06/any...-on-my-machine/

http://www.woodmann.com/forum/archive/index.php/t-11537.html

This won't be fixed soon, so now you know, and have been warned. And I have no experience with kernel drivers... (The one I have is form a skeleton source, which I have shoves my two line code for rebooting into...)

I have to continue searching...

/Manko [EDIT:Problem resolved with new function!]

Edited by Manko

Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

the code gives me unendless errors

Have you downloaded extras? (The includes must ofcourse be in the INCLUDEs directory.) :)

Are you using Windows XP? (Prefered, maybe required...)

Are you administrator? (Required!)

Are you using AutoIt v3.3.0.0?

If that doesn't help, what are the errors? first error?

Thanks for replying! Don't see that often... :lmao:

/Manko

Edited by Manko

Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

yes at all but the errors r code related like endswitch and missing separators as i remember

Edit : line 80 _service_start("Skeleton") in correct number of parameters

i guess the services.au3 that i have is out dated or maybe urs

Edited by yehia

Share this post


Link to post
Share on other sites

yes at all but the errors r code related like endswitch and missing separators as i remember

Edit : line 80 _service_start("Skeleton") in correct number of parameters

i guess the services.au3 that i have is out dated or maybe urs

I'm guessing, if you switch to the provided services.au3, errors will go away. Make a copy of yours so you can switch back.

If that doesn't help, maybe you can give me more info...

/Manko


Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

how can i just list all the loaded dlls in an array?

Here you go!

Apparently I borrowed the module_func from Smoke_N a loooong time ago. Credits to him!!!

I just put it in my originally SMALL script and quickly forgot about it... :)

Never thought about publishing own code, back then...

I have used these APIs before, but AM lazy, so since I wasn't accustomed to Autoit-coding I just took it when I found one readymade.

#AutoIt3Wrapper_outfile=C:\TEST1.exe
#include <WinAPI.au3>   ; _GetPrivilege_SEDEBUG() - by wraithdu - uses this include. My function needs none.
#include <array.au3>    ; Needed to display array in example. Not needed by Func.

; ############ Example code #######################
#RequireAdmin

Global $avArray[100000][7], $iAdd = 0, $i
_GetPrivilege_SEDEBUG() ; I need this for tricky processes. Not needed for most...
Global $procs=ProcessList()
$avArray[0][0] = "ProcessName"
$avArray[0][1] = "th32ProcessID"
$avArray[0][4] = "ProccntUsage"
$avArray[0][5] = "modBaseSize"
$avArray[0][2] = "hModule"
$avArray[0][3] = "szModuleName"
$avArray[0][6] = "szExePath"
for $i= 3 to ubound($procs,1)-1
$iAdd+=1
_ProcessListModules($procs[$i][1])
Next
ReDim $avArray[$iAdd+1][7]
_arraydisplay($avArray, "Credits to Smoke_N for func... I just slightly modified it.")
; ###############################################


; ############ Here be func! #################### Credits to Smoke_N (Just searched for it...)
Func _ProcessListModules($dwPID)
    Local Const $TH32CS_SNAPMODULE = 0x08
    Local $aDLLCall, $tagMODULEENTRY32, $hModuleSnap
    $aDLLCall = DllCall("Kernel32.dll", "ptr", "CreateToolhelp32Snapshot", "int", $TH32CS_SNAPMODULE, "dword", $dwPID)
    $hModuleSnap = $aDLLCall[0]
    $tagMODULEENTRY32 = DllStructCreate("dword;dword;dword;dword;dword;byte;dword;ptr;char[256];char[257]")
    DllStructSetData($tagMODULEENTRY32, 1, DllStructGetSize($tagMODULEENTRY32))
    $aDLLCall = DllCall("Kernel32.dll", "int", "Module32First", "ptr", $hModuleSnap, "long", DllStructGetPtr($tagMODULEENTRY32))
    While 1
;~      typedef struct tagMODULEENTRY32 {
        ;$avArray[$iAdd][0] = DllStructGetData($tagMODULEENTRY32, 1) ;~             DWORD   dwSize;
        $avArray[$iAdd][0] = $procs[$i][0]
        ;$avArray[$iAdd][1] = DllStructGetData($tagMODULEENTRY32, 2) ;~             DWORD   th32ModuleID;
        $avArray[$iAdd][1] = DllStructGetData($tagMODULEENTRY32, 3) ;~          DWORD   th32ProcessID;
        ;$avArray[$iAdd][3] = DllStructGetData($tagMODULEENTRY32, 4) ;~             DWORD   GlblcntUsage;
        $avArray[$iAdd][4] = DllStructGetData($tagMODULEENTRY32, 5) ;~          DWORD   ProccntUsage;
        ;$avArray[$iAdd][5] = DllStructGetData($tagMODULEENTRY32, 6) ;~             BYTE  * modBaseAddr;
        $avArray[$iAdd][5] = DllStructGetData($tagMODULEENTRY32, 7) ;~          DWORD   modBaseSize;
        $avArray[$iAdd][2] = DllStructGetData($tagMODULEENTRY32, 8) ;~          HMODULE hModule;
        $avArray[$iAdd][3] = DllStructGetData($tagMODULEENTRY32, 9) ;~          char    szModule[MAX_MODULE_NAME32 + 1];
        $avArray[$iAdd][6] = DllStructGetData($tagMODULEENTRY32, 10);~          char    szExePath[MAX_PATH];
;~      } MODULEENTRY32;
        $aDLLCall = DllCall("kernel32", "int", "Module32Next", "ptr", $hModuleSnap, "long", DllStructGetPtr($tagMODULEENTRY32))
        If Not $aDLLCall[0] Then ExitLoop
        $iAdd += 1
    WEnd
    DllCall("Kernel32.dll", "int", "CloseHandle", "ptr", $hModuleSnap)
    Return
EndFunc   ;==>_ProcessListModules

; ####################### Below Func is Part of example - Needed to get commandline from more processes.
; ####################### Thanks to wraithdu!
Func _GetPrivilege_SEDEBUG()
    Local $tagLUIDANDATTRIB = "int64 Luid;dword Attributes"
    Local $count = 1
    Local $tagTOKENPRIVILEGES = "dword PrivilegeCount;byte LUIDandATTRIB[" & $count * 12 & "]" ; count of LUID structs * sizeof LUID struct
    Local $TOKEN_ADJUST_PRIVILEGES = 0x20
    Local $call = DllCall("advapi32.dll", "int", "OpenProcessToken", "ptr", _WinAPI_GetCurrentProcess(), "dword", $TOKEN_ADJUST_PRIVILEGES, "ptr*", "")
    Local $hToken = $call[3]
    $call = DllCall("advapi32.dll", "int", "LookupPrivilegeValue", "str", Chr(0), "str", "SeDebugPrivilege", "int64*", "")
    ;msgbox(0,"",$call[3] & " " & _WinAPI_GetLastErrorMessage())
    Local $iLuid = $call[3]
    Local $TP = DllStructCreate($tagTOKENPRIVILEGES)
    Local $LUID = DllStructCreate($tagLUIDANDATTRIB, DllStructGetPtr($TP, "LUIDandATTRIB"))
    DllStructSetData($TP, "PrivilegeCount", $count)
    DllStructSetData($LUID, "Luid", $iLuid)
    DllStructSetData($LUID, "Attributes", $SE_PRIVILEGE_ENABLED)
    $call = DllCall("advapi32.dll", "int", "AdjustTokenPrivileges", "ptr", $hToken, "int", 0, "ptr", DllStructGetPtr($TP), "dword", 0, "ptr", Chr(0), "ptr", Chr(0))
    Return ($call[0] <> 0) ; $call[0] <> 0 is success
EndFunc   ;==>_GetPrivilege_SEDEBUG

/Manko


Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually...

Share this post


Link to post
Share on other sites

thanks alot man

What i'm going to do with it is a "dll scanner that would point out a spy or trojan threads injected to windows services"

thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • By RAMzor
      Hello all!
      I got the Acroname Programmable USB Hub based on BrainStem platform. I will use it to manage ports and read current.
      They have development kit (BRAINSTEM DEVELOPMENT KIT) with examples for any languages like C#, C++, LabVIEW and python but no AutoIt.
      The kit include BrainStem2.dll (x32 and x64), BrainStem2_LabVIEW.dll, BrainStem2CLI.dll and many examples.
      Anyone used this dll and implemented it in AutoIt?
      Please share some example for Device Discovering, User LED Flashing or power enable/disable on port to start play with this HUB
      BrainStem Reference 
       
      BrainStem2 lib+example.7z USB HUB User Manual s79-usbhub-3p_v1.10_0.pdf
    • By matwachich
      Hi guys!
      A pretty simple UDF to convert HTML to PDF using wkHTMLtoPDF.
      It uses the C API of the tool (DLL), so no external process, no ActiveX or COM sh*t.
      See the example, and the documentation of wkHTMLtoPDF.
      Cheers
      https://github.com/matwachich/wkhtmltopdf-au3
    • By Skysnake
      This is relevant
      From here https://stackoverflow.com/questions/3454315/is-it-possible-to-pin-a-dll-in-memory-to-prevent-unloading
      I use several UDFs on the Forum to do various things.  Those UDFs work very well.
      Effectively the UDFs are DLL wrappers, that make it possible to access DLL functions easily without the long hard slog of DLLCall() every time.
      However, I have now run into the issue that multiple UDF DLLCalls are slow. Not mind numbingly slow, but slow enough to become noticeable with a large of repeated function calls.
      So I was wondering, is it possible to "load a DLL into memory" and leave it there for the duration of my script's lifetime, avoid repeated DLL on-disk reads with a persistent in memory DLL?
      From Microsoft
      https://docs.microsoft.com/en-us/windows/desktop/dlls/about-dynamic-link-libraries
      Looks like what I want to do is: load-time dynamic linking,
      So next question, (a) how do I do this with AutoIt (b) How would this impact on standard AutoIt type DLL calls?
       
      The point is speed.  Is there a different approach?
      Or am I barking up the wrong tree?
      Skysnake
    • By bladem2003
      Hello,
      i need help to translate the c code to autoit .
      I don't understand the callback function.
       
      #include <windows.h> #include <stdio.h> // native IR Data by PAnsiChar typedef void CALLBACK CallBackPAnsiChar(char*, char*, char*, char*); typedef int (__stdcall *impInitPAnsiChar)(CallBackPAnsiChar); CALLBACK MyCallBackPAnsiChar(char* Protocol, char* Address, char* Command, char* Flags) { printf("\nIR Data received: Protocol: %s, Address: 0x%s, Command: 0x%s, Flags: 0x%s", Protocol, Address, Command, Flags); fflush(stdout); } int main(int argc, char **argv) { impInitPAnsiChar InitPAnsiChar = NULL; // Load DLL file HINSTANCE hinstLib = LoadLibrary(TEXT("USB_IR_Remote_Receiver.dll")); if (hinstLib == NULL) { printf("\nERROR: unable to load DLL\n"); return 1; } // Get function pointer InitPAnsiChar InitPAnsiChar = (impInitPAnsiChar)GetProcAddress(hinstLib, "InitPAnsiChar"); if (InitPAnsiChar == NULL) { printf("\nERROR: unable to find DLL function\n"); FreeLibrary(hinstLib); return 1; } if (InitPAnsiChar(*MyCallBackPAnsiChar)) { printf("\nInit DLL with InitPAnsiChar successfull"); } else { // Unload DLL file FreeLibrary(hinstLib); return 0; } while(1) { } //return 0; }  
×
×
  • Create New...