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

Method is_file

pwnlib/filesystem/ssh.py:727–749  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

725 return False
726
727 def is_file(self):
728 """Returns True if the path exists and is a file
729
730 Example:
731
732 >>> f = SSHPath('is_file', ssh=ssh_conn)
733 >>> f.is_file()
734 False
735 >>> f.touch()
736 >>> f.is_file()
737 True
738 >>> f.unlink()
739 >>> f.mkdir()
740 >>> f.is_file()
741 False
742 """
743 if not self.exists():
744 return False
745
746 if self.stat().st_mode & 0o040000:
747 return False
748
749 return True
750
751 def is_symlink(self):
752 raise NotImplementedError()

Callers 2

unlinkMethod · 0.95
generate_darwin.pyFile · 0.80

Calls 2

existsMethod · 0.95
statMethod · 0.95

Tested by

no test coverage detected