Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set/Get environmental variables in main.go #2

Merged
merged 5 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

```
. . . . . . . . .
. . . ________
. . . ________
. ///////// . . . . . .
. ________ . . ///////// . .
|.____. /\ ///////// . . . .
. // \/ |\ /////////
// \ | \ ///////// _______ _______ _______ _____ __ _ _______ _______ .
|| | | ///////// . . |______ |_____| | | | \ | | |______ |
. || | |// ///// ______| | | | __|__ | \_| | |______ |_____ .
\\ / // \/ .
|| | | ///////// . . |______ |_____| | | | \ | | |______ |
. || | |// ///// ______| | | | __|__ | \_| | |______ |_____ .
\\ / // \/ .
\\.___./ //\ ,_\ . . .
. . \ //////\ / \ . . Satellite OSINT CLI Tool . .
. ///////// \| | .
. ///////// \| | .
. ///////// . \ __ / . Made by Angelina Tsuboi (G4LXY) .
. ///////// . . .
. . ///////// . . . . . .
Expand All @@ -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
Expand All @@ -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
```
Expand All @@ -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 changes: 38 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
/*
Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 Angelina Tsuboi [email protected]
*/

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()
}
6 changes: 3 additions & 3 deletions osint/satelliteposition.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -31,7 +31,7 @@ func SatellitePositionVisualization() {
var norad string
fmt.Scanln(&norad)
GetLocation(norad)
}
}

return
}
Expand Down