MCPcopy
hub / github.com/RUB-NDS/PRET / do_cd

Method do_cd

printer.py:358–366  ·  view source on GitHub ↗

Change remote working directory: cd

(self, arg)

Source from the content-addressed store, hash-verified

356
357 # ------------------------[ cd <path> ]-------------------------------
358 def do_cd(self, arg):
359 "Change remote working directory: cd <path>"
360 if not self.cpath(arg) or self.dir_exists(self.rpath(arg)):
361 if re.match("^[\." + c.SEP + "]+$", self.cpath(arg)):
362 output().raw("*** Congratulations, path traversal found ***")
363 output().chitchat("Consider setting 'traversal' instead of 'cd'.")
364 self.set_cwd(arg)
365 else:
366 print("Failed to change directory.")
367
368 # set current working directory
369 def set_cwd(self, cwd=""):

Callers

nothing calls this directly

Calls 7

cpathMethod · 0.95
rpathMethod · 0.95
set_cwdMethod · 0.95
outputClass · 0.90
rawMethod · 0.80
dir_existsMethod · 0.45
chitchatMethod · 0.45

Tested by

no test coverage detected