- 帖子
- 75
- 精华
- 1
- 积分
- 373
- 阅读权限
- 30
- 注册时间
- 2013-12-20
- 最后登录
- 2015-6-24
|
- import os
- import re
- print "Please input the location where you installed the Cygwin:"
- print "WARNINING: when you input,please add the '\\' in the back of the location that you input(if your input don't with '\\')"
- CYGWIN_HOME=raw_input()
- CYGWIN_PASS_DIR=CYGWIN_HOME+"etc\passwd"
- if(CYGWIN_HOME==""):
- print "Error!You must enter a directory!!!Exiting"
- elif(not os.path.exists(CYGWIN_HOME)):
- print "Error!The path you entered is not existed!!!Exiting"
- else:
- f=open(CYGWIN_PASS_DIR,"r")
- con = f.read()
- f.close()
- print con
- con1 = re.sub("Administrator","root",con)
- con2 = re.sub("500","0",con1)
- con3 = re.sub("513","0",con2)
- print con3
- f2 = open(CYGWIN_PASS_DIR, 'w')
- f2.write(con3)
- f2.close()
- if(not os.path.exists(CYGWIN_HOME+"home\\root\")):
- os.mkdir(CYGWIN_HOME+"home\\root\")
-
复制代码 |
|