util

package
v0.0.0-...-397df0b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// MESSAGENS
	AppName          = "ArthxRecon"
	WelcomeMessage   = "Welcome to ArthxRecon!"
	AppDescription   = "A modular recon tool for pentesting"
	CmdUsage         = "Use this tool with the provided subcommands to run various enumeration modules."
	ErrInvalidIP     = "Invalid IP address provided."
	LogFileNotFound  = "Log file not found, using console output."
	ErrInvalidTarget = "No valid target provided. Use --target to specify IP(s), CIDR, or a file containing targets."

	FatalErrHD         = "Host Discovery Failed!"
	FatalErrPS         = "Port Scan Failed!"
	FallbackConsoleMsg = "Failed to open log file, using console output" // FallbackConsoleMsg is the message used when the log file cannot be opened.
	HDAppDescription   = "Executes host discovery using Nmap"

	//CONST
	DefaultTimeFormat     = zerolog.TimeFormatUnix // DefaultTimeFormat defines the default time field format for Zerolog.
	ConfigFilePath        = "config/config.toml"   // ConfigFilePath is the path to the configuration file.
	HostDiscoveryName     = "hostDiscovery"
	PortScanName          = "portScan"
	HostDiscoveryFlagNmap = "-PS22,2222,53,80,443,445,3389"
)

Labels centralizes all application messages and texts.

View Source
var (
	MarkerGreen  = Green("[+]")
	MarkerCyan   = Cyan("[*]")
	MarkerRed    = Red("[-]")
	MarkerYellow = Yellow("[!]")
)

Variáveis globais para os printers, criadas uma única vez.

Functions

func Banner()

Exemplo de função para exibir um banner com cores

func Blue

func Blue(text string) string

func Cyan

func Cyan(text string) string

Funções que retornam o texto colorido.

func EnsureDir

func EnsureDir(dirName string) error

EnsureDir verifica se o diretório existe; se não existir, tenta criá-lo.

func GetFormattedTime

func GetFormattedTime() string

GetFormattedTime retorna a data e hora atual formatada no padrão "YYYY/MM/DD HH:MM:SS".

func Green

func Green(text string) string

func InitializeLogger

func InitializeLogger()

InitializeLogger configures the global logger using Zerolog. It reads the configuration from the TOML file at ConfigFilePath.

func IsValidIP

func IsValidIP(ip string) bool

IsValidIP checks if the provided string is a valid IP address.

func IsValidTarget

func IsValidTarget(t string) bool

IsValidTarget valida se o target é um IP válido ou um range em CIDR.

func ParseTargetInput

func ParseTargetInput(input string) (targets []string, fileMode bool)

ParseTargetInput verifica se o valor fornecido na flag -t é um arquivo existente. Se for, retorna um slice contendo o próprio caminho e fileMode=true. Caso contrário, considera que o valor é uma lista de targets separados por vírgula, valida cada um e retorna o slice com fileMode=false.

func Red

func Red(text string) string

func SanitizeFileName

func SanitizeFileName(name string) string

SanitizeFileName remove caracteres inválidos de um nome de arquivo. Remove caracteres: < > : " / \ | ? *

func SanitizeString

func SanitizeString(input string) string

SanitizeString trims spaces from the input string.

func SanitizeTarget

func SanitizeTarget(t string) string

SanitizeTarget substitui "/" por "_" para que o target possa ser usado em nomes de arquivos.

func WriteTargetsToFile

func WriteTargetsToFile(filePath string, targets []string) error

WriteTargetsToFile writes the slice of targets (IPs) to the specified file, one target per line.

func Yellow

func Yellow(text string) string

Types

type Config

type Config struct {
	LogFile string `toml:"log_file"` // Path to the log file
	Verbose bool   `toml:"verbose"`  // Verbose mode flag (if true, logs also go to console in friendly format)
}

Config holds the logger configuration read from the TOML file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL