吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 51498|回复: 255
收起左侧

[调试逆向] 针对PanDownload插件的一次修改——新手

    [复制链接]
Fiverya 发表于 2019-10-25 19:53
前两天在论坛上下载了一个pandownload 的插件集合(可自行搜索),用起来非常方便,在此首先感谢各位大佬~~

如图所示:

image.png


进入正题

今天我打开用的时候,发现有一个插件挂了???我刚下载就挂了?

image.png

于是我决定学一学lua,自己调试一下。

首先打开pandownload的日志文件,发现一堆“no  href..”,然后打开lua脚本,找到了这个输出。

image.png

那么就可以知道是这个 onSearch函数中出了问题。

推断里边的local 应该是定义变量的字段,String.find()函数可以返回find的字符串的首末位置。



image.png

F12打开网页可以发现这个con是列表的div,也就是说接下来while里边的find是从<div id="con">后边开始进行匹配的,我把这行删除了运行发现会报错,因为在<div id="con">的前边也会有<a href="(.-)"这些东西。

那么现在就很清晰了,就是while里边的string.find这里出了问题。

打开网站F12调试一下。

image.png

在这里可以获取到服务器返回的data。

也可以在lua文件中加上pd.logInfo("data is "..data)来查看返回的data。

原来插件中的函数:

p_start,p_end,href,title,fileSize,sharer,time=string.find(data,'<a href="(.-)" .-<div class="des">文件名:(.-) , 文件大小:(.-) , 分享者:(.-) , 分享时间:(.-) ,',start)

获取到的data格式:

<div id="con"><a href="/f/835895/" id="pss-bce27c48"><div class="pss"><h2>泰迦奥特曼.2019</h2><div class="des">文件大小:1KB , 分享者:殇**花落 , 分享时间:2019-09-03 , 浏览次数:1 次</div></div>

可以明显看到data格式发生了变化,改它就完事了。

修改后的函数为


p_start,p_end,href,title,fileSize,sharer,time=string.find(data,'<a href="(.-)" .-<div class="pss"><h2>(.-)</h2><div class="des">文件大小:(.-) , 分享者:(.-) , 分享时间:(.-) , 浏览',start)
保存,运行即可
image.png

       
以后也可以尝试自己写一个完整的插件出来
       



免费评分

