예제 #1
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     self.FtpPort()
     data = {}
     data['isSetup'] = True;
     if os.path.exists(web.ctx.session.setupPath+'/pure-ftpd') == False: data['isSetup'] = False;
     data['lan'] = public.getLan('ftp')
     return render.ftp(data)
예제 #2
0
 def GET(self):
     self.FtpPort()
     data = {}
     data['isSetup'] = True;
     if os.path.exists(web.ctx.session.setupPath+'/pure-ftpd') == False: data['isSetup'] = False;
     data['lan'] = public.getLan('ftp')
     return render.ftp(data)
예제 #3
0
 def GET(self):
     if not os.path.exists('data/close.pl'): raise web.seeother('/')
     render = web.template.render('templates/' + templateName + '/',
                                  globals={'session': session})
     data = {}
     data['lan'] = public.getLan('close')
     return render.close(data)
예제 #4
0
def site(pdata=None):
    comReturn = comm.local()
    if comReturn: return comReturn
    if request.method == method_get[0] and not pdata:
        data = {}
        data['isSetup'] = True
        data['lan'] = public.getLan('site')
        if os.path.exists(public.GetConfigValue('setup_path') +
                          '/nginx') == False and os.path.exists(
                              public.GetConfigValue('setup_path') +
                              '/apache') == False:
            data['isSetup'] = False
        return render_template('site.html', data=data)
    import panelSite
    siteObject = panelSite.panelSite()

    defs = ('GetSiteLogs', 'GetSiteDomains', 'GetSecurity', 'SetSecurity',
            'ProxyCache', 'CloseToHttps', 'HttpToHttps', 'SetEdate',
            'SetRewriteTel', 'GetCheckSafe', 'CheckSafe', 'GetDefaultSite',
            'SetDefaultSite', 'CloseTomcat', 'SetTomcat', 'apacheAddPort',
            'AddSite', 'GetPHPVersion', 'SetPHPVersion', 'DeleteSite',
            'AddDomain', 'DelDomain', 'GetDirBinding', 'AddDirBinding',
            'GetDirRewrite', 'DelDirBinding', 'get_site_types',
            'add_site_type', 'remove_site_type', 'modify_site_type_name',
            'set_site_type', 'UpdateRulelist', 'SetSiteRunPath',
            'GetSiteRunPath', 'SetPath', 'SetIndex', 'GetIndex',
            'GetDirUserINI', 'SetDirUserINI', 'GetRewriteList', 'SetSSL',
            'SetSSLConf', 'CreateLet', 'CloseSSLConf', 'GetSSL', 'SiteStart',
            'SiteStop', 'Set301Status', 'Get301Status', 'CloseLimitNet',
            'SetLimitNet', 'GetLimitNet', 'SetProxy', 'GetProxy', 'ToBackup',
            'DelBackup', 'GetSitePHPVersion', 'logsOpen', 'GetLogsStatus',
            'CloseHasPwd', 'SetHasPwd', 'GetHasPwd', 'GetDnsApi', 'SetDnsApi')
    return publicObject(siteObject, defs, None, pdata)
예제 #5
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     import system
     data = system.system().GetConcifInfo()
     data['siteCount'] = public.M('sites').count()
     data['ftpCount'] = public.M('ftps').count()
     data['databaseCount'] = public.M('databases').count()
     data['lan'] = public.getLan('index')
     return render.index(data)
예제 #6
0
 def GET(self):
     
     data = {}
     data['isSetup'] = True;
     data['mysql_root'] = public.M('config').where('id=?',(1,)).getField('mysql_root');
     data['lan'] = public.getLan('database')
     if os.path.exists('/usr/local/mysql') == False: data['isSetup'] = False;
     return render.database(data)
예제 #7
0
 def GET(self):
     import system
     data = system.system().GetConcifInfo()
     data['siteCount'] = public.M('sites').count()
     data['ftpCount'] = public.M('ftps').count()
     data['databaseCount'] = public.M('databases').count()
     data['lan'] = public.getLan('index')
     return render.index(data)
