request the creation and create the issue
(path, arguments, error_message)
| 190 | |
| 191 | |
| 192 | def request_issue_creation(path, arguments, error_message): |
| 193 | """ |
| 194 | request the creation and create the issue |
| 195 | """ |
| 196 | |
| 197 | # TODO:/ we're gonna go ahead and give you guys another chance |
| 198 | #if not checksum(path): |
| 199 | # lib.output.error( |
| 200 | # "It seems you have changed some of the code in the program. We do not accept issues from edited " |
| 201 | # "code as we have no way of reliably testing your issue. We recommend that you only use the version " |
| 202 | # "that is available on github, no issue will be created for this problem." |
| 203 | # ) |
| 204 | # exit(1) |
| 205 | |
| 206 | question = raw_input( |
| 207 | "do you want to create an anonymized issue?[y/N]: " |
| 208 | ) |
| 209 | if question.lower().startswith("y"): |
| 210 | if check_version_number(lib.banner.VERSION): |
| 211 | # gonna read a chunk of it instead of one line |
| 212 | chunk = 4096 |
| 213 | with open(path) as data: |
| 214 | identifier = create_identifier(error_message) |
| 215 | # gotta seek to the beginning of the file since it's already been read `4096` into it |
| 216 | data.seek(0) |
| 217 | issue_title = "Unhandled Exception ({})".format(identifier) |
| 218 | |
| 219 | issue_data = { |
| 220 | "title": issue_title, |
| 221 | "body": ( |
| 222 | "Autosploit version: `{}`\n" |
| 223 | "OS information: `{}`\n" |
| 224 | "Running context: `{}`\n" |
| 225 | "Error mesage: `{}`\n" |
| 226 | "Error traceback:\n```\n{}\n```\n" |
| 227 | "Metasploit launched: `{}`\n".format( |
| 228 | lib.banner.VERSION, |
| 229 | platform.platform(), |
| 230 | ' '.join(sys.argv), |
| 231 | error_message, |
| 232 | open(path).read(), |
| 233 | lib.settings.MSF_LAUNCHED, |
| 234 | ) |
| 235 | ) |
| 236 | } |
| 237 | |
| 238 | _json_data = json.dumps(issue_data) |
| 239 | if sys.version_info > (3,): # python 3 |
| 240 | _json_data = _json_data.encode("utf-8") |
| 241 | |
| 242 | if not ensure_no_issue(identifier): |
| 243 | req = Request( |
| 244 | url="https://api.github.com/repos/nullarray/autosploit/issues", data=_json_data, |
| 245 | headers={"Authorization": "token {}".format(get_token(lib.settings.TOKEN_PATH))} |
| 246 | ) |
| 247 | urlopen(req, timeout=10).read() |
| 248 | lib.output.info( |
| 249 | "issue has been generated with the title '{}', at the following " |
nothing calls this directly
no test coverage detected