/usr/lib/python/astrometry/util/shell.py is in astrometry.net 0.46-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | def shell_escape(s):
repl = ('\\', '|', '&', ';', '(', ')', '<', '>', ' ', '\t',
'\n', '$', "'", '"', "`")
# (note, \\ must be first!)
for x in repl:
s = s.replace(x, '\\'+x)
return s
# escape a string that will appear inside double-quotes.
def shell_escape_inside_quotes(s):
repl = ('\\', '\t', '`', '"', '$')
# (note, \\ must be first!)
for x in repl:
s = s.replace(x, '\\'+x)
return s
|