MCPcopy Create free account
hub / github.com/Geeoon/asploit / _Base__cat

Method _Base__cat

src/NodeExploitProcessor.py:157–173  ·  view source on GitHub ↗
(self, options: str)

Source from the content-addressed store, hash-verified

155 @brief See base class for details.
156 """
157 def _Base__cat(self, options: str):
158 if len(options) == 0:
159 raise CommandException("Specify a file to print.")
160 out = self.__eval(f"let out='Error opening file.';"
161 f"if(!fs.existsSync('{options}')){{"
162 f"out='File does not exist.';"
163 f"}}else{{"
164 f"try {{"
165 f"out=fs.readFileSync('{options}', 'utf-8');"
166 f"}} catch (e) {{"
167 f"out='Error opening file.';"
168 f"}}"
169 f"}}"
170 f"r.setHeader('{self.header}',"
171 f"Buffer.from(out).toString('base64'));"
172 f"r.end();")
173 print(base64.b64decode(out).decode())
174
175 """
176 @brief See base class for details.

Callers

nothing calls this directly

Calls 2

__evalMethod · 0.95
CommandExceptionClass · 0.85

Tested by

no test coverage detected