-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathftpget.py
More file actions
30 lines (28 loc) · 716 Bytes
/
ftpget.py
File metadata and controls
30 lines (28 loc) · 716 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
29
30
#!/usr/bin/python3.8
import ftplib
def get(ftp):
try:
dirlist=ftp.nlst()
print('listing the contents ')
retlist=[]
for file in dirlist:
fn=file.lower()
if '.php' in fn or '.html' in fn or '.asp' in fn :
print ('found default file ')
retlist.append(file)
return retlst
else:
print('no default page found')
except :
print('not listing')
return
host='192.168.43.75'
user='msfadmin'
password='msfadmin'
ftp=ftplib.FTP(host)
try:
ftp.login(user,password)
print('Logining')
get(ftp)
except Exception as e:
print(str(e))