mirror of
https://github.com/ANG13T/SatIntel.git
synced 2025-12-05 20:40:09 -08:00
Merge pull request #2 from christopherwoodall/1-env-auth-over-ride
Set/Get environmental variables in `main.go`
This commit is contained in:
26
README.md
26
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
|
||||
|
||||
|
||||
43
main.go
43
main.go
@@ -1,17 +1,50 @@
|
||||
/*
|
||||
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 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()
|
||||
}
|
||||
|
||||
@@ -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