| 2 | from autorecon.io import fformat |
| 3 | |
| 4 | class WinRMDetection(ServiceScan): |
| 5 | |
| 6 | def __init__(self): |
| 7 | super().__init__() |
| 8 | self.name = 'WinRM Detection' |
| 9 | self.tags = ['default', 'safe', 'winrm'] |
| 10 | |
| 11 | def configure(self): |
| 12 | self.match_service_name('^wsman') |
| 13 | self.match_service('tcp', [5985, 5986], '^http') |
| 14 | |
| 15 | async def run(self, service): |
| 16 | filename = fformat('{scandir}/{protocol}_{port}_winrm-detection.txt') |
| 17 | with open(filename, mode='wt', encoding='utf8') as winrm: |
| 18 | winrm.write('WinRM was possibly detected running on ' + service.protocol + ' port ' + str(service.port) + '.\nCheck _manual_commands.txt for manual commands you can run against this service.') |
| 19 | |
| 20 | def manual(self, service, plugin_was_run): |
| 21 | service.add_manual_commands('Bruteforce logins:', [ |
| 22 | 'crackmapexec winrm {address} -d \'' + self.get_global('domain', default='<domain>') + '\' -u \'' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '\' -p \'' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '\'' |
| 23 | ]) |
| 24 | |
| 25 | service.add_manual_commands('Check login (requires credentials):', [ |
| 26 | 'crackmapexec winrm {address} -d \'' + self.get_global('domain', default='<domain>') + '\' -u \'<username>\' -p \'<password>\'' |
| 27 | ]) |
| 28 | |
| 29 | service.add_manual_commands('Evil WinRM (gem install evil-winrm):', [ |
| 30 | 'evil-winrm -u \'<user>\' -p \'<password>\' -i {address}', |
| 31 | 'evil-winrm -u \'<user>\' -H \'<hash>\' -i {address}' |
| 32 | ]) |
nothing calls this directly
no outgoing calls
no test coverage detected