#!coding:utf-8 import os,subprocess import random,time pwd="""a=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890""" lpwd=list(pwd) open("user.txt","a+").write('==========%s========\n'%time.strftime("%Y-%m-%d %H:%M",time.localtime())) while True: user=raw_input('輸入用戶名[exit|quit]:') okpwd="".join(random.sample(lpwd,15) ) if user in ['exit','quit']: break subprocess.call("notpad user.txt") else: subprocess.call('net user %s %s /add'%(user,okpwd),shell=True) subprocess.call('''net localgroup "Remote Desktop Users" %s /add'%user''',shell=True) open("user.txt",'a+').write("%s\t\%s\n"%(user,okpwd))