예제 #8
0
 def GET(self):
     data = {}
     data['isSetup'] = True
     data['lan'] = public.getLan('site')
     if os.path.exists(web.ctx.session.setupPath +
                       '/nginx') == False and os.path.exists(
                           web.ctx.session.setupPath + '/apache') == False:
         data['isSetup'] = False
     return render.site(data)
예제 #9
0
 def GET(self):
     pmd = self.get_phpmyadmin_dir();
     web.ctx.session.phpmyadminDir = False
     if pmd: 
         web.ctx.session.phpmyadminDir = 'http://' + web.ctx.host.split(':')[0] + ':'+ pmd[1] + '/' + pmd[0];
     
     data = {}
     data['isSetup'] = True;
     data['mysql_root'] = public.M('config').where('id=?',(1,)).getField('mysql_root');
     data['lan'] = public.getLan('database')
     if os.path.exists(web.ctx.session.setupPath+'/mysql') == False: data['isSetup'] = False;
     return render.database(data)
예제 #10
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     pmd = self.get_phpmyadmin_dir();
     web.ctx.session.phpmyadminDir = False
     if pmd: 
         web.ctx.session.phpmyadminDir = 'http://' + web.ctx.host.split(':')[0] + ':'+ pmd[1] + '/' + pmd[0];
     
     data = {}
     data['isSetup'] = True;
     data['mysql_root'] = public.M('config').where('id=?',(1,)).getField('mysql_root');
     data['lan'] = public.getLan('database')
     if os.path.exists(web.ctx.session.setupPath+'/mysql') == False: data['isSetup'] = False;
     return render.database(data)
예제 #11
0
 def GET(self):
     import system
     data = system.system().GetConcifInfo()
     data['siteCount'] = public.M('sites').count()
     data['ftpCount'] = public.M('ftps').count()
     data['databaseCount'] = public.M('databases').count()
     data['lan'] = public.getLan('index')
     data['endtime'] = time.strftime('%Y-%m-%d',time.localtime(time.time()))
     if 'vip' in web.ctx.session:
         data['endtime'] = '<span>'+time.strftime('%Y-%m-%d',time.localtime(web.ctx.session.vip['msg']['endtime']))+'</span><a href="/vpro" class="btlink xufei"> 续费</a>';
         if not web.ctx.session.vip['msg']['endtime']: data['endtime'] = '<span style="color: #fc6d26;font-weight: bold;">永久授权</span>';
     return render.index(data)
예제 #12
0
 def GET(self):
     import panelPlugin
     data = {}
     data['isSetup'] = True
     data['run'] = False
     data['lan'] = public.getLan('site')
     #if os.path.exists(web.ctx.session.setupPath+'/nginx') == False and os.path.exists(web.ctx.session.setupPath+'/apache') == False: data['isSetup'] = False;
     if os.path.exists(web.ctx.session.setupPath + '/tomcat') == False:
         data['isSetup'] = False
     if os.path.exists(web.ctx.session.setupPath +
                       '/tomcat/logs/catalina-daemon.pid'):
         if panelPlugin.getPid('jsvc'): data['run'] = True
     return render.site(data)
예제 #13
0
def login():
    if os.path.exists('install.pl'): return redirect('/install')
    global admin_check_auth, admin_path
    is_auth_path = False
    if admin_path != '/bt' and os.path.exists(
            admin_path_file) and not 'admin_auth' in session:
        is_auth_path = True
    get = get_input()
    if hasattr(get, 'dologin'):
        login_path = '/login'
        if os.path.exists(admin_path_file): login_path = admin_path
        if session['login'] != False:
            session['login'] = False
            cache.set('dologin', True)
            session.clear()
            session_path = r'/dev/shm/session_py' + str(sys.version_info[0])
            if os.path.exists(session_path):
                public.ExecShell("rm -f " + session_path + '/*')
            return redirect(login_path)

    if is_auth_path:
        if not admin_path.replace(
                '/', '') in request.path.split('/') and os.path.join(
                    admin_path, '') != request.path:
            data = {}
            data['lan'] = public.getLan('close')
            return render_template('autherr.html', data=data)
    session['admin_auth'] = True
    comReturn = common.panelSetup().init()
    if comReturn: return comReturn
    import userlogin
    if request.method == method_post[0]:
        result = userlogin.userlogin().request_post(get)
        if 'login' in session:
            if session['login'] == True:
                result = make_response(result)
                request_token = public.md5(app.secret_key + str(time.time()))
                session['request_token'] = request_token
                result.set_cookie('request_token',
                                  request_token,
                                  httponly=True,
                                  max_age=86400 * 30)
        return result

    if request.method == method_get[0]:
        result = userlogin.userlogin().request_get(get)
        if result: return result
        data = {}
        data['lan'] = public.GetLan('login')
        return render_template('login.html', data=data)
