• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python public.writeFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中public.writeFile函数的典型用法代码示例。如果您正苦于以下问题:Python writeFile函数的具体用法?Python writeFile怎么用?Python writeFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了writeFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: RemoveTask

    def RemoveTask(self,get):
        try:
            name = public.M('tasks').where('id=?',(get.id,)).getField('name');
            status = public.M('tasks').where('id=?',(get.id,)).getField('status');
            public.M('tasks').delete(get.id);
            if status == '-1':
                os.system("kill `ps -ef |grep 'python panelSafe.pyc'|grep -v grep|grep -v panelExec|awk '{print $2}'`");
                os.system("kill `ps -ef |grep 'install_soft.sh'|grep -v grep|grep -v panelExec|awk '{print $2}'`");
                os.system("kill `ps aux | grep 'python task.pyc$'|awk '{print $2}'`");
                os.system('''
pids=`ps aux | grep 'sh'|grep -v grep|grep install|awk '{print $2}'`
arr=($pids)

for p in ${arr[@]}
do
    kill -9 $p
done
            ''');
            
                os.system('rm -f ' + name.replace('扫描目录[','').replace(']','') + '/scan.pl');
                isTask = '/tmp/panelTask.pl';
                public.writeFile(isTask,'True');
                os.system('/etc/init.d/bt start');
        except:
            os.system('/etc/init.d/bt start');
        return public.returnMsg(True,'PLUGIN_DEL');
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:26,代码来源:files.py


示例2: save

 def save(self,keys,param):
     #更新数据
     self.__GetConn()
     self.__DB_CONN.text_factory = str
     try:
         opt = ""
         for key in keys.split(','):
             opt += key + "=?,"
         opt = opt[0:len(opt)-1]
         sql = "UPDATE " + self.__DB_TABLE + " SET " + opt+self.__OPT_WHERE
         
         import public
         public.writeFile('/tmp/test.pl',sql)
                     
         #处理拼接WHERE与UPDATE参数
         tmp = list(param)
         for arg in self.__OPT_PARAM:
             tmp.append(arg)
         self.__OPT_PARAM = tuple(tmp)
         result = self.__DB_CONN.execute(sql,self.__OPT_PARAM)
         self.__close()
         self.__DB_CONN.commit()
         return result.rowcount
     except Exception,ex:
         return "error: " + str(ex)
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:25,代码来源:db.py


示例3: set_mysql_dir

def set_mysql_dir(path):
    mysql_dir = '''#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
oldDir=`cat /etc/my.cnf |grep 'datadir'|awk '{print $3}'`
newDir=$1
mkdir $newDir
if [ ! -d "${newDir}" ];then
    echo 'The specified storage path does not exist!'
    exit
fi
echo "Stopping MySQL service..."
service mysqld stop

echo "Copying files, please wait..."
\cp -r -a $oldDir/* $newDir
chown -R mysql.mysql $newDir
sed -i "s#$oldDir#$newDir#" /etc/my.cnf

echo "Starting MySQL service..."
service mysqld start
echo ''
echo 'Successful'
echo '---------------------------------------------------------------------'
echo "Has changed the MySQL storage directory to: $newDir"
echo '---------------------------------------------------------------------'
''';


    public.writeFile('mysql_dir.sh',mysql_dir)
    os.system("/bin/bash mysql_dir.sh " + path)
    os.system("rm -f mysql_dir.sh")
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:32,代码来源:tools.py


