| 1 | from autorecon.plugins import ServiceScan |
| 2 | |
| 3 | class SMBMap(ServiceScan): |
| 4 | |
| 5 | def __init__(self): |
| 6 | super().__init__() |
| 7 | self.name = "SMBMap" |
| 8 | self.tags = ['default', 'safe', 'smb', 'active-directory'] |
| 9 | |
| 10 | def configure(self): |
| 11 | self.match_service_name(['^smb', '^microsoft\-ds', '^netbios']) |
| 12 | |
| 13 | async def run(self, service): |
| 14 | if service.target.ipversion == 'IPv4': |
| 15 | await service.execute('smbmap -H {address} -P {port} 2>&1', outfile='smbmap-share-permissions.txt') |
| 16 | await service.execute('smbmap -u null -p "" -H {address} -P {port} 2>&1', outfile='smbmap-share-permissions.txt') |
| 17 | await service.execute('smbmap -H {address} -P {port} -r 2>&1', outfile='smbmap-list-contents.txt') |
| 18 | await service.execute('smbmap -u null -p "" -H {address} -P {port} -r 2>&1', outfile='smbmap-list-contents.txt') |
| 19 | await service.execute('smbmap -H {address} -P {port} -x "ipconfig /all" 2>&1', outfile='smbmap-execute-command.txt') |
| 20 | await service.execute('smbmap -u null -p "" -H {address} -P {port} -x "ipconfig /all" 2>&1', outfile='smbmap-execute-command.txt') |
nothing calls this directly
no outgoing calls
no test coverage detected