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,))
|
log.msg('CMD: %s' % (line,))
|
||||||
self.lexer = shlex.shlex(punctuation_chars=True);
|
self.lexer = shlex.shlex(instream=line, punctuation_chars=True);
|
||||||
self.lexer.push_source(line)
|
|
||||||
tokens = []
|
tokens = []
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -23,8 +23,7 @@ class shlex:
|
|||||||
def __init__(self, instream=None, infile=None, posix=False,
|
def __init__(self, instream=None, infile=None, posix=False,
|
||||||
punctuation_chars=False):
|
punctuation_chars=False):
|
||||||
if isinstance(instream, str):
|
if isinstance(instream, str):
|
||||||
instream = StringIO(instream)
|
instream = BytesIO(instream)
|
||||||
#instream = BytesIO(instream)
|
|
||||||
if instream is not None:
|
if instream is not None:
|
||||||
self.instream = instream
|
self.instream = instream
|
||||||
self.infile = infile
|
self.infile = infile
|
||||||
@ -83,7 +82,6 @@ class shlex:
|
|||||||
def push_source(self, newstream, newfile=None):
|
def push_source(self, newstream, newfile=None):
|
||||||
"Push an input source onto the lexer's input source stack."
|
"Push an input source onto the lexer's input source stack."
|
||||||
if isinstance(newstream, str):
|
if isinstance(newstream, str):
|
||||||
#newstream = StringIO(newstream)
|
|
||||||
newstream = BytesIO(newstream)
|
newstream = BytesIO(newstream)
|
||||||
self.filestack.appendleft((self.infile, self.instream, self.lineno))
|
self.filestack.appendleft((self.infile, self.instream, self.lineno))
|
||||||
self.infile = newfile
|
self.infile = newfile
|
||||||
|
|||||||
Reference in New Issue
Block a user