main.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
package main import ( "log" "os" "scan-network/database" "scan-network/oui" "scan-network/utils" ) const dbPath string = "./oui.db" func init() { err := database.CreateDbIfNotExists(dbPath) if err != nil { log.Fatalf("Error creating database file: %v", err) } db, err := database.New(dbPath) if err != nil { log.Fatalf("Error opening database: %v", err) } defer db.Close() err = db.CreateOuiTable() if err != nil { log.Fatalf("Error creating table: %v", err) } } func main() { db, err := database.New(dbPath) if err != nil { log.Fatalf("Error opening database: %v", err) } else { utils.PrintInColor("Database opened successfully", 28) } defer db.Close() file, err := os.Open("standards-oui.ieee.org.txt") if err != nil { log.Fatalf("Error opening file: %v", err) } defer file.Close() oui.ScanDataFromTextFile("/Users/brijesh/projects/ongoing/scan-network/standards-oui.ieee.org.txt", db) utils.PrintInColor("OUI data imported successfully", 28) } |