Skip to content

Commit cb8cf6c

Browse files
authored
Create shodan_automation.py
1 parent 462459f commit cb8cf6c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

shodan_automation.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import requests
2+
from bs4 import BeautifulSoup
3+
import time
4+
url = "https://www.shodan.io/search?query=webcamxp"
5+
6+
response = requests.get(url)
7+
8+
if response.status_code == 200:
9+
soup = BeautifulSoup(response.text, 'html.parser')
10+
11+
results = soup.find_all('div', class_='two columns result-details')
12+
13+
for result in results:
14+
hostnames = result.find_all('li', class_='hostnames text-secondary')
15+
16+
for hostname in hostnames:
17+
print(f"Host/IP: {hostname.get_text(strip=True)}")
18+
19+
search_links = result.find_all('a', href=True)
20+
21+
for link in search_links:
22+
link_url = f"https://www.shodan.io{link['href']}"
23+
print(f"Search Link: {link_url}")
24+
25+
print("-" * 50)
26+
27+
time.sleep(10)
28+
29+
else:
30+
print(f"Error: {response.status_code}")

0 commit comments

Comments
 (0)