ghantoos / lshell

lshell is a shell coded in Python, that lets you restrict a user's environment to limited sets of commands, choose to enable/disable any command over SSH (e.g. SCP, SFTP, rsync, etc.), log user's commands, implement timing restriction, and more.
GNU General Public License v3.0
435 stars 112 forks source link

AttributeError: 'ShellCmd' object has no attribute 'help_1' #152

Closed slonopotamus closed 8 years ago

slonopotamus commented 8 years ago

lshell version da6fbdee72e48ea066b72a3b6ae2da817359b88b

You are in a limited shell.
Type '?' or 'help' to get the list of allowed commands
irina:~$ help 
cd  clear  echo  exit  help  history  ll  lpath  ls  lsudo
irina:~$ help 1
/bin/sh: line 0: help: no help topics match `1'.  Try `help help' or `man -k 1' or `info 1'.
Traceback (most recent call last):
File "lshell/shellcmd.py", line 431, in do_help
    func = getattr(self, 'help_' + arg)
File "lshell/shellcmd.py", line 209, in __getattr__
    return object.__getattribute__(self, attr)
AttributeError: 'ShellCmd' object has no attribute 'help_1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./bin/lshell", line 52, in <module>
    main()
File "./bin/lshell", line 42, in main
    cli.cmdloop()
File "lshell/shellcmd.py", line 266, in cmdloop
    stop = self.onecmd(line)
File "lshell/shellcmd.py", line 412, in onecmd
    return func(arg)
File "lshell/shellcmd.py", line 434, in do_help
    doc = getattr(self, 'do_' + arg).__doc__
File "lshell/shellcmd.py", line 114, in __getattr__
    strict=self.conf['strict'])
File "lshell/sec.py", line 252, in check_secure
    if line[0] in ["&", "|", ";"]:
IndexError: string index out of range

After than, lshell exits.

ghantoos commented 8 years ago

Thanks @slonopotamus for reporting this bug. I am waiting for travis to do its job a merging a fix.

The help command was initially able to get internal commands help docstrings. This is no longer useful/used. So I have put a warning instead.