参与人数 83威望 +1 吾爱币 +71 热心值 +74 收起 理由
叁拾 + 1 谢谢@Thanks!
gaoleicao + 1 + 1 我很赞同!
Cortsin丶 + 1 + 1 我很赞同!
lhxuwen + 1 + 1 我很赞同!
静谧阳光 + 1 + 1 &amp;lt;font style=&amp;quot;vertical-align: inherit;&amp;quot;&amp;gt;&amp;lt;font style=
mln666 + 1 我很赞同!
cactusli + 1 + 1 鼓励转贴优秀软件安全工具和文档!
蹦极不拴绳 + 1 + 1 我很赞同!
收敛又发散 + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
祇桐 + 1 我很赞同!
zzx2006 + 1 我很赞同!
1751816011 + 1 大神加油
xppliang + 1 + 1 谢谢@Thanks!
pltczw666 + 1 谢谢@Thanks!
云破日出 + 1 我很赞同!
穿越之光 + 1 我很赞同!
acg + 1 + 1 热心回复!要研究这个,需要学习什么语言?
youkiey + 1 我很赞同!
mb8315 + 1 + 1 我很赞同!
ccc1215325 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
Wanior + 1 热心回复!
StoneWall + 1 + 1 我很赞同!
柳泉鸣 + 1 + 1 谢谢@Thanks!
银弹罐子哥 + 1 我很赞同!
fengcj + 1 热心回复!
Alphabet_666 + 1 我很赞同!
Pandain7 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
ttd_2001 + 1 + 1 我很赞同!
tishenxian + 1 热心回复!
dreamlivemeng + 1 + 1 热心回复!
weiweilili + 1 我很赞同!
desvlaslo + 1 + 1 谢谢@Thanks!
z777 + 1 我很赞同!
墨语安言 + 1 用心讨论,共获提升!
bapi + 1 + 1 热心回复!
lookerJ + 1 热心回复!
Dream_kirin + 1 + 1 用心讨论,共获提升!
Vicar5235 + 1 + 1 我很赞同!
lyslxx + 1 + 1 我很赞同!
邪天冥 + 1 + 1 我很赞同!
爱偷油的小猪 + 1 + 1 我很赞同!
shhh520 + 1 + 1 Pandownload看起来有希望了,大神们都快显灵吧。
vethenc + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
Esirn + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
对影三人 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
2019upup + 1 + 1 新手就这么厉害?哈哈
yjdh3344 + 1 热心回复!
shaohailon + 1 + 1 鼓励转贴优秀软件安全工具和文档!
龙月蓉 + 1 + 1 谢谢@Thanks!
乌宗 + 1 + 1 用心讨论,共获提升!
ydydq + 1 + 1 我很赞同!
xiaolj + 1 热心回复!
wuaicris + 1 我很赞同!
911061873 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
Goice + 1 谢谢@Thanks!
爱情避风港a + 1 + 1 用心讨论,共获提升!
YG阳光YG + 1 + 1 谢谢@Thanks!
righter + 1 + 1 我很赞同!
javafu159357 + 1 + 1 谢谢@Thanks分享了劳动成果很棒!
smile5 + 1 + 1 用心讨论,共获提升!
沧海笑笑 + 1 + 1 请问pandownload 的插件用的是脚本语言吧?从哪学起?
zvi8 + 1 + 1 我很赞同!
我惠画中仙 + 1 + 1 热心回复!
monsterbaby521 + 1 热心回复!
2623666 + 1 谢谢@Thanks!
Hmily + 1 + 7 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
Vlains + 1 + 1 谢谢@Thanks!
cyc1307 + 1 + 1 谢谢@Thanks!
fenggegang + 1 + 1 谢谢@Thanks!
椎名牧 + 1 + 1 用心讨论,共获提升!
Kings_jk + 1 良心
moranyuyan + 1 + 1 我很赞同!
与月亮说晚安 + 1 + 1 我很赞同!
mu13064998876 + 1 + 1 热心回复!
Ashamed + 1 + 1 用心讨论,共获提升!
lauleegoo + 1 + 1 用心讨论,共获提升!
liyonglan + 1 + 1 我很赞同!
Yoona1 + 1 用心讨论,共获提升!
猪猪怪 + 1 + 1 我很赞同!
吃兔子de胡萝卜 + 1 + 1 用心讨论,共获提升!
绝世仙尊 + 1 + 1 用心讨论,共获提升!
manhuabashenan + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
我的盘由我做主 + 1 + 1 前来支持学习!!!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| Fiverya 发表于 2019-10-27 10:05
绿叶红花 发表于 2019-10-25 20:01
不错。要是能分享修改后成果就更好了

[Lua] 纯文本查看 复制代码
local curl = require "lcurl.safe"
local json = require "cjson.safe"


script_info = {
	["title"] = "盘搜搜1",
	["version"] = "0.0.1",
	["description"] = "http://m.pansoso.com",
}

function request(args)

	local cookie = args.cookie or ""
	local referer = args.referer or ""
	local acceptEncoding = args.acceptEncoding or ""
	--pd.logInfo("the cccc..:"..cookie)
	local header = args.header or {"User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Mobile Safari/537.36","Cookie: "..cookie,"Referer: "..referer,"Accept-Encoding"..acceptEncoding}
	--pd.logInfo("header cookie:"..header[2])
	local method = args.method or "GET"
	local para = args.para
	local url = args.url
	local data = ""

	local c = curl.easy{
		url = url,
		ssl_verifyhost = 0,
		ssl_verifypeer = 0,
		accept_encoding = "gzip",
		timeout = 15,
		proxy = pd.getProxy(),
	}


	if para ~= nil then
		c:setopt(curl.OPT_POST, 1)
		c:setopt(curl.OPT_POSTFIELDS, para)
	end

	if header ~= nil then
		c:setopt(curl.OPT_HTTPHEADER, header)
	end

	if method == "HEAD" then
		c:setopt(curl.OPT_NOBODY, 1)
		--c:setopt(curl.OPT_FOLLOWLOCATION, 1)
		c:setopt(curl.OPT_HEADERFUNCTION, function(h)
			data = data .. h
		end)
	else
		c:setopt(curl.OPT_WRITEFUNCTION, function(buffer)
			data = data .. buffer
			return #buffer
		end)
	end

	local _, err = c:perform()
	if err == nil and method == "HEAD" then
		--data = c:getinfo(curl.INFO_EFFECTIVE_URL)
	end
	c:close()

	if err then
		return nil, tostring(err)
	else
		return data, nil
	end



