get better names
This commit is contained in:
parent
6e98701299
commit
288fa282b4
10
TODO.md
Normal file
10
TODO.md
Normal file
@ -0,0 +1,10 @@
|
||||
TODO
|
||||
======
|
||||
|
||||
|
||||
- Read title from html <title>
|
||||
- Default icon set (mongo, discord, etc)
|
||||
- Use favicon if available
|
||||
- Auto-Refresh
|
||||
- jar name if process == java
|
||||
- Auto start with pc (systemd unit?)
|
13
go.mod
13
go.mod
@ -10,6 +10,17 @@ require (
|
||||
gogs.mikescher.com/BlackForestBytes/goext v0.0.288
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.23.11
|
||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.12 // indirect
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.3 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/bytedance/sonic v1.10.2 // indirect
|
||||
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5
|
||||
@ -34,7 +45,7 @@ require (
|
||||
golang.org/x/arch v0.5.0 // indirect
|
||||
golang.org/x/crypto v0.14.0 // indirect
|
||||
golang.org/x/net v0.17.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
golang.org/x/text v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
32
go.sum
32
go.sum
@ -20,6 +20,8 @@ github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
@ -34,8 +36,11 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
@ -46,6 +51,8 @@ github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZY
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
@ -63,10 +70,18 @@ github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdU
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
|
||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
|
||||
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||
github.com/shirou/gopsutil/v3 v3.23.11 h1:i3jP9NjCPUz7FiZKxlMnODZkdSIp2gnzfrvsu9CuWEQ=
|
||||
github.com/shirou/gopsutil/v3 v3.23.11/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM=
|
||||
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
|
||||
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
|
||||
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
|
||||
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
@ -78,6 +93,10 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
|
||||
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
|
||||
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
|
||||
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||
@ -87,6 +106,8 @@ github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3k
|
||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
|
||||
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE=
|
||||
go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
|
||||
gogs.mikescher.com/BlackForestBytes/goext v0.0.288 h1:t4K/rUNGgvP1jSCX1M9fX3I8mD/NOkqCG4DT+zLTEv8=
|
||||
@ -109,7 +130,9 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@ -117,9 +140,11 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -134,7 +159,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
|
@ -6,8 +6,10 @@ import (
|
||||
"fmt"
|
||||
"github.com/cakturk/go-netstat/netstat"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/shirou/gopsutil/v3/process"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/ginext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/rext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/syncext"
|
||||
"io"
|
||||
bunny "locbunny"
|
||||
@ -17,6 +19,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -24,6 +27,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var regexTitle = rext.W(regexp.MustCompile(`(?i)<title>(?P<v>[^>]+)</title>`))
|
||||
|
||||
type Application struct {
|
||||
Config bunny.Config
|
||||
|
||||
@ -289,9 +294,12 @@ func (app *Application) verifyHTTPConn(sock netstat.SockTabEntry, proto string,
|
||||
pid = langext.Ptr(sock.Process.Pid)
|
||||
}
|
||||
|
||||
name := app.DetectName(sock, ct, string(resbody))
|
||||
|
||||
return models.Server{
|
||||
Port: port,
|
||||
IP: sock.LocalAddr.IP.String(),
|
||||
Name: name,
|
||||
Protocol: proto,
|
||||
StatusCode: resp1.StatusCode,
|
||||
Response: string(resbody),
|
||||
@ -304,5 +312,118 @@ func (app *Application) verifyHTTPConn(sock netstat.SockTabEntry, proto string,
|
||||
}
|
||||
|
||||
log.Debug().Msg(fmt.Sprintf("Failed to categorize [%s|%s|%d] response from %s (Content-Type: '%s')", strings.ToUpper(proto), ipversion, port, url, ct))
|
||||
|
||||
return models.Server{}, errors.New("invalid response-type")
|
||||
}
|
||||
|
||||
func (app *Application) DetectName(sock netstat.SockTabEntry, ct string, body string) string {
|
||||
|
||||
if strings.Contains(strings.ToLower(ct), "html") {
|
||||
if m, ok := regexTitle.MatchFirst(body); ok {
|
||||
title := m.GroupByName("v").Value()
|
||||
if !app.isInvalidHTMLTitle(title) {
|
||||
return title
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if strings.Contains(strings.ToLower(body), "it looks like you are trying to access mongodb over http on the native driver port.") {
|
||||
return "MongoDB"
|
||||
}
|
||||
|
||||
if sock.Process != nil {
|
||||
|
||||
if sock.Process.Name == "java" {
|
||||
|
||||
proc, err := process.NewProcess(int32(sock.Process.Pid))
|
||||
if err == nil {
|
||||
cmdl, err := proc.CmdlineSlice()
|
||||
|
||||
if err == nil {
|
||||
if v, ok := app.extractNameFromJava(cmdl); ok {
|
||||
return v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(sock.Process.Name) > 0 {
|
||||
return sock.Process.Name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
func (app *Application) isInvalidHTMLTitle(title string) bool {
|
||||
title = strings.ToLower(title)
|
||||
title = strings.TrimSpace(title)
|
||||
title = strings.Trim(title, ".,\r\n\t ;")
|
||||
|
||||
arr := []string{
|
||||
"404",
|
||||
"Not found",
|
||||
"404 Not Found",
|
||||
"404 - Not Found",
|
||||
"Page Not Found",
|
||||
"File Not Found",
|
||||
"Not Found",
|
||||
"Site Not Found",
|
||||
"ISAPI or CGI restriction",
|
||||
"MIME type restriction",
|
||||
"No handler configured",
|
||||
"Denied by request filtering configuration",
|
||||
"Verb denied",
|
||||
"File extension denied",
|
||||
"Hidden namespace",
|
||||
"File attribute hidden",
|
||||
"Request header too long",
|
||||
"Request contains double escape sequence",
|
||||
"Request contains high-bit characters",
|
||||
"Content length too large",
|
||||
"Request URL too long",
|
||||
"Query string too long",
|
||||
"DAV request sent to the static file handler",
|
||||
"Dynamic content mapped to the static file handler via a wildcard MIME mapping",
|
||||
"Query string sequence denied",
|
||||
"Denied by filtering rule",
|
||||
"Too Many URL Segments",
|
||||
}
|
||||
|
||||
for _, v := range arr {
|
||||
if title == strings.ToLower(v) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (app *Application) extractNameFromJava(cmdl []string) (string, bool) {
|
||||
|
||||
for i, v := range cmdl {
|
||||
if strings.ToLower(v) == "-jar" && i+1 < len(cmdl) {
|
||||
return cmdl[i+1], true
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range cmdl {
|
||||
if strings.HasPrefix(strings.ToLower(v), "-didea.paths.selector=") {
|
||||
return v[len("-Didea.paths.selector="):], true
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range cmdl {
|
||||
if strings.HasPrefix(strings.ToLower(v), "-didea.platform.prefix") {
|
||||
return v[len("-Didea.platform.prefix"):], true
|
||||
}
|
||||
}
|
||||
|
||||
if len(cmdl) > 0 {
|
||||
return cmdl[len(cmdl)-1], true
|
||||
}
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import "go.mongodb.org/mongo-driver/bson/bsontype"
|
||||
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
import "gogs.mikescher.com/BlackForestBytes/goext/exerr"
|
||||
|
||||
const ChecksumIDGenerator = "cf5fe3d14932e535744418c0aa3751c08f392f9f117bfa5e8b04f70379879131" // GoExtVersion: 0.0.288
|
||||
const ChecksumIDGenerator = "c6ecd0c3665e4ed6d1316ccf2899ba29a28d9d06b6c6b97a86adc19c1343787e" // GoExtVersion: 0.0.288
|
||||
|
||||
// ================================ AnyID (ids.go) ================================
|
||||
|
||||
|
@ -11,4 +11,5 @@ type Server struct {
|
||||
PID *int `json:"pid"`
|
||||
UID uint32 `json:"uid"`
|
||||
SockState string `json:"sockState"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
@ -307,6 +307,9 @@
|
||||
"ip": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"pid": {
|
||||
"type": "integer"
|
||||
},
|
||||
|
@ -60,6 +60,8 @@ definitions:
|
||||
type: string
|
||||
ip:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
pid:
|
||||
type: integer
|
||||
port:
|
||||
|
@ -10,6 +10,8 @@ html, body {
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
background-color: #EFEFEF;
|
||||
}
|
||||
|
||||
main {
|
||||
@ -20,7 +22,9 @@ main {
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3em;
|
||||
margin-bottom: 1rem;
|
||||
text-shadow: 0 0 8px #888;
|
||||
}
|
||||
|
||||
#maincontent {
|
||||
@ -28,12 +32,11 @@ h1 {
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
|
||||
padding: 0 1rem;
|
||||
padding: 0 2rem;
|
||||
}
|
||||
|
||||
.server {
|
||||
background-color: #CCC;
|
||||
text-align: center;
|
||||
padding: 2px 0.5rem;
|
||||
|
||||
color: black;
|
||||
@ -45,11 +48,29 @@ h1 {
|
||||
box-shadow: 0 0 4px #888;
|
||||
|
||||
transition: all 0.2s;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
grid-column-gap: 1rem;
|
||||
}
|
||||
|
||||
.server .txt_icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.server .txt_icon {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.server .txt_port {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.server:hover {
|
||||
box-shadow: 0 0 4px #000;
|
||||
background-color: #AAA;
|
||||
color: #00F;
|
||||
color: #00A;
|
||||
}
|
||||
|
||||
|
1
webassets/icons/microchip-sharp-solid.svg
Normal file
1
webassets/icons/microchip-sharp-solid.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><!--!Font Awesome Pro 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc.--><path d="M176 24V0H128V24 64H64v64H24 0v48H24 64v56H24 0v48H24 64v56H24 0v48H24 64v64h64v40 24h48V488 448h56v40 24h48V488 448h56v40 24h48V488 448h64V384h40 24V336H488 448V280h40 24V232H488 448V176h40 24V128H488 448V64H384V24 0H336V24 64H280V24 0H232V24 64H176V24zM352 160H160V352H352V160zM160 128H352h32v32V352v32H352 160 128V352 160 128h32z"/></svg>
|
After Width: | Height: | Size: 601 B |
@ -16,10 +16,8 @@
|
||||
<main>
|
||||
|
||||
<h1>LocalHostBunny</h1>
|
||||
<div id="maincontent"></div>
|
||||
|
||||
<div id="maincontent">
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
function enc(v) { return `${v}`.replace(/[\u00A0-\u9999<>&]/g, i => '&#'+i.charCodeAt(0)+';') }
|
||||
|
||||
function updateHTML() {
|
||||
|
||||
const main = document.getElementById('maincontent')
|
||||
@ -7,7 +9,11 @@ function updateHTML() {
|
||||
|
||||
for (const srv of servers) {
|
||||
|
||||
html += `<a class="server" href="${srv['protocol'].toLowerCase()}://localhost:${srv['port']}">${encodeURIComponent(srv['process'])} @ ${encodeURIComponent(srv['port'])}</a>`
|
||||
html += `<a class="server" href="${srv['protocol'].toLowerCase()}://localhost:${srv['port']}" target="_blank">`;
|
||||
html += `<span class="txt_icon"><img src="/icons/microchip-sharp-solid.svg" alt="process"></span>`
|
||||
html += `<span class="txt_name">${enc(srv['name'])}</span>`
|
||||
html += `<span class="txt_port">${enc(srv['port'])}</span>`
|
||||
html += `</a>`;
|
||||
|
||||
}
|
||||
main.innerHTML = html;
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
//go:embed css/*.css
|
||||
//go:embed fonts/*.woff
|
||||
//go:embed fonts/*.woff2
|
||||
//go:embed icons/*.svg
|
||||
var _assets embed.FS
|
||||
|
||||
type templateCacheEntry struct {
|
||||
|
Loading…
Reference in New Issue
Block a user