mirror of
https://github.com/ANG13T/SatIntel.git
synced 2025-12-12 07:40:38 -08:00
Check if space track and n2yo creds are present, else prompt the user to enter them
This commit is contained in:
34
main.go
34
main.go
@@ -1,17 +1,43 @@
|
||||
/*
|
||||
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
|
||||
Copyright © 2023 Angelina Tsuboi angelinatsuboi@proton.me
|
||||
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"github.com/ANG13T/SatIntel/cli"
|
||||
)
|
||||
|
||||
|
||||
func set_environmental_variable(env_key string) {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
fmt.Print(env_key + ": ")
|
||||
input, err := reader.ReadString('\n')
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Error reading input:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
os.Setenv(env_key, strings.TrimSpace(input))
|
||||
}
|
||||
|
||||
|
||||
func check_environmental_variable(env_key string) {
|
||||
if os.Getenv(env_key) == "" {
|
||||
set_environmental_variable(env_key)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
os.Setenv("SPACE_TRACK_USERNAME", "username")
|
||||
os.Setenv("SPACE_TRACK_PASSWORD", "password")
|
||||
os.Setenv("N2YO_API_KEY", "api-key")
|
||||
check_environmental_variable("SPACE_TRACK_USERNAME")
|
||||
check_environmental_variable("SPACE_TRACK_PASSWORD")
|
||||
check_environmental_variable("N2YO_API_KEY")
|
||||
|
||||
cli.SatIntel()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user