mirror of https://github.com/cowrie/cowrie.git
give correct error when starting with && || or ;
This commit is contained in:
parent
8916d728b8
commit
d1402b9298
|
@ -161,22 +161,22 @@ class HoneyPotShell(object):
|
||||||
try:
|
try:
|
||||||
tok = self.lexer.get_token()
|
tok = self.lexer.get_token()
|
||||||
#log.msg( "tok: %s" % (repr(tok)) )
|
#log.msg( "tok: %s" % (repr(tok)) )
|
||||||
# for now, execute all after &&
|
|
||||||
if tok == self.lexer.eof:
|
if tok == self.lexer.eof:
|
||||||
if len(tokens):
|
if len(tokens):
|
||||||
self.cmdpending.append((tokens))
|
self.cmdpending.append((tokens))
|
||||||
tokens = []
|
tokens = []
|
||||||
break
|
break
|
||||||
if tok == ';' or tok == '&&' or tok == '||':
|
# For now, execute all after &&
|
||||||
|
elif tok == ';' or tok == '&&' or tok == '||':
|
||||||
|
if len(tokens):
|
||||||
self.cmdpending.append((tokens))
|
self.cmdpending.append((tokens))
|
||||||
tokens = []
|
tokens = []
|
||||||
if tok == ';':
|
|
||||||
continue
|
continue
|
||||||
if tok == '&&':
|
else:
|
||||||
continue
|
self.protocol.terminal.write(
|
||||||
if tok == '||':
|
'-bash: syntax error near unexpected token `{}\'\n'.format(tok))
|
||||||
continue
|
break
|
||||||
if tok == '$?':
|
elif tok == '$?':
|
||||||
tok = "0"
|
tok = "0"
|
||||||
elif tok[0] == '$':
|
elif tok[0] == '$':
|
||||||
env_rex = re.compile('^\$([_a-zA-Z0-9]+)$')
|
env_rex = re.compile('^\$([_a-zA-Z0-9]+)$')
|
||||||
|
|
Loading…
Reference in New Issue