Documentation
¶
Index ¶
- func LargeFilesOutputPath(domain, user, host string) string
- func ProcessCopyQueue(queue *CopyQueue) (*CopyQueue, *CopyHistory, *ErrorLog)
- func SaveAccessDeniedLog(host, path string) error
- func SaveCopyHistory(filename string, history *CopyHistory) error
- func SaveCopyQueue(filename string, queue *CopyQueue) error
- func SaveErrorLog(filename string, errorLog *ErrorLog) error
- func SaveLargeFilesList(filename string, list *LargeFilesList) error
- type AccessDeniedLog
- type CopyConfig
- type CopyHistory
- type CopyQueue
- type CopyQueueEntry
- type CopyResult
- type ErrorEntry
- type ErrorLog
- type FileRef
- type HistoryEntry
- type LargeFileEntry
- type LargeFilesList
- type NocopyScanResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LargeFilesOutputPath ¶
Função auxiliar para montar o caminho de large_files
func ProcessCopyQueue ¶
func ProcessCopyQueue(queue *CopyQueue) (*CopyQueue, *CopyHistory, *ErrorLog)
Função para processar e separar as entradas da fila
func SaveAccessDeniedLog ¶
Função para salvar erro de acesso negado
func SaveCopyHistory ¶
func SaveCopyHistory(filename string, history *CopyHistory) error
SaveCopyHistory saves the copy history to a file
func SaveCopyQueue ¶
Funções utilitárias para salvar/carregar fila de cópia
func SaveErrorLog ¶
Função para salvar os erros
func SaveLargeFilesList ¶
func SaveLargeFilesList(filename string, list *LargeFilesList) error
Funções utilitárias para arquivos grandes
Types ¶
type AccessDeniedLog ¶
type CopyConfig ¶
type CopyConfig struct {
// Base directory to save copied files
OutputDir string
OrganizeByShare bool
// Organize files by match type (filename, content, regex)
OrganizeByMatchType bool
// Preserve directory structure from source
PreserveStructure bool
// Add timestamp to output directory
AddTimestamp bool
// Verbose output
Verbose bool
// User information for logging
Username string
Domain string
// Authentication method used
AuthMethod string
AuthObject auth.AuthMethod // Novo campo: objeto de autenticação
// Novos campos para SMB avançado
Dialect uint16 // Dialeto SMB a ser forçado
Signing *bool // Se deve forçar signing obrigatório
// No copy mode - apenas listar arquivos
NoCopy bool
// Deep copy mode - copy files even if they are not in the original directory
NoCopyDeep bool
// Filename patterns to match for large files
FilenamePatterns []string
// File extensions to match for large files
FileExtensions []string
// Max file size for large files
MaxFileSize int64
// Leet speak enabled
LeetSpeak bool
// Content patterns to match for large files
ContentPatterns []string
// Regex patterns to match for large files
RegexPatterns []*regexp.Regexp
// BatchMode - true = processamento em lote, false = imediato
BatchMode bool
// MiniBatchSize - Tamanho do mini-lote para processamento batch
MiniBatchSize int
// ChunkSize - Tamanho do chunk para processamento em lote
ChunkSize int
// BufferSize - Tamanho do buffer para cópia
BufferSize int
// BatchSize - Tamanho do lote para processamento batch
BatchSize int
// BatchTimeout - Tempo limite para processamento batch
BatchTimeout time.Duration
}
CopyConfig holds the configuration for file copying
func NewCopyConfig ¶
func NewCopyConfig() *CopyConfig
NewCopyConfig creates a new copy configuration with default values
type CopyHistory ¶
type CopyHistory struct {
Host string `json:"host"`
SearchPattern string `json:"search_pattern"`
SearchPatternsHistory []string `json:"search_patterns_history"`
LeetSpeak bool `json:"leet_speak"`
ScanTime time.Time `json:"scan_time"`
User string `json:"user"`
Domain string `json:"domain"`
AuthMethod string `json:"auth_method"`
AuthMethodsUsed []string `json:"auth_methods_history"`
DateTime string `json:"datetime"`
NewFiles int `json:"new_files"`
Entries []HistoryEntry `json:"entries"`
}
CopyHistory representa o histórico de cópias
type CopyQueue ¶
type CopyQueue struct {
Host string `json:"host"`
Entries []CopyQueueEntry `json:"entries"`
}
func LoadCopyQueue ¶
type CopyQueueEntry ¶
type CopyQueueEntry struct {
RemotePath string `json:"remote_path"`
LocalPath string `json:"local_path"`
Size int64 `json:"size"`
SizeFormatted string `json:"size_formatted"`
LargeFile bool `json:"large_file,omitempty"`
Status string `json:"status"` // pending, copied, error
ErrorMsg string `json:"error_msg,omitempty"`
FileType string `json:"file_type,omitempty"`
MatchPattern string `json:"match_pattern,omitempty"`
MatchType string `json:"match_type,omitempty"`
LeetSpeak bool `json:"leet_speak,omitempty"`
SearchParamType string `json:"search_param_type,omitempty"`
SearchParamValue string `json:"search_param_value,omitempty"`
}
type CopyResult ¶
CopyResult represents the result of a file copy operation
func CopyMatchedFiles ¶
func CopyMatchedFiles(ctx context.Context, db *sql.DB, shares map[string]*smb2.Share, searchResults []*search.SearchResult, config *CopyConfig, scanHost string, throttler *smb.Throttler) ([]*CopyResult, int, error)
CopyMatchedFiles copia os arquivos encontrados para o diretório de saída
func CopySingleMatch ¶
func CopySingleMatch(ctx context.Context, db *sql.DB, shares map[string]*smb2.Share, result *search.SearchResult, config *CopyConfig, scanHost string, throttler *smb.Throttler) (*CopyResult, error)
CopySingleMatch processa um único resultado de busca imediatamente
type ErrorEntry ¶
type ErrorEntry struct {
RemotePath string `json:"remote_path"`
LocalPath string `json:"local_path"`
Size int64 `json:"size"`
SizeFormatted string `json:"size_formatted"`
LargeFile bool `json:"large_file,omitempty"`
ErrorMsg string `json:"error_msg"`
ErrorAt time.Time `json:"error_at"`
}
ErrorEntry representa uma entrada com erro na cópia
type ErrorLog ¶
type ErrorLog struct {
Host string `json:"host"`
ScanTime time.Time `json:"scan_time"`
User string `json:"user"`
Domain string `json:"domain"`
AuthMethod string `json:"auth_method"`
AuthMethodsUsed []string `json:"auth_methods_history"`
DateTime string `json:"datetime"`
Entries []ErrorEntry `json:"entries"`
}
ErrorLog representa o log de erros
type FileRef ¶
type FileRef struct {
Path string `json:"path"`
Size int64 `json:"size"`
SizeFormatted string `json:"size_formatted"`
LargeFile bool `json:"large_file,omitempty"` // Indica se é arquivo grande
Found time.Time `json:"found"`
MatchType string `json:"match_type"` // "filename", "content", "regex", "extension"
Pattern string `json:"pattern"` // Padrão que causou o match
}
FileRef representa uma referência a um arquivo encontrado
type HistoryEntry ¶
type HistoryEntry struct {
RemotePath string `json:"remote_path"`
LocalPath string `json:"local_path"`
Size int64 `json:"size"`
SizeFormatted string `json:"size_formatted"`
LargeFile bool `json:"large_file,omitempty"`
CopiedAt time.Time `json:"copied_at"`
ModTime time.Time `json:"mod_time"`
}
HistoryEntry representa uma entrada no histórico de cópias
type LargeFileEntry ¶
type LargeFileEntry struct {
Host string `json:"host"`
Path string `json:"path"`
Size int64 `json:"size"`
SizeFormatted string `json:"size_formatted"`
LargeFile bool `json:"large_file,omitempty"`
DateTime string `json:"datetime"`
MatchType string `json:"match_type"`
Pattern string `json:"pattern"`
}
LargeFileEntry representa um arquivo grande que não foi copiado
type LargeFilesList ¶
type LargeFilesList struct {
Host string `json:"host"`
SearchPattern string `json:"search_pattern"`
LeetSpeak bool `json:"leet_speak"`
ScanTime time.Time `json:"scan_time"`
User string `json:"user"`
Domain string `json:"domain"`
AuthMethod string `json:"auth_method"`
AuthMethodsUsed []string `json:"auth_methods_history"`
Entries []LargeFileEntry `json:"entries"`
}
LargeFilesList representa a lista de arquivos grandes que não foram copiados
func LoadLargeFilesList ¶
func LoadLargeFilesList(filename string) (*LargeFilesList, error)
type NocopyScanResult ¶
type NocopyScanResult struct {
Host string `json:"host"`
SearchPattern string `json:"search_pattern"`
LeetSpeak bool `json:"leet_speak"`
NoCopy bool `json:"no_copy"` // Indica se foi usado -no-copy
DeepScan bool `json:"no_copy_deep"`
ScanTime time.Time `json:"scan_time"`
User string `json:"user"`
Domain string `json:"domain"`
AuthMethod string `json:"auth_method"` // Método atual
AuthMethodsUsed []string `json:"auth_methods_history"` // Histórico de métodos bem-sucedidos
Files []FileRef `json:"files"`
PreviousCount int `json:"previous_count"` // Total de arquivos da execução anterior
NewFiles int `json:"new_files"` // Número de arquivos novos encontrados nesta execução
}
NocopyScanResult representa o resultado da varredura sem cópia