Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BulkRenameCmd = &cobra.Command{ Use: "rename <pattern> <replacement>", Aliases: []string{}, Short: "Bulk rename files or directories using regex", Long: `Renames multiple files or directories in the current folder based on a regex pattern. It uses capture groups from the pattern in the replacement string. - Use \1, \2, etc. in the <replacement> string to refer to capture groups from the <pattern>. - The pattern is standard Go regex. Remember to quote arguments to prevent shell expansion. Examples: # Add a prefix 'new_' to files starting with 'prefix_' anbu rename 'prefix_(.*)' 'new_\1' # Do the same for directories instead of files anbu rename 'old_(.*)' 'new_\1' -d # Add '_backup' before the file extension (e.g., file.txt -> file_backup.txt) anbu rename '(.*)\.(.*)' '\1_backup.\2' # Simulate a rename operation without making changes anbu rename 'image-(\d+).jpg' 'IMG_\1.jpeg' -r`, Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { anbuGenerics.BulkRename(args[0], args[1], bulkRenameFlags.renameDirectories, bulkRenameFlags.dryRun) }, }
View Source
var ConvertCmd = &cobra.Command{ Use: "convert [converter] [data or file]", Aliases: []string{"c"}, Short: "Convert data between different formats", Long: `Convert data between different formats. These are the supported converters: File Formats: - yaml-json: Convert YAML to JSON, requires a file path as input - json-yaml: Convert JSON to YAML, requires a file path as input - docker-compose: Convert Docker Compose to YAML, requires a string as input - compose-docker: Convert Compose to Docker, requires a file path as input Encoding Formats: - b64: Convert plain text to base64 encoded string - b64d: Convert base64 encoded string to plain text - hex: Convert plain text to hex encoded string - hexd: Convert hex encoded string to plain text - b64-hex: Convert base64 encoded string to hex encoded string - hex-b64: Convert hex encoded string to base64 encoded string - url: Convert plain text to URL encoded string - urld: Convert URL encoded string to plain text - jwtd: Convert JWT to decoded struct `, Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { converterType := args[0] input := args[1] anbuGenerics.ConvertData(converterType, input) }, }
View Source
var MarkdownCmd = &cobra.Command{ Use: "markdown", Aliases: []string{"md"}, Short: "Start a markdown viewer web server for the current directory", Long: `Starts a web server that displays all files in the current directory in a sidebar and renders markdown files. Examples: # Start markdown viewer on default address (0.0.0.0:8080) anbu markdown # Start on a specific address and port anbu markdown -l 127.0.0.1:9090 anbu md -l :3000`, Run: func(cmd *cobra.Command, args []string) { err := anbuGenerics.StartMarkdownServer(markdownFlags.listenAddress) if err != nil { log.Fatal().Err(err).Msg("Failed to start markdown viewer") } }, }
View Source
var StashCmd = &cobra.Command{
Use: "stash",
Short: "Manage a persistent clipboard for files, folders, and text snippets",
Long: `Stash provides a persistent storage for files, folders, and text snippets.
Subcommands:
fs <path> Stash a file or folder (removes original)
text <name> Stash text from stdin
list List all stashed entries
apply <id> Apply a stash without removing it
pop <id> Apply a stash and remove it
clear <id> Remove a stash without applying it`,
}
View Source
var StringCmd = &cobra.Command{ Use: "string", Aliases: []string{"s"}, Short: "generate a random string, a sequence, a repetition, or password/passphrase", Long: `generate a variety of strings with the following Examples: anbu string N # generate a random string of length N anbu string seq N # generate a sequence of length N anbu string rep N hello # repeat the string hello N times anbu string uuid # generate a UUID anbu string ruid [N b/w 1 and 30] # generate a reduced UUID of length N anbu string suid # generate a short UUID of length 18 anbu string password # generate a password of length 12 anbu string password N # generate a password of length N anbu string password N simple # generate a password of length N w/ only letters anbu string passphrase # generate a passphrase of 3 words anbu string passphrase N # generate a passphrase of N words anbu string passphrase N "M" # generate a passphrase of N words w/ M as separator anbu string passphrase N simple # generate a passphrase of N words and - as separator`, Args: cobra.ArbitraryArgs, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { anbuGenerics.GenerateRandomString(0) return } if len, err := strconv.Atoi(args[0]); err == nil { anbuGenerics.GenerateRandomString(len) return } if args[0] == "seq" { if len(args) < 2 { log.Fatal().Msg("Missing length for sequence command") } length, err := strconv.Atoi(args[1]) if err != nil { log.Fatal().Msg("Not a valid length") } anbuGenerics.GenerateSequenceString(length) return } if args[0] == "rep" { if len(args) < 3 { log.Fatal().Msg("Missing count or string for repetition") } count, err := strconv.Atoi(args[1]) if err != nil { log.Fatal().Msg("Not a valid count") } anbuGenerics.GenerateRepetitionString(count, args[2]) return } if args[0] == "uuid" { anbuGenerics.GenerateUUIDString() return } if args[0] == "ruid" { if len(args) < 2 { log.Fatal().Msg("Missing length for RUID command") } anbuGenerics.GenerateRUIDString(args[1]) return } if args[0] == "suid" { anbuGenerics.GenerateRUIDString("18") return } if args[0] == "password" { if len(args) < 2 { anbuGenerics.GeneratePassword("12", false) } else if len(args) == 2 { anbuGenerics.GeneratePassword(args[1], false) } else if len(args) == 3 { anbuGenerics.GeneratePassword(args[1], true) } return } if args[0] == "passphrase" { if len(args) < 2 { anbuGenerics.GeneratePassPhrase("3", "-", false) } else if len(args) == 2 { anbuGenerics.GeneratePassPhrase(args[1], "-", false) } else if len(args) == 3 { if args[2] == "simple" { anbuGenerics.GeneratePassPhrase(args[1], "-", true) } else { anbuGenerics.GeneratePassPhrase(args[1], args[2], false) } } return } cmd.Help() }, }
View Source
var TimeCmd = &cobra.Command{ Use: "time", Aliases: []string{"t"}, Short: "time related commands to print or analyze time", Long: `Arguments: - now: print the current time in various formats - purple: print the current time in purple team format (includes public ip) - iso: print the current ISO time string in UTC in plaintext (for scripts) - diff: print the difference between two epochs - parse: parse a time string across various formats and print as table - until: parse a time string and print the difference between now and then`, Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { anbuGenerics.TimeCurrent() return } switch args[0] { case "now": anbuGenerics.TimeCurrent() case "purple": anbuGenerics.TimePurple() case "iso": anbuGenerics.TimeISO() case "diff": anbuGenerics.TimeEpochDiff(timeCmdFlags.epochs) case "parse": anbuGenerics.TimeParse(timeCmdFlags.timeStr, timeCmdFlags.parseAction) case "until": anbuGenerics.TimeParse(timeCmdFlags.timeStr, "diff") default: anbuGenerics.TimeCurrent() } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.