예제 #14
0
 def GET(self):
     data = {}
     data['isSetup'] = True;
     data['run'] = False
     data['lan'] = public.getLan('site');
     #if os.path.exists(web.ctx.session.setupPath+'/nginx') == False and os.path.exists(web.ctx.session.setupPath+'/apache') == False: data['isSetup'] = False;
     if os.path.exists(web.ctx.session.setupPath+'/tomcat') == False: data['isSetup'] = False
     if os.path.exists(web.ctx.session.setupPath+'/tomcat/logs/catalina-daemon.pid'):
         import psutil
         pids = psutil.pids()
         for pid in pids:
             if psutil.Process(pid).name() == 'jsvc':
                 data['run'] = True
     return render.site(data);
예제 #15
0
def login():
    if os.path.exists('install.pl'): return redirect('/install')
    global admin_check_auth,admin_path,route_path
    is_auth_path = False
    if admin_path != '/bt' and os.path.exists(admin_path_file) and  not 'admin_auth' in session: is_auth_path = True
    get = get_input()
    import userlogin
    if hasattr(get,'tmp_token'):
        result = userlogin.userlogin().request_tmp(get)
        return is_login(result)

    if hasattr(get,'dologin'):
        login_path = '/login'
        if not 'login' in session: return redirect(login_path)
        if os.path.exists(admin_path_file): login_path = route_path
        if session['login'] != False:
            session['login'] = False;
            cache.set('dologin',True)
            session.clear()
            session_path = r'/dev/shm/session_py' + str(sys.version_info[0])
            if os.path.exists(session_path): public.ExecShell("rm -f " + session_path + '/*')
            return redirect(login_path)
    
    if is_auth_path:
        if route_path != request.path and route_path + '/' != request.path:
            data = {}
            data['lan'] = public.getLan('close');
            return render_template('autherr.html',data=data)
    session['admin_auth'] = True
    comReturn = common.panelSetup().init()
    if comReturn: return comReturn

    if request.method == method_post[0]:
        result = userlogin.userlogin().request_post(get)
        if result == "1":
            return result
        return is_login(result)

    if request.method == method_get[0]:
        result = userlogin.userlogin().request_get(get)
        if result: return result
        data = {}
        data['lan'] = public.GetLan('login')
        return render_template(
            'login.html',
            data=data
            )
예제 #16
0
파일: common.py 프로젝트: Dizzy-K/expayload
 def setSession(self):
     if not hasattr(web.ctx.session, 'brand'):
         web.ctx.session.brand = public.getMsg('BRAND')
         web.ctx.session.product = public.getMsg('PRODUCT')
         web.ctx.session.rootPath = '/www'
         web.ctx.session.webname = public.getMsg('NAME')
         web.ctx.session.downloadUrl = 'http://download.bt.cn'
         if os.path.exists('data/title.pl'):
             web.ctx.session.webname = public.readFile('data/title.pl')
         web.ctx.session.setupPath = self.setupPath
         web.ctx.session.logsPath = '/www/wwwlogs'
     if not hasattr(web.ctx.session, 'menu'):
         web.ctx.session.menu = public.getLan('menu')
     if not hasattr(web.ctx.session, 'lan'):
         web.ctx.session.lan = public.get_language()
     if not hasattr(web.ctx.session, 'home'):
         web.ctx.session.home = 'https://www.bt.cn'
