importers

package
v0.0.0-...-1298975 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: GPL-3.0 Imports: 5 Imported by: 0

README

Please beware that some of the code here was taken from the lair project

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Addr     string `xml:"addr,attr" json:"addr"`
	AddrType string `xml:"addrtype,attr" json:"addrtype"`
	Vendor   string `xml:"vendor,attr" json:"vendor"`
}

Address contains a IPv4 or IPv6 address for a Host.

type CPE

type CPE string

CPE (Common Platform Enumeration) is a standardized way to name software applications, operating systems, and hardware platforms.

type Certificate

type Certificate struct {
	SignatureAlgorithm string    `xml:"signature-algorithm"`
	PublicKey          PublicKey `xml:"pk"`
	Subject            string    `xml:"subject"`
	AltNames           string    `xml:"altnames"`
	Issuer             string    `xml:"issuer"`
	SelfSigned         bool      `xml:"self-signed"`
}

Certificate contains the certificate parameters.

type Cipher

type Cipher struct {
	Status     string `xml:"status,attr"`
	SSLVersion string `xml:"sslversion,attr"`
	Bits       int    `xml:"bits,attr"`
	Cipher     string `xml:"cipher,attr"`
	Curve      string `xml:"curve,attr"`
	EcdheBits  int    `xml:"ecdhebits,attr"`
}

Cipher contains the support cipher suites..

type Compression

type Compression struct {
	Supported bool `xml:"supported,attr"`
}

Compression contains the compression results.

type Debugging

type Debugging struct {
	Level int `xml:"level,attr" json:"level"`
}

Debugging contains the debugging level for the Nmap scan.

type Distance

type Distance struct {
	Value int `xml:"value,attr" json:"value"`
}

Distance is the amount of hops to a particular host.

type ExtraPorts

type ExtraPorts struct {
	State   string   `xml:"state,attr" json:"state"`
	Count   int      `xml:"count,attr" json:"count"`
	Reasons []Reason `xml:"extrareasons" json:"reasons"`
}

ExtraPorts contains the information about the closed|filtered ports.

type Finished

type Finished struct {
	Time     Timestamp `xml:"time,attr" json:"time"`
	TimeStr  string    `xml:"timestr,attr" json:"timestr"`
	Elapsed  float32   `xml:"elapsed,attr" json:"elapsed"`
	Summary  string    `xml:"summary,attr" json:"summary"`
	Exit     string    `xml:"exit,attr" json:"exit"`
	ErrorMsg string    `xml:"errormsg,attr" json:"errormsg"`
}

Finished contains detailed statistics regarding a finished Nmap scan.

type Heartbleed

type Heartbleed struct {
	SSLVersion string `xml:"sslversion,attr"`
	Vulnerable bool   `xml:"vulnerable,attr"`
}

Heatbleed contains the heartbleed results.

type Hop

type Hop struct {
	TTL    float32 `xml:"ttl,attr" json:"ttl"`
	RTT    float32 `xml:"rtt,attr" json:"rtt"`
	IPAddr string  `xml:"ipaddr,attr" json:"ipaddr"`
	Host   string  `xml:"host,attr" json:"host"`
}

Hop is a ip hop to a Host.

type Host

type Host struct {
	StartTime     Timestamp     `xml:"starttime,attr" json:"starttime"`
	EndTime       Timestamp     `xml:"endtime,attr" json:"endtime"`
	Comment       string        `xml:"comment,attr" json:"comment"`
	Status        Status        `xml:"status" json:"status"`
	Addresses     []Address     `xml:"address" json:"addresses"`
	Hostnames     []Hostname    `xml:"hostnames>hostname" json:"hostnames"`
	Smurfs        []Smurf       `xml:"smurf" json:"smurfs"`
	Ports         []Port        `xml:"ports>port" json:"ports"`
	ExtraPorts    []ExtraPorts  `xml:"ports>extraports" json:"extraports"`
	Os            Os            `xml:"os" json:"os"`
	Distance      Distance      `xml:"distance" json:"distance"`
	Uptime        Uptime        `xml:"uptime" json:"uptime"`
	TcpSequence   TcpSequence   `xml:"tcpsequence" json:"tcpsequence"`
	IpIdSequence  IpIdSequence  `xml:"ipidsequence" json:"ipidsequence"`
	TcpTsSequence TcpTsSequence `xml:"tcptssequence" json:"tcptssequence"`
	HostScripts   []Script      `xml:"hostscript>script" json:"hostscripts"`
	Trace         Trace         `xml:"trace" json:"trace"`
}

