Ejemplo n.º 1
0
        private void btn_Decloak_Click(object sender, EventArgs e)
        {
            if (File.Exists(txt_Input.Text))
            {
                stealth = new StealthArchive(txt_Input.Text);

                try
                {
                    foreach (Ionic.Zip.ZipEntry entry in stealth.GetCloakedEntries(StealthArchive.ArchiveType.Zip))
                    {
                        ListViewItem item = new ListViewItem();
                        item.Name = entry.FileName;
                        item.Text = item.Name;

                        if (entry.UsesEncryption)
                        {
                            item.Text += "*";
                            isEncrypted = true;
                        }

                        item.SubItems.Add((MainForm.formatFileSize(entry.UncompressedSize, Settings.Default.UNITS)));
                        item.SubItems.Add((entry.CompressionRatio * .01).ToString("0%"));
                        item.SubItems.Add(entry.Encryption.ToString());

                        lst_Files.Items.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(String.Format("Error de-cloaking file: {0}", ex.Message), "De-Cloak",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (lst_Files.Items.Count > 0)
                {
                    canExtract(true);
                    lbl_Status.Text = "Select files to extract...";
                }
                else
                {
                    MessageBox.Show("This file contains no cloaked data.","De-CLoak", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txt_Input.Clear();
                    statusCheck();
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        // Create Zip archive using the DotNetZip library
        private bool CreateStealthArchive(string outputFile)
        {
            using (StealthArchive stealth = new StealthArchive())
            {
                // Set Output Path
                stealth.CloakingFile = txt_Output.Text;

                // Get archive settings
                stealth.CompressionLevel = ArchiveSettingsForm.GetLevel(Settings.Default.COMPRESSION_LEVEL);
                stealth.CompressionMethod = ArchiveSettingsForm.GetMethod(Settings.Default.COMPRESSION_METHOD);
                stealth.Strategy = ArchiveSettingsForm.GetStrategy(Settings.Default.COMPRESSION_STRATEGY);
                stealth.BufferSize = Settings.Default.IO_BUFFER_SIZE;
                stealth.CodecBufferSize = Settings.Default.CODEC_BUFFER_SIZE;
                stealth.UseMemory = Settings.Default.MEMORY_ARCHIVE;
                stealth.UseZip64WhenSaving = ArchiveSettingsForm.Get64Option(Settings.Default.USE_ZIP64);

                // Set an optional password
                if (Settings.Default.ENCRYPT_ARCHIVE)
                {
                    // Prompt the user for a password
                    stealth.Password = getPassword(true);
                    stealth.Encryption = ArchiveSettingsForm.GetEncryption(Settings.Default.ENCRYPTION_ALGORITHM);
                }

                try
                {
                    // Iterate through each checked file in the file list
                    foreach (ListViewItem item in lst_Files.CheckedItems)
                    {
                        // Update status label
                        lbl_Status.Text = string.Format("Adding {0} to archive...", item.Text);
                        tsc_Main.Update();

                        // Add entry to archive
                        stealth.AddFile(item.Name, string.Empty);
                    }

                    // Cloak the archive
                    stealth.Cloak();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    return false;
                }
            }

            return true;
        }