Arp Strings
This commit is contained in:
parent
01323c6c65
commit
795a46fd3c
3 changed files with 23 additions and 6 deletions
|
|
@ -46,9 +46,9 @@ func scanStr(str string) string {
|
|||
func parseOutput(text, iface string) []models.Host {
|
||||
var foundHosts = []models.Host{}
|
||||
|
||||
perString := strings.Split(text, "\n")
|
||||
p := strings.Split(text, "\n")
|
||||
|
||||
for _, host := range perString {
|
||||
for _, host := range p {
|
||||
if host != "" {
|
||||
var oneHost models.Host
|
||||
p := strings.Split(host, " ")
|
||||
|
|
@ -71,9 +71,9 @@ func Scan(ifaces, args string, strs []string) []models.Host {
|
|||
var foundHosts = []models.Host{}
|
||||
arpArgs = args
|
||||
|
||||
perString := strings.Split(ifaces, " ")
|
||||
p := strings.Split(ifaces, " ")
|
||||
|
||||
for _, iface := range perString {
|
||||
for _, iface := range p {
|
||||
slog.Debug("Scanning interface " + iface)
|
||||
text = scanIface(iface)
|
||||
slog.Debug("Found IPs: \n" + text)
|
||||
|
|
@ -85,8 +85,9 @@ func Scan(ifaces, args string, strs []string) []models.Host {
|
|||
slog.Debug("Scanning string " + s)
|
||||
text = scanStr(s)
|
||||
slog.Debug("Found IPs: \n" + text)
|
||||
p = strings.Split(s, " ")
|
||||
|
||||
foundHosts = append(foundHosts, parseOutput(text, "")...)
|
||||
foundHosts = append(foundHosts, parseOutput(text, p[len(p)-1])...)
|
||||
}
|
||||
|
||||
return foundHosts
|
||||
|
|
|
|||
|
|
@ -65,8 +65,17 @@ func saveSettingsHandler(c *gin.Context) {
|
|||
appConfig.HistInDB = false
|
||||
}
|
||||
|
||||
arpStrs := c.PostFormArray("arpstrs")
|
||||
appConfig.ArpStrs = []string{}
|
||||
for _, s := range arpStrs {
|
||||
if s != "" {
|
||||
appConfig.ArpStrs = append(appConfig.ArpStrs, s)
|
||||
}
|
||||
}
|
||||
|
||||
conf.Write(appConfig)
|
||||
|
||||
slog.Debug("ARP_STRS", "", appConfig.ArpArgs)
|
||||
slog.Info("Writing new config to " + appConfig.ConfPath)
|
||||
|
||||
updateRoutines() // routines-upd.go
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{{ define "config.html" }}
|
||||
|
||||
<script src="/fs/public/js/config.js"></script>
|
||||
<body>
|
||||
<div class="container-lg">
|
||||
<div class="row">
|
||||
|
|
@ -70,6 +70,13 @@
|
|||
<td>Args for arp-scan</td>
|
||||
<td><input name="arpargs" type="text" class="form-control" value="{{ .Config.ArpArgs }}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Arp Strings</td>
|
||||
<td>{{ range .Config.ArpStrs }}
|
||||
<input name="arpstrs" type="text" class="form-control" value="{{ . }}">{{ end }}
|
||||
<input name="arpstrs" type="text" class="form-control">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Log level</td>
|
||||
<td><select name="log" class="form-select">
|
||||
|
|
|
|||
Loading…
Reference in a new issue