Skip to content

Commit

Permalink
refactor(plugin): use golang.org/x/crypto/ssh/terminal package to rea…
Browse files Browse the repository at this point in the history
…d user password, instead of github.com/howeyc/gopass.
  • Loading branch information
genshen committed Jun 16, 2019
1 parent 08ee347 commit 95bde04
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ require (
github.com/genshen/cmds v0.0.0-20190410131841-986519260a65
github.com/genshen/wssocks v0.2.1
github.com/gorilla/websocket v1.4.0
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c
github.com/sirupsen/logrus v1.4.2
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ github.com/genshen/wssocks v0.2.1 h1:t9mxkZkor+Ov+tDPmtDZErqZck8PfovR2VP4YVcu2a0
github.com/genshen/wssocks v0.2.1/go.mod h1:orUdoo8chhH0NNlnvs6eZ7RT0r+qnd3dht3vpN02vYQ=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0=
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
Expand Down
4 changes: 2 additions & 2 deletions vpn_plugin/vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/genshen/cmds"
"github.com/genshen/wssocks/client"
"github.com/gorilla/websocket"
"github.com/howeyc/gopass"
log "github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh/terminal"
"net"
"net/http"
"net/http/cookiejar"
Expand Down Expand Up @@ -60,7 +60,7 @@ func (v *UstbVpn) BeforeRequest(dialer *websocket.Dialer, url *url.URL, header h
}
if v.password == "" {
fmt.Print("Enter Password: ")
if bytePassword, err := gopass.GetPasswd(); err != nil { // error
if bytePassword, err := terminal.ReadPassword(int(os.Stdin.Fd())); err != nil { // error
return errors.New("Whoops! Error while parsing password:" + err.Error())
} else {
v.password = string(bytePassword)
Expand Down

0 comments on commit 95bde04

Please sign in to comment.