要把第3行的内容彻底替换为xiaoming*,写法: #sed -i "3s/.*/xiaoming*/" /etc/ppp/chap-secrets vim编辑器: 打开文件# vim [OPTION]… FILE… +#:打开文件后,直接让光标处于第#行的行首 +/ PATTERN:打开文件后,直接让光标处于第一个被PATTERN匹配到的行的行首 vim + file直接打开file,光标在 最后一行...
char_set = string.ascii_lowercase + string.ascii_uppercase+ string.digits f = open('/etc/ppp/chap-secrets','w') pw1 = gen_random_text(12) pw2 = gen_random_text(12) f.write("username1 l2tpd {} *\n".format(pw1)) f.write("username2 l2tpd {} *".format(pw2)) f.close() f...
# 需要导入模块: import string [as 别名]# 或者: from string importdigits[as 别名]defsetup_passwords():try: char_set = string.ascii_lowercase + string.ascii_uppercase + string.digitsf = open('/etc/ppp/chap-secrets','w') pw1 = gen_random_text(12) pw2 = gen_random_text(12) f.writ...
vpnsecretfilte="%s/ipsec.any.secrets"% (self.VPNCONFDIR) xl2tpdconffile="/etc/xl2tpd/xl2tpd.conf"xl2tpoptionsfile='/etc/ppp/options.xl2tpd'file = CsFile(vpnconffile) localip=obj['local_ip'] localcidr=obj['local_cidr'] publicIface=obj['public_interface'] iprange=obj['ip_range'...
f = open('/etc/ppp/chap-secrets','w') pw1 = gen_random_text(12) pw2 = gen_random_text(12) f.write("username1 l2tpd {} *\n".format(pw1)) f.write("username2 l2tpd {} *".format(pw2)) f.close() f = open('/etc/ipsec.secrets','w') ...
vpnsecretfilte="%s/ipsec.any.secrets"% (self.VPNCONFDIR) xl2tpdconffile="/etc/xl2tpd/xl2tpd.conf"xl2tpoptionsfile='/etc/ppp/options.xl2tpd'file =CsFile(vpnconffile) localip=obj['local_ip'] localcidr=obj['local_cidr'] publicIface=obj['public_interface'] ...