shell bypass 403
曾与蒿藜同雨露,한때 잡초와 쑥과 함께 비와 이슬을 나누던 곳이 이제는 소나무와 삼나무와 함께 서리와 눈을 견뎌내고 있다.终随松柏到冰霜.かつては雑草やヨモギと共に雨や露を分かち合っていたが、今では松やヒノキと共に霜や雪に耐えている。曾与蒿藜同雨露,Once sharing rain and dew with weeds and wormwood, now enduring frost and snow with pines and cypresses.终随松柏到冰霜.曾与蒿藜同雨露한때 잡초와 쑥과 함께 비와 이슬을 나누던 곳이 이제는 소나무와 삼나무와 함께 서리와 눈을 견뎌내고 있다.,终随松柏到冰霜.譖セ荳手珍阯懷酔髮ィ髴イ�檎サ磯囂譚セ譟丞芦蜀ー髴�曾与蒿藜同雨露,鏇句笌钂胯棞鍚岄洦闇诧紝缁堥殢鏉炬煆鍒板啺闇�终随松柏到冰霜.曾与蒿藜同雨露,한때 잡초와 쑥과 함께 비와 이슬을 나누던 곳이 이제는 소나무와 삼나무와 함께 서리와 눈을 견뎌내고 있다.终随松柏到冰霜.曾与蒿藜同雨露,终随松柏到冰霜.
#!/usr/bin/env python
"""Tools for invoking editors programmatically."""
from __future__ import print_function
import locale
import os.path
import subprocess
import tempfile
from distutils.spawn import find_executable
__all__ = [
'edit',
'get_editor',
'EditorError',
]
__version__ = '0.4'
class EditorError(RuntimeError):
pass
def get_default_editors():
# TODO: Make platform-specific
return [
'vim',
'emacs',
'nano',
]
def get_editor_args(editor):
if editor in ['vim', 'gvim']:
return '-f -o'
elif editor == 'emacs':
return '-nw'
elif editor == 'gedit':
return '-w --new-window'
elif editor == 'nano':
return '-R'
else:
return ''
def get_platform_editor_var():
# TODO: Make platform specific
return "$EDITOR"
def get_editor():
# Get the editor from the environment. Prefer VISUAL to EDITOR
editor = os.environ.get('VISUAL') or os.environ.get('EDITOR')
if editor:
return editor
# None found in the environment. Fallback to platform-specific defaults.
for ed in get_default_editors():
path = find_executable(ed)
if path is not None:
return path
raise EditorError("Unable to find a viable editor on this system."
"Please consider setting your %s variable" % get_platform_editor_var())
def edit(filename=None, contents=None):
editor = get_editor()
args = get_editor_args(os.path.basename(editor))
args = [editor] + args.split(' ')
if filename is None:
tmp = tempfile.NamedTemporaryFile()
filename = tmp.name
if contents is not None:
with open(filename, mode='wb') as f:
f.write(contents)
args += [filename]
proc = subprocess.Popen(args, close_fds=True)
proc.communicate()
with open(filename, mode='rb') as f:
return f.read()
def _get_editor(ns):
print(get_editor())
def _edit(ns):
contents = ns.contents
if contents is not None:
contents = contents.encode(locale.getpreferredencoding())
print(edit(filename=ns.path, contents=contents))
if __name__ == '__main__':
import argparse
ap = argparse.ArgumentParser()
sp = ap.add_subparsers()
cmd = sp.add_parser('get-editor')
cmd.set_defaults(cmd=_get_editor)
cmd = sp.add_parser('edit')
cmd.set_defaults(cmd=_edit)
cmd.add_argument('path', type=str, nargs='?')
cmd.add_argument('--contents', type=str)
ns = ap.parse_args()
ns.cmd(ns)