Skip to content

Latest commit

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Website IP and Ports scan

In this code, we have a Python script that allows us to retrieve the IP addresses associated with a given website and scan for open ports on those IP addresses. This can be useful for network administrators or security professionals who want to assess the security of a website or network..

Table of Contents

Installation

Linux

Windows

  • Click https://github.com/oams84/Pentools.git
  • Install the zip file and extract it
  • modify the oamscanner.py (change website name and modify ports numbers as need.)
  • start the powershell and CD to the folder
  • run python oamscanner.py

Usage

  • cd to the folder

  • run Nano oamscanner.py

  • change website name and modify ports numbers as need.

  • use the ctrl + x to save the file

  • use chmod + oamscanner.py to change it to exe file

  • use ./oamscanner.py

importsocketdefget_ip_addresses(url):
try:
ip_addresses=socket.gethostbyname_ex(url)[2]
returnip_addressesexceptsocket.gaierror:
return []
defscan_ports(ip_address):
open_ports= []
common_ports= [21, 22, 80, 443, 3389, 8080, 8443, 8888] # Add more ports as neededforportincommon_ports:
withsocket.socket(socket.AF_INET, socket.SOCK_STREAM) assock:
sock.settimeout(1)
result=sock.connect_ex((ip_address, port))
ifresult==0:
open_ports.append(port)
returnopen_portsif__name__=="__main__":
websites= ["bjs.com"] # Add more websites as neededforwebsite_urlinwebsites:
ip_addresses=get_ip_addresses(website_url)
ifip_addresses:
print(f"The IP addresses of {website_url} are: {ip_addresses}")
forip_addressinip_addresses:
open_ports=scan_ports(ip_address)
ifopen_ports:
print(f"The open ports on {ip_address} are: {open_ports}")
else:
print(f"No open ports found on {ip_address}")
else:
print(f"Failed to retrieve the IP addresses of {website_url}")

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages