public static void Main(string[] args) { //#if !DEBUG System.AppDomain.CurrentDomain.UnhandledException += CExceptionHandler.UnhandledExceptionTrapper; //#endif _StartTime = CFunctions.GetDateTime(); foreach (string arg in args) { _Arguments += arg + ", "; } Log.Write(new String('=', 78), -2); Log.Write("{", -2); Log.Write(" Executable: " + _Executable.Substring(_Executable.LastIndexOf('\\') + 1), -2); Log.Write(" Arguments: " + _Arguments, -2); Log.Write(" Product version: " + ProductVersion, -2); Log.Write(" Product build: " + ProductBuild, -2); var OSName = Registry.GetValue(_WinRegistry, "ProductName", ""); var OSVersion = Registry.GetValue(_WinRegistry, "CurrentVersion", ""); var OSBuild = Registry.GetValue(_WinRegistry, "CurrentBuild", ""); object OSRelease; try { OSRelease = Registry.GetValue(_WinRegistry, "ReleaseId", ""); } catch { OSRelease = null; } if (OSRelease != null) { OSBuild += OSBuild + "." + OSRelease; } var OSBuildLabEx = Registry.GetValue(_WinRegistry, "BuildLabEx", ""); Log.Write(" OS version: " + OSName + " " + OSVersion + "." + OSBuild, -2); Log.Write(" OS build: " + OSBuildLabEx, -2); Log.Write(" User locale: " + Thread.CurrentThread.CurrentCulture.Name + ", OS locale: " + CultureInfo.InstalledUICulture, 2); Log.Write("}", -2); // ignore invalid SSL errors, warn user in logs (might move up higher in code later on) ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { if (sslPolicyErrors != System.Net.Security.SslPolicyErrors.None) { Log.Write("Warning: A non-critical SSL error occurred: " + sslPolicyErrors); } return(true); // **** Always accept }; //if (args.Length <= 0) //{ _App = new App(); _App.InitializeComponent(); _App.Run(); //} }
public void DoWork() { Completed = false; Started = true; string uid = CFunctions.GenerateUID(); string starttime = CFunctions.GetDateTime(0); Log.Write("[Threading] Starting thread (" + uid + ") to generate database output to " + Outfile.ToLower(), Log.Verbosity.Everything); CThread.Types threadtype = new CThread.Types(CThread.Types.Unmanaged); CDatabaseExporter de = new CDatabaseExporter(); CThread exporter = new CThread() { Type = threadtype, Worker = new Thread(delegate() { de.Export(this, ref _DBConn, DiscoveredSites, DiscoveredServers); }), Id = uid }; Core.ThreadManager.Add(exporter); }
public CQuery(ref CSession parent, int type, List <CSite> sites, string uid) { Session = parent; Type = type; Sites = sites; Id = uid; Progress = new CTaskInfo { Status = new CTaskInfo.State(CTaskInfo.State.Active), Service = Session.Server.Name, StartTime = CFunctions.GetDateTime(0), UID = uid, Details = "Collecting " + CQuery.Types.QueryTypes[Type].ToString().ToLower() + " info from " + Session.Server.Type.ToString() + " " + Session.Server.Name.ToUpper() + " (" + Session.Server.IP.ToString() + ")" }; Log.Write(Progress.Details); }
public CSession(ref CDatabaseConnection conn, List <IDiscoveredObject> discoveredSites, List <IDiscoveredObject> discoveredServers, string uid) { _DBConn = conn; this.DiscoveredSites = discoveredSites; this.DiscoveredServers = discoveredServers; ID = uid; Outfile = conn.FileName; Progress = new CTaskInfo() { Status = new CTaskInfo.State(CTaskInfo.State.Active), Details = "Generating database output to " + Outfile.ToLower(), UID = uid, StartTime = CFunctions.GetDateTime(0) }; Log.Write(Progress.Details); }