示例4: __Conn

 def __Conn(self):
     try:
         import public
         try:
             import MySQLdb
         except Exception,ex:
             self.__DB_ERR = ex
             return False;
         try:
             myconf = public.readFile('/etc/my.cnf');
             rep = "port\s*=\s*([0-9]+)"
             self.__DB_PORT = int(re.search(rep,myconf).groups()[0]);
         except:
             self.__DB_PORT = 3306;
         self.__DB_PASS = public.M('config').where('id=?',(1,)).getField('mysql_root');
         try:
             if os.path.exists(self.__DB_HOST_CONF): self.__DB_HOST = public.readFile(self.__DB_HOST_CONF);
             self.__DB_CONN = MySQLdb.connect(host = self.__DB_HOST,user = self.__DB_USER,passwd = self.__DB_PASS,port = self.__DB_PORT,charset="utf8",connect_timeout=1)
         except MySQLdb.Error,e:
             if e[0] != 2003: 
                 self.__DB_ERR = e
                 return False
             if self.__DB_HOST == 'localhost':
                 self.__DB_HOST = '127.0.0.1';
             else:
                 self.__DB_HOST = 'localhost';
             public.writeFile(self.__DB_HOST_CONF,self.__DB_HOST);
             self.__DB_CONN = MySQLdb.connect(host = self.__DB_HOST,user = self.__DB_USER,passwd = self.__DB_PASS,port = self.__DB_PORT,charset="utf8",connect_timeout=1)
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:28,代码来源:panelMysql.py


示例5: AddPackage

 def AddPackage(self,get):
     jsonFile = self.__setupPath + '/list.json';
     if not os.path.exists(jsonFile): return public.returnMsg(False,'配置文件不存在!');
     
     data = {}
     data = json.loads(public.readFile(jsonFile));
     for d in data:
         if d['name'] == get.dname: return public.returnMsg(False,'您要添加的程序标识已存在!');
         if d['title'] == get.title: return public.returnMsg(False,'您要添加的程序名称已存在!');
     
     if hasattr(get,'rewrite'): get.rewrite = True;
     
     pinfo = {}
     pinfo['name'] = get.dname;
     pinfo['title'] = get.title;
     pinfo['version'] = get.version;
     pinfo['md5'] = get.md5;
     pinfo['rewrite'] = get.rewrite;
     pinfo['php'] = get.php;
     pinfo['ps'] = get.ps;
     pinfo['shell'] = get.shell;
     pinfo['download'] = get.download;
     data.append(pinfo);
     public.writeFile(jsonFile,json.dumps(data));
     return public.returnMsg(True,'添加成功!');
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:25,代码来源:deployment_main.py


示例6: setPathInfo

 def setPathInfo(self,get):
     #设置PATH_INFO
     version = get.version
     type = get.type
     if public.get_webserver() == 'nginx':
         path = web.ctx.session.setupPath+'/nginx/conf/enable-php-'+version+'.conf';
         conf = public.readFile(path);
         rep = "\s+#*include\s+pathinfo.conf;";
         if type == 'on':
             conf = re.sub(rep,'\n\t\t\tinclude pathinfo.conf;',conf)
         else:
             conf = re.sub(rep,'\n\t\t\t#include pathinfo.conf;',conf)
         public.writeFile(path,conf)
         public.serviceReload();
     
     path = web.ctx.session.setupPath+'/php/'+version+'/etc/php.ini';
     conf = public.readFile(path);
     rep = "\n*\s*cgi\.fix_pathinfo\s*=\s*([0-9]+)\s*\n";
     status = '0'
     if type == 'on':status = '1'
     conf = re.sub(rep,"\ncgi.fix_pathinfo = "+status+"\n",conf)
     public.writeFile(path,conf)
     public.WriteLog("TYPE_PHP", "PHP_PATHINFO_SUCCESS",(version,type));
     public.phpReload(version);
     return public.returnMsg(True,'SET_SUCCESS');
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:25,代码来源:config.py


