标签:功能 桌面 sys class 权限 div ftp sci read
import random import string import json import logging import time import os import sys def usage(): print(‘python ‘ + sys.argv[0] + ‘user‘ + ‘ip‘) print (‘eg: python ‘+ sys.argv[0] + ‘tengfei1 172.18.200.14‘) user = sys.argv[1] ip = sys.argv[2] host = "host %s" %ip uid_l = os.popen(host).read() host = ip_l.split()[-1].strip(‘.‘) str_source = string.ascii_letters + string.digits + string.punctuation str_list = random.sample(str_source,10) special=[‘/‘,‘\\‘,‘@‘,‘I‘,‘l‘,‘o‘,‘O‘,‘\‘‘,‘:‘,‘`‘] if len(set(str_list) & set(special))==0: str_final = ‘‘.join(str_list) cmd1 = ‘salt %s user.add %s groups \"Remote Desktop Users\"‘ %(host,user) cmd2 = ‘salt %s user.update %s password=%s password_never_expires=ture‘ %(host,user,str_final) cmd3 = ‘ salt %s file.copy c:/users/test/desktop/ C:/Users/%s/Desktop/‘ %(host,user) os.system(cmd1) os.system(cmd2) os.system(cmd3) #半成品脚本,统一桌面功能未测试完成。 #持续功能,ftp的目录权限需要进行管理,该脚本未实现。
标签:功能 桌面 sys class 权限 div ftp sci read
原文地址:https://www.cnblogs.com/tengfei520/p/10347842.html