aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/js.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-06 00:08:52 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-06 00:08:52 +0800
commit80e5f507130a926ea62dde07c2b98d6f8a0ba3e2 (patch)
tree750fe404c14b6f5e8ef03a07cf3357787c6c9683 /cmd/geth/js.go
parent98f4c936f25de27dbc90f36f2c1ffd1f23b114e9 (diff)
parent26f838796b8793f38268f3a8911ec2b71913153c (diff)
downloadgo-tangerine-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar
go-tangerine-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.gz
go-tangerine-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.bz2
go-tangerine-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.lz
go-tangerine-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.xz
go-tangerine-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.tar.zst
go-tangerine-80e5f507130a926ea62dde07c2b98d6f8a0ba3e2.zip
Merge branch 'develop'
Diffstat (limited to 'cmd/geth/js.go')
-rw-r--r--cmd/geth/js.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index cc4c14c2e..bf56423ec 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -8,11 +8,11 @@
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
@@ -23,6 +23,7 @@ import (
"os"
"os/signal"
"path/filepath"
+ "regexp"
"strings"
"sort"
@@ -44,6 +45,10 @@ import (
"github.com/robertkrimen/otto"
)
+var passwordRegexp = regexp.MustCompile("personal.[nu]")
+
+const passwordRepl = ""
+
type prompter interface {
AppendHistory(string)
Prompt(p string) (string, error)
@@ -413,8 +418,10 @@ func (self *jsre) interactive() {
str += input + "\n"
self.setIndent()
if indentCount <= 0 {
- hist := str[:len(str)-1]
- self.AppendHistory(hist)
+ hist := hidepassword(str[:len(str)-1])
+ if len(hist) > 0 {
+ self.AppendHistory(hist)
+ }
self.parseInput(str)
str = ""
}
@@ -422,6 +429,14 @@ func (self *jsre) interactive() {
}
}
+func hidepassword(input string) string {
+ if passwordRegexp.MatchString(input) {
+ return passwordRepl
+ } else {
+ return input
+ }
+}
+
func (self *jsre) withHistory(op func(*os.File)) {
datadir := common.DefaultDataDir()
if self.ethereum != nil {