Beispiel #1
0
        private void listViewTasks_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            if (e.ColumnIndex == 5)
            {
                CrackTaskManager.CrackTask crackTask = tskManager.CrackTasks[e.ItemIndex];
                int    progress = (int)crackTask.Progress;
                string status = crackTask.Status;
                Color  foreColor, backColor;

                switch (status)
                {
                case "Stopped":
                case "Paused":
                    foreColor = SimpleProgressBar.Colors.ForeColors.Stopped;
                    backColor = SimpleProgressBar.Colors.BackColors.Default;
                    break;

                case "Cracked":
                case "Exhausted":
                    foreColor = SimpleProgressBar.Colors.ForeColors.CompleteLight;
                    backColor = SimpleProgressBar.Colors.ForeColors.Failure;

                    if (crackTask.Digests > 0)
                    {
                        progress = (int)(((float)crackTask.RecoveredDigests) / crackTask.Digests * 100);
                    }

                    break;

                case "Running":
                    foreColor = SimpleProgressBar.Colors.ForeColors.Processing;
                    backColor = SimpleProgressBar.Colors.BackColors.Default;
                    break;

                default:
                    foreColor = SimpleProgressBar.Colors.ForeColors.Stopped;
                    backColor = SimpleProgressBar.Colors.BackColors.Default;
                    break;
                }

                SimpleProgressBar.Render(e.Graphics, e.Bounds, progress,
                                         status + " (" + progress.ToString() + " %)",
                                         backColor, foreColor);
            }
            else
            {
                e.DrawDefault = true;
            }
        }
Beispiel #2
0
        public void VisualizeTask(int TaskId)
        {
            string[] values = new string[listViewTasks.Columns.Count];
            CrackTaskManager.CrackTask curTask = tskManager.CrackTasks[TaskId];

            values[0] = (TaskId + 1).ToString();
            values[1] = curTask.HashTypeName;
            values[2] = curTask.Hash;
            values[3] = curTask.Plain;
            values[4] = curTask.CurrentLength.ToString() + "/"
                        + curTask.MaxLength.ToString();
            values[5] = "";
            values[6] = curTask.RecoveredDigests.ToString() + "/"
                        + curTask.Digests;
            values[7] = curTask.RecoveredSalts.ToString() + "/"
                        + curTask.Salts;
            values[8] = curTask.Estimated;
            values[9] = curTask.OutputFileName;

            switch (curTask.AttackType)
            {
            case 0:
                values[10] = curTask.Dictionary;
                break;

            case 3:
                values[10] = curTask.BruteforceMask;
                break;
            }

            values[11] = curTask.Started.ToString(DateTimeFormat);
            values[12] = curTask.Finished.ToString(DateTimeFormat);
            values[13] = curTask.SessionId;

            if (listViewTasks.Items[TaskId].SubItems.Count > 1)
            {
                for (byte i = 0; i < values.Length; i++)
                {
                    switch (i)
                    {
                    case 2:
                    case 9:
                    case 10:
                        if (values[i] != null)
                        {
                            listViewTasks.Items[TaskId].SubItems[i].Text =
                                values[i].Substring(values[i].LastIndexOf("\\") + 1);
                            listViewTasks.Items[TaskId].SubItems[i].Tag = values[i];
                        }
                        break;

                    default:
                        listViewTasks.Items[TaskId].SubItems[i].Text = values[i];
                        break;
                    }
                }
            }
            else
            {
                listViewTasks.Items[TaskId] = new ListViewItem(values);
            }
        }
