Слияние кода завершено, страница обновится автоматически
import json,sys,os,re,multiprocessing
if __name__ == '__main__':
print("AUDB v1.5 DEV预览版")
import user,rsaop,server
if os.path.isdir('data/')==False:
os.mkdir('data/')
user.init()
print("read config")
def readfile(file):
f=open(file,'r')
re=f.read()
f.close()
return re
def writefile(file,data):
with open(file,'w') as f:
return f.write(data)==len(data)
def start(conf):server.init(conf)
if os.path.isfile('audb.json')==False:
writefile('audb.json','{"Server":{"port":1217,"key":"1-27*5`。#@%¥%。;,@","maximum_connection":100},"anti_ddos":true,"anti_cracking":true}')
conf=json.loads(readfile('audb.json'))
print("starting server,port:",conf['Server']['port'])
server.init(conf)
print('done!')
def runcode(c):
code=re.split(" ",c)
if code[0]=='exit':
exit()
elif code[0]=='restart':
python = sys.executable
os.execl(python, python, * sys.argv)
elif code[0]=='conf':
if len(code)-1>=1:
if code[1]=='see':
print(conf)
elif len(code)-1>=3 and code[1]=='set':
isjson=True
try:
json.loads(code[3])
except:
isjson=False
if code[2] in conf:
if isjson:
conf[code[2]]==json.loads(code[3])
else:
conf[code[2]]==code[3]
writefile('audb.json',json.dumps(conf))
print('Modified successfully')
else:
print(code[2],"is not define")
elif code[0]=='':
1+1==1# do nothing
elif code[0]=='create':
if len(code)-1>=3:
if code[1]=='user':
if user.createuser(code[2],code[3],code[4]):
print('create user seccessfullyp')
else:
print('create user false')
elif code[1]=="db":
if user.checkuser(code[2]):
if user.checkdb(code[2],code[3]):
print('The database already exists')
else:
user.createdb(code[2],code[3])
else:
print('user is not define')
else:
print('There is no such command:',code[0])
if len(sys.argv)>1:
if os.path.isfile(sys.argv[1]):
with open(sys.argv[1]) as file:
codej = re.split('\n',file.read())
for i in codej:
runcode(i)
while True:
runcode(input(">>"))
else:print("请不要以import方式调用!!!!,如需import,请将if __name__ == '__main__':与else删除")
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )