Exemple #1
0
 private Hook(IntPtr id, string moduleName, string functionName, ISpyManager spyManager)
 {
     Id = id;
     FunctionName = functionName;
     ModuleName = moduleName;
     _spyManager = spyManager;
 }
Exemple #2
0
 protected ProcessBase(ISpyManager spyManager, int platformBits, string name, string path, Image icon)
 {
     Name = name;
     Path = path;
     SpyManager = spyManager;
     PlatformBits = platformBits;
     Icon = icon;
 }
 public ApplicationPresenter(IApplicationView aView, ISpyManager aSpyManager, HookingSettings hookingSettings, int platformBits)
 {
     _processModulesDisplayer = new ProcessModulesDisplayer(this, aView);
     _hookingSettings = hookingSettings;
     _platformBits = platformBits;
     InitializePresenter(aView, aSpyManager);
     InitializeView();
 }
Exemple #4
0
        public static IRunningProcess From(NktProcess aProcess, ISpyManager spyManager)
        {
            var modulePathByNameAndProcess = new Dictionary<int, string>();

            if (aProcess.PlatformBits > 0 && aProcess.PlatformBits <= IntPtr.Size * 8)
            {
                var processModules = aProcess.Modules();
                if (processModules != null)
                    processModules.CollectAll().ForEach(m =>
                                                            {
                                                                var moduleKey = (m.Name + aProcess.Id).GetHashCode();
                                                                if (!modulePathByNameAndProcess.ContainsKey(moduleKey))
                                                                    modulePathByNameAndProcess.Add(moduleKey, m.Path);
                                                            });
            }

            return new RunningProcess(aProcess.Id, aProcess.Name, aProcess.Icon(), spyManager, aProcess.Path, aProcess.PlatformBits, modulePathByNameAndProcess);
        }
Exemple #5
0
 public static Module From(NktModule module, IRunningProcess aProcess, ISpyManager aSpyManager)
 {
     return new RunningModule(module.Path, module.Name, module.BaseAddress, aProcess, aSpyManager);
 }
        private void InitializePresenter(IApplicationView aView, ISpyManager aSpyManager)
        {
            _selectedProcesses = Enumerable.Empty<IProcess>();
            _selectedFunctions = Enumerable.Empty<Function>();
            _view = aView;
            _spyManager = aSpyManager;


            _hookLoader = new HookLoader(_hookingSettings, FilterProcessesToApplyHookingSettingsOn, AddHookForRunningProcess);

            InitializeProcessHandlers();

            _spyManager.ProcessStartedHandler = ProcessStartedHandler;
            _spyManager.ProcessTerminatedHandler = ProcessTerminatedHandler;
            _spyManager.FunctionCalledHandler = FunctionCalledHandler;
            _spyManager.HookStateChangedHandler = HookStateChangedHandler;
            _spyManager.AgentLoadHandler = AgentLoadHandler;
        }
Exemple #7
0
 public static Hook From(NktHook nktHook, ISpyManager aSyManager)
 {
     return new Hook(nktHook.Id, nktHook.ModuleName(), nktHook.FunctionNameWithoutModule(), aSyManager);
 }
        //private IEnumerable<Module> _modules;

        #endregion

        #region Instance Creation

        public ProcessToBeHookedOnStart(string aPath, ISpyManager aSpyManager, int platformBits)
            : base(aSpyManager, platformBits, System.IO.Path.GetFileName(aPath), aPath, ProcessIcon.IconFrom(aPath))
        {
        }
Exemple #9
0
 public static IEnumerable<IRunningProcess> From(IEnumerable<NktProcess> expectedRunningProcesses, ISpyManager spyManager)
 {
     return expectedRunningProcesses.Where(p => p.PlatformBits > 0 && p.PlatformBits <= IntPtr.Size * 8).Select(process => From(process, spyManager)).ToArray();
 }
Exemple #10
0
 private RunningProcess(int id, string name, Image icon, ISpyManager spyManager, string path, int platformBits, Dictionary<int, string> modulePathByNameAndProcess)
     : base(spyManager, platformBits, name, path, icon)
 {
     Id = id;
     _modulePathByNameAndProcess = modulePathByNameAndProcess;
 }
Exemple #11
0
 public RunningProcess(int id, string name, Image icon, ISpyManager spyManager, string path, int platformBits)
     : base(spyManager, platformBits, name, path, icon)
 {
     Id = id;
 }
Exemple #12
0
 public RunningModule(string path, string name, IntPtr baseAddress, IRunningProcess process, ISpyManager aSpyManager)
     : base(path, name, baseAddress)
 {
     _process = process;
     _spyManager = aSpyManager;
 }