Skip to content

Commit

Permalink
Added a new interactive shell command.
Browse files Browse the repository at this point in the history
  • Loading branch information
scudette committed Dec 9, 2018
1 parent 12274e2 commit 17c26d3
Show file tree
Hide file tree
Showing 86 changed files with 3,677 additions and 2,924 deletions.
164 changes: 108 additions & 56 deletions Gopkg.lock

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
# go-tests = true
# unused-packages = true

[[override]]
name = "github.com/golang/protobuf"

# Remove when protobuf makes a new release. They current release is
# too old WRT the rest of the protobuf eco system.
revision = "1d3f30b51784bec5aad268e59fd3c2fc1c2fe73f"

[prune]
go-tests = true
unused-packages = true
4 changes: 2 additions & 2 deletions actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ package actions
import (
"context"

config "www.velocidex.com/golang/velociraptor/config"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
crypto_proto "www.velocidex.com/golang/velociraptor/crypto/proto"
)

type ClientAction interface {
Run(
config *config.Config,
config *api_proto.Config,
ctx context.Context,
args *crypto_proto.GrrMessage,
output chan<- *crypto_proto.GrrMessage)
Expand Down
6 changes: 3 additions & 3 deletions actions/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"github.com/Showmax/go-fqdn"
"github.com/shirou/gopsutil/host"
actions_proto "www.velocidex.com/golang/velociraptor/actions/proto"
config "www.velocidex.com/golang/velociraptor/config"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
crypto_proto "www.velocidex.com/golang/velociraptor/crypto/proto"
"www.velocidex.com/golang/velociraptor/responder"
)

type GetHostname struct{}

