util

package
v0.0.0-...-c1dbbc8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2016 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const ANALYSIS_OUTPUT_BASE_PATH = "cleanedResults"
View Source
const AS_FOLDER = "asdb"
View Source
const CONCURRENCY = 10000
View Source
const FILE_ACCESS_PERMISSION = 0755
View Source
const GEODB_FOLDER = "geodb"
View Source
const HTTP_ANALYSIS_OUTPUTH_PATH = "http"
View Source
const HTTP_OUTPUT_FILE_NAME = "http_version"
View Source
const MAXMIND_ASIP_URL = "http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum2.zip"
View Source
const MAXMIND_AS_DB_ENTRY_REGEX = `(AS\d*)(?:\s(.*))?`
View Source
const MAXMIND_AS_DB_FILE_NAME = "GeoIPASNum2.csv"
View Source
const MAXMIND_AS_DB_ZIP_FILE_NAME = "GeoIPASNum2.zip"
View Source
const MAXMIND_GEOIP_URL = "http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz"
View Source
const MAXMIND_GEO_DB_FILE_NAME = "GeoLite2-Country.mmdb"
View Source
const MAXMIND_GEO_DB_ZIP_FILE_NAME = "GeoLite2-Country.mmdb.gz"
View Source
const SCAN_CONCURRENCY = 1000
View Source
const SCAN_OUTPUT_BASE_PATH = "scanResults"
View Source
const SSH_ANALYSIS_OUTPUTH_PATH = "ssh"
View Source
const SSH_OUTPUT_FILE_NAME = "ssh_version"
View Source
const TIMESTAMP_FORMAT = "2006-01-02"
View Source
const TIMESTAMP_FORMAT_SECONDS = "2006-01-02T15:04:05-0700"

Variables

Functions

func ASUtilInitialise

func ASUtilInitialise()

func AppendZeroToVersion

func AppendZeroToVersion(version string) string

func Base64Decode

func Base64Decode(str string) (string, error)

func CalculateSha256

func CalculateSha256(file string) string

func Check

func Check(e error)

func CheckPathExist

func CheckPathExist(path string) bool

func CreateOutputJsonFile

func CreateOutputJsonFile(path string, filename string) (*os.File, string)

func FindAS

func FindAS(ip string) (string, string)

func GeoUtilInitialise

func GeoUtilInitialise()

func GeoUtilShutdown

func GeoUtilShutdown()

func MakeVersionCanonical

func MakeVersionCanonical(version string) string

func TimeTrack

func TimeTrack(start time.Time, name string)

func Ungzip

func Ungzip(source, target string) error

func Unzip

func Unzip(src, dest string) error

func WriteBytesToFile

func WriteBytesToFile(wg *sync.WaitGroup, writeQueue chan []byte, file *os.File)

func WriteEntries

func WriteEntries(complete chan bool, writeQueue chan []byte, file *os.File)

func WriteStringToFile

func WriteStringToFile(wg *sync.WaitGroup, writeQueue chan string, file *os.File)

func WriteSummaryFileAsJson

func WriteSummaryFileAsJson(result map[string]int, path string, filename string)

Types

type Asc

type Asc []geoLiteEntry

func (Asc) Len

func (s Asc) Len() int

func (Asc) Less

func (s Asc) Less(i, j int) bool

func (Asc) Swap

func (s Asc) Swap(i, j int)

type CleanMetaData

type CleanMetaData struct {
	ServerHeaderCleaned    uint64    `json:"server_headers_cleaned"`
	ServerHeaderNotCleaned uint64    `json:"server_headers_not_cleaned"`
	Total                  uint64    `json:"total_processed"`
	InputFile              string    `json:"input_file"`
	Started                time.Time `json:"time_started"`
	Finished               time.Time `json:"time_finished"`
	Duration               string    `json:"duration"`
	Sha256SumOfInputFile   string    `json:"sha256_sum_of_input_file"`
	Sha256SumOfOutputFile  string    `json:"sha256_sum_of_output_file"`
	OutputFile             string    `json:"output_file"`
}

type GeoData

type GeoData struct {
	RegisteredCountryCode  string `json:"RegCountry" maxminddb:"iso_code"`
	GeolocationCountryCode string `json:"GeoCountry"`
	Continent              string `json:"Continent"`
}

func FindGeoData

func FindGeoData(ip string) GeoData

Jump to

Keyboard shortcuts

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