MCPcopy
hub / github.com/Gallopsled/pwntools / is_dir

Method is_dir

pwnlib/filesystem/ssh.py:703–725  ·  view source on GitHub ↗

Returns True if the path exists and is a directory Example: >>> f = SSHPath('is_dir', ssh=ssh_conn) >>> f.is_dir() False >>> f.touch() >>> f.is_dir() False >>> f.unlink() >>> f.mkdir()

(self)

Source from the content-addressed store, hash-verified

701 return False
702
703 def is_dir(self):
704 """Returns True if the path exists and is a directory
705
706 Example:
707
708 >>> f = SSHPath('is_dir', ssh=ssh_conn)
709 >>> f.is_dir()
710 False
711 >>> f.touch()
712 >>> f.is_dir()
713 False
714 >>> f.unlink()
715 >>> f.mkdir()
716 >>> f.is_dir()
717 True
718 """
719 if not self.exists():
720 return False
721
722 if self.stat().st_mode & 0o040000:
723 return True
724
725 return False
726
727 def is_file(self):
728 """Returns True if the path exists and is a file

Callers 4

mkdirMethod · 0.95
rmdirMethod · 0.95
provider_local_databaseFunction · 0.80
query_local_databaseFunction · 0.80

Calls 2

existsMethod · 0.95
statMethod · 0.95

Tested by

no test coverage detected