public override void Init(XmlElement fuzzLocationRoot, ITargetConnector connector, Dictionary<string, IFuzzLocation> predefinedFuzzers) { base.Init (fuzzLocationRoot, connector, predefinedFuzzers); IDictionary<string, string> config = DictionaryHelper.ReadDictionaryXml (fuzzLocationRoot, "FuzzerArg"); _scriptEvaluator = new ScriptEvaluator<UnixSocketEnvironment> (config, this); _socket = new UnixSocketConnection (config); //Attach to the UnixSocketConnection hooks and call the associated user script _socket.Hook_BeforeSocketCreation += delegate(UnixSocketConnection conn) { _scriptEvaluator.Environment.HookType = UnixSocketHookType.BeforeSocketCreation; _scriptEvaluator.Run (); }; _socket.Hook_AfterSocketCreation += delegate(UnixSocketConnection conn) { _scriptEvaluator.Environment.HookType = UnixSocketHookType.AfterSocketCreation; _scriptEvaluator.Run (); }; _socket.Hook_AfterSocketConnect += delegate(UnixSocketConnection conn) { _scriptEvaluator.Environment.HookType = UnixSocketHookType.AfterSocketConnect; _scriptEvaluator.Run (); }; _socket.Hook_BeforeSocketClose += delegate(UnixSocketConnection conn) { _scriptEvaluator.Environment.HookType = UnixSocketHookType.BeforeSocketClose; _scriptEvaluator.Run (); }; _socket.Hook_AfterSocketClose += delegate(UnixSocketConnection conn) { _scriptEvaluator.Environment.HookType = UnixSocketHookType.AfterSocketClose; _scriptEvaluator.Run (); }; }
protected override void Disposing() { base.Dispose (); if (_socket != null && _socket.Connected) { _socket.Close (); _socket.Dispose (); _socket = null; } }