chore: add readme and makefile and also fixed package rename spelling mistakes from last commit
Brijesh Wawdhane brijesh@wawdhane.com
Fri, 20 Sep 2024 23:10:28 +0530
8 files changed,
68 insertions(+),
11 deletions(-)
A
Makefile
@@ -0,0 +1,37 @@
+PROJECT_NAME := network-scan +PLATFORMS := darwin/amd64 darwin/arm64 linux/386 linux/amd64 linux/arm linux/arm64 windows/386 windows/amd64 +EXECUTABLES_DIR := executables + +.PHONY: all build setup clean + +all: setup build + +build: + @mkdir -p $(EXECUTABLES_DIR) + @for platform in $(PLATFORMS); do \ + IFS='/' read -r -a array <<< "$$platform"; \ + GOOS=$${array[0]}; \ + GOARCH=$${array[1]}; \ + if [ $$GOOS = "windows" ]; then \ + OUTPUT_NAME=$(PROJECT_NAME)_$${GOOS}_$${GOARCH}.exe; \ + else \ + OUTPUT_NAME=$(PROJECT_NAME)_$${GOOS}_$${GOARCH}; \ + fi; \ + echo "Building for $$GOOS $$GOARCH"; \ + env GOOS=$$GOOS GOARCH=$$GOARCH go build -o $(EXECUTABLES_DIR)/$$OUTPUT_NAME || exit 1; \ + done + +setup: + @rm -f standards-oui.ieee.org.txt + @echo "Downloading OUI data..." + @wget -q https://raw.githubusercontent.com/wbrijesh/static-files/refs/heads/main/standards-oui.ieee.org.txt -O standards-oui.ieee.org.txt + @if [ $$? -eq 0 ]; then \ + echo "✅ Successfully downloaded OUI data"; \ + else \ + echo "Error: Failed to download OUI data"; \ + exit 1; \ + fi + +clean: + @rm -rf $(EXECUTABLES_DIR) + @rm -f standards-oui.ieee.org.txt
A
README.md
@@ -0,0 +1,20 @@
+# Network Scan + +Network Scan is a tool for scanning devices in your local network. +This project is in its early stages of development. + + +## Why? + +network-scan is born out of the frustration of dealing with either overly complex or paid network scanning tools. +It's a middleground between free but complex tools like nmap and paid but easy to use tools like lanscan. + +## Features + +- [ ] Discover all the devices on your network +- [ ] Show device vendor info +- [ ] If the device can be pinged +- [ ] mDNS name of the device +- [ ] scan for open ports on devices (unsure about this one) +- [ ] install using shell command: `curl script_url | bash` +- [ ] install using go: `go install`
M
database/database.go
→
database/database.go
@@ -3,8 +3,8 @@
import ( "database/sql" "fmt" + "network-scan/utils" "os" - "scan-network/utils" _ "github.com/mattn/go-sqlite3" )
A
go.sum
@@ -0,0 +1,2 @@
+github.com/mattn/go-sqlite3 v1.14.23 h1:gbShiuAP1W5j9UOksQ06aiiqPMxYecovVGwmTxWtuw0= +github.com/mattn/go-sqlite3 v1.14.23/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
M
main.go
→
main.go
@@ -4,9 +4,9 @@ import (
"log" "os" - "scan-network/database" - "scan-network/oui" - "scan-network/utils" + "network-scan/database" + "network-scan/oui" + "network-scan/utils" ) const dbPath string = "./oui.db"@@ -44,6 +44,6 @@ log.Fatalf("Error opening file: %v", err)
} defer file.Close() - oui.ScanDataFromTextFile("/Users/brijesh/projects/ongoing/scan-network/standards-oui.ieee.org.txt", db) + oui.ScanDataFromTextFile("/Users/brijesh/projects/ongoing/network-scan/standards-oui.ieee.org.txt", db) utils.PrintInColor("OUI data imported successfully", 28) }
M
oui/oui-import.go
→
oui/oui-import.go
@@ -3,9 +3,9 @@
import ( "bufio" "fmt" + "network-scan/database" "os" "regexp" - "scan-network/database" ) func ScanDataFromTextFile(filePath string, db *database.Database) {