forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added stand alone GUI command. (Velocidex#580)
* Added stand alone GUI command. Now running: ``` velociraptor.exe gui ``` Will do everything automatigally - create a new config, and open the browser to the welcome page.
- Loading branch information
Showing
37 changed files
with
941 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Server.Internal.Welcome | ||
|
||
reports: | ||
- type: CLIENT | ||
template: | | ||
<div class="row dashboard "> | ||
<div class="card col-10"> | ||
<img src="https://www.velocidex.com/images/logos/logo.svg" class="card-img-top"> | ||
<div class="card-body"> | ||
# Welcome to Velociraptor! | ||
## Common tasks: | ||
* <a href="/app.html#/server_artifacts">Building an Offline Collector</a> | ||
</div></div></div> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright 2016 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// Package browser provides utilities for interacting with users' browsers. | ||
// Comes from https://raw.githubusercontent.com/golang/go/master/src/cmd/internal/browser/browser.go | ||
package main | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"runtime" | ||
"time" | ||
) | ||
|
||
// Commands returns a list of possible commands to use to open a url. | ||
func Commands() [][]string { | ||
var cmds [][]string | ||
if exe := os.Getenv("BROWSER"); exe != "" { | ||
cmds = append(cmds, []string{exe}) | ||
} | ||
switch runtime.GOOS { | ||
case "darwin": | ||
cmds = append(cmds, []string{"/usr/bin/open"}) | ||
case "windows": | ||
cmds = append(cmds, []string{"cmd", "/c", "start"}) | ||
default: | ||
if os.Getenv("DISPLAY") != "" { | ||
// xdg-open is only for use in a desktop environment. | ||
cmds = append(cmds, []string{"xdg-open"}) | ||
} | ||
} | ||
cmds = append(cmds, | ||
[]string{"chrome"}, | ||
[]string{"google-chrome"}, | ||
[]string{"chromium"}, | ||
[]string{"firefox"}, | ||
) | ||
return cmds | ||
} | ||
|
||
// Open tries to open url in a browser and reports whether it succeeded. | ||
func OpenBrowser(url string) bool { | ||
for _, args := range Commands() { | ||
cmd := exec.Command(args[0], append(args[1:], url)...) | ||
if cmd.Start() == nil && appearsSuccessful(cmd, 3*time.Second) { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
// appearsSuccessful reports whether the command appears to have run successfully. | ||
// If the command runs longer than the timeout, it's deemed successful. | ||
// If the command runs within the timeout, it's deemed successful if it exited cleanly. | ||
func appearsSuccessful(cmd *exec.Cmd, timeout time.Duration) bool { | ||
errc := make(chan error, 1) | ||
go func() { | ||
errc <- cmd.Wait() | ||
}() | ||
|
||
select { | ||
case <-time.After(timeout): | ||
return true | ||
case err := <-errc: | ||
return err == nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.