~kdsch/android-bulletin

363f989ea78810f79cbac6c0054a014b61bb48e6 — Karl Schultheisz 2 years ago 456da3b master
refer to TSV, not CSV, file format
4 files changed, 8 insertions(+), 8 deletions(-)

M README.md
M main.go
M scrape
R vulns.csv => vulns.tsv
M README.md => README.md +3 -3
@@ 14,15 14,15 @@ To convert a bulletin list into a newline-delimited list of urls, use

	./android-bulletin urls <bulletin-list.html >urls.txt

To convert a set of HTML files into a CSV file, use
To convert a set of HTML files into a tab-separated value (TSV) file, use

	./android-bulletin csv bulletin/*.html >vulns.csv
	./android-bulletin tsv bulletin/*.html >vulns.tsv


## Contributing

`android-bulletin` is licensed under GPLv3.

vulns.csv is derived from [Android Security Bulletins][aosp-sb].
vulns.tsv is derived from [Android Security Bulletins][aosp-sb].

[aosp-sb]: https://source.android.com/security/bulletin

M main.go => main.go +4 -4
@@ 225,7 225,7 @@ func shave(s string) string {
	return strings.ReplaceAll(strings.TrimSpace(s), "\n", " ")
}

func emitEntriesAsCSV(entries []entry) {
func emitEntriesAsTSV(entries []entry) {
	w := csv.NewWriter(os.Stdout)
	w.Comma = '\t'
	defer w.Flush()


@@ 268,7 268,7 @@ func emitEntriesAsCSV(entries []entry) {
}

func usage() {
	fmt.Fprintf(os.Stderr, "usage: %s urls|(csv <html files>)\n", os.Args[0])
	fmt.Fprintf(os.Stderr, "usage: %s urls|(tsv <html files>)\n", os.Args[0])
	os.Exit(1)
}



@@ 281,7 281,7 @@ func main() {
	case "urls":
		os.Stdout.WriteString(strings.Join(getBulletinURLs(os.Stdin), "\n"))

	case "csv":
	case "tsv":
		var entries []entry
		for _, file := range os.Args[2:] {
			f, err := os.Open(file)


@@ 292,7 292,7 @@ func main() {
			entries = append(entries, getCVEs(bulletin{path: file, html: f})...)
			f.Close()
		}
		emitEntriesAsCSV(entries)
		emitEntriesAsTSV(entries)

	default:
		usage()

M scrape => scrape +1 -1
@@ 4,4 4,4 @@ mkdir -p bulletins
wget https://source.android.com/security/bulletin
./android-bulletin urls <bulletin >urls
wget -i - -P bulletins <urls
./android-bulletin csv bulletins/* >vulns.csv
./android-bulletin tsv bulletins/* >vulns.tsv

R vulns.csv => vulns.tsv +0 -0