Host contains all information about a single host.

type HostProperties

type HostProperties struct {
	Tags []Tag `xml:"tag"`
}

HostProperties are tags filled with likely useless information.

type HostStats

type HostStats struct {
	Up    int `xml:"up,attr" json:"up"`
	Down  int `xml:"down,attr" json:"down"`
	Total int `xml:"total,attr" json:"total"`
}

HostStats contains the amount of up and down hosts and the total count.

type Hostname

type Hostname struct {
	Name string `xml:"name,attr" json:"name"`
	Type string `xml:"type,attr" json:"type"`
}

Hostname is a single name for a Host.

type IpIdSequence

type IpIdSequence Sequence

type NessusData

type NessusData struct {
	Report Report `xml:"Report"`
}

NessusData contains a nessus report.

func ParseNessus

func ParseNessus(input io.Reader) (*NessusData, error)

Parse takes deserializes nessus xml data from the given input and unmarshals it into an NessusData struct.

type NmapRun

type NmapRun struct {
	Scanner          string         `xml:"scanner,attr" json:"scanner"`
	Args             string         `xml:"args,attr" json:"args"`
	Start            Timestamp      `xml:"start,attr" json:"start"`
	StartStr         string         `xml:"startstr,attr" json:"startstr"`
	Version          string         `xml:"version,attr" json:"version"`
	ProfileName      string         `xml:"profile_name,attr" json:"profile_name"`
	XMLOutputVersion string         `xml:"xmloutputversion,attr" json:"xmloutputversion"`
	ScanInfo         ScanInfo       `xml:"scaninfo" json:"scaninfo"`
	Verbose          Verbose        `xml:"verbose" json:"verbose"`
	Debugging        Debugging      `xml:"debugging" json:"debugging"`
	TaskBegin        []Task         `xml:"taskbegin" json:"taskbegin"`
	TaskProgress     []TaskProgress `xml:"taskprogress" json:"taskprogress"`
	TaskEnd          []Task         `xml:"taskend" json:"taskend"`
	PreScripts       []Script       `xml:"prescript>script" json:"prescripts"`
	PostScripts      []Script       `xml:"postscript>script" json:"postscripts"`
	Hosts            []Host         `xml:"host" json:"hosts"`
	Targets          []Target       `xml:"target" json:"targets"`
	RunStats         RunStats       `xml:"runstats" json:"runstats"`
}

NmapRun is contains all the data for a single nmap scan.

func ParseNmap

func ParseNmap(input io.Reader) (*NmapRun, error)

Parse takes deserializes nmap xml data from the given input and unmarshals it into an NmapRun struct.

type Os

type Os struct {
	PortsUsed      []PortUsed      `xml:"portused" json:"portsused"`
	OsMatches      []OsMatch       `xml:"osmatch" json:"osmatches"`
	OsFingerprints []OsFingerprint `xml:"osfingerprint" json:"osfingerprints"`
}

Os contains the fingerprinted operating system for a Host.

type OsClass

type OsClass struct {
	Vendor   string `xml:"vendor,attr" json:"vendor"`
	OsGen    string `xml"osgen,attr"`
	Type     string `xml:"type,attr" json:"type"`
	Accuracy string `xml:"accurancy,attr" json:"accurancy"`
	OsFamily string `xml:"osfamily,attr" json:"osfamily"`
	CPEs     []CPE  `xml:"cpe" json:"cpes"`
}

OsClass contains vendor information for an Os.

type OsFingerprint

type OsFingerprint struct {
	Fingerprint string `xml:"fingerprint,attr" json:"fingerprint"`
}

OsFingerprint is the actual fingerprint string.

type OsMatch

