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

Method which

pwnlib/tubes/ssh.py:1030–1047  ·  view source on GitHub ↗

which(program) -> str Minor modification to just directly invoking ``which`` on the remote system which adds the current working directory to the end of ``$PATH``.

(self, program)

Source from the content-addressed store, hash-verified

1028 return python
1029
1030 def which(self, program):
1031 """which(program) -> str
1032
1033 Minor modification to just directly invoking ``which`` on the remote
1034 system which adds the current working directory to the end of ``$PATH``.
1035 """
1036 # If name is a path, do not attempt to resolve it.
1037 if os.path.sep in program:
1038 return program
1039
1040 program = packing._encode(program)
1041
1042 result = self.system(b'export PATH=$PATH:$PWD; command -v ' + program).recvall().strip()
1043
1044 if (b'/' + program) not in result:
1045 return None
1046
1047 return packing._decode(result)
1048
1049 def system(self, process, tty = True, cwd = None, env = None, timeout = None, raw = True, wd = None):
1050 r"""system(process, tty = True, cwd = None, env = None, timeout = Timeout.default, raw = True) -> ssh_channel

Callers 10

getenvMethod · 0.95
binaryFunction · 0.80
attachFunction · 0.80
ssh_gdbFunction · 0.80
versionFunction · 0.80
user_pathFunction · 0.80
binaryFunction · 0.80
compileFunction · 0.80
getenvMethod · 0.80

Calls 2

systemMethod · 0.95
recvallMethod · 0.45

Tested by

no test coverage detected