mirror of
https://github.com/cowrie/cowrie.git
synced 2025-07-01 18:07:27 -04:00
this remedies an issue when twistd is run with -n flag.
it will no longer read from stdin in that case
This commit is contained in:
@ -136,8 +136,7 @@ class HoneyPotShell(object):
|
||||
"""
|
||||
"""
|
||||
log.msg('CMD: %s' % (line,))
|
||||
self.lexer = shlex.shlex(punctuation_chars=True);
|
||||
self.lexer.push_source(line)
|
||||
self.lexer = shlex.shlex(instream=line, punctuation_chars=True);
|
||||
tokens = []
|
||||
while True:
|
||||
try:
|
||||
|
||||
@ -23,8 +23,7 @@ class shlex:
|
||||
def __init__(self, instream=None, infile=None, posix=False,
|
||||
punctuation_chars=False):
|
||||
if isinstance(instream, str):
|
||||
instream = StringIO(instream)
|
||||
#instream = BytesIO(instream)
|
||||
instream = BytesIO(instream)
|
||||
if instream is not None:
|
||||
self.instream = instream
|
||||
self.infile = infile
|
||||
@ -83,7 +82,6 @@ class shlex:
|
||||
def push_source(self, newstream, newfile=None):
|
||||
"Push an input source onto the lexer's input source stack."
|
||||
if isinstance(newstream, str):
|
||||
#newstream = StringIO(newstream)
|
||||
newstream = BytesIO(newstream)
|
||||
self.filestack.appendleft((self.infile, self.instream, self.lineno))
|
||||
self.infile = newfile
|
||||
|
||||
Reference in New Issue
Block a user