type OsMatch struct {
	Name      string    `xml:"name,attr" json:"name"`
	Accuracy  string    `xml:"accuracy,attr" json:"accuracy"`
	Line      string    `xml:"line,attr" json:"line"`
	OsClasses []OsClass `xml:"osclass" json:"osclasses"`
}

OsMatch contains detailed information regarding a Os fingerprint.

type Owner

type Owner struct {
	Name string `xml:"name,attr" json:"name"`
}

Owner contains the name of Port.Owner.

type Port

type Port struct {
	Protocol string   `xml:"protocol,attr" json:"protocol"`
	PortId   int      `xml:"portid,attr" json:"id"`
	State    State    `xml:"state" json:"state"`
	Owner    Owner    `xml:"owner" json:"owner"`
	Service  Service  `xml:"service" json:"service"`
	Scripts  []Script `xml:"script" json:"scripts"`
}

Port contains all the information about a scanned port.

type PortUsed

type PortUsed struct {
	State  string `xml:"state,attr" json:"state"`
	Proto  string `xml:"proto,attr" json:"proto"`
	PortId int    `xml:"portid,attr" json:"portid"`
}

PortsUsed is the port used to fingerprint a Os.

type PublicKey

type PublicKey struct {
	Error bool   `xml:"error,attr"`
	Type  string `xml:"type,attr"`
	Bits  int    `xml:"bits,attr"`
}

PublicKey contains the public key parameters.

type Reason

type Reason struct {
	Reason string `xml:"reason,attr" json:"reason"`
	Count  int    `xml:"count,attr" json:"count"`
}

type Renegotiation

type Renegotiation struct {
	Supported bool `xml:"supported,attr"`
	Secure    bool `xml:"secure,attr"`
}

Renegotation contains the renegotation results.

type Report

type Report struct {
	Name        string       `xml:"name,attr"`
	ReportHosts []ReportHost `xml:"ReportHost"`
}

Report has a name and contains all the host details.

type ReportHost

type ReportHost struct {
	Name           string         `xml:"name,attr"`
	HostProperties HostProperties `xml:"HostProperties"`
	ReportItems    []ReportItem   `xml:"ReportItem"`
}

ReportHost containts the hostname or ip address for the host and all vulnerability and service information.

type ReportItem

type ReportItem struct {
	Port                       int      `xml:"port,attr"`
	SvcName                    string   `xml:"svc_name,attr"`
	Protocol                   string   `xml:"protocol,attr"`
	Severity                   int      `xml:"severity,attr"`
	PluginID                   string   `xml:"pluginID,attr"`
	PluginName                 string   `xml:"pluginName,attr"`
	PluginFamily               string   `xml:"pluginFamily,attr"`
	PluginType                 string   `xml:"plugin_type,name"`
	PluginVersion              string   `xml:"plugin_version"`
	Fname                      string   `xml:"fname,name"`
	RiskFactor                 string   `xml:"risk_factor,name"`
	Synopsis                   string   `xml:"synopsis,name"`
	Description                string   `xml:"description,name"`
	Solution                   string   `xml:"solution,name"`
	PluginOutput               string   `xml:"plugin_output,name"`
	SeeAlso                    string   `xml:"see_also,name"`
	CVE                        []string `xml:"cve,name"`
	BID                        []string `xml:"bid,name"`
	XREF                       []string `xml:"xref,name"`
	PatchPublicationDate       string   `xml:"patch_publication_date,name"`
	PluginModificationDate     string   `xml:"plugin_modification_date,name"`
	PluginPublicationDate      string   `xml:"plugin_publication_date,name"`
	VulnPublicationDate        string   `xml:"vuln_publication_date,name"`
	ExploitabilityEase         string   `xml:"exploitability_ease,name"`
	ExploitAvailable           bool     `xml:"exploit_available,name"`
	ExploitFrameworkCanvas     bool     `xml:"exploit_framework_canvas,name"`
	ExploitFrameworkMetasploit bool     `xml:"exploit_framework_metasploit,name"`
	ExploitFrameworkCore       bool     `xml:"exploit_framework_core,name"`
	MetasploitName             string   `xml:"metasploit_name,name"`
	CanvasPackage              string   `xml:"canvas_package,name"`
	CoreName                   string   `xml:"core_name,name"`
	CVSSVector                 string   `xml:"cvss_vector,name"`
	CVSSBaseScore              float64  `xml:"cvss_base_score,name"`
	CVSSTemporalScore          string   `xml:"cvss_temporal_score,name"`
	CVSS3Vector                string   `xml:"cvss3_vector,name,omitempty"`
	CVSS3BaseScore             float64  `xml:"cvss3_base_score,name,omitempty"`
	CVSS3TemporalScore         string   `xml:"cvss3_temporal_score,name,omitempty"`
	ComplianceResult           string   `xml:"cm:compliance-result,name"`
	ComplianceActualValue      string   `xml:"cm:compliance-actual-value,name"`
	ComplianceCheckID          string   `xml:"cm:compliance-check-id,name"`
	ComplianceAuditFile        string   `xml:"cm:compliance-audit-file,name"`
	ComplianceCheckValue       string   `xml:"cm:compliance-check-name,name"`
}

