first commit
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								research/alert.mp3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								research/alert.mp3
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										47
									
								
								research/beep.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								research/beep.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"log"
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	"github.com/hajimehoshi/oto"
 | 
			
		||||
 | 
			
		||||
	"github.com/hajimehoshi/go-mp3"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func run() error {
 | 
			
		||||
	f, err := os.Open("alert.mp3")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer f.Close()
 | 
			
		||||
 | 
			
		||||
	d, err := mp3.NewDecoder(f)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	c, err := oto.NewContext(d.SampleRate(), 2, 2, 44100)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer c.Close()
 | 
			
		||||
 | 
			
		||||
	p := c.NewPlayer()
 | 
			
		||||
	defer p.Close()
 | 
			
		||||
 | 
			
		||||
	fmt.Printf("Length: %d[bytes]\n", d.Length())
 | 
			
		||||
 | 
			
		||||
	if _, err := io.Copy(p, d); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	if err := run(); err != nil {
 | 
			
		||||
		log.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										148
									
								
								research/intel2noise.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										148
									
								
								research/intel2noise.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,148 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"flag"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/nxadm/tail"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ParseChat Parses a string, returns the payload of the chat
 | 
			
		||||
// *sigh*
 | 
			
		||||
// This took effing forever to get right.
 | 
			
		||||
// "Lets start with Regex, cannot go wrong".
 | 
			
		||||
// You have this string:
 | 
			
		||||
// <20><>[ 2022.02.09 10:05:43 ] Kaysee Guru > EX-GBT clr nd
 | 
			
		||||
// Cool. Looks easy.
 | 
			
		||||
// .*\[ (.*?) (.*?) \] (.*?) > (.*)
 | 
			
		||||
// regex101.com says its good
 | 
			
		||||
// And no matter what I do just does not work for some magical reason.
 | 
			
		||||
//
 | 
			
		||||
// Lets do this with splitting by space and compare it with that. Do a bunch of ifs, it works in test aaaaaand....
 | 
			
		||||
// It doesn't work.
 | 
			
		||||
//
 | 
			
		||||
// By now I have a somewhat reliable version, but it fails to look for the word MOTD.
 | 
			
		||||
// I should prolly look into runes()
 | 
			
		||||
// This is terrible
 | 
			
		||||
func ParseChat(chatline string) (LineDate string, LineTime string, LineUser string, Payload []string) {
 | 
			
		||||
	logLine := chatline[3:]
 | 
			
		||||
 | 
			
		||||
	//var LineDate string
 | 
			
		||||
	//var LineTime string
 | 
			
		||||
	//var LineUser string
 | 
			
		||||
	var LinePayload string
 | 
			
		||||
	//var Payload []string
 | 
			
		||||
	var splitpos int
 | 
			
		||||
 | 
			
		||||
	splitpos = strings.Index(logLine, ">")
 | 
			
		||||
	LineDate = logLine[4:24]
 | 
			
		||||
	LineTime = logLine[24:42]
 | 
			
		||||
	LineUser = logLine[46 : splitpos-2]
 | 
			
		||||
	LinePayload = logLine[splitpos+4:]
 | 
			
		||||
	LinePayload = shorten(LinePayload)
 | 
			
		||||
	Payload = strings.Fields(LinePayload)
 | 
			
		||||
 | 
			
		||||
	//fmt.Println(logLine)
 | 
			
		||||
	//fmt.Println(LineDate)
 | 
			
		||||
	//fmt.Println(LineTime)
 | 
			
		||||
	//fmt.Println(LineUser)
 | 
			
		||||
	//fmt.Println(splitpos)
 | 
			
		||||
	//fmt.Println(LinePayload)
 | 
			
		||||
	//fmt.Println(Payload)
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func shorten(payload string) (logLine string) {
 | 
			
		||||
	runes := []rune(payload)
 | 
			
		||||
	for pos, char := range runes {
 | 
			
		||||
		if pos%2 == 0 && char != 13 {
 | 
			
		||||
			logLine = logLine + string(char)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CompareElements Compares a log msg with systems we wish to track
 | 
			
		||||
func CompareElements(alerts []string, payload []string) bool {
 | 
			
		||||
 | 
			
		||||
	for _, word := range payload {
 | 
			
		||||
		for _, alert := range alerts {
 | 
			
		||||
 | 
			
		||||
			if strings.EqualFold(word, alert) {
 | 
			
		||||
				//fmt.Println("Found (EF): ", alert, "in", word)
 | 
			
		||||
				return true
 | 
			
		||||
			} //else {
 | 
			
		||||
			//	fmt.Println(word, "!=", alert)
 | 
			
		||||
			//}
 | 
			
		||||
 | 
			
		||||
			// In the odd case somebody links "C-V6DQ*"
 | 
			
		||||
			if len(word) > 6 {
 | 
			
		||||
				//alert = alert[:len(word)]
 | 
			
		||||
				word = word[:6]
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// In case of partials like "C-V"
 | 
			
		||||
			if len(word) < 6 && len(word) >= 3 {
 | 
			
		||||
				//word = word[:5]
 | 
			
		||||
				alert = alert[:len(word)]
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if strings.EqualFold(word, alert) {
 | 
			
		||||
				//fmt.Println("Found: ", alert, "in", word)
 | 
			
		||||
				return true
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// playBeep Play a beep
 | 
			
		||||
// Honestly, I tried to play alert.mp3, but after two executions I got a segfault and thought 0x07 it is!
 | 
			
		||||
func playBeep() {
 | 
			
		||||
	fmt.Print("\a")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
 | 
			
		||||
	// Deal with parameters first.
 | 
			
		||||
	LogLocation := flag.String("l", "", "Location of the log-file to track.")
 | 
			
		||||
	LogSystemsRaw := flag.String("s", "jita,Perimeter,New Caldari,Sobaseki", "comma-seperated list of systems")
 | 
			
		||||
	//LogAlarm := flag.String("a", "alert.mp3", "Audio file to play when an alert needs to be triggered")
 | 
			
		||||
	flag.Parse()
 | 
			
		||||
 | 
			
		||||
	// Split the CSV string into different parts
 | 
			
		||||
	LogSystems := strings.Split(*LogSystemsRaw, ",")
 | 
			
		||||
 | 
			
		||||
	// Do the main loop and start parsing the logfiles
 | 
			
		||||
	t, err := tail.TailFile(*LogLocation, tail.Config{Follow: true})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for line := range t.Lines {
 | 
			
		||||
		// Cast a line to a text, trim the trash
 | 
			
		||||
		logLine := string(line.Text)
 | 
			
		||||
		logLine = strings.Trim(logLine, "\n")
 | 
			
		||||
 | 
			
		||||
		// Figure out if this is a message we want to deal with
 | 
			
		||||
		// > is critical in this regard because it is the start of the message
 | 
			
		||||
		// and everything behind it until it hits ] is the username
 | 
			
		||||
		splitpos := strings.Index(logLine, ">")
 | 
			
		||||
		if -1 == splitpos {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Somehow I cannot filter out this stuff.
 | 
			
		||||
		// EVE System > Channel MOTD
 | 
			
		||||
		LineDate, LineTime, LineUser, Payload := ParseChat(logLine)
 | 
			
		||||
 | 
			
		||||
		if CompareElements(LogSystems, Payload) {
 | 
			
		||||
			playBeep()
 | 
			
		||||
			fmt.Println("On", LineDate, "at", LineTime, "", LineUser, "posted", Payload)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										26
									
								
								research/params.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								research/params.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"flag"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	num := flag.Int("n", 5, "# of iterations")
 | 
			
		||||
	mysystems := flag.String("s", "jita,New Caldari", "comma-seperated list of systems")
 | 
			
		||||
	flag.Parse()
 | 
			
		||||
 | 
			
		||||
	n := *num
 | 
			
		||||
	i := 0
 | 
			
		||||
 | 
			
		||||
	for i < n {
 | 
			
		||||
		fmt.Println("falcon")
 | 
			
		||||
		i++
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fmt.Println(*mysystems)
 | 
			
		||||
	s := strings.Split(*mysystems, ",")
 | 
			
		||||
	fmt.Println(s)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										46
									
								
								research/partial.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								research/partial.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	chatline := "c-v Morretus Isayeki nv"
 | 
			
		||||
	words := strings.Fields(chatline)
 | 
			
		||||
	alerts := [...]string{"C-V6DQ", "1PF-BC", "EX-GBT", "Z-FET0"}
 | 
			
		||||
 | 
			
		||||
	//var found bool
 | 
			
		||||
 | 
			
		||||
	for _, word := range words {
 | 
			
		||||
		for _, alert := range alerts {
 | 
			
		||||
 | 
			
		||||
			if strings.EqualFold(word, alert) {
 | 
			
		||||
				fmt.Println("Found: ", alert, "in", word)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// In the odd case somebody links "C-V6DQ*"
 | 
			
		||||
			if len(word) < 6 {
 | 
			
		||||
				alert = alert[:len(word)]
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// In case of partials like "C-V"
 | 
			
		||||
			if len(word) > 6 {
 | 
			
		||||
				word = word[:5]
 | 
			
		||||
			}
 | 
			
		||||
			if strings.EqualFold(word, alert) {
 | 
			
		||||
				fmt.Println("Found: ", alert, "in", word)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			fmt.Println(word)
 | 
			
		||||
			fmt.Println(alert)
 | 
			
		||||
			fmt.Println("---")
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//fmt.Println(string(myString[:3]))
 | 
			
		||||
	//fmt.Println("Dit")
 | 
			
		||||
	//fmt.Println(strings.EqualFold(myString[:3], "Dit"))
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										60
									
								
								research/regex_funpark.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								research/regex_funpark.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ParseChat Parses a string, returns the payload of the chat
 | 
			
		||||
func ParseChat(chatline string) (LineDate string, LineTime string, LineUser string, LinePayload []string) {
 | 
			
		||||
	words := strings.Fields(chatline)
 | 
			
		||||
	//fmt.Println(len(words))
 | 
			
		||||
	//var LineDate string
 | 
			
		||||
	//var LineTime string
 | 
			
		||||
	//var LineUser string
 | 
			
		||||
	//var LinePayload []string
 | 
			
		||||
	var SplitFound int
 | 
			
		||||
 | 
			
		||||
	for i := range words {
 | 
			
		||||
 | 
			
		||||
		if i == 1 {
 | 
			
		||||
			LineDate = words[i]
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if i == 2 {
 | 
			
		||||
			LineTime = words[i]
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if i >= 5 && SplitFound == 1 {
 | 
			
		||||
			LinePayload = append(LinePayload, words[i])
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if words[i] == ">" {
 | 
			
		||||
			SplitFound = 1
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if i >= 4 && SplitFound == 0 {
 | 
			
		||||
			if LineUser == "" {
 | 
			
		||||
				LineUser = words[i]
 | 
			
		||||
			} else {
 | 
			
		||||
				LineUser = LineUser + " " + words[i]
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	//fmt.Println(LineDate)
 | 
			
		||||
	//fmt.Println(LineTime)
 | 
			
		||||
	//fmt.Println(LineUser)
 | 
			
		||||
	//fmt.Println(LinePayload)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
 | 
			
		||||
	mystring := "<22><>[ 2022.02.07 19:57:52 ] Samoa Serine > BY-7PY  Morretus Isayeki  nv"
 | 
			
		||||
 | 
			
		||||
	LineDate, LineTime, LineUser, Payload := ParseChat(mystring)
 | 
			
		||||
	fmt.Println("On " + LineDate + " " + LineTime + " " + LineUser + " posted the following: ")
 | 
			
		||||
	fmt.Println(Payload)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										162
									
								
								research/searchlog.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										162
									
								
								research/searchlog.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,162 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"flag"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io/fs"
 | 
			
		||||
	"log"
 | 
			
		||||
	"os"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// findPath Find the path in which the log files are stored.
 | 
			
		||||
func findPath() (logPath string) {
 | 
			
		||||
 | 
			
		||||
	var err error
 | 
			
		||||
	var homedir string
 | 
			
		||||
	var Path string
 | 
			
		||||
	var Paths []string
 | 
			
		||||
	var PathsLinux []string
 | 
			
		||||
	var PathsMac []string
 | 
			
		||||
	var PathsWindows []string
 | 
			
		||||
 | 
			
		||||
	// Determine the homedir of the user.
 | 
			
		||||
	homedir, err = os.UserHomeDir()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Define Paths to check out
 | 
			
		||||
	PathsLinux = append(PathsLinux, "/Documents/EVE/logs/")
 | 
			
		||||
	PathsLinux = append(PathsLinux, "/.local/share/Steam/steamapps/compatdata/8500/pfx/drive_c/users/steamuser/My Documents/EVE/logs/Chatlogs/")
 | 
			
		||||
 | 
			
		||||
	PathsMac = append(PathsMac, "/Documents/EVE/logs/")
 | 
			
		||||
	PathsMac = append(PathsMac, "/Library/Application Support/EVE Online/p_drive/User/My Documents/EVE/")
 | 
			
		||||
 | 
			
		||||
	PathsWindows = append(PathsWindows, "C:\\Users\\YourUserName\\Documents\\EVE\\logs")
 | 
			
		||||
	PathsWindows = append(PathsWindows, "MyDocuments -> EVE -> Logs")
 | 
			
		||||
 | 
			
		||||
	switch runtime.GOOS {
 | 
			
		||||
	case "linux":
 | 
			
		||||
		Paths = PathsLinux
 | 
			
		||||
	case "darwin":
 | 
			
		||||
		Paths = PathsMac
 | 
			
		||||
	case "windows":
 | 
			
		||||
		Paths = PathsWindows
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, Path = range Paths {
 | 
			
		||||
		if _, err := os.Stat(homedir + Path); !os.IsNotExist(err) {
 | 
			
		||||
			logPath = homedir + Path
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OrchestrateIntelMonitoring routine to periodically check the logpath for the intel channels.
 | 
			
		||||
func OrchestrateIntelMonitoring(logPath string, intelChannel string) {
 | 
			
		||||
 | 
			
		||||
	// Declare variables
 | 
			
		||||
	var files []fs.FileInfo
 | 
			
		||||
	var lastName string
 | 
			
		||||
	var tempName string
 | 
			
		||||
 | 
			
		||||
	// Enter a for-loop that periodically checks.
 | 
			
		||||
	for {
 | 
			
		||||
		files = fetchFileListing(logPath)
 | 
			
		||||
		tempName = findLatestLog(logPath, intelChannel, files)
 | 
			
		||||
 | 
			
		||||
		if !strings.EqualFold(lastName, tempName) {
 | 
			
		||||
			lastName = tempName
 | 
			
		||||
			fmt.Println("Found a new LogFile! Its " + lastName)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Sleep a minute before we check again.
 | 
			
		||||
		time.Sleep(time.Second * 60)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// fetchFileListing As it says on the tin.
 | 
			
		||||
func fetchFileListing(logPath string) (files []fs.FileInfo) {
 | 
			
		||||
 | 
			
		||||
	// Declare Variables
 | 
			
		||||
	var err error
 | 
			
		||||
	var folder *os.File
 | 
			
		||||
 | 
			
		||||
	// Open the folder we need to open.
 | 
			
		||||
	folder, err = os.Open(logPath)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Read the files UwU
 | 
			
		||||
	files, err = folder.Readdir(-1)
 | 
			
		||||
	folder.Close()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Off you go! \o/
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// findLatestLog Find the last log-file based on the Internet
 | 
			
		||||
func findLatestLog(logPath string, intelChannel string, files []fs.FileInfo) (lastName string) {
 | 
			
		||||
 | 
			
		||||
	// Declare Variables
 | 
			
		||||
	var lastTime time.Time
 | 
			
		||||
	var tempTime time.Time
 | 
			
		||||
 | 
			
		||||
	for _, file := range files {
 | 
			
		||||
		file, err := os.Stat(logPath + file.Name())
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Fatal(err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if strings.EqualFold(intelChannel, file.Name()[:len(intelChannel)]) {
 | 
			
		||||
			tempTime = file.ModTime()
 | 
			
		||||
			if tempTime.After(lastTime) {
 | 
			
		||||
				lastTime = tempTime
 | 
			
		||||
				lastName = logPath + file.Name()
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// And there you are (or not)
 | 
			
		||||
	return
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// main Something Importang. Dunno
 | 
			
		||||
func main() {
 | 
			
		||||
 | 
			
		||||
	// Declare variables
 | 
			
		||||
	var logPath string
 | 
			
		||||
	var IntelChannelsSplit []string
 | 
			
		||||
	var IntelChannel string
 | 
			
		||||
 | 
			
		||||
	// Handle Parameters
 | 
			
		||||
	var intelChannels = flag.String("i", "Etherium Intel,Bean-Intel", "A commaseparated list of intel channels.")
 | 
			
		||||
	flag.Parse()
 | 
			
		||||
 | 
			
		||||
	// Split the CSV string into different parts
 | 
			
		||||
	IntelChannelsSplit = strings.Split(*intelChannels, ",")
 | 
			
		||||
 | 
			
		||||
	// Get the path we need to
 | 
			
		||||
	logPath = findPath()
 | 
			
		||||
 | 
			
		||||
	for _, IntelChannel = range IntelChannelsSplit {
 | 
			
		||||
		IntelChannel = strings.ReplaceAll(IntelChannel, " ", "_")
 | 
			
		||||
		go OrchestrateIntelMonitoring(logPath, IntelChannel)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for {
 | 
			
		||||
		time.Sleep(time.Second * 3600)
 | 
			
		||||
		fmt.Println("Hi. This is your hourly reminder that this program is still runnig and hasn't crashed!")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								research/tailLocal.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								research/tailLocal.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	"github.com/nxadm/tail"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var logFile = "/home/outcast/.local/share/Steam/steamapps/compatdata/8500/pfx/drive_c/users/steamuser/My Documents/EVE/logs/Chatlogs/Etherium_Intel_20220207_154354_93488613.txt"
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	t, err := tail.TailFile(logFile, tail.Config{Follow: true})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for line := range t.Lines {
 | 
			
		||||
		fmt.Println(line.Text)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user