Beispiel #1
0
 public static void TestScanContent()
 {
     try
     {
         Assert.Equal(AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED, AmsiUtils.ScanContent(string.Empty, string.Empty));
     }
     finally
     {
         AmsiUtils.Uninitialize();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Constructor to initialize both Runspace and Command to invoke.
        /// Caller should make sure that "command" is not null.
        /// </summary>
        /// <param name="runspace">
        /// Runspace to use for the command invocation.
        /// </param>
        /// <param name="command">
        /// command to Invoke.
        /// Caller should make sure that "command" is not null.
        /// </param>
        internal Pipeline(Runspace runspace, CommandCollection command)
        {
            if (runspace == null)
            {
                PSTraceSource.NewArgumentNullException(nameof(runspace));
            }
            // This constructor is used only internally.
            // Caller should make sure the input is valid
            Dbg.Assert(command != null, "Command cannot be null");
            InstanceId = runspace.GeneratePipelineId();
            Commands   = command;

            // Reset the AMSI session so that it is re-initialized
            // when the next script block is parsed.
            AmsiUtils.CloseSession();
        }
Beispiel #3
0
 public static void TestUninitialize()
 {
     AmsiUtils.Uninitialize();
 }
Beispiel #4
0
 public static void TestCloseSession()
 {
     AmsiUtils.CloseSession();
 }
Beispiel #5
0
 public static void TestCurrentDomain_ProcessExit()
 {
     Assert.Throws <PlatformNotSupportedException>(delegate {
         AmsiUtils.CurrentDomain_ProcessExit(null, EventArgs.Empty);
     });
 }
Beispiel #6
0
 public static void TestScanContent()
 {
     Assert.Equal(AmsiUtils.ScanContent("", ""), AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED);
 }
 public static void TestScanContent()
 {
     Assert.Equal(AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED, AmsiUtils.ScanContent(string.Empty, string.Empty));
 }