ReportItem is vulnerability plugin output.

type RunStats

type RunStats struct {
	Finished Finished  `xml:"finished" json:"finished"`
	Hosts    HostStats `xml:"hosts" json:"hosts"`
}

RunStats contains statistics for a finished Nmap scan.

type SSLScanData

type SSLScanData struct {
	Title   string    `xml:"title,attr"`
	Version string    `xml:"version,attr"`
	Web     string    `xml:"web,attr"`
	SSLTest []SSLTest `xml:"ssltest"`
}

SSLScanData contains all the data form a single sslscan job.

func ParseSslscan

func ParseSslscan(input io.Reader) (*SSLScanData, error)

Parse deserializes an sslscan xml from the given input and unmarshals it into an SSLScanRun struct.

type SSLTest

type SSLTest struct {
	Host          string        `xml:"host,attr"`
	Port          int           `xml:"port,attr"`
	Renegotiation Renegotiation `xml:"renegotiation"`
	Compression   Compression   `xml:"compression"`
	Heartbleed    []Heartbleed  `xml:"heartbleed"`
	Cipher        []Cipher      `xml:"cipher"`
	DefaultCipher Cipher        `xml:"defaultcipher"`
	Certificate   Certificate   `xml:"certificate"`
}

SSLTest contains sslscan results.

type ScanInfo

type ScanInfo struct {
	Type        string `xml:"type,attr" json:"type"`
	Protocol    string `xml:"protocol,attr" json:"protocol"`
	NumServices int    `xml:"numservices,attr" json:"numservices"`
	Services    string `xml:"services,attr" json:"services"`
	ScanFlags   string `xml:"scanflags,attr" json:"scanflags"`
}

ScanInfo contains informational regarding how the scan was run.

type Script

type Script struct {
	Id     string  `xml:"id,attr" json:"id"`
	Output string  `xml:"output,attr" json:"output"`
	Tables []Table `xml:"table" json:"tables"`
}

Script contains information from Nmap Scripting Engine.

type Sequence

type Sequence struct {
	Class  string `xml:"class,attr" json:"class"`
	Values string `xml:"values,attr" json:"values"`
}

Sequence contains information regarding the detected X sequence.

type Service

type Service struct {
	Name       string `xml:"name,attr" json:"name"`
	Conf       int    `xml:"conf,attr" json:"conf"`
	Method     string `xml:"method,attr" json:"method"`
	Version    string `xml:"version,attr" json:"version"`
	Product    string `xml:"product,attr" json:"product"`
	ExtraInfo  string `xml:"extrainfo,attr" json:"extrainfo"`
	Tunnel     string `xml:"tunnel,attr" json:"tunnel"`
	Proto      string `xml:"proto,attr" json:"proto"`
	Rpcnum     string `xml:"rpcnum,attr" json:"rpcnum"`
	Lowver     string `xml:"lowver,attr" json:"lowver"`
	Highver    string `xml:"hiver,attr" json:"hiver"`
	Hostname   string `xml:"hostname,attr" json:"hostname"`
	OsType     string `xml:"ostype,attr" json:"ostype"`
	DeviceType string `xml:"devicetype,attr" json:"devicetype"`
	ServiceFp  string `xml:"servicefp,attr" json:"servicefp"`
	CPEs       []CPE  `xml:"cpe" json:"cpes"`
}

