Skip to content

Commit c162591

Browse files
author
AniYengibaryan
authored
Add files via upload
1 parent b6a8a7f commit c162591

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Port Scanner/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--Please do not remove this part-->
2+
![Star Badge](https://img.shields.io/static/v1?label=%F0%9F%8C%9F&message=If%20Useful&style=style=flat&color=BC4E99)
3+
![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)
4+
5+
# Port Scanner
6+
7+
## 🛠️ Description
8+
<!--Remove the below lines and add yours -->
9+
It's a simple port scanner.
10+
11+
## ⚙️ Languages or Frameworks Used
12+
The program was created with Python3.
13+
14+
## 🌟 How to run
15+
<!--Remove the below lines and add yours -->
16+
* Clone the Project
17+
* Run ```python scan_port.py```
18+
19+
20+
## 🤖 Author
21+
[AniYengibaryan](https://github.com/AniYengibaryan)
22+

Port Scanner/scan_port.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import socket
2+
# List of ports to scan
3+
ports = [20, 21, 22, 23, 25, 42, 43, 53, 67, 69, 80, 110, 115, 123, 137, 138, 139, 143, 161, 179, 443, 445, 514, 515, 993, 995, 1080, 1194, 1433, 1702, 1723, 3128, 3268, 3306, 3389, 5432, 5060, 5900, 5938, 8080, 10000, 20000]
4+
host = input('Enter the site name without http/https or IP address: ')
5+
print ("Wait, there is a port scan!")
6+
7+
for port in ports:
8+
9+
s = socket.socket()
10+
# Setting the timeout to one second
11+
s.settimeout(1)
12+
# Ловим ошибки
13+
try:
14+
15+
s.connect((host, port))
16+
# If the connection caused an error
17+
except socket.error:
18+
# then we don't do anything
19+
pass
20+
else:
21+
print(f"{host}: {port} port is active")
22+
# Closing the connection
23+
s.close
24+
print ("The scan is complete!")

0 commit comments

Comments
 (0)