remove path from collected data

PATH is fairy sensitive information and it doesn't represent command context
pull/15/head
Simon Let 7 years ago
parent fee9700de0
commit 848d50011b
  1. 2
      .gitignore
  2. 26
      collect/resh-collect.go
  3. 14
      common/resh-common.go
  4. 4
      shellrc.sh
  5. 2
      version

2
.gitignore vendored

@ -0,0 +1,2 @@
resh-collect
resh-daemon

@ -5,12 +5,14 @@ import (
"encoding/json" "encoding/json"
"flag" "flag"
"fmt" "fmt"
"github.com/BurntSushi/toml"
common "github.com/curusarn/resh/common"
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
"os" "os"
"github.com/BurntSushi/toml"
common "github.com/curusarn/resh/common"
// "os/exec" // "os/exec"
"os/user" "os/user"
"path/filepath" "path/filepath"
@ -52,7 +54,7 @@ func main() {
lang := flag.String("lang", "", "$LANG") lang := flag.String("lang", "", "$LANG")
lcAll := flag.String("lcAll", "", "$LC_ALL") lcAll := flag.String("lcAll", "", "$LC_ALL")
login := flag.String("login", "", "$LOGIN") login := flag.String("login", "", "$LOGIN")
path := flag.String("path", "", "$PATH") // path := flag.String("path", "", "$PATH")
pwd := flag.String("pwd", "", "$PWD - present working directory") pwd := flag.String("pwd", "", "$PWD - present working directory")
pwdAfter := flag.String("pwdAfter", "", "$PWD after command") pwdAfter := flag.String("pwdAfter", "", "$PWD after command")
shellEnv := flag.String("shellEnv", "", "$SHELL") shellEnv := flag.String("shellEnv", "", "$SHELL")
@ -102,18 +104,18 @@ func main() {
os.Exit(0) os.Exit(0)
} }
if *requireVersion != "" && *requireVersion != Version { if *requireVersion != "" && *requireVersion != Version {
fmt.Println("Please restart/reload this terminal session " + fmt.Println("Please restart/reload this terminal session " +
"(resh version: " + Version + "(resh version: " + Version +
" resh version of this terminal session: " + *requireVersion + " resh version of this terminal session: " + *requireVersion +
")") ")")
os.Exit(3) os.Exit(3)
} }
if *requireRevision != "" && *requireRevision != Revision { if *requireRevision != "" && *requireRevision != Revision {
fmt.Println("Please restart/reload this terminal session " + fmt.Println("Please restart/reload this terminal session " +
"(resh revision: " + Revision + "(resh revision: " + Revision +
" resh revision of this terminal session: " + *requireRevision + " resh revision of this terminal session: " + *requireRevision +
")") ")")
os.Exit(3) os.Exit(3)
} }
realtimeAfter, err := strconv.ParseFloat(*rta, 64) realtimeAfter, err := strconv.ParseFloat(*rta, 64)
if err != nil { if err != nil {
@ -178,11 +180,11 @@ func main() {
Cols: *cols, Cols: *cols,
Lines: *lines, Lines: *lines,
Home: *home, Home: *home,
Lang: *lang, Lang: *lang,
LcAll: *lcAll, LcAll: *lcAll,
Login: *login, Login: *login,
Path: *path, // Path: *path,
Pwd: *pwd, Pwd: *pwd,
PwdAfter: *pwdAfter, PwdAfter: *pwdAfter,
ShellEnv: *shellEnv, ShellEnv: *shellEnv,

@ -9,13 +9,13 @@ type Record struct {
SessionId string `json:"sessionId"` SessionId string `json:"sessionId"`
// posix // posix
Cols string `json:"cols"` Cols string `json:"cols"`
Lines string `json:"lines"` Lines string `json:"lines"`
Home string `json:"home"` Home string `json:"home"`
Lang string `json:"lang"` Lang string `json:"lang"`
LcAll string `json:"lcAll"` LcAll string `json:"lcAll"`
Login string `json:"login"` Login string `json:"login"`
Path string `json:"path"` //Path string `json:"path"`
Pwd string `json:"pwd"` Pwd string `json:"pwd"`
PwdAfter string `json:"pwdAfter"` PwdAfter string `json:"pwdAfter"`
ShellEnv string `json:"shellEnv"` ShellEnv string `json:"shellEnv"`

@ -112,7 +112,7 @@ __resh_preexec() {
__RESH_LC_ALL="$LC_ALL" __RESH_LC_ALL="$LC_ALL"
# other LC ? # other LC ?
__RESH_LINES="$LINES" __RESH_LINES="$LINES"
__RESH_PATH="$PATH" # __RESH_PATH="$PATH"
__RESH_PWD="$PWD" __RESH_PWD="$PWD"
# non-posix # non-posix
@ -165,7 +165,6 @@ __resh_precmd() {
-lcAll "$__RESH_LC_ALL" \ -lcAll "$__RESH_LC_ALL" \
-lines "$__RESH_LINES" \ -lines "$__RESH_LINES" \
-login "$__RESH_LOGIN" \ -login "$__RESH_LOGIN" \
-path "$__RESH_PATH" \
-pwd "$__RESH_PWD" \ -pwd "$__RESH_PWD" \
-pwdAfter "$__RESH_PWD_AFTER" \ -pwdAfter "$__RESH_PWD_AFTER" \
-shellEnv "$__RESH_SHELL_ENV" \ -shellEnv "$__RESH_SHELL_ENV" \
@ -193,6 +192,7 @@ __resh_precmd() {
-osReleaseName "$__RESH_OS_RELEASE_NAME" \ -osReleaseName "$__RESH_OS_RELEASE_NAME" \
-osReleasePrettyName "$__RESH_OS_RELEASE_PRETTY_NAME" \ -osReleasePrettyName "$__RESH_OS_RELEASE_PRETTY_NAME" \
&>~/.resh/client_last_run_out.txt || echo "resh ERROR: $(head -n 1 ~/.resh/client_last_run_out.txt)" &>~/.resh/client_last_run_out.txt || echo "resh ERROR: $(head -n 1 ~/.resh/client_last_run_out.txt)"
# -path "$__RESH_PATH" \
fi fi
unset __RESH_COLLECT unset __RESH_COLLECT
} }

@ -1 +1 @@
1.0.0 1.1.0

Loading…
Cancel
Save