Beispiel #3
0
        private void toolStripMenuItemInfo_Click(object sender, EventArgs e)
        {
            if (listViewTasks.SelectedIndices.Count == 0)
            {
                return;
            }

            CrackTaskManager.CrackTask crackTask = tskManager.CrackTasks[listViewTasks.SelectedIndices[0]];
            string clipboardText = "";

            switch ((sender as ToolStripMenuItem).Name)
            {
            case "toolStripMenuItemFullInfo":
                clipboardText = (listViewTasks.SelectedIndices[0] + 1).ToString()
                                + ";" + crackTask.HashTypeName
                                + ";" + crackTask.Hash
                                + ";" + crackTask.Plain;

                switch (crackTask.AttackType)
                {
                case 0:
                    clipboardText += ";" + crackTask.Dictionary + ";";
                    break;

                case 3:
                    clipboardText += ";" + crackTask.BruteforceMask + ";";
                    break;
                }

                if (crackTask.OutputToFile)
                {
                    clipboardText += crackTask.OutputFileName;
                }

                clipboardText += ";" + crackTask.SessionId
                                 + ";" + crackTask.Estimated
                                 + ";" + crackTask.Started
                                 + ";" + crackTask.Finished;

                break;

            case "toolStripMenuItemHashType":
                clipboardText = crackTask.HashTypeName;
                break;

            case "toolStripMenuItemHashTargetName":
                clipboardText = crackTask.Hash.Substring(crackTask.Hash.LastIndexOf("\\") + 1);
                break;

            case "toolStripMenuItemHashTargetPath":
                clipboardText = crackTask.Hash;
                break;

            case "toolStripMenuItemPlain":
                clipboardText = crackTask.Plain;
                break;

            case "toolStripMenuItemTimeEstimated":
                clipboardText = crackTask.Estimated;
                break;

            case "toolStripMenuItemTimeStarted":
                clipboardText = crackTask.Started.ToString(DateTimeFormat);
                break;

            case "toolStripMenuItemTimeFinished":
                clipboardText = crackTask.Finished.ToString(DateTimeFormat);
                break;

            case "toolStripMenuItemOutputFileName":
                if (crackTask.OutputToFile)
                {
                    clipboardText = crackTask.OutputFileName.Substring(crackTask.OutputFileName.LastIndexOf("\\") + 1);
                }

                break;

            case "toolStripMenuItemOutputFilePath":
                if (crackTask.OutputToFile)
                {
                    clipboardText = crackTask.OutputFileName;
                }

                break;

            case "toolStripMenuItemMaskDictionaryName":
                switch (crackTask.AttackType)
                {
                case 0:
                    clipboardText = crackTask.Dictionary.Substring(crackTask.Dictionary.LastIndexOf("\\") + 1);
                    break;

                case 3:
                    clipboardText = crackTask.BruteforceMask.Substring(crackTask.BruteforceMask.LastIndexOf("\\") + 1);
                    break;
                }

                break;

            case "toolStripMenuItemMaskDictionaryPath":
                switch (crackTask.AttackType)
                {
                case 0:
                    clipboardText = crackTask.Dictionary;
                    break;

                case 3:
                    clipboardText = crackTask.BruteforceMask;
                    break;
                }
                break;

            case "toolStripMenuItemSession":
                clipboardText = crackTask.SessionId;
                break;
            }

            if ((clipboardText != null) && (clipboardText != ""))
            {
                Clipboard.SetText(clipboardText);
            }
        }
        private void FillFormWithTaskData()
        {
            if (changingTaskId == -1)
            {
                comboBoxHashType.SelectedIndex        = 0;
                comboBoxOutputFormat.SelectedIndex    = 0;
                comboBoxWorkloadProfile.SelectedIndex = 0;
                comboBoxWorkloadTuning.SelectedIndex  = 0;
                textBoxSessionId.Text = DateTime.Now.ToString("yyyyMMddHHmmss");

                textBoxHashFileName.Text = "";
                textBoxSeparator.Text    = ":";
                //radioButtonAttackTypeBrute.Checked = true;

                textBoxBruteforceMask.Text = "";
                textBoxDictionary.Text     = "";
                textBoxCharset1.Text       = "";
                textBoxCharset2.Text       = "";
                textBoxCharset3.Text       = "";
                textBoxCharset4.Text       = "";
                checkBoxCharset1.Checked   = false;
                checkBoxCharset2.Checked   = false;
                checkBoxCharset3.Checked   = false;
                checkBoxCharset4.Checked   = false;

                checkBoxGPUAsync.Checked = false;
                checkBoxSpecificWorkloadProfile.Checked = false;
                checkBoxWorkloadTuning.Checked          = false;
                checkBoxWorkloadFineTuning.Checked      = false;
                checkBoxDisableTemp.Checked             = false;
                checkBoxTempAbort.Checked             = false;
                checkBoxTempRetain.Checked            = false;
                checkBoxDisablePowertune.Checked      = false;
                numericUpDownWorkloadFineTuning.Value = 8;
                numericUpDownTempAbort.Value          = 0;
                numericUpDownTempRetain.Value         = 0;

                checkBoxEnableIncrement.Checked = false;
                numericUpDownIncrementMin.Value = 0;
                numericUpDownIncrementMax.Value = 0;

                checkBoxOutputToFile.Checked = false;
                textBoxOutputFile.Text       = "";

                checkBoxCharsetIsInHex.Checked  = false;
                checkBoxSaltIsInHex.Checked     = false;
                checkBoxIgnoreWarnings.Checked  = false;
                checkBoxLoopback.Checked        = false;
                checkBoxIgnoreUsernames.Checked = false;
                checkBoxRemoveCracked.Checked   = false;
                checkBoxDisablePot.Checked      = false;
                checkBoxDisableLog.Checked      = false;
            }
            else
            {
                CrackTaskManager.CrackTask CrackTask = tskManager.CrackTasks[changingTaskId];

                textBoxHashFileName.Text = CrackTask.Hash;
                textBoxSeparator.Text    = CrackTask.Separator;
                comboBoxHashType.SelectedIndex
                    = comboBoxHashType.FindString(CrackTask.HashTypeCode.ToString());

                switch (CrackTask.AttackType)
                {
                case 0:
                    radioButtonAttackTypeDictionary.Checked = true;
                    break;

                case 3:
                    radioButtonAttackTypeBrute.Checked = true;
                    break;
                }

                textBoxBruteforceMask.Text = CrackTask.BruteforceMask;
                textBoxDictionary.Text     = CrackTask.Dictionary;
                textBoxCharset1.Text       = CrackTask.Charset1;
                textBoxCharset2.Text       = CrackTask.Charset2;
                textBoxCharset3.Text       = CrackTask.Charset3;
                textBoxCharset4.Text       = CrackTask.Charset4;
                checkBoxCharset1.Checked   = CrackTask.UseCharset1;
                checkBoxCharset2.Checked   = CrackTask.UseCharset2;
                checkBoxCharset3.Checked   = CrackTask.UseCharset3;
                checkBoxCharset4.Checked   = CrackTask.UseCharset4;

                checkBoxGPUAsync.Checked = CrackTask.EnableGPUAsync;
                checkBoxSpecificWorkloadProfile.Checked = CrackTask.EnableSpecificWorkloadProfile;
                checkBoxWorkloadTuning.Checked          = CrackTask.EnableWorkloadTuning;
                checkBoxWorkloadFineTuning.Checked      = CrackTask.EnableWorkloadFineTuning;
                checkBoxDisableTemp.Checked             = CrackTask.DisableTempReading;
                checkBoxTempAbort.Checked        = CrackTask.AbortSessionIfReachesMaxTemp;
                checkBoxTempRetain.Checked       = CrackTask.TryToRetain;
                checkBoxDisablePowertune.Checked = CrackTask.DisableAutoPowertuning;
                comboBoxWorkloadProfile.SelectedIndex
                    = comboBoxWorkloadProfile.FindString(CrackTask.WorkloadProfileCode.ToString());
                comboBoxWorkloadTuning.SelectedIndex
                    = comboBoxWorkloadTuning.FindString(CrackTask.WorkloadTuning.ToString());
                numericUpDownWorkloadFineTuning.Value = CrackTask.WorkloadFineTuning;
                numericUpDownTempAbort.Value          = CrackTask.AbortTemp;
                numericUpDownTempRetain.Value         = CrackTask.RetainTemp;

                checkBoxEnableIncrement.Checked = CrackTask.EnableIncrementMode;
                numericUpDownIncrementMin.Value = CrackTask.StartLength;
                numericUpDownIncrementMax.Value = CrackTask.MaxLength;

                checkBoxOutputToFile.Checked = CrackTask.OutputToFile;
                textBoxOutputFile.Text       = CrackTask.OutputFileName;
                comboBoxOutputFormat.SelectedIndex
                    = comboBoxOutputFormat.FindString(CrackTask.OutputFormatCode.ToString());

                textBoxSessionId.Text           = CrackTask.SessionId;
                checkBoxCharsetIsInHex.Checked  = CrackTask.CharsetIsInHex;
                checkBoxSaltIsInHex.Checked     = CrackTask.SaltIsInHex;
                checkBoxIgnoreWarnings.Checked  = CrackTask.IgnoreWarnings;
                checkBoxLoopback.Checked        = CrackTask.EnableLoopback;
                checkBoxIgnoreUsernames.Checked = CrackTask.IgnoreUsernames;
                checkBoxRemoveCracked.Checked   = CrackTask.RemoveCrackedHashes;
                checkBoxDisablePot.Checked      = CrackTask.DisablePotfile;
                checkBoxDisableLog.Checked      = CrackTask.DisableLogfile;
            }
        }
        private void buttonSubmitTask_Click(object sender, EventArgs e)
        {
            string[] Data;
            CrackTaskManager.CrackTask CrackTask;

            if ((changingTaskId > -1) && (!radioButtonAttackTypeMulti.Checked))
            {
                CrackTask = tskManager.CrackTasks[changingTaskId].DeepCopy();
            }
            else
            {
                CrackTask = new CrackTaskManager.CrackTask();
            }

            if (!CrackTask.SetHash(textBoxHashFileName.Text, true))
            {
                return;
            }

            CrackTask.SetSeparator(textBoxSeparator.Text);
            Data = comboBoxHashType.Text.Split('=');
            CrackTask.SetHashTypeCode(int.Parse(Data[0].Trim()));
            CrackTask.SetHashTypeName(Data[1].Trim());
            CrackTask.SetBruteforceMask(textBoxBruteforceMask.Text);
            CrackTask.SetDictionary(textBoxDictionary.Text);
            CrackTask.SetCharset1(textBoxCharset1.Text);
            CrackTask.SetCharset2(textBoxCharset2.Text);
            CrackTask.SetCharset3(textBoxCharset3.Text);
            CrackTask.SetCharset4(textBoxCharset4.Text);
            CrackTask.UseCharset1 = checkBoxCharset1.Checked;
            CrackTask.UseCharset2 = checkBoxCharset2.Checked;
            CrackTask.UseCharset3 = checkBoxCharset3.Checked;
            CrackTask.UseCharset4 = checkBoxCharset4.Checked;
            CrackTask.Status      = "Paused";

            CrackTask.EnableGPUAsync = checkBoxGPUAsync.Checked;

            CrackTask.EnableSpecificWorkloadProfile = checkBoxSpecificWorkloadProfile.Checked;
            Data = comboBoxWorkloadProfile.Text.Split('=');
            CrackTask.SetWorkloadProfileCode(byte.Parse(Data[0].Trim()));
            CrackTask.SetWorkloadProfileName(Data[1].Trim());

            CrackTask.EnableWorkloadTuning = checkBoxWorkloadTuning.Checked;
            CrackTask.SetWorkloadTuning(byte.Parse(comboBoxWorkloadTuning.Text));

            CrackTask.EnableWorkloadFineTuning = checkBoxWorkloadFineTuning.Checked;
            CrackTask.SetWorkloadFineTuning((int)numericUpDownWorkloadFineTuning.Value);

            CrackTask.DisableTempReading = checkBoxDisableTemp.Checked;

            CrackTask.AbortSessionIfReachesMaxTemp = checkBoxTempAbort.Checked;
            CrackTask.SetAbortTemp((byte)numericUpDownTempAbort.Value);

            CrackTask.TryToRetain = checkBoxTempRetain.Checked;
            CrackTask.SetRetainTemp((byte)numericUpDownTempRetain.Value);

            CrackTask.DisableAutoPowertuning = checkBoxDisablePowertune.Checked;

            if (checkBoxOutputToFile.Checked)
            {
                CrackTask.OutputToFile = true;

                if (!CrackTask.SetOutputFileName(textBoxOutputFile.Text, true))
                {
                    return;
                }
            }
            else
            {
                CrackTask.SetOutputFileName(textBoxOutputFile.Text);
            }

            Data = comboBoxOutputFormat.Text.Split('=');
            CrackTask.SetOutputFormatCode(byte.Parse(Data[0].Trim()));
            CrackTask.SetOutputFormatName(Data[1].Trim());

            CrackTask.SetSessionId(textBoxSessionId.Text);
            CrackTask.CharsetIsInHex      = checkBoxCharsetIsInHex.Checked;
            CrackTask.SaltIsInHex         = checkBoxSaltIsInHex.Checked;
            CrackTask.IgnoreWarnings      = checkBoxIgnoreWarnings.Checked;
            CrackTask.EnableLoopback      = checkBoxLoopback.Checked;
            CrackTask.IgnoreUsernames     = checkBoxIgnoreUsernames.Checked;
            CrackTask.RemoveCrackedHashes = checkBoxRemoveCracked.Checked;
            CrackTask.DisablePotfile      = checkBoxDisablePot.Checked;
            CrackTask.DisableLogfile      = checkBoxDisableLog.Checked;

            if (radioButtonAttackTypeMulti.Checked)
            {
                //if((checkedListBoxDictionary.CheckedIndices.Count > 0)
                //    || (checkedListBoxMask.CheckedIndices.Count > 0))
                //{
                //    foreach (int dictId in checkedListBoxDictionary.CheckedIndices)
                //    {
                //        CrackTaskManager.CrackTask curTask = CrackTask.DeepCopy();
                //        curTask.SetAttackType(0);
                //        curTask.SetDictionary(dictManager.Dictionaries[dictId].FileName, true);
                //        tskManager.AddTask(curTask);
                //    }

                //    foreach (int maskId in checkedListBoxMask.CheckedIndices)
                //    {
                //        CrackTaskManager.CrackTask curTask = CrackTask.DeepCopy();
                //        curTask.SetAttackType(3);
                //        curTask.SetBruteforceMask(maskManager.Masks[maskId].BruteMask);
                //        curTask.SetCharset1(maskManager.Masks[maskId].Charset1);
                //        curTask.SetCharset2(maskManager.Masks[maskId].Charset2);
                //        curTask.SetCharset3(maskManager.Masks[maskId].Charset3);
                //        curTask.SetCharset4(maskManager.Masks[maskId].Charset4);
                //        curTask.UseCharset1 = maskManager.Masks[maskId].UseCharset1;
                //        curTask.UseCharset2 = maskManager.Masks[maskId].UseCharset2;
                //        curTask.UseCharset3 = maskManager.Masks[maskId].UseCharset3;
                //        curTask.UseCharset4 = maskManager.Masks[maskId].UseCharset4;
                //        curTask.EnableIncrementMode = maskManager.Masks[maskId].EnableIncrement;
                //        curTask.SetStartLength(maskManager.Masks[maskId].IncrementMin);
                //        curTask.SetMaxLength(maskManager.Masks[maskId].IncrementMax);
                //        tskManager.AddTask(curTask);
                //    }
                //}
                if (listViewMultipleAttacks.SelectedIndices.Count > 0)
                {
                }
                else
                {
                    MessageBox.Show("Select at least 1 dictionary or mask");
                    return;
                }
            }
            else
            {
                if (radioButtonAttackTypeBrute.Checked)
                {
                    CrackTask.SetAttackType(3);

                    if (checkBoxEnableIncrement.Checked)
                    {
                        CrackTask.EnableIncrementMode = true;
                        CrackTask.SetStartLength((byte)numericUpDownIncrementMin.Value);
                        CrackTask.SetMaxLength((byte)numericUpDownIncrementMax.Value);
                    }
                    else
                    {
                        CrackTask.SetMaxLength((byte)textBoxBruteforceMask.Text.Replace("?", "").Length);
                    }
                }
                else
                {
                    CrackTask.SetAttackType(0);
                }

                if (changingTaskId > -1)
                {
                    tskManager.UpdateTask(changingTaskId, CrackTask);
                }
                else
                {
                    tskManager.AddTask(CrackTask);
                }
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }