Example #1
0
func (h *hashcatTooler) Parameters() string {
	hashcatForm := goschemaform.NewSchemaForm()

	// Setup the dropdown for the hashing algorithm to use
	algoInput := goschemaform.NewDropDownInput("algorithm")
	algoInput.SetTitle("Select hash type to attack")
	algoInput.IsRequired(true)
	sort.Sort(hashAlgorithms(algorithms))
	for i := range algorithms {
		option := goschemaform.NewDropDownInputOption(algorithms[i].Number)
		option.SetGroup(algorithms[i].Group)
		option.SetName(algorithms[i].Name)
		algoInput.AddOption(option)
	}
	// Add the dropdown to the form at the top
	hashcatForm.AddElement(algoInput)

	// Build the fieldset for tabs based on attack type (Dictionary vs Bruteforce)
	attackTypeFieldset := goschemaform.NewTabFieldset()
	attackTypeFieldset.SetTitle("Attack Type")

	// Build the dictionary attack tab
	dictionaryAttackTab := goschemaform.NewTab()
	dictionaryAttackTab.SetTitle("Dictionary")
	// Setup the dropdown for choosing a dictionary to use
	dictionaryDropDown := goschemaform.NewDropDownInput("dict_dictionaries")
	dictionaryDropDown.SetTitle("Select dictionary to use")
	sort.Sort(config.Dictionaries)
	for i := range config.Dictionaries {
		option := goschemaform.NewDropDownInputOption(config.Dictionaries[i].Name)
		dictionaryDropDown.AddOption(option)
	}
	// Add the dictionary drop down to the tab
	dictionaryAttackTab.AddElement(dictionaryDropDown)
	// Build the rules dropdown
	ruleDropDown := goschemaform.NewDropDownInput("dict_rules")
	ruleDropDown.SetTitle("Select rule file to use")
	sort.Sort(config.Rules)
	for i := range config.Rules {
		option := goschemaform.NewDropDownInputOption(config.Rules[i].Name)
		ruleDropDown.AddOption(option)
	}
	// Add the rules drop down to the tab
	dictionaryAttackTab.AddElement(ruleDropDown)
	// Add the tab to the Attack Type fieldset
	attackTypeFieldset.AddTab(dictionaryAttackTab)

	// Buld the bruteforce attack tab
	bruteForceTab := goschemaform.NewTab()
	bruteForceTab.SetTitle("Brute Force")
	// Add whether to increment from 0 - length
	bfIncrementCheckBox := goschemaform.NewCheckBoxInput("brute_increment")
	bfIncrementCheckBox.SetTitle("Check for incremental mode")
	// Add the checkbox to the tab
	bruteForceTab.AddElement(bfIncrementCheckBox)
	// Setup the input for getting the length of the bruteforce
	bfLength := goschemaform.NewNumberInput("brute_length")
	bfLength.SetTitle("Select the length of the charset")
	bfLength.SetMin(0)
	// Add Length input to the tab
	bruteForceTab.AddElement(bfLength)
	// Setup the dropdown for choosing a character set
	bfCharSetDropDown := goschemaform.NewDropDownInput("brute_charset")
	bfCharSetDropDown.SetTitle("Select character set")
	sort.Sort(config.CharacterSets)
	for i := range config.CharacterSets {
		option := goschemaform.NewDropDownInputOption(config.CharacterSets[i].Name)
		bfCharSetDropDown.AddOption(option)
	}
	// Add the dropdown to the tab
	bruteForceTab.AddElement(bfCharSetDropDown)
	// Add the tab to the Attack Type fieldset
	attackTypeFieldset.AddTab(bruteForceTab)

	// Add the tab fieldset to the form
	hashcatForm.AddElement(attackTypeFieldset)

	// Build the hashes multiline input
	hashesMultiline := goschemaform.NewTextInput("hashes")
	hashesMultiline.SetTitle("Hashes")
	hashesMultiline.SetPlaceHolder("Add in Hashcat required format")
	hashesMultiline.SetMultiline(true)
	hashesMultiline.IsRequired(true)
	// Add the multiline to the form
	hashcatForm.AddElement(hashesMultiline)

	return hashcatForm.SchemaForm()
}
Example #2
0
func (h *hashcat3Tooler) Parameters() string {
	hashcatForm := goschemaform.NewSchemaForm()

	// Setup the dropdown for the hashing hashmode to use
	hashModeInput := goschemaform.NewDropDownInput("hashmode")
	hashModeInput.SetTitle("Select hash type to attack")
	hashModeInput.IsRequired(true)

	for i := range config.HashModes {
		option := goschemaform.NewDropDownInputOption(config.HashModes[i].Number)
		option.SetGroup(config.HashModes[i].Category)
		option.SetName(config.HashModes[i].Name)
		hashModeInput.AddOption(option)
	}
	// Add the dropdown to the form at the top
	hashcatForm.AddElement(hashModeInput)

	// Build the fieldset for tabs based on attack type (Dictionary vs Bruteforce)
	attackTypeFieldset := goschemaform.NewTabFieldset()
	attackTypeFieldset.SetTitle("Attack Type")

	// Build the dictionary attack tab
	dictionaryAttackTab := goschemaform.NewTab()
	dictionaryAttackTab.SetTitle("Dictionary")
	// Setup the dropdown for choosing a dictionary to use
	dictionaryDropDown := goschemaform.NewDropDownInput("dict_dictionaries")
	dictionaryDropDown.SetTitle("Select dictionary to use")
	sort.Sort(config.Dictionaries)
	for i := range config.Dictionaries {
		option := goschemaform.NewDropDownInputOption(config.Dictionaries[i].Name)
		dictionaryDropDown.AddOption(option)
	}
	// Add the dictionary drop down to the tab
	dictionaryAttackTab.AddElement(dictionaryDropDown)

	// Setup checkbox to determine if we are prepending rules to the dictionary
	dictionaryPrependCheckbox := goschemaform.NewCheckBoxInput("dict_use_custom_prepend")
	dictionaryPrependCheckbox.SetTitle("Prepend custom words to the selected dictionary")
	// Add checkbox to to the tab
	dictionaryAttackTab.AddElement(dictionaryPrependCheckbox)

	// Setup conditional multiline if we want to prepend words to the dictionary
	dictionaryPrependMultiline := goschemaform.NewTextInput("dict_custom_prepend")
	dictionaryPrependMultiline.SetTitle("Custom Words to Prepend")
	dictionaryPrependMultiline.SetPlaceHolder("One word per line")
	dictionaryPrependMultiline.SetMultiline(true)
	dictionaryPrependMultiline.SetCondition("dict_use_custom_prepend", false)
	// Add dictionary prepend multiline to the tab
	dictionaryAttackTab.AddElement(dictionaryPrependMultiline)

	// Add a checkbox to determine if we want to also generate random rules
	ruleGenRandomCheckbox := goschemaform.NewCheckBoxInput("dict_rules_use_random")
	ruleGenRandomCheckbox.SetTitle("Generate random rules")
	// Add checkbox to the tab
	dictionaryAttackTab.AddElement(ruleGenRandomCheckbox)

	// Build a number input for the maximum number of random rules
	ruleGenRandomMax := goschemaform.NewNumberInput("dict_rules_random_max")
	ruleGenRandomMax.SetTitle("Maximum random rules to generate")
	ruleGenRandomMax.SetMin(1)
	ruleGenRandomMax.SetCondition("dict_rules_use_random", false)
	// Add input to tab
	dictionaryAttackTab.AddElement(ruleGenRandomMax)

	// Build a checkbox to determine if we are going to use an existing rules file or upload
	// a custom one for this job.
	ruleCustomCheckbox := goschemaform.NewCheckBoxInput("dict_rules_use_custom")
	ruleCustomCheckbox.SetTitle("Upload a custom rule file")
	ruleCustomCheckbox.SetCondition("dict_rules_use_random", true)
	// Add the checkbox to the form
	dictionaryAttackTab.AddElement(ruleCustomCheckbox)

	// Build the rules dropdown
	ruleDropDown := goschemaform.NewDropDownInput("dict_rules")
	ruleDropDown.SetTitle("Select rule file to use")
	ruleDropDown.SetCondition("dict_rules_use_custom && !model.dict_rules_use_random", true)

	for i := range config.RuleFiles {
		option := goschemaform.NewDropDownInputOption(config.RuleFiles[i].Name)
		ruleDropDown.AddOption(option)
	}
	// Add the rules drop down to the tab
	dictionaryAttackTab.AddElement(ruleDropDown)

	// Build a custom rule upload control
	ruleCustomUpload := goschemaform.NewFileInput("dict_rules_custom_file")
	ruleCustomUpload.SetTitle("Custom Rule File")
	ruleCustomUpload.SetPlaceHolder("Click here or drop file to upload")
	ruleCustomUpload.SetCondition("dict_rules_use_custom", false)
	// Add custom upload to the tab
	dictionaryAttackTab.AddElement(ruleCustomUpload)

	// Add the tab to the Attack Type fieldset
	attackTypeFieldset.AddTab(dictionaryAttackTab)

	// Buld the bruteforce attack tab
	bruteForceTab := goschemaform.NewTab()
	bruteForceTab.SetTitle("Brute Force")

	// Build a checkbox to select custom or predefined character sets
	bfCustomCharsets := goschemaform.NewCheckBoxInput("brute_use_custom_chars")
	bfCustomCharsets.SetTitle("Use a custom character set instead")
	// Add to the tab
	bruteForceTab.AddElement(bfCustomCharsets)

	// Build inputs for a custom character set
	// Custom Mask
	bfCustomMask := goschemaform.NewTextInput("brute_custom_mask")
	bfCustomMask.SetTitle("Custom Brute Force Mask")
	bfCustomMask.SetPlaceHolder("Mask to brute force...")
	bfCustomMask.SetMultiline(false)
	bfCustomMask.SetCondition("brute_use_custom_chars", false)
	// Add to the tab
	bruteForceTab.AddElement(bfCustomMask)
	// Custom Character Set 1
	bfCustomChar1 := goschemaform.NewTextInput("brute_custom_charset1")
	bfCustomChar1.SetTitle("Custom Character Set 1")
	bfCustomChar1.SetPlaceHolder("Custom characters...")
	bfCustomChar1.SetMultiline(false)
	bfCustomChar1.SetCondition("brute_use_custom_chars", false)
	// Add to the tab
	bruteForceTab.AddElement(bfCustomChar1)
	// Custom Character Set 2
	bfCustomChar2 := goschemaform.NewTextInput("brute_custom_charset2")
	bfCustomChar2.SetTitle("Custom Character Set 2")
	bfCustomChar2.SetPlaceHolder("Custom characters...")
	bfCustomChar2.SetMultiline(false)
	bfCustomChar2.SetCondition("brute_use_custom_chars", false)
	// Add to the tab
	bruteForceTab.AddElement(bfCustomChar2)
	// Custom Character Set 3
	bfCustomChar3 := goschemaform.NewTextInput("brute_custom_charset3")
	bfCustomChar3.SetTitle("Custom Character Set 3")
	bfCustomChar3.SetPlaceHolder("Custom characters...")
	bfCustomChar3.SetMultiline(false)
	bfCustomChar3.SetCondition("brute_use_custom_chars", false)
	// Add to the tab
	bruteForceTab.AddElement(bfCustomChar3)
	// Custom Character Set 4
	bfCustomChar4 := goschemaform.NewTextInput("brute_custom_charset4")
	bfCustomChar4.SetTitle("Custom Character Set 4")
	bfCustomChar4.SetPlaceHolder("Custom characters...")
	bfCustomChar4.SetMultiline(false)
	bfCustomChar4.SetCondition("brute_use_custom_chars", false)
	// Add to the tab
	bruteForceTab.AddElement(bfCustomChar4)

	// Setup the dropdown for choosing a character set
	bfCharSetDropDown := goschemaform.NewDropDownInput("brute_predefined_charset")
	bfCharSetDropDown.SetTitle("Select character set (?1=?l?d, ?2=?u?l?d, ?3=?d?s, ?4=?l?d?s)")
	bfCharSetDropDown.SetCondition("brute_use_custom_chars", true)

	for i := range config.Charsets {
		option := goschemaform.NewDropDownInputOption(config.Charsets[i].Name)
		bfCharSetDropDown.AddOption(option)
	}
	// Add the dropdown to the tab
	bruteForceTab.AddElement(bfCharSetDropDown)

	// Add whether to increment from minLenght - maxLength
	bfIncrementCheckBox := goschemaform.NewCheckBoxInput("brute_increment")
	bfIncrementCheckBox.SetTitle("Enabled incremental mode")
	// Add the checkbox to the tab
	bruteForceTab.AddElement(bfIncrementCheckBox)

	// Setup the starting value of the incremental mode
	bfMinLength := goschemaform.NewNumberInput("brute_min_length")
	bfMinLength.SetTitle("Select the starting length of the charset")
	bfMinLength.SetMin(1)
	bfMinLength.SetCondition("brute_increment", false)
	// Add Length input to the tab
	bruteForceTab.AddElement(bfMinLength)

	// Setup the input for getting the length of the bruteforce
	bfMaxLength := goschemaform.NewNumberInput("brute_max_length")
	bfMaxLength.SetTitle("Select the maximum length of the charset")
	bfMaxLength.SetMin(1)
	bfMaxLength.SetCondition("brute_increment", false)
	// Add Length input to the tab
	bruteForceTab.AddElement(bfMaxLength)

	// Add the tab to the Attack Type fieldset
	attackTypeFieldset.AddTab(bruteForceTab)

	// Add the tab fieldset to the form
	hashcatForm.AddElement(attackTypeFieldset)

	// Build the fieldset for the Hash input options
	hashFieldset := goschemaform.NewTabFieldset()
	hashFieldset.SetTitle("Hash Input")

	// Only need one tab
	hashTab := goschemaform.NewTab()
	hashTab.SetTitle("Hashes")

	// Build a checkbox to determine how we will upload hashes
	hashFileUploadCheckbox := goschemaform.NewCheckBoxInput("hashes_use_upload")
	hashFileUploadCheckbox.SetTitle("Use a file to upload hashes")
	// Add to the tab
	hashTab.AddElement(hashFileUploadCheckbox)

	// Build the hashes multiline input
	hashesMultiline := goschemaform.NewTextInput("hashes_multiline")
	hashesMultiline.SetTitle("Hashes")
	hashesMultiline.SetPlaceHolder("Add in Hashcat required format")
	hashesMultiline.SetMultiline(true)
	hashesMultiline.IsRequired(true)
	hashesMultiline.SetCondition("hashes_use_upload", true)
	// Add to the tab
	hashTab.AddElement(hashesMultiline)

	// Build the hash file upload
	hashesFileUpload := goschemaform.NewFileInput("hashes_file_upload")
	hashesFileUpload.SetTitle("Hashes File")
	hashesFileUpload.SetPlaceHolder("Click here or drop file to upload")
	hashesFileUpload.SetCondition("hashes_use_upload", false)
	// Add to the tab
	hashTab.AddElement(hashesFileUpload)

	// Add the tab to the fieldset and the fieldset to the form
	hashFieldset.AddTab(hashTab)
	hashcatForm.AddElement(hashFieldset)

	// Build a checkbox to show or hide advanced options
	advancedOptionsCheckbox := goschemaform.NewCheckBoxInput("use_adv_options")
	advancedOptionsCheckbox.SetTitle("Show advanced options")

	// Add checkbox to the form
	hashcatForm.AddElement(advancedOptionsCheckbox)

	// Build fieldset and tab for the advanced options
	advancedOptionsFieldset := goschemaform.NewTabFieldset()
	advancedOptionsFieldset.SetTitle("Advanced Options")
	advancedOptionsFieldset.SetCondition("use_adv_options", false)

	// Build the tabs
	// Loopback
	advOptTabLoopback := goschemaform.NewTab()
	advOptTabLoopback.SetTitle("Loopback Input")
	advOptLookbackCheckbox := goschemaform.NewCheckBoxInput("adv_options_loopback")
	advOptLookbackCheckbox.SetTitle("Enable loopback flag")
	advOptTabLoopback.AddElement(advOptLookbackCheckbox)
	// Add tab
	advancedOptionsFieldset.AddTab(advOptTabLoopback)
	// Markov
	advOptTabMarkov := goschemaform.NewTab()
	advOptTabMarkov.SetTitle("Markov Options")
	advOptMarkovNumber := goschemaform.NewNumberInput("adv_options_markov")
	advOptMarkovNumber.SetTitle("Markov Threshold")
	advOptMarkovNumber.SetMin(0)
	advOptTabMarkov.AddElement(advOptMarkovNumber)
	// Add tab
	advancedOptionsFieldset.AddTab(advOptTabMarkov)
	// Timeout
	advOptTabTimeout := goschemaform.NewTab()
	advOptTabTimeout.SetTitle("Timeout Options")
	advOptTimeoutNumber := goschemaform.NewNumberInput("adv_options_timeout")
	advOptTimeoutNumber.SetTitle("Job Timeout (in seconds)")
	advOptTimeoutNumber.SetMin(120)
	advOptTabTimeout.AddElement(advOptTimeoutNumber)
	// Add tab
	advancedOptionsFieldset.AddTab(advOptTabTimeout)

	// Add fieldset to the form
	hashcatForm.AddElement(advancedOptionsFieldset)

	return hashcatForm.SchemaForm()
}