Giter Club home page Giter Club logo

deviare2's Introduction

Deviare is a professional hooking engine for instrumenting arbitrary Win32 functions, COM objects, and functions whose symbols are located in program databases (PDBs). It can intercept unmanaged code in 32-bit and 64-bit applications. It is implemented as a COM component, so it can be integrated with all the programming languages which support COM, such as C/C++, VB, C#, Delphi, and Python.

Several Fortune 500 companies are using Deviare technology for application virtualization, packaging, and troubleshooting, and for computer security. Computer science researchers are also using Deviare to conduct malware and reverse engineering studies. Our blog articles contain a vast quantity of code samples to get you started easily.

Deviare offers a unique programmer friendly API which resolves the complexities associated with binary instrumentation so that even software engineers without expertise in the field can use it. Deviare takes care of code injection, parameter marshalling, and inter-process communication. We created Deviare API in 2007 and continually improve it. Intercepting applications is a complex task. We test multiple application environments to ensure that the end user has a trouble-free experience. Deviare also has a focus on performance handling thousands of hooks with little footprint.

Code instrumentation is used in several other areas like: tracing and debugging, sandboxing and browser security, malware analysis, video conference recording, and gaming.

Download the latest binaries and source code from here.


MINIMUM REQUIREMENTS

Deviare runtime runs on any computer with Microsoft Windows XP or later OS installed.

To compile Deviare and/or build samples you need:

  • Visual Studio 2017.
  • .NET Framework 4.
  • Windows SDK 8 with all .NET Framework components installed.

NOTE: The database (.db) files you'll find in the BIN folder are NOT generated when building Deviare. Deviare needs these files to work. If you create new databases, don't forget to move them to the BIN folder. To create them you must first build the corresponding tools that are included in the solution. Refer to these instructions for further details.


BEFORE BUILDING

Since Deviare depends directly on Deviare-InProc, it is included as a submodule in this repository. To clone this repository do git clone --recursive. If you already cloned without the --recursive option, you can complete the repository initialization with git submodule update --init --recursive.

We recommend always executing git submodule update --init --recursive after pulling from this repository. This ensures the Deviare-InProc submodule is up to date with the HEAD of the Deviare2 branch.

If you downloaded the zipped source package from Github instead, you need to satisfy this dependency manually. To do so, place the contents of Deviare-InProc inside Externals/DeviareInProc.


BUILDING DEVIARE

To build Deviare you can either execute the build script (build.bat) in a VS2017 command prompt or open the solution and build it from within Visual Studio. When doing the latter, make sure to build for both x86 and x64 target platforms.


BUG REPORTS

If you experience something you think might be a bug in Deviare, please report it in the GitHub repository or write to us in our contact page.

Describe what you did, what happened, what kind of computer you have, which operating system you're using and anything else you think might be relevant.


LICENSING INFORMATION

This library has a dual license, a commercial one suitable for closed source projects and a GPL license that can be used in open source software.

Depending on your needs, you must choose one of them and follow its policies. A detail of the policies and agreements for each license type are available in the LICENSE.COMMERCIAL and LICENSE.GPL files.

For further information please refer to our licensing options or contact Nektra here.

This library uses a portion of UDis86 project, authored, copyrighted and maintained by Vivek Thampi. UDis86 is licensed under the terms of BSD License. For any questions referring to UDis86 contact the author at vivek[at]sig9[dot]com.

deviare2's People

Contributors

bzzzil avatar mxmauro avatar nelsonjchen avatar scnale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deviare2's Issues

C Sample

Hello all,

Is there a C sample?

Regards,

Injector_x86.asm does not assemble

Downloaded Deviare2-master, updated C++ tools, tried to compile DvEngine.sln.

Error: .text section not found File:CUSTOMBUILD Project:SpyMgrLib

A quick check of the file reveals no obvious deficiencies.

Any ideas?

appcrash on "Remove All Hooks" with CSharpConsole

appcrash in after hooked, remove the hook again.

  1. select any process and select kernel32.dll!CreateFile (maybe any functions)
    Snipaste_2019-12-13_20-05-10
  2. click "Remove All Hooks"
    Snipaste_2019-12-13_20-05-10
  3. let the program call
    Snipaste_2019-12-13_20-05-10

The program has crashed.

After I tried to track it, I found that
HookEngine.cpp#L806
CNktAutoFastMutex cLock(this) // crash point

Missing namespace in sample named "COMHookingBasis" under CSharp environment.