예제 #17
0
 def setSession(self):
     if not hasattr(web.ctx.session,'brand'):
         web.ctx.session.brand = public.getMsg('BRAND');
         web.ctx.session.product = public.getMsg('PRODUCT');
         web.ctx.session.rootPath = '/www'
         web.ctx.session.webname = public.getMsg('NAME');
         web.ctx.session.downloadUrl = 'http://download.bt.cn';
         if os.path.exists('data/title.pl'):
             web.ctx.session.webname = public.readFile('data/title.pl'); 
         web.ctx.session.setupPath = self.setupPath;
         web.ctx.session.logsPath = '/www/wwwlogs';
     if not hasattr(web.ctx.session,'menu'):
         web.ctx.session.menu = public.getLan('menu');
     if not hasattr(web.ctx.session,'lan'):
         web.ctx.session.lan = public.get_language();
     if not hasattr(web.ctx.session,'home'):
         web.ctx.session.home = 'https://www.bt.cn';
예제 #18
0
 def SetSession(self):
     if not hasattr(web.ctx.session, 'brand'):
         web.ctx.session.brand = public.getMsg('BRAND')
         web.ctx.session.product = public.getMsg('PRODUCT')
         web.ctx.session.rootPath = '/www'
         web.ctx.session.webname = public.getMsg('NAME')
         web.ctx.session.downloadUrl = 'http://download.bt.cn'
         if os.path.exists('data/title.pl'):
             web.ctx.session.webname = public.readFile('data/title.pl')
         web.ctx.session.setupPath = '/www/server'
         web.ctx.session.logsPath = '/www/wwwlogs'
     if not hasattr(web.ctx.session, 'menu'):
         web.ctx.session.menu = public.getLan('menu')
     if not hasattr(web.ctx.session, 'lan'):
         web.ctx.session.lan = public.get_language()
     if not hasattr(web.ctx.session, 'home'):
         web.ctx.session.home = 'https://www.bt.cn'
     if not hasattr(web.ctx.session, 'webserver'):
         if os.path.exists('/www/server/nginx'):
             web.ctx.session.webserver = 'nginx'
         else:
             web.ctx.session.webserver = 'apache'
         if os.path.exists('/www/server/' + web.ctx.session.webserver +
                           '/version.pl'):
             web.ctx.session.webversion = public.readFile(
                 '/www/server/' + web.ctx.session.webserver +
                 '/version.pl').strip()
     if not hasattr(web.ctx.session, 'phpmyadminDir'):
         filename = '/www/server/data/phpmyadminDirName.pl'
         if os.path.exists(filename):
             web.ctx.session.phpmyadminDir = public.readFile(
                 filename).strip()
     if not hasattr(web.ctx.session, 'server_os'):
         tmp = {}
         if os.path.exists('/etc/redhat-release'):
             tmp['x'] = 'RHEL'
             tmp['osname'] = public.readFile(
                 '/etc/redhat-release').split()[0]
         elif os.path.exists('/usr/bin/yum'):
             tmp['x'] = 'RHEL'
             tmp['osname'] = public.readFile('/etc/issue').split()[0]
         elif os.path.exists('/etc/issue'):
             tmp['x'] = 'Debian'
             tmp['osname'] = public.readFile('/etc/issue').split()[0]
         web.ctx.session.server_os = tmp
예제 #19
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     data = {}
     data['isSetup'] = True;
     data['lan'] = public.getLan('site');
     if os.path.exists(web.ctx.session.setupPath+'/nginx') == False and os.path.exists(web.ctx.session.setupPath+'/apache') == False: data['isSetup'] = False;
     return render.site(data);
