private void uiSaveSourceToolStripButton_Click(object sender, EventArgs e)
        {
            string filename = Constants.PageSourceFileName.Replace("%%dt%%", DateTime.Now.ToString("yyyy-MM-dd_hh_mm_ss")).Replace("%%name%%", domainUrlAndTitle.Item1).Replace("%%action%%", action.ToString().Replace(".", "_"));
            string path     = Path.Combine(Constants.ContainerLocation, Constants.Directories.GetSpecifiedCaseDirectory(action), filename);

            using (FileStream fileStream = new FileStream(path, FileMode.Create))
            {
                using (StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.UTF8))
                {
                    streamWriter.WriteLine(fctb.Text);
                }
            }

            Logger.Log(new WebpageActionsLog(domainUrlAndTitle.Item2, action, OsirtHelper.GetFileHash(path), filename, $"[{action.ToString()} downloaded]"));
            MessageBox.Show("Save successful", $"Saved - {action.ToString()}", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemplo n.º 2
0
        private void sendRequest(string hash)
        {
            string uri = "http://" + _host + ":" + _port + "/gui/";

            uri += "?token=" + _token + "&action=" + _action.ToString().ToLower() + hash;
            //retrieveToken();
            WebClient webClient = new WebClient();

            webClient.DownloadProgressChanged += (s, e) => {
                OnDataSending(null);
            };
            webClient.DownloadStringCompleted += (s, e) => {
                Console.WriteLine(e.Result);
                OnDataReceived(null);
            };
            webClient.DownloadStringAsync(new Uri(uri));
        }
 public ViewPageSource(string source, Enums.Actions action, Tuple <string, string, string> domainUrlAndTitle)
 {
     InitializeComponent();
     this.domainUrlAndTitle = domainUrlAndTitle;
     this.action            = action;
     fctb          = new FastColoredTextBox();
     fctb.ReadOnly = true;
     fctb.Dock     = DockStyle.Fill;
     fctb.Language = Language.HTML;
     fctb.WordWrap = true;
     fctb.Text     = source;
     Size          = new System.Drawing.Size(800, 600);
     Icon          = Properties.Resources.source_code1;
     Text          = $"Viewing {action.ToString()} for {domainUrlAndTitle.Item1}";
     uiSourcePanel.Controls.Add(fctb);
     //toolStrip1.ImageScalingSize = new Size(40, 40);
 }
Exemplo n.º 4
0
 public ViewPageSource(string source, Enums.Actions action, Tuple<string, string, string> domainUrlAndTitle)
 {
     InitializeComponent();
     this.domainUrlAndTitle = domainUrlAndTitle;
     this.action = action;
     fctb = new FastColoredTextBox();
     fctb.ReadOnly = true;
     fctb.Dock = DockStyle.Fill;
     fctb.Language = Language.HTML;
     fctb.WordWrap = true;
     fctb.Text = source;
     Size = new System.Drawing.Size(800, 600);
     Icon = Properties.Resources.source_code1;
     Text = $"Viewing {action.ToString()} for {domainUrlAndTitle.Item1}";
     uiSourcePanel.Controls.Add(fctb);
     //toolStrip1.ImageScalingSize = new Size(40, 40);
 }