Currently I am trying run the code sample named "COMHookingBasis" under CSharp environment but I got this error as mentioned below:

Error CS0246: The type or namespace name 'Nektra' could not be found (are you missing a using directive or an assembly reference?)

Could you please help me solving this matter.

Thank you in advance.

CSharpConsole(64) crashed on Windows Server R2 x64

hi here,
I am new to windows programming. I finally got all the source code compiled. When I ran CSharpConsole(64) on ../Deviar2/bin, it crashed. I could run it be VS2015. And then, i tried to run it with COM samples by "regsvr32 XXX". They failed either. I tried to run CSharpConsole(64) again with VS2015. It crashed either. I found RunningProcesses() return NULL. What I can do to detour this error? Many thanks!

Hooking process creation/destruction not capturing all processes

I have downloaded and compiled Deviare from source.
Windows 7 x64 SP1
Python 2.7.9 Stackless 32bit
pywin32 220

when running the following code not all process creation/destruction notifications show. There are specific process that i am looking for that happen very quickly and some of them are getting passed by. I have tested this in many different ways. but in this example I am using threading.Event() to stall the process creation. but it seems to be the "sweet spot" 0.728 seconds. with 4 creation and 4 destruction notifications out of 10 processes created and destroyed.

please excuse the code this is for testing purposes and wasn't meant to be pretty

import os
import win32com.client
import ctypes
import sys
import threading

dllPath = os.path.join(os.path.split(__file__)[0], 'DeviareCOM.dll')
dll = ctypes.windll[dllPath]
dll.DllRegisterServer()


class ProcessEvents:

    def OnProcessStarted(self, pyPID):
        process = win32com.client.Dispatch(pyPID)

        name = process.Name.split('.')[0]
        pid = process.Id
        user = process.UserName

        print 'OnProcessStarted:', name, pid, user

    def OnProcessTerminated(self, pyPID):
        process = win32com.client.Dispatch(pyPID)
        name = process.Name.split('.')[0]
        pid = process.Id
        user = process.UserName

        print 'OnProcessTerminated:', name, pid, user

win32com.client.pythoncom.CoInitialize()

processManager = win32com.client.DispatchWithEvents("DeviareCOM.NktSpyMgr", ProcessEvents)
processManager.Initialize()

hook = processManager.CreateHook("kernel32.dll!CreateProcess", 0)
hook.Hook(True)

event = threading.Event()
event.set()


def run():
    while event.isSet():
        pass

    for i in range(10):
        os.system("cmd /c echo Test")
    event.wait(0.0728)


threading.Thread(target=run).start()

MessageBox = ctypes.windll.user32.MessageBoxW
event.clear()
MessageBox(None, "", "", 0)

I am not sure if this is normal behavior please advise

Stack overflow exception in dvAgent64.dll

I have windows 10 version 1607 (Build 14393) and using deviare 2.7.6 and recompiled with commenting "BuildOriginalNtCalls" function due to issue #16.

Now when testing in autocad application, it is giving Stack over flow exception in TlsSetValue inside Initialize().

I have upload crash dump to dropbox.

Please let me if you need more information.

_spyMgr.CreateProcess crashes at launch

Sorry to bug you here again. This is probably answered on the old forums, but I'm stuck.

I'm getting a crash at launch while using Deviare2:

First-chance exception at 0x004F2B75 in limbo.exe: 0xC0000005: Access violation reading location 0x00000000.

win32u.dll!_NtUserCallOneParam@8�() Unknown
limbo.exe!0044fd9a() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for limbo.exe]
limbo.exe!004457ac() Unknown
uxtheme.dll!ClassicSystemParametersInfoA() Unknown
uxtheme.dll!_InternalSystemParametersInfo() Unknown
uxtheme.dll!ThemeSystemParametersInfoA() Unknown
user32.dll!__EndUserApiHook@0�() Unknown
limbo.exe!00478878() Unknown
limbo.exe!00739980() Unknown
ntdll.dll!_NtClose@4�() Unknown
KernelBase.dll!CloseHandle() Unknown
kernel32.dll!@BaseThreadInitThunk@12�() Unknown
ntdll.dll!__RtlUserThreadStart() Unknown
ntdll.dll!__RtlUserThreadStart@8�() Unknown

The game is Limbo, running from the GoG version, which means there is no DRM or other foolishness.

I trimmed the C# code down to a minimal example, which is just the launch itself, no DLL load, and it still crashes. This also crashes when run as Admin. All Deviare 2.8.3 DLLs are in the app launch folder, and the DLLs are regsvr32 active.

            _spyMgr = new NktSpyMgr();
            hresult = _spyMgr.Initialize();
            if (hresult != 0)
                throw new Exception("Deviare initialization error.");

            // Launch the game, but suspended, so we can hook our first call and be certain to catch it.
            _gameProcess = _spyMgr.CreateProcess(@"G:\Games\limbo\limbo.exe", true, out continueevent);
            if (_gameProcess == null)
                throw new Exception("Game launch failed.");

            _spyMgr.ResumeProcess(_gameProcess, continueevent);

Bit of a loss here, any suggestions?

Placing hooks from .net dll cause hook connection to die

Hi all!
I have met the problem while using Deviare2 and looking for someone who could explain the observed behavior.

Let's consider following scheme of a project:

  1. The .exe c# application(1), that creates NktSpyMgr object and place some hooks.
  2. The .dll c# .net library(2) running in the process of application(1), that receives NktSpyMgr object from it and also place some hooks through it.
  3. Some 3rd-party .exe application(3) we are hooking through NktSpyMgr

The problem I met is after several calls to the hooks handlers inside .net library(2) some of the hooks in this library(2) (sometimes all of them) will not trigger anymore, despite the corresponding winapi is called.

I have inspected the case a bit and found that the part of Deviare2 code that injected into the application(3) is working OK and trigger transport sending message to the client (CDvAgentMgr::OnUserHook code works well).
The client successfully received that message and trying to call the handler inside spymgr.cpp CNktSpyMgrEngineImpl::OnHookCalled

In the successfull case the call to handler will be inside lpHookImpl->Fire_OnFunctionCalled(cIHook, cIProc, cIHookCallInfo);

Next the hookevents.h Fire_OnFunctionCalled is triggered, and it tries to enumerate connections, but it seems that all connections are dead in the case of the error.

I have prepared the sample project based on COM sample to demonstrate the problem, it could be downloaded here
It works much similiar to the COM sample: it runs notepad.exe, the one should click File->Save first time, the hooks from dll will be triggered (a lot of times maybe), then close the dialog and click File->Save second time, and some of the hooks from dll will not be triggered (winapi calls to the hooked functions will go normally).

Am I do something completely wrong by design, or is this a bug? What could cause such a strange behavior?

UPD: Save dialog (not Open) should be used to reproduce the issue with sample.

Unexpected CreateRemoteThread calls (Possible bug)

Hi,
While using your api to hook some functions in notepad++, I noticed some calls to CreateRemoteThread whenever I use the notepad's open file button. I do not understand why notepad would call this function, and in fact, rohitab's "ApiMonitor" does not see these calls. I fear these calls could be the result of interference from the hooking procedure itself, while performing process injection. Many other windows applications are also triggering the hook where I would not expect them to. Could you please look into this? Steps to reproduce:
1:Use CSharpConsole to hook CreateRemoteThread in notepad++
2:Try to open a file in notepad++
Optionally I recall these steps working with windows' notepad.exe 32bit.

logging/printing all api calls of a hooked process

Hello,

i just needed to know that i want to print all the api calls(e.g cretaefilew, queryinformation, closefile,readfile etc) (not only dll) of a hooked process, can i do that? and what method/function should i use. I am working In C# in deviare2.

Thanks.

AppCrash on hooking 32 bit process on Windows 10 64 bit with CSharpConsole

I'm playing around with CSharpConsole from precompiled Deviare 2.8.0 release under a Windows 10 64 bit VM and while CSharpConsole64.exe can hook 64 bit process like notepad.exe no problem, CSharpConsole.exe crashes target 32 bit process like notepad++.exe, devenv.exe, etc. Is 32 bit hooking supported under Windows 10?

Faulting application name: notepad++.exe, version: 6.9.2.0, time stamp: 0x573b9c9e
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x00d90030
Faulting process id: 0x10fc
Faulting application start time: 0x01d21359b0a69664
Faulting application path: C:\Program Files (x86)\Notepad++\notepad++.exe
Faulting module path: unknown
Report Id: c34e8c31-c38b-402c-834c-3df70f833943
Faulting package full name: 
Faulting package-relative application ID: 

Crash at NktHook.Hook if LoadCustomDLL cannot find DLL

