mirror of
https://github.com/aaPanel/aaPanel.git
synced 2026-08-17 21:25:47 +02:00
Since version 7.7.0, we recommend yours update python to 3.12. [+] Using nginx technology to load static files improves access speed [+] Refactor homepage, website, FTP, and database using vue3 [+] Table loading changed to skeleton screen [+] Add Website statistics-v2 professional plug-in [+] Add Home page - top 5 resource occupancy [+] Add protection for Files management (requires Tamper-proof for Enterprise 3.7) [+] Website, FTP, Databases page add program status [+] Add FTP log analysis (only supports Centos) [+] Add password-free login to phpMyAdmin [+] Add Proxy Project in Website (Supported when web service uses Nginx) [+] Add WP Toolkit (Pro version only) [+] Redesigned Docker module [+] Add WP Toolkit Protection [+] Add WP Toolkit Backup and Restore [+] Add WP Toolkit Migrated [+] Add WP Toolkit Clone site (supports new domain and subdomain) [+] Add WP Toolkit Create site from backup of other panel [+] Add WP Toolkit support for Cron automatic backup (only save Local disk) [+] Add WP Toolkit operation log [+] Add Integrity check for WP Toolkit [+] Add WP Toolkit plug-in management and themes management [*] Optimize phpMyAdmin formula access method [*] Optimize Home page PHP display problem [*] Optimize jump to the login interface after the login expires [*] Optimize automatic renewal of SSL at some times [*] Optimize Let's Encrypt to increase application success rate [-] Fix Logs Audit cannot be opened [-] Fix apache URL rewrite issue [-] Fix phpmyadmin installation problem [-] Fix the problem that some servers cannot install software [-] Fix upload file error [-] Fix left menu hiding problem [-] Fix aaPanel Mobile QR code display problem [-] Fix problem that third-party plug-ins are not displayed in the App Store [-] Fix issue where the menu bar is blank when opening new tabs [-] Fixed panel not being accessible in some cases [-] Fix the issue where Curl warning caused the inability to apply for SSL [-] Fix Quota issues for Website, FTP, Databases [-] Fix file interface display problem on mobile terminal
64 lines
1.7 KiB
Python
64 lines
1.7 KiB
Python
#coding: utf-8
|
|
import public,re
|
|
|
|
class projectBase:
|
|
|
|
def check_port(self, port):
|
|
'''
|
|
@name 检查端口是否被占用
|
|
@args port:端口号
|
|
@return: 被占用返回True,否则返回False
|
|
@author: lkq 2021-08-28
|
|
'''
|
|
a = public.ExecShell("netstat -nltp|awk '{print $4}'")
|
|
if a[0]:
|
|
if re.search(':' + port + '\n', a[0]):
|
|
return True
|
|
else:
|
|
return False
|
|
else:
|
|
return False
|
|
|
|
def is_domain(self, domain):
|
|
'''
|
|
@name 验证域名合法性
|
|
@args domain:域名
|
|
@return: 合法返回True,否则返回False
|
|
@author: lkq 2021-08-28
|
|
'''
|
|
import re
|
|
domain_regex = re.compile(r'(?:[A-Z0-9_](?:[A-Z0-9-_]{0,247}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,}(?<!-))\Z', re.IGNORECASE)
|
|
return True if domain_regex.match(domain) else False
|
|
|
|
|
|
def generate_random_port(self):
|
|
'''
|
|
@name 生成随机端口
|
|
@args
|
|
@return: 端口号
|
|
@author: lkq 2021-08-28
|
|
'''
|
|
import random
|
|
port = str(random.randint(5000, 10000))
|
|
while True:
|
|
if not self.check_port(port): break
|
|
port = str(random.randint(5000, 10000))
|
|
return port
|
|
|
|
def IsOpen(self, port):
|
|
'''
|
|
@name 检查端口是否被占用
|
|
@args port:端口号
|
|
@return: 被占用返回True,否则返回False
|
|
@author: lkq 2021-08-28
|
|
'''
|
|
ip = '0.0.0.0'
|
|
import socket
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
try:
|
|
s.connect((ip, int(port)))
|
|
s.shutdown(2)
|
|
return True
|
|
except:
|
|
return False
|