start the exploit, there is still no rollover but it's being worked
(self, sep="*" * 10)
| 72 | return self.sorted_modules |
| 73 | |
| 74 | def start_exploit(self, sep="*" * 10): |
| 75 | """ |
| 76 | start the exploit, there is still no rollover but it's being worked |
| 77 | """ |
| 78 | if self.dry_run: |
| 79 | lib.settings.close("dry run was initiated, exploitation will not be done") |
| 80 | |
| 81 | today_printable = datetime.datetime.today().strftime("%Y-%m-%d_%Hh%Mm%Ss") |
| 82 | current_run_path = path.join(lib.settings.RC_SCRIPTS_PATH, today_printable) |
| 83 | try: |
| 84 | makedirs(current_run_path) |
| 85 | except OSError: |
| 86 | current_run_path = path.join(lib.settings.RC_SCRIPTS_PATH, today_printable + "(1)") |
| 87 | makedirs(current_run_path) |
| 88 | |
| 89 | report_path = path.join(current_run_path, "report.csv") |
| 90 | with open(report_path, 'w') as f: |
| 91 | csv_file = csv.writer(f, quoting=csv.QUOTE_ALL) |
| 92 | csv_file.writerow( |
| 93 | [ |
| 94 | 'Target Host', 'Date (UTC)', 'MSF Module', |
| 95 | "LocalHost", "Listening Port", "Successful Logs", |
| 96 | "Failure Logs", "All Logs" |
| 97 | ] |
| 98 | ) |
| 99 | |
| 100 | lib.output.info("Launching exploits against {hosts_len} hosts:".format(hosts_len=len(self.hosts))) |
| 101 | |
| 102 | win_total = 0 |
| 103 | fail_total = 0 |
| 104 | skip_amount = 0 |
| 105 | lib.settings.MSF_LAUNCHED = True |
| 106 | |
| 107 | for host in self.hosts: |
| 108 | host = host.strip() |
| 109 | if self.check_honey: |
| 110 | lib.output.misc_info("checking if {} is a honeypot".format(host)) |
| 111 | honey_score = api_calls.honeyscore_hook.HoneyHook(host, self.shodan_token).make_request() |
| 112 | if honey_score < self.compare_honey: |
| 113 | lib.output.warning( |
| 114 | "honeypot score ({}) is above (or equal to) requested, skipping target".format(honey_score) |
| 115 | ) |
| 116 | skip = True |
| 117 | skip_amount += 1 |
| 118 | else: |
| 119 | lib.output.misc_info("{} does not appear to be a honeypot, continuing attack".format(host)) |
| 120 | skip = False |
| 121 | else: |
| 122 | skip = False |
| 123 | |
| 124 | if not skip: |
| 125 | current_host_path = path.join(current_run_path, host.strip()) |
| 126 | try: |
| 127 | makedirs(current_host_path) |
| 128 | except OSError: |
| 129 | pass |
| 130 | |
| 131 | for mod in self.mods: |
no test coverage detected