This has killed me at least twice now, and I really am expecting LoadCustomDLL to return an error. I check and handle all errors, but LoadCustomDLL will report success, even if the dll path name is invalid.

In particular, if the pathname is invalid, LoadCustomDLL will return the int/hresult=0. And I'll crash later at NktHook.Hook.

If my pathname is valid, then LoadCustomDLL will return int/hresult=1, which is a little weird, but still matches the SUCCESS style macros. Still, it really ought to be 0, this is not a 'test for functionality' type call. The documentation does not indicate it would ever return '1'.

This is a fairly serious problem, because debugging this took me a couple of days. This crash because of a bad path is quite obscure, and would be dramatically better if LoadCustomDLL would return an error.


Here is the stack crawl when it crashes.

	>	00000001()	Unknown
 	[Frames below may be incorrect and/or missing]	
 	DvAgent.dll!TNktArrayList<CNktDvParam *,128,TNktArrayListItemRemove_Release<CNktDvParam *> >::RemoveAllElements() Line 330	C++
 	DvAgent.dll!CNktDvHookEngine::Hook(CNktDvHookEngine::tagHOOKINFO * aHookInfo=0x8007007e, unsigned long nCount=1, int bIsInternal=0) Line 494	C++
 	DvAgent.dll!CDvAgentMgr::OnEngMsg_AddHook(tagNKT_DV_TMSG_ADDHOOK * lpMsg=0xffe16054, CNktDvTransportBigData * lpConnBigData=0xffe300e0) Line 2522	C++
 	DvAgent.dll!CDvAgentMgr::TAC_OnEngineMessage(CNktDvTransportAgent * lpTransport=0x77ad4060, tagNKT_DV_TMSG_COMMON * lpMsg=0xffe16054, unsigned long nMsgSize=1084, CNktDvTransportBigData * lpConnBigData=0xffe300e0) Line 699	C++
 	DvAgent.dll!CNktDvTransportAgent::WorkerThreadProc(unsigned long nIndex=5) Line 564	C++
 	DvAgent.dll!TNktClassWorkerThread<CNktDvTransportAgent>::ThreadProc() Line 169	C++
 	DvAgent.dll!thread_start<unsigned int (__stdcall*)(void *)>(void * const parameter=0xffe0418c) Line 115	C++
 	kernel32.dll!@BaseThreadInitThunk@12�()	Unknown
 	ntdll.dll!___RtlUserThreadStart@8�()	Unknown
 	ntdll.dll!__RtlUserThreadStart@8�()	Unknown

Here is my simplified C# code that demonstrates the problem:

        _spyMgr = new NktSpyMgr();
        hresult = _spyMgr.Initialize();
        if (hresult != 0)
            throw new Exception("Deviare initialization error.");
#if DEBUG
        _spyMgr.SettingOverride("SpyMgrDebugLevelMask", 0xCF8);
#endif


        {
            // Launch the game, but suspended, so we can hook our first call and be certain to catch it.

            _gameProcess = _spyMgr.CreateProcess(game, true, out continueevent);
            if (_gameProcess == null)
                throw new Exception("Game launch failed.");

            // Load the NativePlugin for the C++ side.  The NativePlugin must be in this app folder.
            // The Agent supports the use of Deviare in the CustomDLL, but does not respond to hooks.

            _spyMgr.LoadAgent(_gameProcess);
            int result = _spyMgr.LoadCustomDll(_gameProcess, _nativeDLLName, true, true);  // *** trouble
            if (result < 0)
                throw new Exception("Could not load NativePlugin DLL.");

            // Hook the primary DX9 creation call of Direct3DCreate9, which is a direct export of 
            // the d3d9 DLL.  All DX9 games must call this interface, or the Direct3DCreate9Ex.
            // We set this to flgOnlyPreCall, because we want to always create the IDirect3D9Ex object.

            NktHook d3dHook = _spyMgr.CreateHook("D3D9.DLL!Direct3DCreate9", (int)eNktHookFlags.flgOnlyPreCall);
            if (d3dHook == null)
                throw new Exception("Failed to hook D3D9.DLL!Direct3DCreate9");

            // Make sure the CustomHandler in the NativePlugin at OnFunctionCall gets called when this 
            // object is created. At that point, the native code will take over.

            d3dHook.AddCustomHandler(_nativeDLLName, 0, "");

            // Finally attach and activate the hook in the still suspended game process.

            d3dHook.Attach(_gameProcess, true);
            d3dHook.Hook(true);  // *** Will crash here.


            // Ready to go.  Let the game startup.  When it calls Direct3DCreate9, we'll be
            // called in the NativePlugin::OnFunctionCall

            _spyMgr.ResumeProcess(_gameProcess, continueevent);
        }

