MCPcopy Create free account
hub / github.com/ANG13T/SatIntel / TLETextFile

Function TLETextFile

osint/tleparser.go:27–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27func TLETextFile() {
28
29 fmt.Print("\n ENTER TEXT FILE PATH > ")
30 var path string
31 fmt.Scanln(&path)
32 file, err := os.Open(path)
33
34 if err != nil {
35 fmt.Println(color.Ize(color.Red, " [!] INVALID TEXT FILE"))
36 }
37
38 scanner := bufio.NewScanner(file)
39 scanner.Split(bufio.ScanLines)
40 var txtlines []string
41 var count int = 0
42
43 for scanner.Scan() {
44 txtlines = append(txtlines, scanner.Text())
45 count += 1
46 }
47
48 file.Close()
49
50 if (count < 2 || count > 3) {
51 fmt.Println(color.Ize(color.Red, " [!] INVALID TLE FORMAT"))
52 return
53 }
54
55 output := TLE{}
56
57 if (count == 3) {
58 var satelliteName string = txtlines[0]
59 output = ConstructTLE(satelliteName, txtlines[1], txtlines[2])
60 } else {
61 output = ConstructTLE("UNSPECIFIED", txtlines[0], txtlines[1])
62 }
63
64 PrintTLE(output)
65}
66
67func TLEPlainString(){
68 scanner := bufio.NewScanner(os.Stdin)

Callers 1

TLEParserFunction · 0.85

Calls 2

ConstructTLEFunction · 0.85
PrintTLEFunction · 0.85

Tested by

no test coverage detected