在linux系统中使用shell进行抓包与访问

———————————————————————————————————

  • 在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
  • 5
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值