diff --git a/osint/osint.go b/osint/osint.go index c80ecde..6ff7dce 100644 --- a/osint/osint.go +++ b/osint/osint.go @@ -8,6 +8,7 @@ import ( "github.com/iskaa02/qalam/gradient" "io/ioutil" "strconv" + "strings" ) type TLE struct { @@ -32,7 +33,7 @@ type TLE struct { ChecksumTwo int } -func TLEParser(){ +func TLEParser() { options, _ := ioutil.ReadFile("txt/tle_parser.txt") opt,_:=gradient.NewGradient("#1179ef", "cyan") opt.Print("\n" + string(options)) @@ -47,10 +48,11 @@ func TLEParser(){ return } -func TLETextFile(){ +func TLETextFile() { - fmt.Print("\n ENTER INPUT > ") + fmt.Print("\n ENTER TEXT FILE PATH > ") var path string + fmt.Scanln(&path) file, err := os.Open(path) if err != nil { @@ -60,16 +62,46 @@ func TLETextFile(){ scanner := bufio.NewScanner(file) scanner.Split(bufio.ScanLines) var txtlines []string + var count int = 0 for scanner.Scan() { txtlines = append(txtlines, scanner.Text()) + count += 1 } + + output := TLE{} file.Close() - - for _, eachline := range txtlines { - fmt.Println(eachline) + + if (count < 2 || count > 3) { + fmt.Println(color.Ize(color.Red, " [!] INVALID TLE FORMAT")) + return } + + for index, eachline := range txtlines { + fmt.Println(eachline) + if (count == 2) { + output.CommonName = "UNDEFINED" + line := strings.Split(eachline, " ") + fmt.Println(line[0]) + if (index == 0) { + + } else { + + } + } else { + line := strings.Split(eachline, " ") + fmt.Println(line[0]) + if (index == 0) { + + } else if (index == 1) { + + } else { + + } + } + } + fmt.Println(count, output) } func TLEPlainString(){ @@ -78,6 +110,10 @@ func TLEPlainString(){ fmt.Scanln(&tleString) } +func PrintTLE (tle TLE) { + +} + func Option(min int, max int) int { fmt.Print("\n ENTER INPUT > ") var selection string diff --git a/txt/test/example_tle.txt b/txt/test/example_tle.txt new file mode 100644 index 0000000..7569a53 --- /dev/null +++ b/txt/test/example_tle.txt @@ -0,0 +1,2 @@ +1 00005U 58002B 23124.48670449 -.00000022 00000-0 -29578-5 0 9996 +2 00005 34.2435 229.9960 1846720 42.7915 330.2528 10.85080555319419 \ No newline at end of file