How to Hook a process as soon as it starts and check if the hook is active.

I have an application that consists of a windows service that is hooking the windows print spooler process.
I'm having a problem, sometimes, for some reason, the spooler restarts, and the hook is lost.
What is the best way of monitoring if the hook is active in the hooked process and to hook this process as soon as it starts?

Unexpected CreateRemoteThread calls (Possible bug)

Hi,
While using your api to hook some functions in notepad++, I noticed some calls to CreateRemoteThread whenever I use the notepad's open file button. I do not understand why notepad would call this function, and in fact, rohitab's "ApiMonitor" does not see these calls. I fear these calls could be the result of interference from the hooking procedure itself, while performing process injection. Many other windows applications are also triggering the hook where I would not expect them to. Could you please look into this? Steps to reproduce:
1:Use CSharpConsole to hook CreateRemoteThread in notepad++
2:Try to open a file in notepad++
Optionally I recall these steps working with windows' notepad.exe 32bit.

In case of start of an example nothing occurs.

Hello, excuse for troubling, but I am a beginner in programming and I only began to study hook.

Question: it was succeeded to compile libraries and examples, but in case of start of an example of "CSharp\COMHookingBasis" nothing occurs - the console appears and at once finishes operation though "Console.WriteLine ("Press ESCAPE key to quit...");" shall occur in case of any outcome.
Help to understand, please.

DbGenerator: compilation failed

I saw from the headers that #include <NCryptprotect.h> is missing, while #include <ncrypt.h> is present. I would like to hook all the functions of NCrypt.dll. Is it possible to add them? Can I easily do that by generating a custom db?

AppCrash on hooking SQL Server 64 bit with CSharpConsole64 and multiple hooks

In CSharpConsole64 under Windows 10 64 bit VM after hooking sqlservr.exe (SQL Server 2016) with multiple kernel32 functions (specifically GetLocalTime and GetSystemTimeAsFileTime, latter being frequently called) it crashes the SQL Server after about 10 seconds of logging the events with few GetLocalTime and few dozen GetSystemTimeAsFileTime. Is it related to #16? The exception code seems different.

Faulting application name: sqlservr.exe, version: 2015.130.1601.5, time stamp: 0x5724ae45
Faulting module name: ntdll.dll, version: 10.0.14393.103, time stamp: 0x57b7e207
Exception code: 0xc00000fd
Fault offset: 0x0000000000039633
Faulting process id: 0xb3c
Faulting application start time: 0x01d213f220cda4c6
Faulting application path: C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Binn\sqlservr.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 18c975dd-9023-44c4-a4f8-ce7858986dd7
Faulting package full name: 
Faulting package-relative application ID: 

Deviare DB cannot be rebuilt

Always possible I'm doing something wrong, but I'm getting fatal errors when trying to rebuild the DB.