Service contains detailed information about a Port's service details.

type Smurf

type Smurf struct {
	Responses string `xml:"responses,attr" json:"responses"`
}

Smurf contains repsonses from a smurf attack. I think. Smurf attacks, really?

type State

type State struct {
	State     string  `xml:"state,attr" json:"state"`
	Reason    string  `xml:"reason,attr" json:"reason"`
	ReasonTTL float32 `xml:"reason_ttl,attr" json:"reason_ttl"`
	ReasonIP  string  `xml:"reason_ip,attr" json:"reason_ip"`
}

State contains information about a given ports status. State will be open, closed, etc.

type Status

type Status struct {
	State     string  `xml:"state,attr" json:"state"`
	Reason    string  `xml:"reason,attr" json:"reason"`
	ReasonTTL float32 `xml:"reason_ttl,attr" json:"reason_ttl"`
}

Status is the host's status. Up, down, etc.

type Table

type Table struct {
	Key      string   `xml:"key,attr" json:"key"`
	Elements []string `xml:"elem" json:"elements"`
}

Table contains the output of the script in a more parse-able form. ToDo: This should be a map[string][]string

type Tag

type Tag struct {
	Name string `xml:"name,attr"`
	Data string `xml:",chardata"`
}

Tag is used to split the tag into name and the tag content.

type Target

type Target struct {
	Specification string `xml:"specification,attr" json:"specification"`
	Status        string `xml:"status,attr" json:"status"`
	Reason        string `xml:"reason,attr" json:"reason"`
}

Target is found in the Nmap xml spec. I have no idea what it actually is.

type Task

type Task struct {
	Task      string    `xml:"task,attr" json:"task"`
	Time      Timestamp `xml:"time,attr" json:"time"`
	ExtraInfo string    `xml:"extrainfo,attr" json:"extrainfo"`
}

Task contains information about started and stopped Nmap tasks.

type TaskProgress

type TaskProgress struct {
	Task      string    `xml:"task,attr" json:"task"`
	Time      Timestamp `xml:"time,attr" json:"time"`
	Percent   float32   `xml:"percent,attr" json:"percent"`
	Remaining int       `xml:"remaining,attr" json:"remaining"`
	Etc       Timestamp `xml:"etc,attr" json:"etc"`
}

TaskProgress contains information about the progression of a Task.

type TcpSequence

type TcpSequence struct {
	Index      int    `xml:"index,attr" json:"index"`
	Difficulty string `xml:"difficulty,attr" json:"difficulty"`
	Values     string `xml:"vaules,attr" json:"vaules"`
}

TcpSequence contains information regarding the detected tcp sequence.

type TcpTsSequence

type TcpTsSequence Sequence

type Times

type Times struct {
	SRTT string `xml:"srtt,attr" json:"srtt"`
	RTT  string `xml:"rttvar,attr" json:"rttv"`
	To   string `xml:"to,attr" json:"to"`
}

Times contains time statistics for an Nmap scan.

type Timestamp

type Timestamp time.Time

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (Timestamp) MarshalXMLAttr

func (t Timestamp) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

func (Timestamp) UnmarshalJSON

func (t Timestamp) UnmarshalJSON(b []byte) error

func (Timestamp) UnmarshalXMLAttr

func (t Timestamp) UnmarshalXMLAttr(attr xml.Attr) (err error)

type Trace

type Trace struct {
	Proto string `xml:"proto,attr" json:"proto"`
	Port  int    `xml:"port,attr" json:"port"`
	Hops  []Hop  `xml:"hop" json:"hops"`
}

Trace contains the hops to a Host.

type Uptime

type Uptime struct {
	Seconds  int    `xml:"seconds,attr" json:"seconds"`
	Lastboot string `xml:"lastboot,attr" json:"lastboot"`
}

Uptime is the amount of time the host has been up.

type Verbose

type Verbose struct {
	Level int `xml:"level,attr" json:"level"`
}

Verbose contains the verbosity level for the Nmap scan.

Jump to

Keyboard shortcuts

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