package
3.0.2
Repository: https://github.com/vdjagilev/nmap-formatter.git
Documentation: pkg.go.dev

# Functions

New returns new instance of formatter the exact struct of formatter would depend on provided config.
NewSqliteDB attempts to create new instance of SqliteDB struct and attempts to make a connection to the database, once it's successful it assigns variables to a ScanRepository struct and returns a pointer.
TemplateContent reads customly provided template content or fails with error.

# Constants

CSVOutput constant defines OutputFormat for Comma-Separated Values CSV file which is viewed most of the time in Excel.
D2LangOutput constant defines OutputFormat for D2 language, which can be used to generate D2 language files.
DotClosedPortColor defies default color of the closed port.
DotDefaultColor defines default color of various elements (lines, boxes).
DotFilteredPortColor defines default color of the filtered port.
DotFontStyle default font style.
DotLayout is a type of layout used in Graphviz (dot by default is the most fitting).
DotOpenPortColor defines default color of the opened port.
DotOutput constant defined OutputFormat for Dot (Graphviz), which can be used to generate various graphs.
ExcelOutput constant defines OutputFormat for Excel file, which can be used to generate Excel files.
HTMLOutput constant defines OutputFormat is HyperText Markup Language which can be viewed using browsers.
JSONOutput constant defines OutputFormat for JavaScript Object Notation, which is more useful for machine-related operations (parsing).
MarkdownOutput constant defines OutputFormat for Markdown, which is handy and easy format to read-write.
SqliteOutput constant defines OutputFormat for sqlite file, which can be used to generate sqlite embedded databases.

# Variables

DotDefaultOptions is a config map that is used in Graphviz template.
DotTemplate variable is used to store contents of graphviz template go:embed resources/templates/graphviz.tmpl.
ExcelColWidth is the default width of the columns in the Excel file.
HTMLSimpleTemplate variable is used to store embedded HTML template content go:embed resources/templates/simple-html.gohtml.
MarkdownTemplate variable is used to store markdown.tmpl embed file contents go:embed resources/templates/markdown.tmpl.
SqliteDDL contains database schema definition go:embed resources/sql/sqlite_ddl.sql.

# Structs

CellData is a struct to hold the data for a cell to avoid code duplication.
Config defines main application configs (requirements from user), like: where output will be delivered, desired output format, input file path, output file path and different output options.
CSVFormatter is struct defined for CSV Output use-case.
CSVOutputOptions store option related only to CSV conversion/formatting.
D2LangFormatter is struct defined for D2 Language Output use-case.
D2LangOutputOptions store options related to D2 language file formatting.
Debugging defines level of debug during NMAP execution.
Distance describes amount of hops to the target.
DotFormatter is used to create Graphviz (dot) format.
DotTemplateData is a custom TemplateData struct that is used by DotFormatter.
ExcelFormatter is struct defined for Excel Output use-case.
ExcelOutputOptions store options related to Excel file formatting.
ExtraPorts contains information about certain amount of ports that were (for example) filtered.
Finished is part of `RunStats` struct, it has all information related to the time (started, how much time it took) and summary incl.
Hop struct contains information about HOP record with time to live, host name, IP.
Host describes host related entry (`host` node).
HostAddress struct contains the host address (IP) and type of it.
HostName defines the name of the host and type of DNS record (like PTR for example).
HostNames struct contains list of hostnames (domains) that this host has.
HostRepository main responsibility is to populated database with host related data.
HostStatus describes the state (up or down) of the host and the reason.
HTMLFormatter is struct defined for HTML Output use-case.
HTMLOutputOptions stores options related only to HTML conversion/formatting.
InputFileConfig stores all options related to nmap XML (path, is content is taken from stdin and io reader).
IPIDSequence describes all information related to `<ipidsequence>` node.
JSONFormatter is struct defined for JSON Output use-case.
JSONOutputOptions store option related only to JSON conversion/formatting.
MainWorkflow is main workflow implementation struct.
MarkdownFormatter is a formatter struct used to deliver markdown file format.
MarkdownOutputOptions stores options related only to Markdown conversion/formatting.
NMAPRun represents main `<nmaprun>` node which contains meta-information about the scan For example: scanner, what arguments used during scan, nmap version, verbosity level, et cetera Main information about scanned hosts is in the `host` node.
OS describes all information about underlying operating system that this host operates.
OSClass contains all information about operating system family.
OSMatch is a record of OS that matched with certain accuracy.
OSPortUsed defines which ports were used for OS detection.
OSRepository is responsible for populating database with OS related data on the scanned host.
OutputOptions describes various output options for nmap formatter.
Port record contains main information about port that was scanned.
PortRepository is responsible for populating database with a data related to ports.
PortService struct contains information about the service that is located on certain port.
PortState describes information about the port state and why it's state was defined that way.
RunStats contains other nodes that refer to statistics of the scan.
ScanInfo shows what type of scan it was and number of services covered.
ScanRepository main function is to make a first step populating sqlite database with values.
Script defines a script ID and script output (result).
SqliteDB holds sqlite connection and transaction and performs main database function - preparation, population and finishing data migration.
SqliteFormatter is a main struct to handle output for Sqlite.
SqliteOutputOptions store options related to SQLite database formatting.
StatHosts contains statistics about hosts that are up or down.
TCPSequence describes all information related to `<tcpsequence>`.
TCPTSSequence describes all information related to `<tcptssequence>` node.
TemplateData is a struct that is used in the template, where NMAPRun is containing all parsed data from XML & OutputOptions contain all the information about certain output preferences.
Trace struct contains trace information with hops.
Uptime shows the information about host uptime.
Verbose defines verbosity level that was configured during NMAP execution.

# Interfaces

Formatter interface describes only one function `Format()` that is responsible for data "formatting".
Workflow interface that describes the main functions that are used in nmap-formatter.

# Type aliases

InputFile describes input file (nmap XML full path).
OutputFile describes output file name (full path).
OutputFormat is a resulting type of file that is converted/formatted from XML to HTML (for example).
RTT is a separate type that is located in Hop struct.