Aug-15-2022, 12:44 PM
(Aug-15-2022, 09:57 AM)Calli Wrote: Now the only problem I am facing is how to output the scan result in a text file like scan.txtYou can do it like this.
import requests with open('ip_lst1.txt') as fd,open('scan.txt', 'w') as fd_out: for ip in fd: try: ip = ip.strip() print(ip) response = requests.get(f"http://{ip}:9200/_cat/indices", timeout=2) print(response.text.strip()) fd_out.write(f'{ip}\n{response.text.strip()}\n') except Exception as error: #print(error) pass