end

function onSearch(key,page)
	local url = "http://m.pansoso.com/zh/"..pd.urlEncode(key).."_"..page
	local result = {}
	local start = 1
	local p_start,p_end,title,href,sharer,time,description
	local data = request({url=url})
	--pd.logInfo("data is "..data)
	p_start,start = string.find(data,'<div id="con">')
	pd.logInfo("p_start is  "..p_start)
	pd.logInfo("start is  "..start)

	while true do
		--p_start,p_end,href,title,fileSize,sharer,time=string.find(data,'<a href="(.-)" .-<div class="pss"><h2>(.-)</h2><div class="des"> 文件大小:(.-) , 分享者:(.-) , 分享时间:(.-) ,',start)
		p_start,p_end,href,title,fileSize,sharer,time=string.find(data,'<a href="(.-)" .-<div class="pss"><h2>(.-)</h2><div class="des">文件大小:(.-) , 分享者:(.-) , 分享时间:(.-) , 浏览',start)
		--pd.logInfo("href is  "..href)
		if not href then
			pd.logInfo("no href:..")
			break
		end


		href = "http://m.pansoso.com"..href
		local tooltip = string.gsub(title, key, "%1")
		title = string.gsub(title,key, "{c #ff0000}%1{/c}")
		description = "文件大小:"..fileSize.."  ".."分享者:"..sharer

		--pd.logInfo("title:.."..title)
		table.insert(result,{["href"]=href, ["title"]=title, ["time"]=time, ["showhtml"] = "true", ["tooltip"] = tooltip, ["description"] = description})

		start = p_end + 1

	end

	return result
end

function onItemClick(item)
	local url = getUrl(item.href)
	if url then
		return ACT_SHARELINK,url
	else
		return ACT_ERROR,"获取链接失败"
	end

end

function getUrl(href)
	--pd.logInfo(href)
	local data = request({url=href})
	local baiduPan_url,url,p_start,p_end
	--pd.logInfo("data:"..data)
	p_start,p_end,url = string.find(data,'id="down_button_link".-href="(.-)"')
	--pd.logInfo("url:"..url)
	if url then
		data = request({url=url,referer=href})
		p_start,p_end,url = string.find(data,'')
		url = "http://to.pansoso.com/"..url
		-- <a rel="noreferrer external nofollow" href="http://to.pansoso.com/?url=/sH%2B3Bhh4Zf31%2BDdACzW9lEj0rO71My2yKLmhVVv7I7%2B3P6GGHbhiPfJ4MgAcNb2UWLSo7vXzMjI9uaFVUDsuv7C/ukYWuGh9/Pg3wB71pRRHNKiu%2BLM3Mio5pJVVw==&a=f4ZsK
		--:<a rel="noreferrer external nofollow" class="btn-download" target="_self" id="ceef3a87" >
		--pd.logInfo("url:"..url)
		if url then
			p_start,p_end,baiduPan_url = string.find(request({url=url,method="HEAD"}),"Location:(.-)\n")
			--pd.logInfo("baiduPan_url:"..baiduPan_url)
		end

	end
	--pd.logInfo("baiduPan_url:"..baiduPan_url)
	return baiduPan_url
end

993113 发表于 2019-10-25 21:13
今天发现PD网页版用不了啦,也不知是咋回事。好担心
绿叶红花 发表于 2019-10-25 20:01
玥璺 发表于 2019-10-25 20:00
虽然看不懂,但还是给个666吧!
manhuabashenan 发表于 2019-10-25 19:55
牛批!学习了!感谢大神分享!
alicematic731 发表于 2019-10-25 20:04
这个学习精神值得正赞!学习!
zhuyouyou 发表于 2019-10-25 20:05
好东西,谢谢分享,学习学习!
数据摧毁 发表于 2019-10-25 20:18

牛批!学习了!感谢大神分享!
132DMH 发表于 2019-10-25 20:34
牛批,学习了,感谢大佬分享
猪猪怪 发表于 2019-10-25 20:36
i only can see
dxlxh20150521 发表于 2019-10-25 20:41
牛批!学习了!感谢大神分享!
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-25 08:09

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表