예제 #20
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
    def GET(self):
        if os.path.exists('/www/server/panel/install.pl'): raise web.seeother('/install');
        web.ctx.session.lan = public.get_language();
        if not hasattr(session,'webname'): session.webname = public.getMsg('NAME');
        tmp = web.ctx.host.split(':')
        domain = public.readFile('data/domain.conf')
        if domain:
            if(tmp[0].strip() != domain.strip()): 
                errorStr = '''
<meta charset="utf-8">
<title>%s</title>
</head><body>
<h1>%s</h1>
    <p>%s</p>
    <p>%s</p>
    <p>%s</p>
<hr>
<address>%s 5.x <a href="http://www.bt.cn/bbs" target="_blank">%s</a></address>
</body></html>
    ''' % (public.getMsg('PAGE_ERR_TITLE'),public.getMsg('PAGE_ERR_DOMAIN_H1'),public.getMsg('PAGE_ERR_DOMAIN_P1'),public.getMsg('PAGE_ERR_DOMAIN_P2'),public.getMsg('PAGE_ERR_DOMAIN_P3'),public.getMsg('NAME'),public.getMsg('PAGE_ERR_HELP'))
                web.header('Content-Type','text/html; charset=utf-8', unique=True)
                return errorStr
        if os.path.exists('data/limitip.conf'):
            iplist = public.readFile('data/limitip.conf')
            if iplist:
                iplist = iplist.strip();
                if not web.ctx.ip in iplist.split(','):
                    errorStr = '''
<meta charset="utf-8">
<title>%s</title>
</head><body>
<h1>%s</h1>
    <p>%s</p>
    <p>%s</p>
    <p>%s</p>
<hr>
<address>%s 5.x <a href="http://www.bt.cn/bbs" target="_blank">%s</a></address>
</body></html>
''' % (public.getMsg('PAGE_ERR_TITLE'),public.getMsg('PAGE_ERR_IP_H1'),public.getMsg('PAGE_ERR_IP_P1',(web.ctx.ip,)),public.getMsg('PAGE_ERR_IP_P2'),public.getMsg('PAGE_ERR_IP_P3'),public.getMsg('NAME'),public.getMsg('PAGE_ERR_HELP'))
                    web.header('Content-Type','text/html; charset=utf-8', unique=True)
                    return errorStr;
        
        get = web.input()
        sql = db.Sql()
        if hasattr(get,'dologin'):
            if web.ctx.session.login != False:
                web.ctx.session.login = False;
                web.ctx.session.kill();
            import time
            time.sleep(0.2);
            raise web.seeother('/login')
        
        if hasattr(web.ctx.session,'login'):
            if web.ctx.session.login == True:
                raise web.seeother('/')
        
        if not hasattr(web.ctx.session,'code'):
            web.ctx.session.code = False
        data = {}
        data['lan'] = public.getLan('login')
        render = web.template.render('templates/' + templateName + '/',globals={'session': session,'web':web})
        return render.login(data)
예제 #21
0
 def GET(self):
     import system
     data = system.system().GetConcifInfo()
     data['lan'] = public.getLan('soft')
     return render.soft(data)
예제 #22
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     import system
     data = system.system().GetConcifInfo();
     data['lan'] = public.getLan('config');
     return render.config(data);
예제 #23
0
 def GET(self):
     import crontab
     data = {}
     data['lan'] = public.getLan('crontab')
     return render.crontab(data)
예제 #24
0
 def GET(self):
     data = {}
     data['lan'] = public.getLan('control')
     return render.control(data)
예제 #25
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     if not os.path.exists('data/close.pl'): raise web.seeother('/');
     render = web.template.render('templates/' + templateName + '/',globals={'session': session})
     data = {}
     data['lan'] = public.getLan('close');
     return render.close(data)
예제 #26
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     import system
     data = system.system().GetConcifInfo()
     data['lan'] = public.getLan('soft')
     return render.soft(data)
