Foro de elhacker.net

Programación => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: BigBear en 28 Mayo 2016, 03:43 am



Título: [C#] ZIP Cracker 0.2
Publicado por: BigBear en 28 Mayo 2016, 03:43 am
Un simple programa en C# para buscar el password de un comprimido ZIP usando un diccionario.

El codigo :

Código
  1. // ZIP Cracker 0.2
  2. // (C) Doddy Hackman 2015
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. using Ionic.Zip;
  12. using System.IO;
  13.  
  14. namespace ZIP_Cracker
  15. {
  16.    public partial class Form1 : Form
  17.    {
  18.        public Form1()
  19.        {
  20.            InitializeComponent();
  21.        }
  22.  
  23.        public bool check_password(string filename, string password)
  24.        {
  25.            try
  26.            {
  27.                using (ZipFile zip = ZipFile.Read(filename))
  28.                {
  29.                    zip.Password = password;
  30.                    var stream = new MemoryStream();
  31.  
  32.                    foreach (ZipEntry z in zip)
  33.                    {
  34.                        z.Extract(stream);
  35.                    }
  36.                    return true;
  37.                }
  38.            }
  39.            catch
  40.            {
  41.                return false;
  42.            }
  43.        }
  44.  
  45.        private void exit_Click(object sender, EventArgs e)
  46.        {
  47.            Application.Exit();
  48.        }
  49.  
  50.        private void load_Click(object sender, EventArgs e)
  51.        {
  52.            open.InitialDirectory = Directory.GetCurrentDirectory();
  53.            open.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
  54.            open.Title = "Select File";
  55.            if (open.ShowDialog() == DialogResult.OK)
  56.            {
  57.                wordlist.Text = open.FileName;
  58.            }
  59.        }
  60.  
  61.        private void crack_Click(object sender, EventArgs e)
  62.        {
  63.            string zip_file = archivo_zip.Text;
  64.            string wordlist_file = wordlist.Text;
  65.            string password;
  66.  
  67.            console.Clear();
  68.  
  69.            if (File.Exists(zip_file) && File.Exists(wordlist_file))
  70.            {
  71.                console.AppendText("[+] Cracking ...\n\n");
  72.                System.IO.StreamReader leyendo = new System.IO.StreamReader(wordlist_file);
  73.                while ((password = leyendo.ReadLine()) != null)
  74.                {
  75.                    if (check_password(zip_file,password))
  76.                    {
  77.                        console.AppendText("[+] Password Found : " + password+"\n");
  78.                        break;
  79.                    }
  80.                    else
  81.                    {
  82.                        console.AppendText("[-] Password : "+password+" FAIL"+"\n");
  83.                    }
  84.                }
  85.  
  86.                leyendo.Close();
  87.  
  88.                console.AppendText("\n[+] Finished");
  89.            }
  90.            else
  91.            {
  92.                console.AppendText("[-] File not found");
  93.            }
  94.        }
  95.  
  96.        private void load_zip_Click(object sender, EventArgs e)
  97.        {
  98.            open.InitialDirectory = Directory.GetCurrentDirectory();
  99.            open.Filter = "zip files (*.zip)|*.zip|All files (*.*)|*.*";
  100.            open.Title = "Select ZIP";
  101.            if (open.ShowDialog() == DialogResult.OK)
  102.            {
  103.                archivo_zip.Text = open.FileName;
  104.            }
  105.        }
  106.  
  107.    }
  108. }
  109.  
  110. // The End ?
  111.  

Una imagen :

(http://doddyhackman.webcindario.com/images/ZIP_Cracker_CSharp.jpg)

Si quieren bajar el proyecto con el codigo fuente lo pueden hacer de aca :

SourceForge (https://sourceforge.net/projects/zip-cracker/).

Eso seria todo.