File tree 1 file changed +17
-2
lines changed 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
23
23
"os"
24
24
"os/signal"
25
25
"path/filepath"
26
+ "regexp"
26
27
"strings"
27
28
28
29
"sort"
@@ -44,6 +45,10 @@ import (
44
45
"github.com/robertkrimen/otto"
45
46
)
46
47
48
+ var passwordRegexp = regexp .MustCompile ("personal.[nu]" )
49
+
50
+ const passwordRepl = ""
51
+
47
52
type prompter interface {
48
53
AppendHistory (string )
49
54
Prompt (p string ) (string , error )
@@ -413,15 +418,25 @@ func (self *jsre) interactive() {
413
418
str += input + "\n "
414
419
self .setIndent ()
415
420
if indentCount <= 0 {
416
- hist := str [:len (str )- 1 ]
417
- self .AppendHistory (hist )
421
+ hist := hidepassword (str [:len (str )- 1 ])
422
+ if len (hist ) > 0 {
423
+ self .AppendHistory (hist )
424
+ }
418
425
self .parseInput (str )
419
426
str = ""
420
427
}
421
428
}
422
429
}
423
430
}
424
431
432
+ func hidepassword (input string ) string {
433
+ if passwordRegexp .MatchString (input ) {
434
+ return passwordRepl
435
+ } else {
436
+ return input
437
+ }
438
+ }
439
+
425
440
func (self * jsre ) withHistory (op func (* os.File )) {
426
441
datadir := common .DefaultDataDir ()
427
442
if self .ethereum != nil {
You can’t perform that action at this time.
0 commit comments