Skip to content

Instantly share code, notes, and snippets.

@porjo
Last active November 7, 2016 10:08
Show Gist options
  • Save porjo/4bacc354d15a8c7026ecdf16d0cf75b6 to your computer and use it in GitHub Desktop.
Save porjo/4bacc354d15a8c7026ecdf16d0cf75b6 to your computer and use it in GitHub Desktop.
Take XML file from nmap and dump resulting structs
package main
import (
"fmt"
"io/ioutil"
"os"
nmap "github.com/lair-framework/go-nmap"
)
func main() {
xmlFile, err := os.Open("scan.xml")
if err != nil {
fmt.Println("Error opening file:", err)
return
}
defer xmlFile.Close()
b, err := ioutil.ReadAll(xmlFile)
if err != nil {
fmt.Println("Error opening file:", err)
return
}
res, err := nmap.Parse(b)
if err != nil {
fmt.Println("Error opening file:", err)
return
}
fmt.Printf("%+v\n", res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment