Exemple #1
0
        /// <summary>
        /// Verifica se uma imagem foi gerada pelo sistema
        /// A verificação é salva no arquivo de Log
        /// </summary>
        /// <param name="args"></param>
        private void ImageIsUdyat(string[] args)
        {
            if (Path.GetExtension(args[2]).ToUpper() != ".PNG")
            {
                Log.AddLog("-VI" + args[2], "Imagem não verificada. Somente arquivos PNG.");
                Util.ShowConsoleMessage("Somente imagens PNG podem ser verificadas.", showConsoleMessages);
                Environment.Exit(0);
            }
            if ((args.Length >= 3) && (args[2].Length > 0) && (File.Exists(args[2])))
            {
                string auxFileName = args[2];
                Bitmap teste       = new Bitmap(auxFileName);

                string msg = SteganographyHelper.extractText(teste);
                if (msg.Length > UDYATSIGN.Length)
                {
                    string UdyatSign = MsgValue(msg, out msg);
                    if (UdyatSign == UDYATSIGN)
                    {
                        string   customerIdent  = MsgValue(msg, out msg);
                        string   customerMacNum = MsgValue(msg, out msg);
                        string   customerHash   = MsgValue(msg, out msg);
                        string   machineUID     = MsgValue(msg, out msg);
                        string   embedfileName  = msg.Substring(0, msg.Length);
                        string   strUserName    = MsgValue(msg, out msg);
                        string   macAddress     = MsgValue(msg, out msg);
                        string   macIP          = MsgValue(msg, out msg);
                        string   imgSeqMonitor  = msg.Substring(22, msg.Length - 22).Substring(0, msg.Substring(22, msg.Length - 22).IndexOf("."));
                        string   prtDateTime    = msg.Substring(0, 21);
                        DateTime outputDateTimeValue;
                        string   strDateTime;
                        if (DateTime.TryParseExact(prtDateTime, "yyyyMMdd_HH_mm_ss_fff", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out outputDateTimeValue))
                        {
                            strDateTime = outputDateTimeValue.ToString("dd/MM/yyyy HH:mm:ss FFF");
                        }
                        string customerWord = sysConfig.Data.CustomerWord;
                        string wordClienth  = FnvHash.GetHash(customerWord, 120).ToHexString();
                        bool   testSecurity = ((wordClienth == customerHash) && (embedfileName == auxFileName));
                        Log.AddLog("-VI " + args[2], "Imagem válida");
                        return;
                    }
                }
                Log.AddLog("-VI" + args[2], "Imagem inválida");
                return;
            }
            Log.AddLog("-VI", "Parâmetros inválidos");
        }
Exemple #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     textBox2.Text = StringCipher.Decrypt(SteganographyHelper.extractText(new Bitmap(pictureBox2.Image)), ConfigurationManager.AppSettings["secret"]);
 }
        private void button4_Click(object sender, EventArgs e)
        {
            // image_ini = (Bitmap)pictureBox1.Image;

            string finalText = null;
            string text;

            // List<String> temp_list = new List<String>(files.Count());

            string[] temp_list = new string[files.Count()];


            try
            {
                for (int x = 0; x < files.Count(); x++)
                {
                    text = SteganographyHelper.extractText(this.files.ElementAt(x));

                    string temp = text.Substring(text.IndexOf(" ") + 1);

                    temp_list[Int32.Parse(text.Substring(0, 1))] = temp;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
            }

            foreach (String text_temp in temp_list)
            {
                finalText = string.Concat(finalText, text_temp);
            }


            MessageBox.Show("DONE!");

            button3.Enabled = true;


            this.files.Clear();
            imageList1.Images.Clear();


            System.IO.File.WriteAllText(@"C:\Users\Blotz\Desktop\WriteLines.txt", finalText);

            this.containerBytes = GetBytes(finalText);



            //try
            //{
            //   // extractedText = Crypto.DecryptStringAES(extractedText, passwordTextBox.Text);
            //}
            //catch
            //{
            //    MessageBox.Show("Wrong password", "Error");

            //    return;
            //}


            //dataTextBox.Text = extractedText;
        }
Exemple #4
0
        private void openFileBtn_Click(object sender, EventArgs e)
        {
            filePath.Clear();
            textBox.Clear();
            OpenFileDialog open_dialog = new OpenFileDialog();

            open_dialog.Filter = "Text Documents;Word Docx;PPTX;XLSX;Png;MP4;All |*.txt;*.docx;*pptx;*xlsx;*.png;*mp4;*.*";
            if (open_dialog.ShowDialog() == DialogResult.OK)
            {
                filePath.Text = open_dialog.FileName;
                var extension = Path.GetExtension(open_dialog.FileName);
                switch (extension.ToLower())
                {
                case ".docx":
                    readMeta(open_dialog.FileName);
                    break;

                case ".xlsx":
                    readMeta(open_dialog.FileName);
                    break;

                case ".pptx":
                    readMeta(open_dialog.FileName);
                    break;

                case ".png":
                    string password = "******";
                    bmp = (Bitmap)Image.FromFile(open_dialog.FileName);;
                    string extractedText = SteganographyHelper.extractText(bmp);
                    extractedText = Crypto.DecryptStringAES(extractedText, password);
                    textBox.Text  = extractedText;
                    break;

                case ".txt":
                    System.Diagnostics.Process pProcess = new System.Diagnostics.Process();

                    pProcess.StartInfo.UseShellExecute = false;

                    pProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

                    //strCommand is path and file name of command to run
                    pProcess.StartInfo.FileName = "cmd.exe";

                    //strCommandParameters are parameters to pass to program
                    pProcess.StartInfo.Arguments = "/C more < " + open_dialog.FileName + ":DS1";

                    pProcess.StartInfo.UseShellExecute = false;

                    //Set output of program to be written to process output stream
                    pProcess.StartInfo.RedirectStandardOutput = true;

                    //Optional
                    //pProcess.StartInfo.WorkingDirectory = strWorkingDirectory;

                    //Start the process
                    pProcess.Start();

                    //Get program output
                    string strOutput = pProcess.StandardOutput.ReadToEnd();

                    textBox.Text = strOutput;
                    //Wait for process to finish
                    pProcess.WaitForExit();
                    break;

                case ".mp4":
                    TagLib.File           videoFile = TagLib.File.Create(open_dialog.FileName);
                    TagLib.Mpeg4.AppleTag customTag = (TagLib.Mpeg4.AppleTag)videoFile.GetTag(TagLib.TagTypes.Apple);
                    string tokenValue = customTag.GetDashBox("User", "Downloaded");
                    textBox.Text = tokenValue;
                    break;
                }
            }
        }