Last active
November 7, 2016 10:08
-
-
Save porjo/4bacc354d15a8c7026ecdf16d0cf75b6 to your computer and use it in GitHub Desktop.
Take XML file from nmap and dump resulting structs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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