-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0cfc43
commit bade0cf
Showing
3 changed files
with
101 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,46 @@ | ||
import sys | ||
import socket | ||
import threading | ||
import threading | ||
import time | ||
k=0 | ||
|
||
k = 0 | ||
|
||
|
||
def scanner(): | ||
print('EFFLUX Eagle port scanner') | ||
print('-'*80) | ||
print("EFFLUX Eagle port scanner") | ||
print("-" * 80) | ||
try: | ||
tar=input('IP addr : ') | ||
target= socket.gethostbyname(tar) #host name given will resolve to corresponding ip address from dns | ||
tar = input("IP addr : ") | ||
target = socket.gethostbyname( | ||
tar | ||
) # host name given will resolve to corresponding ip address from dns | ||
except socket.gaierror: | ||
print('Name resolution error') | ||
print("Name resolution error") | ||
sys.exit() | ||
start_port=int(input('START Port : ')) | ||
end_port=int(input("END Port : ")) | ||
start_port = int(input("START Port : ")) | ||
end_port = int(input("END Port : ")) | ||
startTime = time.time() | ||
print('Scanning ',target) | ||
print("Scanning ", target) | ||
|
||
def scan(port): | ||
global k | ||
p=socket.socket(socket.AF_INET,socket.SOCK_STREAM) #tcp | ||
p = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # tcp | ||
p.settimeout(5) | ||
connection=p.connect_ex((target,port)) | ||
if(not(connection)): | ||
serviceName = socket.getservbyport(port, 'tcp') | ||
connection = p.connect_ex((target, port)) | ||
if not (connection): | ||
serviceName = socket.getservbyport(port, "tcp") | ||
print(f"{port}|tcp OPEN {serviceName}") | ||
k+=1 | ||
k += 1 | ||
if port == end_port: | ||
if k!=0: | ||
if k != 0: | ||
print(f"Eagle Scanning was sucessfull, {k} Ports are open") | ||
elif k==0: | ||
elif k == 0: | ||
print(f"Unfortunately no ports were open") | ||
print('Time taken:', str(time.time() - startTime)[:4],'sec') | ||
print("Time taken:", str(time.time() - startTime)[:4], "sec") | ||
p.close() | ||
print('PORT \t STATUS SERVICE') | ||
for port in range(start_port,end_port+1): | ||
thread=threading.Thread(target=scan , args=(port,)) | ||
|
||
print("PORT \t STATUS SERVICE") | ||
for port in range(start_port, end_port + 1): | ||
thread = threading.Thread(target=scan, args=(port,)) | ||
thread.start() | ||
exit() | ||
exit() |