三行程式碼破解寶塔面板最新版!
寶塔面板怎麼上傳原始碼
最近看到寶塔面板又更新了版本,看了下原始碼,都是用python寫的,我新手入門,於是想看看能不能破解掉收費!
檢視原始碼分析,基本上都是從遠端下載許可權資訊(以JSON檔案格式),還有就是檢測出本地快取檔案,但是面板重啟本地快取就會被重新整理,所以修改本地檔案就有點雞肋了。分析出雲端更新程式碼檔案在/www/server/panel/class
程式碼檔案在裡面的panelPlugin。py 因為使用到的功能主要是寶塔面板的外掛功能
這一段是關鍵程式碼:
#從雲端取列表
def get_cloud_list(self,get=None):
cacheKey = ‘plugin_soft_list’
softList = cache。get(cacheKey)
lcoalTmp = ‘data/plugin。json’
if not softList:
listTmp = public。readFile(lcoalTmp)
if listTmp: softList = json。loads(listTmp)
focre = 0
if hasattr(get,‘force’): focre = int(get。force)
if hasattr(get,‘cache’):
if cache。get(cacheKey+‘_list’): focre = 0;
if not softList or focre > 0:
cloudUrl = public。GetConfigValue(‘home’) + ‘/api/panel/get_soft_list’
import panelAuth
pdata = panelAuth。panelAuth()。create_serverid(None)
listTmp = public。httpPost(cloudUrl,pdata,10)
if len(listTmp) < 200:
listTmp = public。readFile(lcoalTmp)
softList = json。loads(listTmp)
if softList: public。writeFile(lcoalTmp,json。dumps(softList))
cache。set(cacheKey,softList,1800)
cache。set(cacheKey+‘_list’,1,1800)
public。ExecShell(‘rm -f /tmp/bmac_*’)
self。getCloudPHPExt(get)
try:
public。writeFile(“/tmp/” + cache。get(‘p_token’),str(softList[‘pro’]))
except:pass
sType = 0
if hasattr(get,‘type’): sType = int(get[‘type’])
softList[‘list’] = self。get_local_plugin(softList[‘list’])
softList[‘list’] = self。get_types(softList[‘list’],sType)
if hasattr(get,‘query’):
if get。query:
tmpList = []
for softInfo in softList[‘list’]:
if softInfo[‘name’]。find(get。query) != -1 or softInfo[‘title’]。find(get。query) != -1: tmpList。append(softInfo)
softList[‘list’] = tmpList
return softList
它就是從雲端獲取程式碼然後寫入本地檔案,所以我就直接在獲取程式碼以後更改就可以了,在這兩段中間增加三行程式碼!
softList = json。loads(listTmp)
softList[‘pro’] = 0
for i in softList[‘list’]:
i[‘endtime’] = 0
if softList: public。writeFile(lcoalTmp,json。dumps(softList))
重啟伺服器,完美解決!
吐槽下沒有格式排版真心醜爆的說~