-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathclientScript.py
More file actions
28 lines (25 loc) · 950 Bytes
/
clientScript.py
File metadata and controls
28 lines (25 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python3
import os
from ftplib import FTP
import ftplib
username = 'anonymous'
remote_path = "pub"
remoteIP = input("Enter Remote FTP Server IP: ")
nmapdb = input("Enter your name: ")
subnet =input("Enter IP Address/CIDR for scan: ")
server = remoteIP
os.system("apt-get install nmap -y")
while True:
first = "nmap -n -sn " + subnet + " -oG - | awk '/Up$/{print $2}' > first.txt"
second = "nmap -v -T5 " + subnet + " -p21,22,23,25,110,139,443,445,3000,3389,8080 | grep Discovered | awk '{print $6}' > second.txt"
os.system(first)
os.system(second)
os.system("sort first.txt second.txt | uniq > initial.txt")
os.system("nmap -sV -T5 -iL initial.txt -oA " + nmapdb)
ftp_connection = ftplib.FTP(server, username)
ftp_connection.cwd(remote_path)
ftp_connection.set_pasv(False)
fh = open(nmapdb +".xml" , 'rb')
ftp_connection.storbinary("STOR %s.xml" % nmapdb, fh)
fh.close()
ftp_connection.quit()