mirror of
https://github.com/andatoshiki/shikigrid.git
synced 2026-06-06 04:04:15 +00:00
init: initial commit for complete root sources of project codebases for shikigrid api server branch awaiting git push operation
This commit is contained in:
parent
60f316bc55
commit
bd0482f864
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,5 +3,3 @@
|
|||||||
test-unit
|
test-unit
|
||||||
test-unit.pub
|
test-unit.pub
|
||||||
build
|
build
|
||||||
id_rsa
|
|
||||||
id_rsa.pub
|
|
||||||
|
|||||||
@ -90,7 +90,7 @@ deploy:
|
|||||||
- shikigrid_*.sha256
|
- shikigrid_*.sha256
|
||||||
on:
|
on:
|
||||||
tags: true
|
tags: true
|
||||||
repo: evilsocket/shikigrid
|
repo: andatoshiki/shikigrid
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- "/^v[0-9]+\\.[0-9]+\\.[0-9]+[A-Za-z0-9]+?$/"
|
- "/^v[0-9]+\\.[0-9]+\\.[0-9]+[A-Za-z0-9]+?$/"
|
||||||
|
|||||||
60
Makefile
60
Makefile
@ -1,4 +1,4 @@
|
|||||||
VERSION := $(shell sed -n 's/Version\s*=\s*"\([0-9.]\+\)"/\1/p' version/ver.go | tr -d '\t')
|
VERSION=$(shell git describe --abbrev=0 --tags)
|
||||||
|
|
||||||
all: clean
|
all: clean
|
||||||
@mkdir build
|
@mkdir build
|
||||||
@ -8,9 +8,12 @@ all: clean
|
|||||||
install:
|
install:
|
||||||
@cp build/shikigrid /usr/local/bin/
|
@cp build/shikigrid /usr/local/bin/
|
||||||
@mkdir -p /etc/systemd/system/
|
@mkdir -p /etc/systemd/system/
|
||||||
|
@cp shikigrid.service /etc/systemd/system/
|
||||||
@mkdir -p /etc/shikigrid/
|
@mkdir -p /etc/shikigrid/
|
||||||
@cp env.example /etc/shikigrid/shikigrid.conf
|
@cp env.example /etc/shikigrid/shikigrid.conf
|
||||||
|
@chmod 644 /etc/systemd/system/shikigrid.service
|
||||||
@systemctl daemon-reload
|
@systemctl daemon-reload
|
||||||
|
@systemctl enable shikigrid.service
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -rf build
|
@rm -rf build
|
||||||
@ -18,51 +21,16 @@ clean:
|
|||||||
restart:
|
restart:
|
||||||
@service shikigrid restart
|
@service shikigrid restart
|
||||||
|
|
||||||
release_files: clean cross_compile_libpcap_x64 cross_compile_libpcap_arm
|
release_files: clean
|
||||||
@mkdir build
|
@mkdir build
|
||||||
@echo building for linux/amd64 ...
|
@echo building for linux/amd64 ...
|
||||||
@CGO_ENABLED=1 CC=x86_64-linux-gnu-gcc GOARCH=amd64 GOOS=linux go build -o build/shikigrid cmd/shikigrid/*.go
|
@GOARM=6 GOARCH=amd64 GOOS=linux go build -o build/shikigrid cmd/shikigrid/*.go
|
||||||
@openssl dgst -sha256 "build/shikigrid" > "build/shikigrid-amd64.sha256"
|
@zip -j "build/shikigrid_linux_amd64_$(VERSION).zip" build/shikigrid > /dev/null
|
||||||
@zip -j "build/shikigrid-$(VERSION)-amd64.zip" build/shikigrid build/shikigrid-amd64.sha256 > /dev/null
|
@rm -rf build/shikigrid
|
||||||
@rm -rf build/shikigrid build/shikigrid-amd64.sha256
|
@echo building for linux/armv6l ...
|
||||||
@echo building for linux/armhf ...
|
@GOARM=6 GOARCH=arm GOOS=linux go build -o build/shikigrid cmd/shikigrid/*.go
|
||||||
@CGO_ENABLED=1 CC=arm-linux-gnueabi-gcc GOARM=6 GOARCH=arm GOOS=linux go build -o build/shikigrid cmd/shikigrid/*.go
|
@zip -j "build/shikigrid_linux_armv6l_$(VERSION).zip" build/shikigrid > /dev/null
|
||||||
@openssl dgst -sha256 "build/shikigrid" > "build/shikigrid-armhf.sha256"
|
@rm -rf build/shikigrid
|
||||||
@zip -j "build/shikigrid-$(VERSION)-armhf.zip" build/shikigrid build/shikigrid-armhf.sha256 > /dev/null
|
@openssl dgst -sha256 "build/shikigrid_linux_amd64_$(VERSION).zip" > "build/shikigrid-hashes.sha256"
|
||||||
@rm -rf build/shikigrid build/shikigrid-armhf.sha256
|
@openssl dgst -sha256 "build/shikigrid_linux_armv6l_$(VERSION).zip" >> "build/shikigrid-hashes.sha256"
|
||||||
@echo building for linux/aarch64 ...
|
|
||||||
@CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOARCH=arm64 GOOS=linux go build -o build/shikigrid cmd/shikigrid/*.go
|
|
||||||
@openssl dgst -sha256 "build/shikigrid" > "build/shikigrid-aarch64.sha256"
|
|
||||||
@zip -j "build/shikigrid-$(VERSION)-aarch64.zip" build/shikigrid build/shikigrid-aarch64.sha256 > /dev/null
|
|
||||||
@rm -rf build/shikigrid build/shikigrid-aarch64.sha256
|
|
||||||
@ls -la build
|
@ls -la build
|
||||||
|
|
||||||
# requires sudo apt-get install bison flex gcc-arm-linux-gnueabihf
|
|
||||||
cross_compile_libpcap_arm:
|
|
||||||
@echo "Cross-compiling libpcap for armhf..."
|
|
||||||
@wget https://www.tcpdump.org/release/libpcap-1.9.1.tar.gz
|
|
||||||
@tar -zxvf libpcap-1.9.1.tar.gz
|
|
||||||
@cd libpcap-1.9.1 && \
|
|
||||||
export CC=arm-linux-gnueabi-gcc && \
|
|
||||||
./configure --host=arm-linux-gnueabi && \
|
|
||||||
make
|
|
||||||
@echo "Copying cross-compiled libpcap to /usr/lib/arm-linux-gnueabi/"
|
|
||||||
@sudo cp libpcap-1.9.1/libpcap.a /usr/lib/arm-linux-gnueabi/
|
|
||||||
@echo "Clean up..."
|
|
||||||
@rm -rf libpcap-1.9.1 libpcap-1.9.1.tar.gz
|
|
||||||
|
|
||||||
# requires sudo apt-get install bison flex gcc-x86-64-linux-gnu
|
|
||||||
cross_compile_libpcap_x64:
|
|
||||||
@echo "Cross-compiling libpcap for armhf..."
|
|
||||||
@wget https://www.tcpdump.org/release/libpcap-1.9.1.tar.gz
|
|
||||||
@tar -zxvf libpcap-1.9.1.tar.gz
|
|
||||||
@cd libpcap-1.9.1 && \
|
|
||||||
export CC=x86_64-linux-gnu-gcc && \
|
|
||||||
./configure --host=x86_64-linux-gnu && \
|
|
||||||
make
|
|
||||||
@echo "Copying cross-compiled libpcap to /usr/lib/x86_64-linux-gnu/"
|
|
||||||
@sudo cp libpcap-1.9.1/libpcap.a /usr/lib/x86_64-linux-gnu/
|
|
||||||
@echo "Clean up..."
|
|
||||||
@rm -rf libpcap-1.9.1 libpcap-1.9.1.tar.gz
|
|
||||||
|
|
||||||
.PHONY: cross_compile_libpcap_arm cross_compile_libpcap_x64
|
|
||||||
@ -4,11 +4,12 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
|
||||||
"github.com/andatoshiki/shikigrid/models"
|
"github.com/andatoshiki/shikigrid/models"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/dgrijalva/jwt-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@ -5,27 +5,25 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/evilsocket/islazy/log"
|
||||||
|
"github.com/andatoshiki/shikigrid/crypto"
|
||||||
|
"github.com/andatoshiki/shikigrid/models"
|
||||||
|
"github.com/andatoshiki/shikigrid/utils"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/evilsocket/islazy/log"
|
|
||||||
"github.com/andatoshiki/shikigrid/crypto"
|
|
||||||
"github.com/andatoshiki/shikigrid/models"
|
|
||||||
"github.com/andatoshiki/shikigrid/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ClientTimeout = 60
|
ClientTimeout = 60
|
||||||
ClientTokenFile = "/tmp/shikigrid-api-enrollment.json"
|
ClientTokenFile = "/tmp/shikigrid-api-enrollment.json"
|
||||||
Endpoint = ""
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//const (
|
const (
|
||||||
// Endpoint
|
Endpoint = "https://shikigrid-go.toshiki.dev/api/v1"
|
||||||
//)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
@ -37,7 +35,7 @@ type Client struct {
|
|||||||
data map[string]interface{}
|
data map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(keys *crypto.KeyPair, endpoint string) *Client {
|
func NewClient(keys *crypto.KeyPair) *Client {
|
||||||
cli := &Client{
|
cli := &Client{
|
||||||
cli: &http.Client{
|
cli: &http.Client{
|
||||||
Timeout: time.Duration(ClientTimeout) * time.Second,
|
Timeout: time.Duration(ClientTimeout) * time.Second,
|
||||||
@ -46,8 +44,6 @@ func NewClient(keys *crypto.KeyPair, endpoint string) *Client {
|
|||||||
data: make(map[string]interface{}),
|
data: make(map[string]interface{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
Endpoint = endpoint
|
|
||||||
|
|
||||||
if info, err := os.Stat(ClientTokenFile); err == nil {
|
if info, err := os.Stat(ClientTokenFile); err == nil {
|
||||||
if time.Since(info.ModTime()) < models.TokenTTL {
|
if time.Since(info.ModTime()) < models.TokenTTL {
|
||||||
log.Debug("loading token from %s ...", ClientTokenFile)
|
log.Debug("loading token from %s ...", ClientTokenFile)
|
||||||
@ -161,14 +157,6 @@ func (c *Client) request(method string, path string, data interface{}, auth bool
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if res.StatusCode == 401 {
|
|
||||||
if err := c.enroll(); err != nil {
|
|
||||||
log.Warning("error token expired failed to re-enroll: %v", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
log.Warning("token expired, re-enroll success")
|
|
||||||
}
|
|
||||||
|
|
||||||
if res.StatusCode != 200 {
|
if res.StatusCode != 200 {
|
||||||
err = fmt.Errorf("%d %s", res.StatusCode, obj["error"])
|
err = fmt.Errorf("%d %s", res.StatusCode, obj["error"])
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/go-chi/chi/v5"
|
|
||||||
"github.com/andatoshiki/shikigrid/crypto"
|
"github.com/andatoshiki/shikigrid/crypto"
|
||||||
"github.com/andatoshiki/shikigrid/models"
|
"github.com/andatoshiki/shikigrid/models"
|
||||||
|
"github.com/go-chi/chi"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package api
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/go-chi/chi/v5"
|
|
||||||
"github.com/andatoshiki/shikigrid/mesh"
|
"github.com/andatoshiki/shikigrid/mesh"
|
||||||
|
"github.com/go-chi/chi"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
|
||||||
"github.com/andatoshiki/shikigrid/crypto"
|
"github.com/andatoshiki/shikigrid/crypto"
|
||||||
"github.com/andatoshiki/shikigrid/mesh"
|
"github.com/andatoshiki/shikigrid/mesh"
|
||||||
|
"github.com/go-chi/chi"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
_ "github.com/jinzhu/gorm/dialects/mysql"
|
_ "github.com/jinzhu/gorm/dialects/mysql"
|
||||||
|
|
||||||
@ -20,13 +19,13 @@ type API struct {
|
|||||||
Client *Client
|
Client *Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func Setup(keys *crypto.KeyPair, peer *mesh.Peer, router *mesh.Router, Endpoint string) (err error, api *API) {
|
func Setup(keys *crypto.KeyPair, peer *mesh.Peer, router *mesh.Router) (err error, api *API) {
|
||||||
api = &API{
|
api = &API{
|
||||||
Router: chi.NewRouter(),
|
Router: chi.NewRouter(),
|
||||||
Keys: keys,
|
Keys: keys,
|
||||||
Peer: peer,
|
Peer: peer,
|
||||||
Mesh: router,
|
Mesh: router,
|
||||||
Client: NewClient(keys, Endpoint),
|
Client: NewClient(keys),
|
||||||
}
|
}
|
||||||
|
|
||||||
api.Router.Use(CORS)
|
api.Router.Use(CORS)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (api *API) setupPeerRoutes() {
|
func (api *API) setupPeerRoutes() {
|
||||||
|
|||||||
@ -3,7 +3,8 @@ package api
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi"
|
||||||
|
"github.com/go-chi/chi/middleware"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,6 +19,8 @@ func cached(seconds int, next http.HandlerFunc) http.HandlerFunc {
|
|||||||
func (api *API) setupServerRoutes() {
|
func (api *API) setupServerRoutes() {
|
||||||
log.Debug("registering server api ...")
|
log.Debug("registering server api ...")
|
||||||
|
|
||||||
|
api.Router.Use(middleware.DefaultCompress)
|
||||||
|
|
||||||
api.Router.Route("/api", func(r chi.Router) {
|
api.Router.Route("/api", func(r chi.Router) {
|
||||||
r.Route("/v1", func(r chi.Router) {
|
r.Route("/v1", func(r chi.Router) {
|
||||||
r.Route("/units", func(r chi.Router) {
|
r.Route("/units", func(r chi.Router) {
|
||||||
|
|||||||
@ -5,9 +5,9 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/go-chi/chi/v5"
|
|
||||||
"github.com/andatoshiki/shikigrid/crypto"
|
"github.com/andatoshiki/shikigrid/crypto"
|
||||||
"github.com/andatoshiki/shikigrid/models"
|
"github.com/andatoshiki/shikigrid/models"
|
||||||
|
"github.com/go-chi/chi"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-chi/chi/v5"
|
|
||||||
"github.com/andatoshiki/shikigrid/models"
|
"github.com/andatoshiki/shikigrid/models"
|
||||||
|
"github.com/go-chi/chi"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"runtime/pprof"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/evilsocket/islazy/fs"
|
"github.com/evilsocket/islazy/fs"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/andatoshiki/shikigrid/api"
|
"github.com/andatoshiki/shikigrid/api"
|
||||||
@ -15,6 +10,10 @@ import (
|
|||||||
"github.com/andatoshiki/shikigrid/utils"
|
"github.com/andatoshiki/shikigrid/utils"
|
||||||
"github.com/andatoshiki/shikigrid/version"
|
"github.com/andatoshiki/shikigrid/version"
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"runtime/pprof"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func cleanup() {
|
func cleanup() {
|
||||||
@ -86,11 +85,6 @@ func waitForKeys() {
|
|||||||
|
|
||||||
func setupMesh() {
|
func setupMesh() {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if advertise == false {
|
|
||||||
return //this probably doesnt work
|
|
||||||
}
|
|
||||||
|
|
||||||
peer = mesh.MakeLocalPeer(utils.Hostname(), keys)
|
peer = mesh.MakeLocalPeer(utils.Hostname(), keys)
|
||||||
if err = peer.StartAdvertising(iface); err != nil {
|
if err = peer.StartAdvertising(iface); err != nil {
|
||||||
log.Fatal("error while starting signaling: %v", err)
|
log.Fatal("error while starting signaling: %v", err)
|
||||||
@ -131,7 +125,7 @@ func setupMode() string {
|
|||||||
|
|
||||||
// for inbox actions, set the keys to the default path if empty
|
// for inbox actions, set the keys to the default path if empty
|
||||||
if (whoami || inbox) && keysPath == "" {
|
if (whoami || inbox) && keysPath == "" {
|
||||||
keysPath = "/etc/pwnagotchi/"
|
keysPath = "/etc/shikigotchi/"
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate keypair
|
// generate keypair
|
||||||
@ -150,12 +144,12 @@ func setupMode() string {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
mode := "peer"
|
mode := "server"
|
||||||
// if keys have been passed explicitly, or one of the inbox actions
|
// if keys have been passed explicitly, or one of the inbox actions
|
||||||
// has been specified, we're running on the unit
|
// has been specified, we're running on the unit
|
||||||
// if keysPath != "" {
|
if keysPath != "" {
|
||||||
// mode = "peer"
|
mode = "peer"
|
||||||
// }
|
}
|
||||||
|
|
||||||
log.Info("shikigrid v%s starting in %s mode ...", version.Version, mode)
|
log.Info("shikigrid v%s starting in %s mode ...", version.Version, mode)
|
||||||
|
|
||||||
@ -170,11 +164,7 @@ func setupMode() string {
|
|||||||
}
|
}
|
||||||
// print identity and exit
|
// print identity and exit
|
||||||
if whoami {
|
if whoami {
|
||||||
if Endpoint == "https://grid-api.toshiki.dev/api/v1" {
|
|
||||||
log.Info("https://toshiki.dev/search/%s", keys.FingerprintHex)
|
|
||||||
} else {
|
|
||||||
log.Info("https://pwnagotchi.ai/pwnfile/#!%s", keys.FingerprintHex)
|
log.Info("https://pwnagotchi.ai/pwnfile/#!%s", keys.FingerprintHex)
|
||||||
}
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
// only start mesh signaling if this is not an inbox action
|
// only start mesh signaling if this is not an inbox action
|
||||||
@ -187,7 +177,7 @@ func setupMode() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setup the proper routes for either server or peer mode
|
// setup the proper routes for either server or peer mode
|
||||||
err, server = api.Setup(keys, peer, router, Endpoint)
|
err, server = api.Setup(keys, peer, router)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("%v", err)
|
log.Fatal("%v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/andatoshiki/shikigrid/api"
|
"github.com/andatoshiki/shikigrid/api"
|
||||||
"github.com/andatoshiki/shikigrid/crypto"
|
"github.com/andatoshiki/shikigrid/crypto"
|
||||||
@ -38,8 +37,6 @@ var (
|
|||||||
server = (*api.API)(nil)
|
server = (*api.API)(nil)
|
||||||
cpuProfile = ""
|
cpuProfile = ""
|
||||||
memProfile = ""
|
memProfile = ""
|
||||||
Endpoint = "https://grid-api.toshiki.dev/api/v1"
|
|
||||||
advertise = true
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -75,7 +72,4 @@ func init() {
|
|||||||
|
|
||||||
flag.StringVar(&cpuProfile, "cpu-profile", cpuProfile, "Generate CPU profile to this file.")
|
flag.StringVar(&cpuProfile, "cpu-profile", cpuProfile, "Generate CPU profile to this file.")
|
||||||
flag.StringVar(&memProfile, "mem-profile", cpuProfile, "Generate memory profile to this file.")
|
flag.StringVar(&memProfile, "mem-profile", cpuProfile, "Generate memory profile to this file.")
|
||||||
|
|
||||||
flag.StringVar(&Endpoint, "endpoint", Endpoint, "Pass which endpoint shikigrid should be using.")
|
|
||||||
flag.BoolVar(&advertise, "advertise", advertise, "Advertise?")
|
|
||||||
}
|
}
|
||||||
|
|||||||
23
go.mod
23
go.mod
@ -1,20 +1,15 @@
|
|||||||
module github.com/andatoshiki/shikigrid
|
module github.com/andatoshiki/shikigrid
|
||||||
|
|
||||||
go 1.21
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/biezhi/gorm-paginator/pagination v0.0.0-20190124091837-7a5c8ed20334
|
github.com/biezhi/gorm-paginator/pagination v0.0.0-20190124091837-7a5c8ed20334
|
||||||
github.com/evilsocket/islazy v1.11.0
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||||
github.com/go-chi/chi/v5 v5.0.11
|
github.com/evilsocket/islazy v1.10.4
|
||||||
github.com/go-chi/cors v1.2.1
|
github.com/go-chi/chi v4.0.2+incompatible
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.0
|
github.com/go-chi/cors v1.0.0
|
||||||
github.com/gopacket/gopacket v1.2.0
|
github.com/google/gopacket v1.1.17
|
||||||
github.com/jinzhu/gorm v1.9.16
|
github.com/jinzhu/gorm v1.9.11
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.3.0
|
||||||
)
|
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc // indirect
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/go-sql-driver/mysql v1.7.1 // indirect
|
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
|
||||||
golang.org/x/sys v0.15.0 // indirect
|
|
||||||
)
|
)
|
||||||
|
|||||||
176
go.sum
176
go.sum
@ -1,53 +1,159 @@
|
|||||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
cloud.google.com/go v0.37.4 h1:glPeL3BQJsbF6aIIYfZizMwc5LTYz250bDMjttbBGAU=
|
||||||
|
cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||||
|
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
github.com/biezhi/gorm-paginator/pagination v0.0.0-20190124091837-7a5c8ed20334 h1:ptFjQ4+vPGZDiNmBuKUetQoREFiPz/WB29CfQfdfeKc=
|
github.com/biezhi/gorm-paginator/pagination v0.0.0-20190124091837-7a5c8ed20334 h1:ptFjQ4+vPGZDiNmBuKUetQoREFiPz/WB29CfQfdfeKc=
|
||||||
github.com/biezhi/gorm-paginator/pagination v0.0.0-20190124091837-7a5c8ed20334/go.mod h1:Y/N4aF7p+Med/9ivVSsGBc8xOs8BGptUVBCY3k4KFCY=
|
github.com/biezhi/gorm-paginator/pagination v0.0.0-20190124091837-7a5c8ed20334/go.mod h1:Y/N4aF7p+Med/9ivVSsGBc8xOs8BGptUVBCY3k4KFCY=
|
||||||
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM=
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3 h1:tkum0XDgfR0jcVVXuTsYv/erY2NnEDqwRojbxR1rBYA=
|
||||||
|
github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
|
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||||
|
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||||
|
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
|
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
|
||||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
|
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
|
||||||
github.com/evilsocket/islazy v1.11.0 h1:B5w6uuS6ki6iDG+aH/RFeoMb8ijQh/pGabewqp2UeJ0=
|
github.com/evilsocket/islazy v1.10.4 h1:Z5373Kn5Gh2EWch1Tb/Qxb6vyQ7lw704bmKi7sY4Ecs=
|
||||||
github.com/evilsocket/islazy v1.11.0/go.mod h1:muYH4x5MB5YRdkxnrOtrXLIBX6LySj1uFIqys94LKdo=
|
github.com/evilsocket/islazy v1.10.4/go.mod h1:OrwQGYg3DuZvXUfmH+KIZDjwTCbrjy48T24TUpGqVVw=
|
||||||
github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs=
|
||||||
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
||||||
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
github.com/go-chi/cors v1.0.0 h1:e6x8k7uWbUwYs+aXDoiUzeQFT6l0cygBYyNhD7/1Tg0=
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-chi/cors v1.0.0/go.mod h1:K2Yje0VW/SJzxiyMYu6iPQYa7hMjQX2i/F491VChg1I=
|
||||||
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
|
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gopacket/gopacket v1.2.0 h1:eXbzFad7f73P1n2EJHQlsKuvIMJjVXK5tXoSca78I3A=
|
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gopacket/gopacket v1.2.0/go.mod h1:BrAKEy5EOGQ76LSqh7DMAr7z0NNPdczWm2GxCG7+I8M=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||||
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
|
github.com/google/gopacket v1.1.17 h1:rMrlX2ZY2UbvT+sdz3+6J+pp2z+msCq9MxTU6ymxbBY=
|
||||||
|
github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM=
|
||||||
|
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||||
|
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||||
|
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||||
|
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/jinzhu/gorm v1.9.2/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCdxqo=
|
github.com/jinzhu/gorm v1.9.2/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCdxqo=
|
||||||
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
|
github.com/jinzhu/gorm v1.9.11 h1:gaHGvE+UnWGlbWG4Y3FUwY1EcZ5n6S9WtqBA/uySMLE=
|
||||||
github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
|
github.com/jinzhu/gorm v1.9.11/go.mod h1:bu/pK8szGZ2puuErfU0RwyeNdsf3e6nCX/noXaVxkfw=
|
||||||
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
|
github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
|
||||||
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||||
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
|
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
|
||||||
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
|
github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q=
|
||||||
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
|
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
|
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||||
|
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
|
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||||
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||||
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI=
|
||||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd h1:GGJVjV8waZKRHrgwvtH66z9ZGVurTD1MT0n1Bb+q4aM=
|
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc h1:c0o/qxkaO2LF5t6fQrT4b5hzyggAkLLlCUjqfRxd8Q4=
|
||||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
|
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To=
|
||||||
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||||
|
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
||||||
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||||
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||||
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
|||||||
@ -4,15 +4,15 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/evilsocket/islazy/async"
|
"github.com/evilsocket/islazy/async"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/gopacket/gopacket"
|
"github.com/google/gopacket"
|
||||||
"github.com/gopacket/gopacket/pcap"
|
"github.com/google/gopacket/pcap"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Ugly, but gopacket folks are not exporting pcap errors, so ...
|
// Ugly, but gopacket folks are not exporting pcap errors, so ...
|
||||||
// ref. https://github.com/gopacket/gopacket/blob/96986c90e3e5c7e01deed713ff8058e357c0c047/pcap/pcap.go#L281
|
// ref. https://github.com/google/gopacket/blob/96986c90e3e5c7e01deed713ff8058e357c0c047/pcap/pcap.go#L281
|
||||||
ErrIfaceNotUp = "Interface Not Up"
|
ErrIfaceNotUp = "Interface Not Up"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/gopacket/gopacket/layers"
|
|
||||||
"github.com/andatoshiki/shikigrid/crypto"
|
"github.com/andatoshiki/shikigrid/crypto"
|
||||||
"github.com/andatoshiki/shikigrid/version"
|
"github.com/andatoshiki/shikigrid/version"
|
||||||
"github.com/andatoshiki/shikigrid/wifi"
|
"github.com/andatoshiki/shikigrid/wifi"
|
||||||
|
"github.com/google/gopacket/layers"
|
||||||
"net"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@ -5,9 +5,9 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/evilsocket/islazy/log"
|
"github.com/evilsocket/islazy/log"
|
||||||
"github.com/gopacket/gopacket"
|
|
||||||
"github.com/gopacket/gopacket/layers"
|
|
||||||
"github.com/andatoshiki/shikigrid/wifi"
|
"github.com/andatoshiki/shikigrid/wifi"
|
||||||
|
"github.com/google/gopacket"
|
||||||
|
"github.com/google/gopacket/layers"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -22,7 +22,6 @@ type EnrollmentRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ansi = regexp.MustCompile("\033\\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]")
|
var ansi = regexp.MustCompile("\033\\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]")
|
||||||
|
|
||||||
func clean(s string) string {
|
func clean(s string) string {
|
||||||
for _, m := range ansi.FindAllString(s, -1) {
|
for _, m := range ansi.FindAllString(s, -1) {
|
||||||
s = strings.Replace(s, m, "", -1)
|
s = strings.Replace(s, m, "", -1)
|
||||||
|
|||||||
@ -3,28 +3,15 @@ package models
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/dgrijalva/jwt-go"
|
||||||
|
"github.com/evilsocket/islazy/log"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/evilsocket/islazy/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TokenTTL = time.Minute * 30
|
TokenTTL = time.Minute * 30
|
||||||
CacheTTL = time.Minute * 120
|
|
||||||
)
|
|
||||||
|
|
||||||
type cachedCounter struct {
|
|
||||||
Time time.Time
|
|
||||||
Count int
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
cache = make(map[uint]*cachedCounter)
|
|
||||||
cacheLock = sync.Mutex{}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Unit struct {
|
type Unit struct {
|
||||||
@ -139,26 +126,6 @@ type unitJSON struct {
|
|||||||
Networks int `json:"networks"`
|
Networks int `json:"networks"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Unit) apCounter() int {
|
|
||||||
cacheLock.Lock()
|
|
||||||
defer cacheLock.Unlock()
|
|
||||||
|
|
||||||
count := -1
|
|
||||||
if cnt, found := cache[u.ID]; found && time.Since(cnt.Time) < CacheTTL {
|
|
||||||
count = cnt.Count
|
|
||||||
}
|
|
||||||
|
|
||||||
if count == -1 {
|
|
||||||
count = db.Model(u).Association("AccessPoints").Count()
|
|
||||||
cache[u.ID] = &cachedCounter{
|
|
||||||
Time: time.Now(),
|
|
||||||
Count: count,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return count
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *Unit) MarshalJSON() ([]byte, error) {
|
func (u *Unit) MarshalJSON() ([]byte, error) {
|
||||||
doc := unitJSON{
|
doc := unitJSON{
|
||||||
EnrolledAt: u.CreatedAt,
|
EnrolledAt: u.CreatedAt,
|
||||||
@ -168,7 +135,7 @@ func (u *Unit) MarshalJSON() ([]byte, error) {
|
|||||||
Fingerprint: u.Fingerprint,
|
Fingerprint: u.Fingerprint,
|
||||||
PublicKey: u.PublicKey,
|
PublicKey: u.PublicKey,
|
||||||
Data: map[string]interface{}{},
|
Data: map[string]interface{}{},
|
||||||
Networks: u.apCounter(),
|
Networks: db.Model(u).Association("AccessPoints").Count(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if u.Data != "" {
|
if u.Data != "" {
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=shikigrid peer service
|
Description=shikigrid peer service
|
||||||
Documentation=https://shikigotchi.toshiki.dev/
|
Documentation=https://pwnagotchi.ai/
|
||||||
Wants=network.target
|
Wants=network.target
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
PermissionsStartOnly=true
|
PermissionsStartOnly=true
|
||||||
ExecStart=/usr/local/bin/shikigrid -log /var/log/shikigrid.log -peers /root/peers -address 127.0.0.1:8666
|
ExecStart=/usr/local/bin/shikigrid -log /var/log/shikigrid.log -peer -address 127.0.0.1:8666
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=shikigrid api service
|
Description=shikigrid api service
|
||||||
Documentation=https://shikigotchi.toshiki.dev/
|
Documentation=https://pwnagotchi.ai/
|
||||||
Wants=network.target
|
Wants=network.target
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
package version
|
package version
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "1.10.7"
|
Version = "1.10.3"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package wifi
|
package wifi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gopacket/gopacket"
|
"github.com/google/gopacket"
|
||||||
"github.com/gopacket/gopacket/layers"
|
"github.com/google/gopacket/layers"
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package wifi
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"github.com/gopacket/gopacket"
|
"github.com/google/gopacket"
|
||||||
"github.com/gopacket/gopacket/layers"
|
"github.com/google/gopacket/layers"
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package wifi
|
package wifi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gopacket/gopacket"
|
"github.com/google/gopacket"
|
||||||
"github.com/gopacket/gopacket/layers"
|
"github.com/google/gopacket/layers"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Parse(packet gopacket.Packet) (ok bool, radio *layers.RadioTap, dot11 *layers.Dot11) {
|
func Parse(packet gopacket.Packet) (ok bool, radio *layers.RadioTap, dot11 *layers.Dot11) {
|
||||||
|
|||||||
@ -2,8 +2,8 @@ package wifi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gopacket/gopacket"
|
"github.com/google/gopacket"
|
||||||
"github.com/gopacket/gopacket/layers"
|
"github.com/google/gopacket/layers"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Unpack(pkt gopacket.Packet, radio *layers.RadioTap, dot11 *layers.Dot11) (error, []byte) {
|
func Unpack(pkt gopacket.Packet, radio *layers.RadioTap, dot11 *layers.Dot11) (error, []byte) {
|
||||||
|
|||||||
@ -2,8 +2,8 @@ package wifi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/gopacket/gopacket"
|
"github.com/google/gopacket"
|
||||||
"github.com/gopacket/gopacket/layers"
|
"github.com/google/gopacket/layers"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Serialize(layers ...gopacket.SerializableLayer) (error, []byte) {
|
func Serialize(layers ...gopacket.SerializableLayer) (error, []byte) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user