func (self *GetHostname) Run(
config *config.Config,
config *api_proto.Config,
ctx context.Context,
msg *crypto_proto.GrrMessage,
output chan<- *crypto_proto.GrrMessage) {
Expand All @@ -38,7 +38,7 @@ func (self *GetHostname) Run(
type GetPlatformInfo struct{}

func (self *GetPlatformInfo) Run(
config *config.Config,
config *api_proto.Config,
ctx context.Context,
msg *crypto_proto.GrrMessage,
output chan<- *crypto_proto.GrrMessage) {
Expand Down
5 changes: 3 additions & 2 deletions actions/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

actions_proto "www.velocidex.com/golang/velociraptor/actions/proto"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
config "www.velocidex.com/golang/velociraptor/config"
crypto_proto "www.velocidex.com/golang/velociraptor/crypto/proto"
"www.velocidex.com/golang/velociraptor/responder"
Expand All @@ -12,7 +13,7 @@ import (
type GetClientInfo struct{}

func (self *GetClientInfo) Run(
config *config.Config,
config *api_proto.Config,
ctx context.Context,
args *crypto_proto.GrrMessage,
output chan<- *crypto_proto.GrrMessage) {
Expand All @@ -29,7 +30,7 @@ func (self *GetClientInfo) Run(
type UpdateForeman struct{}

func (self *UpdateForeman) Run(
config_obj *config.Config,
config_obj *api_proto.Config,
ctx context.Context,
msg *crypto_proto.GrrMessage,
output chan<- *crypto_proto.GrrMessage) {
Expand Down
4 changes: 2 additions & 2 deletions actions/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"

actions_proto "www.velocidex.com/golang/velociraptor/actions/proto"
config "www.velocidex.com/golang/velociraptor/config"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
crypto_proto "www.velocidex.com/golang/velociraptor/crypto/proto"
"www.velocidex.com/golang/velociraptor/events"
"www.velocidex.com/golang/velociraptor/logging"
Expand All @@ -15,7 +15,7 @@ import (
type UpdateEventTable struct{}

func (self *UpdateEventTable) Run(
config *config.Config,
config *api_proto.Config,
ctx context.Context,
msg *crypto_proto.GrrMessage,
output chan<- *crypto_proto.GrrMessage) {
Expand Down
2 changes: 1 addition & 1 deletion actions/proto/actions.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion actions/proto/fingerprint.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion actions/proto/generic.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion actions/proto/hunts.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion actions/proto/transport.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion actions/proto/vql.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions actions/vql.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/dustin/go-humanize"
actions_proto "www.velocidex.com/golang/velociraptor/actions/proto"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
artifacts "www.velocidex.com/golang/velociraptor/artifacts"
config "www.velocidex.com/golang/velociraptor/config"
crypto_proto "www.velocidex.com/golang/velociraptor/crypto/proto"
"www.velocidex.com/golang/velociraptor/logging"
"www.velocidex.com/golang/velociraptor/responder"
Expand All @@ -19,7 +19,7 @@ import (
)

type LogWriter struct {
config_obj *config.Config
config_obj *api_proto.Config
responder *responder.Responder
}

Expand All @@ -35,7 +35,7 @@ func (self *LogWriter) Write(b []byte) (int, error) {
type VQLClientAction struct{}

func (self *VQLClientAction) Run(
config_obj *config.Config,
config_obj *api_proto.Config,
ctx context.Context,
msg *crypto_proto.GrrMessage,
output chan<- *crypto_proto.GrrMessage) {
Expand All @@ -54,7 +54,7 @@ func (self *VQLClientAction) Run(
}

func (self *VQLClientAction) StartQuery(
config_obj *config.Config,
config_obj *api_proto.Config,
ctx context.Context,
responder *responder.Responder,
arg *actions_proto.VQLCollectorArgs) {
Expand Down
5 changes: 2 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
artifacts "www.velocidex.com/golang/velociraptor/artifacts"
artifacts_proto "www.velocidex.com/golang/velociraptor/artifacts/proto"
"www.velocidex.com/golang/velociraptor/config"
"www.velocidex.com/golang/velociraptor/constants"
"www.velocidex.com/golang/velociraptor/datastore"
"www.velocidex.com/golang/velociraptor/flows"
Expand All @@ -28,7 +27,7 @@ import (
)

type ApiServer struct {
config *config.Config
config *api_proto.Config
server_obj *server.Server
}

Expand Down Expand Up @@ -324,7 +323,7 @@ func (self *ApiServer) GetArtifacts(
return result, nil
}

func StartServer(config_obj *config.Config, server_obj *server.Server) error {
func StartServer(config_obj *api_proto.Config, server_obj *server.Server) error {
bind_addr := fmt.Sprintf("%s:%d", config_obj.API.BindAddress,
config_obj.API.BindPort)

Expand Down
7 changes: 4 additions & 3 deletions api/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ import (
"html/template"
"net/http"
"time"
config "www.velocidex.com/golang/velociraptor/config"

api_proto "www.velocidex.com/golang/velociraptor/api/proto"
"www.velocidex.com/golang/velociraptor/gui/assets"
)

func install_mux(config_obj *config.Config, mux *http.ServeMux) {
func install_mux(config_obj *api_proto.Config, mux *http.ServeMux) {
dir := "/static/"
mux.Handle(dir, http.FileServer(assets.HTTP))
}

func GetTemplateHandler(
config_obj *config.Config, template_name string) (http.Handler, error) {
config_obj *api_proto.Config, template_name string) (http.Handler, error) {
data, err := assets.ReadFile(template_name)
if err != nil {
return nil, err
Expand Down
7 changes: 4 additions & 3 deletions api/assets_filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ import (
"html/template"
"net/http"
"time"
config "www.velocidex.com/golang/velociraptor/config"

api_proto "www.velocidex.com/golang/velociraptor/api/proto"
"www.velocidex.com/golang/velociraptor/logging"
)

func install_mux(config_obj *config.Config, mux *http.ServeMux) {
func install_mux(config_obj *api_proto.Config, mux *http.ServeMux) {
logging.NewLogger(config_obj).Info("GUI will serve files from directory gui/static")
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(
http.Dir("gui/static"))))
}

func GetTemplateHandler(config_obj *config.Config,
func GetTemplateHandler(config_obj *api_proto.Config,
template_name string) (http.Handler, error) {
tmpl, err := template.ParseFiles("gui" + template_name)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package api

import (
"context"
"google.golang.org/grpc/metadata"
"net/http"

"google.golang.org/grpc/metadata"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
config "www.velocidex.com/golang/velociraptor/config"
users "www.velocidex.com/golang/velociraptor/users"
)

func checkUserCredentialsHandler(
config_obj *config.Config,
config_obj *api_proto.Config,
parent http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`)
Expand Down Expand Up @@ -41,14 +41,14 @@ func checkUserCredentialsHandler(

// TODO: Implement this properly.
func IsUserApprovedForClient(
config_obj *config.Config,
config_obj *api_proto.Config,
md *metadata.MD,
client_id string) bool {
return true
}

func getClientApprovalForUser(
config *config.Config,
config *api_proto.Config,
md *metadata.MD,
client_id string) *api_proto.ApprovalList {
result := api_proto.ApprovalList{
Expand Down
3 changes: 1 addition & 2 deletions api/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import (

actions_proto "www.velocidex.com/golang/velociraptor/actions/proto"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
"www.velocidex.com/golang/velociraptor/config"
"www.velocidex.com/golang/velociraptor/datastore"
urns "www.velocidex.com/golang/velociraptor/urns"
)

func GetApiClient(
config_obj *config.Config, client_id string, detailed bool) (
config_obj *api_proto.Config, client_id string, detailed bool) (
*api_proto.ApiClient, error) {
result := &api_proto.ApiClient{
ClientId: client_id,
Expand Down
7 changes: 3 additions & 4 deletions api/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/gorilla/schema"
actions_proto "www.velocidex.com/golang/velociraptor/actions/proto"
api_proto "www.velocidex.com/golang/velociraptor/api/proto"
config "www.velocidex.com/golang/velociraptor/config"
crypto_proto "www.velocidex.com/golang/velociraptor/crypto/proto"
"www.velocidex.com/golang/velociraptor/file_store"
"www.velocidex.com/golang/velociraptor/flows"
Expand All @@ -29,7 +28,7 @@ func returnError(w http.ResponseWriter, code int, message string) {

// URL format: /api/v1/download/<client_id>/<flow_id>
func flowResultDownloadHandler(
config_obj *config.Config) http.Handler {
config_obj *api_proto.Config) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
components := strings.Split(r.URL.Path, "/")
if len(components) < 2 {
Expand Down Expand Up @@ -151,7 +150,7 @@ func flowResultDownloadHandler(

// URL format: /api/v1/DownloadHuntResults
func huntResultDownloadHandler(
config_obj *config.Config) http.Handler {
config_obj *api_proto.Config) http.Handler {
logger := logging.NewLogger(config_obj)

return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -305,7 +304,7 @@ type vfsFileDownloadRequest struct {

// URL format: /api/v1/DownloadVFSFile
func vfsFileDownloadHandler(
config_obj *config.Config) http.Handler {
config_obj *api_proto.Config) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
request := vfsFileDownloadRequest{}
decoder := schema.NewDecoder()
Expand Down
2 changes: 1 addition & 1 deletion api/proto/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 17c26d3

Please sign in to comment.