fix port scanner, add banner
This commit is contained in:
parent
e0cb7c11b3
commit
4f3e770e17
@ -93,6 +93,7 @@ func executor(cmd string) {
|
|||||||
}
|
}
|
||||||
bcmd, ok := Commands[args[0]]
|
bcmd, ok := Commands[args[0]]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
log.Error().Msg("invalid command: " + args[0])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
br, ok := ziggy.Lucifer.Bridges[sel.Bridge]
|
br, ok := ziggy.Lucifer.Bridges[sel.Bridge]
|
||||||
|
@ -127,7 +127,7 @@ func GetControllers(bridges []config.KnownBridge) (br []*Bridge) {
|
|||||||
log.Error().Str("caller", lightConfig.Hostname).Err(err).Msg("unsuccessful connection")
|
log.Error().Str("caller", lightConfig.Hostname).Err(err).Msg("unsuccessful connection")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
c.Log().Info().Msg("successful connection")
|
c.Log().Info().Str("caller", strings.Split(lightConfig.Hostname, "http://")[1]).Msg("connected")
|
||||||
br = append(br, c)
|
br = append(br, c)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -80,7 +80,7 @@ func enumerateBridge(a net.Addr, ctx context.Context) interface{} {
|
|||||||
log.Warn().Err(err).Msg("failed to read response")
|
log.Warn().Err(err).Msg("failed to read response")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if !strings.Contains(string(ret), "Philips hue") || !strings.Contains(string(ret), "bridgeid") {
|
if !strings.Contains(string(ret), "factorynew") || !strings.Contains(string(ret), "bridgeid") {
|
||||||
log.Debug().Msgf("%s does not appear to be a hue bridge", a.String())
|
log.Debug().Msgf("%s does not appear to be a hue bridge", a.String())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
23
main.go
23
main.go
@ -3,16 +3,19 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.tcp.direct/kayos/common/squish"
|
||||||
"github.com/amimof/huego"
|
"github.com/amimof/huego"
|
||||||
"github.com/manifoldco/promptui"
|
"github.com/manifoldco/promptui"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
|
|
||||||
"git.tcp.direct/kayos/ziggs/internal/cli"
|
"git.tcp.direct/kayos/ziggs/internal/cli"
|
||||||
"git.tcp.direct/kayos/ziggs/internal/common"
|
"git.tcp.direct/kayos/ziggs/internal/common"
|
||||||
config2 "git.tcp.direct/kayos/ziggs/internal/config"
|
"git.tcp.direct/kayos/ziggs/internal/config"
|
||||||
"git.tcp.direct/kayos/ziggs/internal/data"
|
"git.tcp.direct/kayos/ziggs/internal/data"
|
||||||
"git.tcp.direct/kayos/ziggs/internal/ziggy"
|
"git.tcp.direct/kayos/ziggs/internal/ziggy"
|
||||||
)
|
)
|
||||||
@ -21,10 +24,22 @@ var (
|
|||||||
log *zerolog.Logger
|
log *zerolog.Logger
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const banner = "H4sIAAAAAAACA+OSjjY2tjYxyH00pefRlAYwmiAdbZALwgookmtwyjRQLmOQyyUdbYnukhmoeg2NwSyYsiagoDmIqYCkDFkSQ8caShROwe5oqGaYPHZXg2W34JZqoIYU0DkA2WCqGc8BAAA="
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
config2.Init()
|
bnr, _ := squish.UnpackStr(banner)
|
||||||
log = config2.StartLogger()
|
_, _ = io.Copy(os.Stdout, strings.NewReader(bnr))
|
||||||
log.Info().Msg("Logger started")
|
compileTime, Version := common.Version()
|
||||||
|
if Version == "" {
|
||||||
|
Version = "DEVEL"
|
||||||
|
}
|
||||||
|
if compileTime == "" {
|
||||||
|
compileTime = time.Now().Format(time.RFC3339)
|
||||||
|
}
|
||||||
|
config.Init()
|
||||||
|
log = config.StartLogger()
|
||||||
|
log.Trace().Msg("Logger started")
|
||||||
|
log.Info().Str("version", Version).Str("compileTime", compileTime).Send()
|
||||||
if len(os.Args) < 1 {
|
if len(os.Args) < 1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user