📶 [WIP] RouterOS WinBox bruteforce
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mtbf/results.go

46 lines
1.0 KiB

package main
import (
"fmt"
"os"
)
var outFile *os.File
func RegisterResult(t *Task, good bool) {
if good {
log("res", 0, "****************\n******** OK: %v %v %v\n****************", t.e.String(), t.login, t.password)
if outFile != nil {
fmt.Fprintf(outFile, "%v\t%v\t%v\n", t.e.String(), t.login, t.password)
}
} else {
log("res", 1, "bad: %v %v %v", t.e.String(), t.login, t.password)
}
}
func OpenOutFile() {
fileName := CfgGetString("out-file")
if fileName == "" {
log("out", 0, "WARNING: out-file is not specified, results will only be logged in console")
outFile = nil
} else {
var err error
outFile, err = os.OpenFile(fileName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
fail("error opening output file \"%v\": %v", fileName, err.Error())
}
log("out", 2, "opened output file \"%v\"", fileName)
}
}
func CloseOutFile() {
outFile.Close()
outFile = nil
}
func init() {
CfgRegister("out-file", "good.txt", "results will be saved in this file")
CfgRegisterAlias("o", "out-file")
}