A package for scanning subdomains and collecting website information.
Project description
Subweb Package
The Subweb package is a Python library designed for scanning and retrieving information about subdomains for a given domain. It provides functionalities to find subdomains, retrieve their status codes, titles, and more.
Installation
To install the Subweb package, use pip:
pip install subweb
Usage
Scanning Subdomains
You can scan subdomains by creating a script that uses the subdomain_scan
function from the subweb
package. Below are several examples of how to use this package.
Example: Find Subdomains
from subweb import subdomain_scan
def display_found_subdomains(domain, subdomains):
found_info = subdomain_scan(domain, subdomains)
return [info['url'] for info in found_info]
if __name__ == "__main__":
target_domain = "example.com" # Replace with your target domain
subdomains = ["www", "api", "blog", "test"] # Replace with your subdomain list
found_subdomains = display_found_subdomains(target_domain, subdomains)
for sub in found_subdomains:
print(f"Found subdomain: {sub}")
Example: Subdomains with Status Codes
from subweb import subdomain_scan
def display_status_codes_with_found(domain, subdomains):
found_info = subdomain_scan(domain, subdomains)
return [(info['url'], info['status_code']) for info in found_info]
if __name__ == "__main__":
target_domain = "example.com" # Replace with your target domain
subdomains = ["www", "api", "blog", "test"] # Replace with your subdomain list
status_codes = display_status_codes_with_found(target_domain, subdomains)
for url, code in status_codes:
print(f"Found subdomain: {url} with Status Code: {code}")
Example: Subdomains with Titles
from subweb import subdomain_scan
def display_titles_with_found(domain, subdomains):
found_info = subdomain_scan(domain, subdomains)
return [(info['url'], info['title']) for info in found_info]
if __name__ == "__main__":
target_domain = "example.com" # Replace with your target domain
subdomains = ["www", "api", "blog", "test"] # Replace with your subdomain list
titles = display_titles_with_found(target_domain, subdomains)
for url, title in titles:
print(f"Found subdomain: {url} with Title: {title}")
Example: Full Info of Subdomains
from subweb import subdomain_scan
def display_full_info_with_found(domain, subdomains):
found_info = subdomain_scan(domain, subdomains)
return found_info
if __name__ == "__main__":
target_domain = "example.com" # Replace with your target domain
subdomains = ["www", "api", "blog", "test"] # Replace with your subdomain list
full_info = display_full_info_with_found(target_domain, subdomains)
for info in full_info:
print(f"Found subdomain: {info['url']}")
print(f"Status Code: {info.get('status_code', 'N/A')}")
print(f"Title: {info.get('title', 'N/A')}")
print(f"Server: {info.get('server', 'N/A')}")
print(f"IP Address: {info.get('ip_address', 'N/A')}")
print("-" * 40)
Reading Subdomains from a File
You can also read subdomains from a file. Here’s how to implement it:
def read_subdomains_from_file(file_path):
with open(file_path, 'r') as file:
return [line.strip() for line in file if line.strip()]
# Example usage
if __name__ == "__main__":
target_domain = input("Enter the target domain (e.g., example.com): ")
subdomain_file = input("Enter the path to the subdomain list file: ")
subdomains = read_subdomains_from_file(subdomain_file)
# Call your desired function with the loaded subdomains
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue.
Acknowledgements
- Subweb for the subdomain scanning functionality.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file subweb-2.0.0.tar.gz
.
File metadata
- Download URL: subweb-2.0.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1983b6474466db3e4e516f757f8eb35ccf29fabe945363fd60289f59bf95d290 |
|
MD5 | 7537f2ce9ce3133341189f19eeda7b6e |
|
BLAKE2b-256 | 3df78354a8d547764575e81387fffb237b2f45d54617e83c68d607eff06b22a2 |
File details
Details for the file subweb-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: subweb-2.0.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ebaee1748575bb2e157932980654bf559b84af0f659eee0e3926114454b90f3 |
|
MD5 | a3e3e44a2410331e94f60eca6f4d3236 |
|
BLAKE2b-256 | 0758b6999e3cf75775fa527b3ad80b51e0a1604eca3d8f0832220bd6d78ea198 |