예제 #27
0
    def GET(self):
        if os.path.exists('/www/server/panel/install.pl'):
            raise web.seeother('/install')
        web.ctx.session.lan = public.get_language()
        if not hasattr(session, 'webname'):
            session.webname = public.getMsg('NAME')
        tmp = web.ctx.host.split(':')
        domain = public.readFile('data/domain.conf')
        if domain:
            if (tmp[0].strip() != domain.strip()):
                errorStr = '''
<meta charset="utf-8">
<title>%s</title>
</head><body>
<h1>%s</h1>
    <p>%s</p>
    <p>%s</p>
    <p>%s</p>
<hr>
<address>%s 5.x <a href="http://www.bt.cn/bbs" target="_blank">%s</a></address>
</body></html>
    ''' % (public.getMsg('PAGE_ERR_TITLE'),
                public.getMsg('PAGE_ERR_DOMAIN_H1'),
                public.getMsg('PAGE_ERR_DOMAIN_P1'),
                public.getMsg('PAGE_ERR_DOMAIN_P2'),
                public.getMsg('PAGE_ERR_DOMAIN_P3'), public.getMsg('NAME'),
                public.getMsg('PAGE_ERR_HELP'))
                web.header('Content-Type',
                           'text/html; charset=utf-8',
                           unique=True)
                return errorStr
        if os.path.exists('data/limitip.conf'):
            iplist = public.readFile('data/limitip.conf')
            if iplist:
                iplist = iplist.strip()
                if not web.ctx.ip in iplist.split(','):
                    errorStr = '''
<meta charset="utf-8">
<title>%s</title>
</head><body>
<h1>%s</h1>
    <p>%s</p>
    <p>%s</p>
    <p>%s</p>
<hr>
<address>%s 5.x <a href="http://www.bt.cn/bbs" target="_blank">%s</a></address>
</body></html>
''' % (public.getMsg('PAGE_ERR_TITLE'), public.getMsg('PAGE_ERR_IP_H1'),
                    public.getMsg('PAGE_ERR_IP_P1', (web.ctx.ip, )),
                    public.getMsg('PAGE_ERR_IP_P2'), public.getMsg('PAGE_ERR_IP_P3'),
                    public.getMsg('NAME'), public.getMsg('PAGE_ERR_HELP'))
                    web.header('Content-Type',
                               'text/html; charset=utf-8',
                               unique=True)
                    return errorStr

        get = web.input()
        sql = db.Sql()
        if hasattr(get, 'dologin'):
            if web.ctx.session.login != False:
                web.ctx.session.login = False
                web.ctx.session.kill()
            import time
            time.sleep(0.2)
            raise web.seeother('/login')

        if hasattr(web.ctx.session, 'login'):
            if web.ctx.session.login == True:
                raise web.seeother('/')

        if not hasattr(web.ctx.session, 'code'):
            web.ctx.session.code = False
        data = {}
        data['lan'] = public.getLan('login')
        render = web.template.render('templates/' + templateName + '/',
                                     globals={
                                         'session': session,
                                         'web': web
                                     })
        return render.login(data)
예제 #28
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     data = {}
     data['lan'] = public.getLan('files')
     return render.files(data)
예제 #29
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     data = {}
     data['lan'] = public.getLan('firewall')
     return render.firewall(data)
예제 #30
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     import crontab
     data = {}
     data['lan'] = public.getLan('crontab')
     return render.crontab(data)
예제 #31
0
파일: main.py 프로젝트: soitun/BaoTa-Panel
 def GET(self):
     data = {}
     data['lan'] = public.getLan('control')
     return render.control(data)
예제 #32
0
def close():
    if not os.path.exists('data/close.pl'): return redirect('/')
    data = {}
    data['lan'] = public.getLan('close')
    return render_template('close.html', data=data)
예제 #33
0
 def GET(self):
     data = {}
     data['lan'] = public.getLan('firewall')
     return render.firewall(data)
예제 #34
0
 def GET(self):
     data = {}
     data['lan'] = public.getLan('files')
     return render.files(data)
예제 #35
0
 def GET(self):
     import system,wxapp
     data = system.system().GetConcifInfo();
     data['lan'] = public.getLan('config');
     # data['wx'] = wxapp.wxapp().get_user_info(None)['msg'];
     return render.config(data);