示例7: SetSshPort

 def SetSshPort(self,get):
     #return public.returnMsg(False,'演示服务器,禁止此操作!');
     port = get.port
     if int(port) < 22 or int(port) > 65535: return public.returnMsg(False,'FIREWALL_SSH_PORT_ERR');
     ports = ['21','25','80','443','8080','888','8888'];
     if port in ports: return public.returnMsg(False,'');
     
     file = '/etc/ssh/sshd_config'
     conf = public.readFile(file)
     
     rep = "#*Port\s+([0-9]+)\s*\n"
     conf = re.sub(rep, "Port "+port+"\n", conf)
     public.writeFile(file,conf)
     
     if self.__isFirewalld:
         self.__Obj.AddAcceptPort(port);
         public.ExecShell('setenforce 0');
         public.ExecShell('sed -i "s#SELINUX=enforcing#SELINUX=disabled#" /etc/selinux/config');
         public.ExecShell("systemctl restart sshd.service")
     elif self.__isUfw:
         public.ExecShell('ufw allow ' + port + '/tcp');
         public.ExecShell("service ssh restart")
     else:
         public.ExecShell('iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport '+port+' -j ACCEPT')
         public.ExecShell("/etc/init.d/sshd restart")
     
     self.FirewallReload()
     public.M('firewall').where("ps=?",('SSH远程管理服务',)).setField('port',port)
     public.WriteLog("TYPE_FIREWALL", "FIREWALL_SSH_PORT",(port,))
     return public.returnMsg(True,'EDIT_SUCCESS') 
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:30,代码来源:firewalls.py


示例8: GetLogs

 def GetLogs(self,get):
     id = get['id']
     echo = public.M('crontab').where("id=?",(id,)).field('echo').find()
     logFile = web.ctx.session.setupPath+'/cron/'+echo['echo']+'.log'
     if not os.path.exists(logFile):return public.returnMsg(False, 'CRONTAB_TASKLOG_EMPTY')
     log = public.GetNumLines(logFile,2000)
     f = open(logFile,'r')
     tmp = f.readline()
     n=0;
     while tmp:
         n += 1;
         tmp = f.readline();
     f.close();
     if n > 2000: public.writeFile(logFile,log)
     
     where = "Warning: Using a password on the command line interface can be insecure.\n"
     if  log.find(where)>-1:
         log = log.replace(where, '')
         public.writeFile('/tmp/read.tmp',log)
     
     import chardet;
     char=chardet.detect(log);
     encodeing = char['encoding'];
     if char['encoding'] == 'GB2312': encodeing = 'GBK';
     if char['encoding'] == 'ascii': encodeing = 'utf-8';
     log = log.decode(encodeing).encode('utf-8');
     return public.returnMsg(True, log);
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:27,代码来源:crontab.py


示例9: setFpmConfig

 def setFpmConfig(self,get):
     version = get.version
     max_children = get.max_children
     start_servers = get.start_servers
     min_spare_servers = get.min_spare_servers
     max_spare_servers = get.max_spare_servers
     pm = get.pm
     
     file = web.ctx.session.setupPath+"/php/"+version+"/etc/php-fpm.conf";
     conf = public.readFile(file);
     
     rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*";
     conf = re.sub(rep, "\npm.max_children = "+max_children, conf);
     
     rep = "\s*pm.start_servers\s*=\s*([0-9]+)\s*";
     conf = re.sub(rep, "\npm.start_servers = "+start_servers, conf);
     
     rep = "\s*pm.min_spare_servers\s*=\s*([0-9]+)\s*";
     conf = re.sub(rep, "\npm.min_spare_servers = "+min_spare_servers, conf);
     
     rep = "\s*pm.max_spare_servers \s*=\s*([0-9]+)\s*";
     conf = re.sub(rep, "\npm.max_spare_servers = "+max_spare_servers+"\n", conf);
     
     rep = "\s*pm\s*=\s*(\w+)\s*";
     conf = re.sub(rep, "\npm = "+pm+"\n", conf);
     
     public.writeFile(file,conf)
     public.phpReload(version);
     public.WriteLog("TYPE_PHP",'PHP_CHILDREN', (version,max_children,start_servers,min_spare_servers,max_spare_servers));
     return public.returnMsg(True, 'SET_SUCCESS');
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:30,代码来源:config.py


