diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/README.md b/README.md index 5a3b652..aa29c4a 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,18 @@ ``` . . . . . . . . . - . . . ________ + . . . ________ . ///////// . . . . . . . ________ . . ///////// . . |.____. /\ ///////// . . . . . // \/ |\ ///////// // \ | \ ///////// _______ _______ _______ _____ __ _ _______ _______ . - || | | ///////// . . |______ |_____| | | | \ | | |______ | - . || | |// ///// ______| | | | __|__ | \_| | |______ |_____ . - \\ / // \/ . + || | | ///////// . . |______ |_____| | | | \ | | |______ | + . || | |// ///// ______| | | | __|__ | \_| | |______ |_____ . + \\ / // \/ . \\.___./ //\ ,_\ . . . . . \ //////\ / \ . . Satellite OSINT CLI Tool . . - . ///////// \| | . + . ///////// \| | . . ///////// . \ __ / . Made by Angelina Tsuboi (G4LXY) . . ///////// . . . . . ///////// . . . . . . @@ -26,7 +26,7 @@ ### Features - Satellite Catalog Retrieval from NORAD ID or Selection Menu - Display Satellite Telemetry -- Visual and Radio Orbital Predictions +- Visual and Radio Orbital Predictions - Parse Two Line Elements (TLE) ### Preview @@ -37,17 +37,17 @@ Make an account at [**Space Track**](https://space-track.org) save username and Create an account at [**N2YO**](https://n2yo.com) and save API key. -Update `main.go` to have proper credentials -``` -os.Setenv("SPACE_TRACK_USERNAME", "username") -os.Setenv("SPACE_TRACK_PASSWORD", "password") -os.Setenv("N2YO_API_KEY", "api-key") +The CLI will prompt for both Space Track and N2YO credentials if none are present in your environmental variables. To export your credentials enter the following commands: +```bash +$ export SPACE_TRACK_USERNAME="YOUR_USER_NAME" +$ export SPACE_TRACK_PASSWORD="YOUR_PASSWORD" +$ export N2YO_API_KEY="YOUR_API_KEY" ``` To build from source, you will need Go installed. ```bash -$ export GO111MODULE=on +$ export GO111MODULE=on $ go get ./... $ go run main.go ``` @@ -61,5 +61,5 @@ To get a general overview of the underlying concepts of this tool, [read this ar ### Upcoming Features + [ ] Map Layout of Satellite Positioning -+ [ ] Including the [SGP4 Algorithm](joshuaferrara/go-satellite) for Position Prediction ++ [ ] Including the [SGP4 Algorithm](joshuaferrara/go-satellite) for Position Prediction diff --git a/main.go b/main.go index d4de56e..f22ed36 100644 --- a/main.go +++ b/main.go @@ -1,17 +1,50 @@ /* -Copyright © 2023 NAME HERE - +Copyright © 2023 Angelina Tsuboi angelinatsuboi@proton.me */ + package main import ( + "bufio" + "fmt" "os" + "strings" + "github.com/ANG13T/SatIntel/cli" ) +func setEnvironmentalVariable(envKey string) string { + reader := bufio.NewReader(os.Stdin) + fmt.Printf("%s: ", envKey) + input, err := reader.ReadString('\n') + + if err != nil { + fmt.Println("Error reading input:", err) + os.Exit(1) + } + input = strings.TrimSuffix(input, "\n") + + if err := os.Setenv(envKey, input); err != nil { + fmt.Printf("Error setting environment variable %s: %v\n", envKey, err) + os.Exit(1) + } + + return input +} + + +func checkEnvironmentalVariable(envKey string) { + _, found := os.LookupEnv(envKey) + if !found { + setEnvironmentalVariable(envKey) + } +} + + func main() { - os.Setenv("SPACE_TRACK_USERNAME", "username") - os.Setenv("SPACE_TRACK_PASSWORD", "password") - os.Setenv("N2YO_API_KEY", "api-key") + checkEnvironmentalVariable("SPACE_TRACK_USERNAME") + checkEnvironmentalVariable("SPACE_TRACK_PASSWORD") + checkEnvironmentalVariable("N2YO_API_KEY") + cli.SatIntel() } diff --git a/osint/satelliteposition.go b/osint/satelliteposition.go index 9044fe2..4fff648 100644 --- a/osint/satelliteposition.go +++ b/osint/satelliteposition.go @@ -3,10 +3,10 @@ package osint import ( "io/ioutil" "fmt" - "github.com/iskaa02/qalam/gradient" + "github.com/iskaa02/qalam/gradient" "encoding/json" "github.com/TwiN/go-color" - "net/http" + "net/http" "strconv" "os" ) @@ -31,7 +31,7 @@ func SatellitePositionVisualization() { var norad string fmt.Scanln(&norad) GetLocation(norad) - } + } return }