I wanted access to the d3d9.dll!SetRenderState function. As near as I can tell, that function is missing from the DB that ships with 2.8.3. If I use the DbFunctions call, I do not find that function in the returned list.

        NktDbObjectsEnum funcs = spyMgr.DbFunctions(theball.PlatformBits);
        for (int i = 0; i < funcs.Count; i++)
        {
            NktDbObject funcObj = funcs.GetAt(i);
            Console.WriteLine(i + ": " + funcObj.Name);
         ...

Trying to limit the function list to just the d3d9.dll module, I get an AccessViolation exception when I try to fetch the functions for that module. Not sure if this is related, but it seemed odd.

        INktDbModulesEnum modules = spyMgr.DbModules(theball.PlatformBits);
        NktDbModule d3d9 = modules.GetByName("d3d9.dll");   <<< works
        NktDbObjectsEnum functions = d3d9.DbFunctions();     <<< crash
        for (int i = 0; i < functions.Count; i++)
        {
            NktDbObject funcObj = functions.GetAt(i);
            Console.WriteLine(i + ": " + funcObj.Name + "  " + funcObj.Declaration);
        }

Searching the entire function list for a partial name match of "SetRender" did not show any results, which makes me think it is missing.


Then took a look at rebuilding the DB with current header files. As near as I can tell, this is not currently possible.

The documentation suggests using a zip file that is not available, but seems to be clearly related to the other tools in the Database folder. Running the build32.bat full and build64.bat full generated the expected preprocessed*.h files.

However, running the DbBuilder/build_32.bat against those files gives 60 or so errors.

c:\Users\bo3b\Documents\Code\Deviare2\Database\HeaderBuilder\Full\output\preprocessed32W.h:148788: error: wrong number of arguments specified for 'deprecated' attribute

This error appears to happen because the gcc compiler used for building the DB is old, and does not support parameters for the 'deprecated' attribute. For example:

typedef struct __declspec(deprecated("Use ""ADDRINFOEX2W"" instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings")) addrinfoex2A

It's not the double quotes, it's the entire string parameter it does not like.


There are a handful of other errors as well.

Not sure this is helpful, but thought I'd report it as not working with Visual Studio 2013, and SDK 8.1 headers. As noted, I cannot be certain I setup or built this all correctly.

how to hook fastprox.dll?

hi
NktHook hook = _spyMgr.CreateHook("Fastprox.dll!CWbemObject::Get", (int)( eNktHookFlags.flgOnlyPreCall)); not working
NktHook hook = _spyMgr.CreateHook("Fastprox.dll!?Get@CWbemObject@@UAGJPBGJPAUtagVARIANT@@PAJ2@Z", (int)( eNktHookFlags.flgOnlyPreCall)); not work
how else can???
thanks

Hooking undocumented functions and adding new functions into nektra's database

Hello everyone!

I'm trying to hook some functions of the spoolsv.exe process, for instance the YSetJob and YGetJob functions (both undocumented). So far I'm abble to get the calls, but when I try to get the params through:
INktParamsEnum paramsEnum = hookCallInfo.Params();
nothing is returned.
I believe that I have to insert these functions into the nektras database, still, I don't even know where to begin with and actually I'm not entirely sure if this is the real problem here

Please, help!
Using C# and Visual Studio 2013 in this one.

Buffer overflow being detected by Sophos Anti-virus

Hi,

OS version : windows 7/windows 8.1
Office version : Office 2013
when testing latest deviare 2.8.3 with Microsoft Word application, Sophos Endpoint Security and Control (v10.6), detecting Buffer overflow and stopping word document from opening (word application just hangs at splash screen) .

I used CSharpConsole64.exe to hook to winword.exe

Please let me know if you need more information.

CTest sample didn't work well

Hi, I can build the Samples\C\Test.sln, but the result seems not correct.

To understand deviare, I use the CTest to test. My command paramters are:

CTest.exe exec notepad -log=CTest.log. And logging contains:

..
CNktDvEngine::CreateHook (user32.dll!GetWindowTextW) => 00000000
CNktDvEngine::CreateHook (ntdll.dll!NtRaiseException) => 00000000
CNktDvEngine::CreateHook (ntdll.dll!NtRaiseHardError) => 00000000
CNktDvEngine::CreateHook (ntdll.dll!RtlUnhandledExceptionFilter2) => 00000000
CNktDvProcess::Create => 00000000
CNktDvHooksEnumerator::AddProcess => 00000000
1112011859: Hook state change [18624]: comdlg32.dll!ChooseColorA -> Activating
1112011859: Agent load [18624]: hRes=0x8A320003
1112011875: Hook state change [18624]: comdlg32.dll!ChooseColorA -> Error: 8A320003
1112011875: Hook state change [18624]: comdlg32.dll!ChooseColorW -> Activating
1112011875: Agent load [18624]: hRes=0x8A320003
1112011875: Hook state change [18624]: comdlg32.dll!ChooseColorW -> Error: 8A320003
1112011875: Hook state change [18624]: comdlg32.dll!ChooseFontA -> Activating
1112011875: Agent load [18624]: hRes=0x8A320003
1112011875: New process [18624]: C:\Windows\SysWOW64\notepad.exe
1112011890: Hook state change [18624]: comdlg32.dll!ChooseFontA -> Error: 8A320003
1112011890: Hook state change [18624]: comdlg32.dll!ChooseFontW -> Activating
1112011890: Agent load [18624]: hRes=0x8A320003
1112011890: Hook state change [18624]: comdlg32.dll!ChooseFontW -> Error: 8A320003
1112011890: Hook state change [18624]: comdlg32.dll!FindTextA -> Activating
1112011890: Agent load [18624]: hRes=0x8A320003
...
1112028203: Hook state change [18624]: shell32.dll!ExtractIconExA -> Removing
1112028203: Hook state change [18624]: wininet.dll!SetUrlCacheGroupAttributeA -> Removing
1112028203: Hook state change [18624]: shell32.dll!SHCreateDirectoryExW -> Removing
...

Initialization/Parsing HookAPI/Hook all these seem well, but logging file only contains

  1. CreateHook success
  2. Hook state change success
  3. New process created
  4. Agent loaded

Other SypMgr Events don't be hit? Like OnFunctionCalled/OnLoadLibraryCall. And how can I get the meaning of these errcode? My ultimate purpose is tracing internet traffic so I need to inspect network-related APIs', and recording payloads sent/recieved.

Please tell me what's wrong with it. Thx!

CSharpConsole RefreshJobsExecutionOrderForNextUpdate() missing jobs lock

I experienced random exceptions "Collection was modified; enumeration operation may not execute" thrown in RefreshJobsExecutionOrderForNextUpdate(). It happens because the the execution decrement is not protected by a _jobsLock. Adding the _jobsLock fixes it.

        lock (_jobsLock)
        {
            _jobs.Where(j => j.ExecutionOrder > 1).ForEach(j => j.ExecutionOrder--);
        }

Unexpected CreateRemoteThread calls (Possible bug)

Hi,
While using your api to hook some functions in notepad++, I noticed some calls to CreateRemoteThread whenever I use the notepad's open file button. I do not understand why notepad would call this function, and in fact, rohitab's "ApiMonitor" does not see these calls. I fear these calls could be the result of interference from the hooking procedure itself, while performing process injection. Many other windows applications are also triggering the hook where I would not expect them to. Could you please look into this? Steps to reproduce:
1:Use CSharpConsole to hook CreateRemoteThread in notepad++
2:Try to open a file in notepad++
Optionally I recall these steps working with windows' notepad.exe 32bit.

Quickstart

Hello.
I have a small request: whether somebody can show or explain as it is correct to collect completely an example from Quickstart, and that there pieces of a code with explanations, but it not to be told where and what to add.
I thank for the help in advance.

Question about Deviare-InProc

Hello Mauro,

Do you know of any Deviare-InProc example code that also writes the "NktProcessMemory" parameters?

I am trying to intercept process calls and then redirect file and registry requests to another drive location (on a network).

Is this possible to do with Deviare-InProc?

Antivirus blocks hooking

Need: Identify all the applications that are opened, and kill some if needed.

While i am trying to hook explorer.exe, BitDefender(Advanced threat defense) blocks it.
Is there a way to skip this?

Not able to hook to protected process

Hi,

When I tried to open the word document from network drive, two word processes are being opened with one window (UI), where document is opened in "Protected View". If I don't click on "Enable Editing" button, still two processes will be opened.

Now If I use CSharpConsole64.exe to hook to winword.exe, it is not able to hook and returns some error. Please find the attached screenshot.

It is able to hook only one winword.exe (hook is active) and not other winword.exe (in inactive list and has stError)

OS : windows 10 1703 (15063.483) [Anniversary Update also has the same issue).
deviare version : 2.8.3
Office versoin : Office 2016 64-bit

Please let me know if you more information.
deviare issue

COMHookingBasis sample difficult to get running

When I build and run the COMHookingBasis C# sample in Visual Studio 2013, I never hit the breakpoint on OnDllGetClassObjectCalled.

I hit other breakpoints, so the connection to debugger is correct.

This along with other tests makes me think that the

            hookDllGetClassObj.OnFunctionCalled += OnDllGetClassObjectCalled;

is not functional. I tested on both Win7 and Win10, neither work. No errors are reported.


Adding a handler to the SpyMgr itself seems to work, but hook specific call handlers do not get called.

May I hook calls without tying to specific program?

I'd like to hook all calls to some API function independent from what program makes them. Getting the information about calling program would be nice too.

Can Deviare be used for that? It looks like it is possible but I cannot find an example of such usage. Are there any?

It's a new sphere for me, I'd like to ask a question before I dive in.

How do I compile from source with Visual Studio 2015 ?

I got a message about updrading the runtime: after the upgrade, when i hit the compile button many errors popup like "cmd.exe failed" and so on.

I tried running the "build.bat" but it says it didn't find visual studio 2012.

Could you update this project for use with visual studio 2015 or at least update the build script or add a 2015-specific one?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.