示例10: setPHPMaxSize

 def setPHPMaxSize(self,get):
     version = get.version
     max = get.max
     
     if int(max) < 2: return public.returnMsg(False,'PHP_UPLOAD_MAX_ERR')
     
     #设置PHP
     path = web.ctx.session.setupPath+'/php/'+version+'/etc/php.ini'
     conf = public.readFile(path)
     rep = u"\nupload_max_filesize\s*=\s*[0-9]+M"
     conf = re.sub(rep,u'\nupload_max_filesize = '+max+'M',conf)
     rep = u"\npost_max_size\s*=\s*[0-9]+M"
     conf = re.sub(rep,u'\npost_max_size = '+max+'M',conf)
     public.writeFile(path,conf)
     
     if public.get_webserver() == 'nginx':
         #设置Nginx
         path = web.ctx.session.setupPath+'/nginx/conf/nginx.conf'
         conf = public.readFile(path)
         rep = "client_max_body_size\s+([0-9]+)m"
         tmp = re.search(rep,conf).groups()
         if int(tmp[0]) < int(max):
             conf = re.sub(rep,'client_max_body_size '+max+'m',conf)
             public.writeFile(path,conf)
         
     public.serviceReload()
     public.phpReload(version);
     public.WriteLog("TYPE_PHP", "PHP_UPLOAD_MAX",(version,max))
     return public.returnMsg(True,'SET_SUCCESS')
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:29,代码来源:config.py


示例11: threadto

 def threadto(self,filename):
     print 'scanning ' + filename,
     file= open(filename)
     filestr = file.read()
     char=chardet.detect(filestr)
     try:
         filestr = filestr.decode(char['encoding'])
     except:
         return;
     file.close()
     for rule in self.rulelist:
         tmps = re.compile(rule['code']).findall(filestr)
         if tmps:
             tmp = {}
             tmp['msg'] = rule['msg'];
             tmp['level'] = rule['level'];
             tmp['filename'] = filename;
             tmp['code'] = str(tmps[0][0:200])
             tmp['etime'] = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(os.path.getmtime(filename)))
             self.result['data'].append(tmp);
             self.result['error'] += 1
             break
     print '  done'
     self.result['count'] += 1
     public.writeFile(self.result['path'] + '/scan.pl',json.dumps(self.result));
     del(filestr)
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:26,代码来源:panelSafe.py


示例12: GetTaskSpeed

 def GetTaskSpeed(self,get):
     tempFile = '/tmp/panelExec.log'
     freshFile = '/tmp/panelFresh'
     import db
     find = db.Sql().table('tasks').where('status=? OR status=?',('-1','0')).field('id,type,name,execstr').find()
     if not len(find): return public.returnMsg(False,'当前没有任务队列在执行-2!')
     isTask = '/tmp/panelTask.pl'
     public.writeFile(isTask,'True');
     echoMsg = {}
     echoMsg['name'] = find['name']
     echoMsg['execstr'] = find['execstr']
     if find['type'] == 'download':
         import json
         try:
             tmp = public.readFile(tempFile)
             if len(tmp) < 10:
                 return public.returnMsg(False,'当前没有任务队列在执行-3!')
             echoMsg['msg'] = json.loads(tmp)
             echoMsg['isDownload'] = True
         except:
             db.Sql().table('tasks').where("id=?",(find['id'],)).save('status',('0',))
             return public.returnMsg(False,'当前没有任务队列在执行-4!')
     else:
         echoMsg['msg'] = self.GetLastLine(tempFile,20)
         echoMsg['isDownload'] = False
     
     echoMsg['task'] = public.M('tasks').where("status!=?",('1',)).field('id,status,name,type').order("id asc").select()
     return echoMsg
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:28,代码来源:files.py


