在linux系统中使用shell进行抓包与访问
curl的使用
·
———————————————————————————————————
- 在Linux系统中可以使用curl工具进行抓包,获取cookie,发送请求等操作
以下代码仅是学习记录
Name=`echo '姓名' | tr -d '\n' | xxd -plain | sed 's/\(..\)/%\1/g'`
Id=编号
#保存detail
detail=userName=$Name&userId=$Id
curl -X POST -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -d 'userName='"${Name}"'&userId='"${Id}"'' -i "http://qndxx.bestcood.com/mp/WeixinAuth/LoginByUser2.html" > /root/QNdaxuexi/respondheader.txt
#假如登录成功
grep Set-Cookie:.* /root/QNdaxuexi/respondheader.txt > /root/QNdaxuexi/setcookie.txt
sed 's/ /\n/g' /root/QNdaxuexi/respondheader.txt > /root/QNdaxuexi/sed0.txt
sed 's/;/\n/g' /root/QNdaxuexi/sed0.txt > /root/QNdaxuexi/sed.txt
grep SSUUID /root/QNdaxuexi/sed.txt > /root/QNdaxuexi/cookie.txt
ck=`cat /root/QNdaxuexi/cookie.txt`
#ck=/root/QNdaxuexi/cookie.txt
curl -X GET -H "Cookie: $ck " 'http://qndxx.bestcood.com/nanning/daxuexi/' > /root/QNdaxuexi/html.txt
grep \{\"isLe.*\} /root/QNdaxuexi/html.txt > /root/QNdaxuexi/learndata.txt
sed 's/ var learnData = /\n/g' /root/QNdaxuexi/learndata.txt > /root/QNdaxuexi/sed1.txt
sed 's/;/\n/g' /root/QNdaxuexi/sed1.txt > /root/QNdaxuexi/sed2.txt
grep . /root/QNdaxuexi/sed2.txt > /root/QNdaxuexi/cidian.json
#获取季次
sed 's/"title":"/\n/g' /root/QNdaxuexi/cidian.json > /root/QNdaxuexi/sed3.txt
sed 's/"/\n/g' /root/QNdaxuexi/sed3.txt > /root/QNdaxuexi/sed4.txt
grep 第.*季 /root/QNdaxuexi/sed4.txt > /root/QNdaxuexi/ji.txt
grep 第.*期 /root/QNdaxuexi/sed4.txt > /root/QNdaxuexi/qi.txt
grep :[0-9]*, /root/QNdaxuexi/sed4.txt > /root/QNdaxuexi/grep.txt
sed 's/:/\n/g' /root/QNdaxuexi/grep.txt > /root/QNdaxuexi/sed5.txt
sed 's/,/\n/g' /root/QNdaxuexi/sed5.txt > /root/QNdaxuexi/sed6.txt
grep [0-9] /root/QNdaxuexi/sed6.txt | head -n 1 > /root/QNdaxuexi/id.txt
ji=`cat /root/QNdaxuexi/ji.txt`
qi=`cat /root/QNdaxuexi/qi.txt`
id=`cat /root/QNdaxuexi/id.txt`
#echo $ji
#echo $qi
#echo $id
############
curl -X POST -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Cookie: $ck " -d 'id='"${id}"'' -i "http://qndxx.bestcood.com/mp/gx/DaXueXi/LearnHit.html" > /root/QNdaxuexi/respondbody.txt
curl -i "http://dxxoss.wwwtop.top/dxx_data.js" > /root/QNdaxuexi/respondbody2.txt
grep \{.*\} /root/QNdaxuexi/respondbody2.txt > /root/QNdaxuexi/grep2.txt
sed 's/,/\n/g' /root/QNdaxuexi/grep2.txt > /root/QNdaxuexi/sed7.txt
grep "ji" /root/QNdaxuexi/sed7.txt > /root/QNdaxuexi/grep3.txt
grep "qi" /root/QNdaxuexi/sed7.txt > /root/QNdaxuexi/grep4.txt
sed 's/:/\n/g' /root/QNdaxuexi/grep3.txt > /root/QNdaxuexi/sed8.txt
sed 's/:/\n/g' /root/QNdaxuexi/grep4.txt > /root/QNdaxuexi/sed9.txt
grep [0-9] /root/QNdaxuexi/sed8.txt > /root/QNdaxuexi/ji1.txt
grep [0-9] /root/QNdaxuexi/sed9.txt > /root/QNdaxuexi/qi1.txt
ji1=`cat /root/QNdaxuexi/ji1.txt`
qi1=`cat /root/QNdaxuexi/qi1.txt`
curl -i 'https://dxx.wwwtop.top/dxx_finish?a=${ji1}&b=${qi1}' > /root/QNdaxuexi/finish.txt
更多推荐
已为社区贡献1条内容
所有评论(0)