コード例 #1
0
 public void Sync_ShouldCommitAll()
 {
     // Prepare
     // Execute
     GSettings.Sync();
     // Assert
     // Should simply not fail.
 }
コード例 #2
0
        private void _DoneButton_OnClicked(MenuBase mBase)
        {
            string _un = _UnReg.Match(_UserNameText.Text.Trim()).Value;

            if (!string.IsNullOrWhiteSpace(_un))
            {
                GSettings.Name = _un;
            }

            if (int.TryParse(_PortText.Text, out int _port) && _port < 65000 && _port > 1025)
            {
                GSettings.Port = _port;
            }

            GSettings.DefaultHost = _DefaultHostText.Text.Trim();

            GSettings.Save();

            GScreens.OpenScreen <MainScreen>();
        }
コード例 #3
0
        private void SavePage(object sender, WaitWindowEventArgs e)
        {
            string output = "";

            List <RequestWrapper> resources      = uiTabbedBrowserControl.CurrentTab.Browser.ResourcesSet().OrderBy(q => q.Identifier).ToList();
            List <HeaderWrapper>  headers        = uiTabbedBrowserControl.CurrentTab.Browser.ResponseHeaders().OrderBy(q => q.Identifer).ToList();
            List <HeaderWrapper>  requestHeaders = uiTabbedBrowserControl.CurrentTab.Browser.RequestHeaders().OrderBy(q => q.Identifer).ToList();

            string saveFolder  = new Uri(uiTabbedBrowserControl.CurrentTab.Browser.URL).Host.Replace(".", "_") + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff");
            string savePath    = Path.Combine(GSettings.Load().SaveDirectory, saveFolder);
            string logSavePath = Path.Combine(savePath, "_complete_log");

            Directory.CreateDirectory(savePath);
            Directory.CreateDirectory(logSavePath);

            output += "=================================================================================\r\n";
            output += "Capture started: " + DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss.fff") + "\r\n";
            output += "URL: " + uiTabbedBrowserControl.CurrentTab.Browser.URL + "\r\n";
            output += "IP(s): " + OsirtHelper.GetIpFromUrl(uiTabbedBrowserControl.CurrentTab.Browser.URL).Replace("\r\n", " ") + "\r\n";
            output += "Screenshot Hash: " + OsirtHelper.GetFileHash(Constants.TempImgFile) + "\r\n";
            output += "=================================================================================\r\n";

            ulong count = 0;

            foreach (var resource in resources)
            {
                Directory.CreateDirectory($@"{savePath}\{resource.ResourceType}");
                string filename = resource.ResourceType == ResourceType.MainFrame ? "mainframe.html" : OsirtHelper.GetSafeFilename(resource.RequestUrl, resource.MimeType);
                e.Window.Message = "Saving: " + filename + "...Please Wait";

                if (File.Exists($@"{savePath}\{resource.ResourceType}\{filename}"))
                {
                    filename = $"{++count}_{filename}";
                }

                File.WriteAllBytes($@"{savePath}\{resource.ResourceType}\{filename}", resource.Data);
                output  += "=================================================================================\r\n";
                output  += "Request ID: " + resource.Identifier + "\r\n";
                output  += "Request URL: " + resource.RequestUrl + "\r\n";
                output  += "Request URL IP(s): " + OsirtHelper.GetIpFromUrl(resource.RequestUrl).Replace("\r\n", " ") + "\r\n";
                output  += "Resource Type: " + resource.ResourceType + "\r\n";
                output  += "Mime Type: " + resource.MimeType + "\r\n";
                output  += "File Saved Location: " + $@"{savePath}\{resource.ResourceType}\{filename}" + "\r\n";
                output  += $"Hash [{UserSettings.Load().Hash.ToUpper()}]: " + OsirtHelper.GetFileHash(resource.Data) + "\r\n";
                output  += "Save completed at: " + DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss.fffffff") + "\r\n";
                output  += "=================================================================================\r\n";
                e.Result = savePath;
            }

            output += "=================================================================================\r\n";
            output += "Capture finished: " + DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss.fff") + "\r\n";
            output += "=================================================================================\r\n";
            File.AppendAllText($@"{logSavePath}\_capture.txt", output);
            File.Copy(Constants.TempImgFile, $@"{logSavePath}\_website.png");

            if (GSettings.Load().SaveHttpHeaders)
            {
                string headerOutput = "";
                foreach (var k in headers)
                {
                    headerOutput += "====================================================\r\n";
                    headerOutput += "Request ID: " + k.Identifer + "\r\n";
                    foreach (KeyValuePair <string, string> kv in k.Headers)
                    {
                        headerOutput += $"{kv.Key} : {kv.Value}" + "\r\n";
                    }
                    headerOutput += "====================================================\r\n";
                }
                File.AppendAllText($@"{logSavePath}\_headers.txt", headerOutput);

                //string reqheaderOutput = "";
                //foreach (var k in requestHeaders)
                //{
                //    reqheaderOutput += "====================================================\r\n";
                //    reqheaderOutput += "Request ID: " + k.Identifer + "\r\n";
                //    foreach (KeyValuePair<string, string> kv in k.Headers)
                //    {
                //        reqheaderOutput += $"{kv.Key} : {kv.Value}" + "\r\n";
                //    }
                //    reqheaderOutput += "====================================================\r\n";
                //}
                //File.AppendAllText($@"{logSavePath}\_request_headers.txt", reqheaderOutput);
            }

            CopyPageSaveToCase(savePath, e);
        }
コード例 #4
0
 public GVariantTypeTest(GSchemaFixture schemaFix)
 {
     _gSettings = new GSettings(schemaFix.SchemaName);
 }
コード例 #5
0
        public void New_ShouldReturnsSchemaPointer()
        {
            var settings = new GSettings(_schemaFix.SchemaName);

            Assert.NotEqual(IntPtr.Zero, settings.GSettingsPtr);
        }
コード例 #6
0
 public GSettingsTest(GSchemaFixture schemaFix)
 {
     _schemaFix = schemaFix;
     _gSettings = new GSettings(_schemaFix.SchemaName);
 }