Explanation: ------------ Exploit the already gathered hosts inside of the hosts.txt file Parameters: ----------- :param workspace_info: a tuple of workspace information Command Format: -------------- exploit[/run/attack] IP
(self, workspace_info, shodan_token=None)
| 360 | lib.output.info("exiting terminal session") |
| 361 | |
| 362 | def do_exploit_targets(self, workspace_info, shodan_token=None): |
| 363 | """ |
| 364 | Explanation: |
| 365 | ------------ |
| 366 | Exploit the already gathered hosts inside of the hosts.txt file |
| 367 | |
| 368 | Parameters: |
| 369 | ----------- |
| 370 | :param workspace_info: a tuple of workspace information |
| 371 | |
| 372 | Command Format: |
| 373 | -------------- |
| 374 | exploit[/run/attack] IP PORT WORKSPACE_NAME [whitewash list] |
| 375 | |
| 376 | Examples: |
| 377 | --------- |
| 378 | exploit 127.0.0.1 9065 default whitelist.txt |
| 379 | """ |
| 380 | if workspace_info[3] is not None and workspace_info[3] != "honeycheck": |
| 381 | lib.output.misc_info("doing whitewash on hosts file") |
| 382 | lib.exploitation.exploiter.whitelist_wash( |
| 383 | open(lib.settings.HOST_FILE).readlines(), |
| 384 | workspace_info[3] |
| 385 | ) |
| 386 | else: |
| 387 | if not lib.settings.check_for_msf(): |
| 388 | msf_path = lib.output.prompt( |
| 389 | "metasploit is not in your PATH, provide the full path to it", lowercase=False |
| 390 | ) |
| 391 | ruby_exec = True |
| 392 | else: |
| 393 | msf_path = None |
| 394 | ruby_exec = False |
| 395 | |
| 396 | sort_mods = lib.output.prompt( |
| 397 | "sort modules by relevance to last query[y/N]", lowercase=True |
| 398 | ) |
| 399 | |
| 400 | try: |
| 401 | if sort_mods.lower().startswith("y"): |
| 402 | mods_to_use = lib.exploitation.exploiter.AutoSploitExploiter( |
| 403 | None, None |
| 404 | ).sort_modules_by_query() |
| 405 | else: |
| 406 | mods_to_use = self.modules |
| 407 | except Exception: |
| 408 | lib.output.error("error sorting modules defaulting to all") |
| 409 | mods_to_use = self.modules |
| 410 | |
| 411 | view_modules = lib.output.prompt("view sorted modules[y/N]", lowercase=True) |
| 412 | if view_modules.startswith("y"): |
| 413 | for mod in mods_to_use: |
| 414 | lib.output.misc_info(mod.strip()) |
| 415 | lib.output.prompt("press enter to start exploitation phase") |
| 416 | lib.output.info("starting exploitation phase") |
| 417 | lib.exploitation.exploiter.AutoSploitExploiter( |
| 418 | configuration=workspace_info[0:3], |
| 419 | all_modules=mods_to_use, |
no test coverage detected