| 13 | self.match_service_name('^nacn_http$', negative_match=True) |
| 14 | |
| 15 | async def run(self, service): |
| 16 | if service.protocol == 'tcp': |
| 17 | process, stdout, _ = await service.execute('curl -sSikf {http_scheme}://{addressv6}:{port}/robots.txt', future_outfile='{protocol}_{port}_{http_scheme}_curl-robots.txt') |
| 18 | |
| 19 | lines = await stdout.readlines() |
| 20 | |
| 21 | if process.returncode == 0 and lines: |
| 22 | filename = fformat('{scandir}/{protocol}_{port}_{http_scheme}_curl-robots.txt') |
| 23 | with open(filename, mode='wt', encoding='utf8') as robots: |
| 24 | robots.write('\n'.join(lines)) |
| 25 | else: |
| 26 | service.info('{bblue}[' + fformat('{tag}') + ']{rst} There did not appear to be a robots.txt file in the webroot (/).') |