示例13: limitAddress

 def limitAddress(self,type):
     import time
     logFile = 'data/'+web.ctx.ip+'.login';
     timeFile = 'data/'+web.ctx.ip+'_time.login';
     limit = 6;
     outtime = 600;
     try:
         #初始化
         if not os.path.exists(timeFile): public.writeFile(timeFile,str(time.time()));
         if not os.path.exists(logFile): public.writeFile(logFile,'0');
         
         #判断是否解除登陆限制
         time1 = float(public.readFile(timeFile));
         if (time.time() - time1) > outtime: 
             public.writeFile(logFile,'0');
             public.writeFile(timeFile,str(time.time()));
         
         #计数
         num1 = int(public.readFile(logFile));
         if type == '+':
             num1 += 1;
             public.writeFile(logFile,str(num1));
             self.errorNum();
             web.ctx.session.code = True;
             return limit - num1;
         
         #清空
         if type == '-':
             public.ExecShell('rm -f data/*.login');
             web.ctx.session.code = False;
             return 1;
         return limit - num1;
     except:
         return limit;
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:34,代码来源:main.py


示例14: set_mysql_root

def set_mysql_root(password):
    import db,os
    sql = db.Sql()
    
    root_mysql = '''#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
pwd=$1
service mysqld stop
mysqld_safe --skip-grant-tables&
echo '正在修改密码...';
echo 'The set password...';
sleep 6
mysql -uroot -e "insert into mysql.user(Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv,Event_priv,Trigger_priv,Create_tablespace_priv,User,Password,host)values('Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','root',password('${pwd}'),'127.0.0.1')"
mysql -uroot -e "insert into mysql.user(Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv,Event_priv,Trigger_priv,Create_tablespace_priv,User,Password,host)values('Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','root',password('${pwd}'),'localhost')"
mysql -uroot -e "UPDATE mysql.user SET password=PASSWORD('${pwd}') WHERE user='root'";
mysql -uroot -e "UPDATE mysql.user SET authentication_string=PASSWORD('${pwd}') WHERE user='root'";
mysql -uroot -e "FLUSH PRIVILEGES";
pkill -9 mysqld_safe
pkill -9 mysqld
sleep 2
service mysqld start

echo '==========================================='
echo "root密码成功修改为: ${pwd}"
echo "The root password set ${pwd}  successuful"''';
    
    public.writeFile('mysql_root.sh',root_mysql)
    os.system("/bin/bash mysql_root.sh " + password)
    os.system("rm -f mysql_root.sh")
    
    result = sql.table('config').where('id=?',(1,)).setField('mysql_root',password)
    print result;
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:33,代码来源:tools.py


示例15: GetFileBody

 def GetFileBody(self,get) :
     get.path = get.path.encode('utf-8');
     if not os.path.exists(get.path):
         if get.path.find('rewrite') == -1:
             return public.returnMsg(False,'FILE_NOT_EXISTS')
         public.writeFile(get.path,'');
     try:
         if os.path.getsize(get.path) > 2097152: return public.returnMsg(False,'不能在线编辑大于2MB的文件!');
         srcBody = public.readFile(get.path)
         
         data = {}
         if srcBody:
             import chardet
             char=chardet.detect(srcBody)
             data['encoding'] = char['encoding']
             if char['encoding'] == 'GB2312': data['encoding'] = 'GBK';
             if char['encoding'] == 'ascii': data['encoding'] = 'utf-8'
             data['data'] = srcBody.decode(data['encoding']).encode('utf-8')
         else:
             data['data'] = srcBody
             data['encoding'] = 'utf-8'
         
         data['status'] = True
         return data
     except Exception,ex:
         return public.returnMsg(False,'FILE_GET_ERR' + str(ex))
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:26,代码来源:files.py


