Пример #1
0
        // Allows running Babel-Shellfish from unmanaged code. Installs default logger for Babel-Shellfish
        public static int Run(string input)
        {
            int success = 0;

            try
            {
                BabelShellfish instance            = BabelShellfish.GetInstance();
                BabelShellfishConfiguration config = BabelShellfishConfiguration.GetInstance();

                if (config.DebugOut)
                {
                    BabelShellfishDebugString debugStringLogger = new BabelShellfishDebugString();
                    instance.ScriptInvoke += debugStringLogger.ScriptInvokeHandler;
                }
                if (!String.IsNullOrEmpty(config.LogPath))
                {
                    BabelShellfishLogger logger = new BabelShellfishLogger(config.LogPath);
                    instance.ScriptInvoke += logger.ScriptInvokeHandler;
                }
                if (config.ScanAmsi)
                {
                    BabelShellfishAmsi amsiScanner = new BabelShellfishAmsi();
                    instance.ScriptScan += amsiScanner.ScriptScanHandler;
                }
                instance.Init();

                success = 1;
            }
            catch (Exception)
            {
            }
            return(success);
        }
Пример #2
0
        ////////////////////////////////////////////////////////////////
        // System.Management.Automation.AmsiUtils
        // Monitor strings Amsi receives
        private static UInt32 ScanContent(string content, string sourceMetadata)
        {
            if (BabelShellfishConfiguration.GetInstance().LogAmsi)
            {
                GetInstance().OnScriptInvoke(ScriptType.Amsi, content);
            }

            return(ScanContentDummy(content, sourceMetadata));
        }