Serv-U账号密码保存方式:


Gene6 FTP 账号密码保存方式:


案例代码:
def userout(name,txtcode): #输出函数
txtname='''d:\py\list/'''+name+'''.ini'''
s=open(txtname,"w+")
s.write(txtcode)
s.close()
#start
f = open('D:\py\ServUDaemon.ini', 'r',encoding='utf-8')
txts=f.read()
f.close()
#资料提取
p=txts.split("\n[")
n=3
lenpw=len(p)
while n< lenpw:
pwd=p[n].split("\n")[1].split("=")[1]
if pwd!="0":
usename = p[n].split("\n")[0].split("=")[1].split("|")[0]
if 'DiskQuota' in p[n]:
DiskQuota = p[n].split("DiskQuota=")[1].split("|")[1]
else:
DiskQuota="209715200"
code='''[Account]
ExpirationEnabled=0
Enabled=-1
Password=SALTED-MD5:{0}
QuotaEnabled=-1
QuotaMax={2}
MaxUsers=5
TimeOut=600
AccessList0=/,E:\Vhost\WebRoot\{1},----,FD--I---
AccessList1=/data_base,E:\Vhost\WebRoot\{1}\data_base,RWDA,FD--I---
AccessList2=/www,E:\Vhost\WebRoot\{1}\www,RWDA,FDMRI---
AccessList3=/logfiles,E:\Vhost\WebRoot\{1}\logfiles,R---,FD--I---
IncomingFXPAllowed=0
OutgoingFXPAllowed=0
CreationDate=2018-03-05 13:19:54
'''.format(pwd,usename,DiskQuota)
print(code)
userout(usename, code)
n=n+1
未经允许不得转载:天府数据港官方信息博客 » python案例之Serv-U转 Gene6 FTP
客官点个赞呗! (0)