示例16: DelCrontab

 def DelCrontab(self,get):
     try:
         id = get['id']
         find = public.M('crontab').where("id=?",(id,)).field('name,echo').find()
         x = web.ctx.session.server_os['x'];
         if x == 'RHEL':
             file='/var/spool/cron/root'
         else:
             file='/var/spool/cron/crontabs/root'
         conf=public.readFile(file)
         rep = ".+" + str(find['echo']) + ".+\n"
         conf = re.sub(rep, "", conf)
         cronPath = web.ctx.session.setupPath + '/cron'
         public.writeFile(file,conf)
         
         sfile = cronPath + '/' + find['echo']
         if os.path.exists(sfile): os.remove(sfile)
         sfile = cronPath + '/' + find['echo'] + '.log'
         if os.path.exists(sfile): os.remove(sfile)
         
         self.CrondReload()
         public.M('crontab').where("id=?",(id,)).delete()
         public.WriteLog('TYPE_CRON', 'CRONTAB_DEL',(find['name'],))
         return public.returnMsg(True, 'DEL_SUCCESS')
     except:
         return public.returnMsg(False, 'DEL_ERROR')
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:26,代码来源:crontab.py


示例17: ClosePanel

 def ClosePanel(self,get):
     #return public.returnMsg(False,'体验服务器,禁止修改!')
     filename = 'data/close.pl'
     public.writeFile(filename,'True');
     public.ExecShell("chmod 600 " + filename);
     public.ExecShell("chown root.root " + filename);
     return public.returnMsg(True,'PANEL_CLOSE');
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:7,代码来源:config.py


示例18: BinLog

 def BinLog(self,get):
     myfile = '/etc/my.cnf';
     mycnf = public.readFile(myfile);
     if mycnf.find('#log-bin=mysql-bin') != -1:
         if hasattr(get,'status'): return public.returnMsg(False,'0');
         mycnf = mycnf.replace('#log-bin=mysql-bin','log-bin=mysql-bin')
         mycnf = mycnf.replace('#binlog_format=mixed','binlog_format=mixed')
         os.system('sync')
         os.system('/etc/init.d/mysqld restart');
     else:
         path = self.GetMySQLInfo(get)['datadir'];
         if hasattr(get,'status'): 
             dsize = 0;
             for n in os.listdir(path):
                 if len(n) < 9: continue;
                 if n[0:9] == 'mysql-bin':
                     dsize += os.path.getsize(path + '/' + n);
             return public.returnMsg(True,dsize);
         
         mycnf = mycnf.replace('log-bin=mysql-bin','#log-bin=mysql-bin')
         mycnf = mycnf.replace('binlog_format=mixed','#binlog_format=mixed')
         os.system('sync')
         os.system('/etc/init.d/mysqld restart');
         os.system('rm -f ' + path + '/mysql-bin.*')
     
     public.writeFile(myfile,mycnf);
     return public.returnMsg(True,'SUCCESS');
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:27,代码来源:database.py


示例19: checkSSH

 def checkSSH(self):
     if self.md5sum('/etc/issue') == '3e3c7c4194b12af573ab11c16990c477':
         if self.md5sum('/usr/sbin/sshd') != 'abf7a90c36705ef679298a44af80b10b':  self.result['sshd'] = False
             
     if self.md5sum('/etc/issue') == '6c9222ee501323045d85545853ebea55':
         if self.md5sum('/usr/sbin/sshd') != '4bbf2b12d6b7f234fa01b23dc9822838': self.result['sshd'] = False
     self.result['sshd'] = True
     public.writeFile(self.result['path'] + '/scan.pl',json.dumps(self.result));
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:8,代码来源:panelSafe.py


示例20: SetMySQLPort

 def SetMySQLPort(self,get):
     myfile = '/etc/my.cnf';
     mycnf = public.readFile(myfile);
     rep = "port\s*=\s*([0-9]+)\s*\n"
     mycnf = re.sub(rep,'port = ' + get.port + '\n',mycnf);
     public.writeFile(myfile,mycnf);
     os.system('/etc/init.d/mysqld restart');
     return public.returnMsg(True,'EDIT_SUCCESS');
开发者ID:soitun,项目名称:BaoTa-Panel,代码行数:8,代码来源:database.py



注:本文中的public.writeFile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python login_bank.login_bank函数代码示例发布时间:2022-05-25
下一篇:
Python public.success_result_http函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap