Permalink
Browse files

[code] cleaned up spelling mistakes

  • Loading branch information...
Ignace Mouzannar
Ignace Mouzannar committed Feb 21, 2016
1 parent 74efe8a commit 4314ea57d89462bc255827fb5074c9ffd4193fa8
Showing with 77 additions and 23 deletions.
  1. +1 −1 lshell/builtins.py
  2. +9 −9 lshell/checkconfig.py
  3. +12 −12 lshell/shellcmd.py
  4. +1 −1 lshell/utils.py
  5. +54 −0 test/words
View
@@ -88,7 +88,7 @@ def export(args):
# if command contains at least 1 space
if args.count(' '):
env = args.split(" ", 1)[1]
- # if it conatins the equal sign, consider only the first one
+ # if it contains the equal sign, consider only the first one
if env.count('='):
var, value = env.split(' ')[0].split('=')[0:2]
# disallow dangerous variable
View
@@ -78,7 +78,7 @@ def getoptions(self, arguments, conf):
""" This method checks the usage. lshell.py must be called with a
configuration file.
If no configuration file is specified, it will set the configuration
- file path to /etc/lshell.confelf.conf['allowed'].append('exit')
+ file path to /etc/lshell.conf
"""
# set configfile as default configuration file
conf['configfile'] = variables.configfile
@@ -127,8 +127,8 @@ def check_env(self):
os.environ[key] = str(env_vars[key])
def check_file(self, file):
- """ This method checks the existence of the "argumently" given
- configuration file.
+ """ This method checks the existence of the given configuration
+ file passed via command line arguments
"""
if not os.path.exists(file):
self.stderr.write("Error: Config file doesn't exist\n")
@@ -259,8 +259,8 @@ def check_log(self):
self.log = logger
def get_config(self):
- """ Load default, group and user configuation. Then merge them all.
- The loadpriority is done in the following order:
+ """ Load default, group and user configuration. Then merge them all.
+ The load priority is done in the following order:
1- User section
2- Group section
3- Default section
@@ -387,7 +387,7 @@ def minusplus(self, confdict, key, extra):
def expand_all(self):
""" expand allowed, if set to 'all'
"""
- # initialize list to common shell builtins
+ # initialize list to common shell built-ins
expanded_all = ['bg', 'break', 'case', 'cd', 'continue', 'eval',
'exec', 'exit', 'fg', 'if', 'jobs', 'kill', 'login',
'logout', 'set', 'shift', 'stop', 'suspend', 'umask',
@@ -404,7 +404,7 @@ def expand_all(self):
return str(expanded_all)
def myeval(self, value, info=''):
- """ if eval returns SyntaxError, log it as critical iconf missing """
+ """ if eval returns SyntaxError, log it as critical conf missing """
try:
evaluated = eval(value)
return evaluated
@@ -635,7 +635,7 @@ def check_scp_sftp(self):
self.log.error('*** forbidden SFTP connection')
sys.exit(0)
- # initialise cli session
+ # initialize cli session
from lshell.shellcmd import ShellCmd
cli = ShellCmd(self.conf,
None, None, None, None,
@@ -777,7 +777,7 @@ def set_noexec(self):
cmd)
else:
# if sudo_noexec.so file is not found, write error in log file,
- # but don't exit tp prevent strict dependincy on sudo noexec lib
+ # but don't exit tp prevent strict dependency on sudo noexec lib
self.log.error("Error: noexec library not found")
self.conf['allowed'] += self.conf['allowed_shell_escape']
View
@@ -79,7 +79,7 @@ def __init__(self, userconf, args, stdin=None, stdout=None, stderr=None,
def __getattr__(self, attr):
""" This method actually takes care of all the called method that are
not resolved (i.e not existing methods). It actually will simulate
- the existance of any method entered in the 'allowed' variable list.
+ the existence of any method entered in the 'allowed' variable list.
e.g. You just have to add 'uname' in list of allowed commands in
the 'allowed' variable, and lshell will react as if you had
@@ -129,7 +129,7 @@ def __getattr__(self, attr):
self.g_arg)
# replace previous command exit code
# in case multiple commands (using separators), only replace first
- # command. Regex replaces all occureces of $?, before ;,&,|
+ # command. Regex replaces all occurrences of $?, before ;,&,|
if re.search('[;&\|]', self.g_line):
p = re.compile("(\s|^)(\$\?)([\s|$]?[;&|].*)")
else:
@@ -164,16 +164,16 @@ def __getattr__(self, attr):
self.retcode, self.conf = builtins.cd(directory,
self.conf)
- # builtin lpath function: list all allowed path
+ # built-in lpath function: list all allowed path
elif self.g_cmd == 'lpath':
self.retcode = builtins.lpath(self.conf)
- # builtin lsudo function: list all allowed sudo commands
+ # built-in lsudo function: list all allowed sudo commands
elif self.g_cmd == 'lsudo':
self.retcode = builtins.lsudo(self.conf)
- # builtin history function: print command history
+ # built-in history function: print command history
elif self.g_cmd == 'history':
self.retcode = builtins.history(self.conf, self.log)
- # builtin export function
+ # built-in export function
elif self.g_cmd == 'export':
self.retcode, var = builtins.export(self.g_line)
if self.retcode == 1:
@@ -204,8 +204,8 @@ def check_secure(self, line, strict=None, ssh=None):
The forbidden characters are placed in the 'forbidden' variable.
Feel free to update the list. Emptying it would be quite useless..: )
- A warining counter has been added, to kick out of lshell a user if he
- is warned more than X time (X beeing the 'warning_counter' variable).
+ A warning counter has been added, to kick out of lshell a user if he
+ is warned more than X time (X being the 'warning_counter' variable).
"""
# store original string
@@ -352,13 +352,13 @@ def check_path(self, line, completion=None, ssh=None, strict=None):
line = sep.split(line)
for item in line:
- # remove potential quotes or backticks
+ # remove potential quotes or back-ticks
item = re.sub(r'^["\'`]|["\'`]$', '', item)
# remove potential $(), ${}, ``
item = re.sub(r'^\$[\(\{]|[\)\}]$', '', item)
- # if item has been converted to somthing other than a string
+ # if item has been converted to something other than a string
# or an int, reconvert it to a string
if type(item) not in ['str', 'int']:
item = str(item)
@@ -588,7 +588,7 @@ def completechdir(self, text, line, begidx, endidx):
return None
def onecmd(self, line):
- """ This method overrides the original onecomd method, to put the cmd,
+ """ This method overrides the original onecmd method, to put the cmd,
arg and line variables in class global variables: self.g_cmd,
self.g_arg and self.g_line.
Thos variables are then used by the __getattr__ method
@@ -651,7 +651,7 @@ def help_help(self):
def mytimer(self, timeout):
""" This function is kicks you out the the lshell after
- the 'timer' variable exprires. 'timer' is set in seconds.
+ the 'timer' variable expires. 'timer' is set in seconds.
"""
# set timer
signal.signal(signal.SIGALRM, self._timererror)
View
@@ -61,7 +61,7 @@ def get_aliases(line, aliases):
reg1 = '(^|;|&&|\|\||\|)\s*%s([ ;&\|]+|$)(.*)' % escaped_item
reg2 = '(^|;|&&|\|\||\|)\s*%s([ ;&\|]+|$)' % escaped_item
- # in case aliase bigin with the same command
+ # in case alias begins with the same command
# (this is until i find a proper regex solution..)
aliaskey = random_string(10)
View
@@ -0,0 +1,54 @@
+lshell
+ghantoos
+org
+http
+www
+configfile
+logpath
+usr
+dss
+dict
+stderr
+logfilename
+commandline
+config
+loglevel
+scp
+dir
+sudo
+env
+lsudo
+winscp
+sftp
+cli
+overssh
+tp
+noexec
+py
+conf
+eval
+bsd
+cd
+oldpwd
+regex
+promptbase
+html
+exitcodes
+cd's
+cmd
+lpath
+toto
+tmp
+foo
+fot
+uname
+blabla
+completenames
+arg
+emptyline
+prepending
+wildcard
+wildcards
+tldp
+onecmd
+ldp

0 comments on commit 4314ea5

Please sign in to comment.