diff --git a/cmd/company.go b/cmd/company.go index 5ac1996..d8a4893 100644 --- a/cmd/company.go +++ b/cmd/company.go @@ -30,6 +30,7 @@ var ( includeNumbers int includePostal int includeAll bool + includeCity string ) var companyCmd = &cobra.Command{ @@ -55,6 +56,7 @@ func init() { companyCmd.Flags().StringVarP(&includeMask, "mask", "m", "", "Apply a custom mask to the passwords") companyCmd.Flags().IntVar(&includeNumbers, "numbers", 0, "Include numbers to the passwords") companyCmd.Flags().IntVarP(&includePostal, "postal", "p", 0, "Include postal code to the passwords") + companyCmd.Flags().StringVar(&includeCity, "city", "", "Include city name to the passwords") companyCmd.Flags().BoolVarP(&includeAll, "all", "a", false, "Include all variations") } @@ -170,6 +172,10 @@ func generateCompanyPasslist(name string) []string { wordlist = append(wordlist, generate.WithPostal(baseWordlist, includePostal)...) } + if includeCity != "" { + wordlist = append(wordlist, generate.WithCity(baseWordlist, includeCity)...) + } + wordlist = append(wordlist, baseWordlist...) transformedWordlist := wordlist diff --git a/generate/generate.go b/generate/generate.go index 6ae4262..a897872 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -217,3 +217,14 @@ func WithPostal(wordlist []string, includePostal int) []string { } return result } + +// WithCity appends the city name to each word in the wordlist +func WithCity(wordlist []string, includeCity string) []string { + var result []string + + for _, word := range wordlist { + result = append(wordlist, word+includeCity) + } + + return result +}