sanitize

package
v0.0.0-...-01d0886 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: UPL-1.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedactionPrefix = "REDACTED-"
	RedactionMap    = "sensitive-do-not-share-redaction-map.csv"
)

Variables

View Source
var KnownHostNames = make(map[string]bool)
View Source
var KnownHostNamesMutex = &sync.Mutex{}
View Source
var KnownNodeNames = make(map[string]string)
View Source
var KnownNodeNamesMutex = &sync.Mutex{}

Functions

func GetShortSha256Hash

func GetShortSha256Hash(line string) string

GetShortSha256Hash generates the one way hash for the input string and then returns "REDACTED-"and the first 7 characters of that hash

func InitRegexToReplacementMap

func InitRegexToReplacementMap()

InitRegexToReplacementMap Initialize the regex string to replacement string map Append to this map for any future additions

func PutIntoNodeNamesIfNotPresent

func PutIntoNodeNamesIfNotPresent(inputKey string)

PutIntoNodeNamesIfNotPresent populates the node map with a given node name

func SanitizeFilesInDirTree

func SanitizeFilesInDirTree(rootDir string) error

SanitizeFilesInDirTree all files in a directory tree, including files in all nested subdirectories

func SanitizeLines

func SanitizeLines(reader io.Reader, writer io.Writer) error

read each line, sanitize it and write to writer

func SanitizeString

func SanitizeString(l string, redactedValuesOverride map[string]string) string

SanitizeString sanitizes each line in a given file, Sanitizes based on the regex map initialized above, which is currently filtering for IPv4 addresses and hostnames

The redactedValuesOverride parameter can be used to override the default redactedValues map for keeping track of redacted strings.

func WriteRedactionMapFile

func WriteRedactionMapFile(captureDir string, redactedValuesOverride map[string]string) error

WriteRedactionMapFile creates a CSV file to document all the values this tool has redacted so far, stored in the redactedValues (or redactedValuesOverride) map.

Types

This section is empty.

Jump to

Keyboard shortcuts

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