Help your friends to like - capture packets and use shell scripts to send HTTP requests in batches

demand analysis

I have a friend who thinks that his hand hurts when he likes with his hands, and wants me to like him with technical means.

This requirement is very simple, the following provides specific ideas:

Technical points

First of all, let’s analyze the first way to think of the above scene.

Going to like a webpage must trigger an HTTP request. We only need to use the packet capture tool to capture the HTTP request, and simulate an identical request to the server to complete a like operation.

How to capture packets (HTTP request packets)

In fact, you can use the developer tools that come with Google Chrome. As shown below:

insert image description here
After clicking, you can get a series of messages in Curl format.

Let's analyze this string of messages first, import the curl into postman, and you can see the details of the request:

Open your postman:

insert image description here
insert image description here
This will allow you to see the details of the request. You can tamper with the send parameters and so on according to your preferences

solution

Send the request using a shell script:

It's easier to get to this point. Find a Linux server that can be connected to the Internet, and write a series of scripts, paste the previously copied curl parameters into the script:

MyShell.sh


count=1
step=1
while [ true ]  #比较必须用 -le;-eq 等等
do

   count=$(($count+$step))

   curl 'https://xxxx/xxx/xx' \
  -H 'Connection: keep-alive' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'sec-ch-ua-mobile: ?1' \
  -H 'User-Agent:  (KHTML, li' \
  -H 'sec-ch-ua-platform: "Android"' \
  -H 'Origin: https://xxxxxxxx.com.cn' \
  -H 'Sec-Fetch-Site: same-site' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: https://xxxxxxxxxxx.cn/' \
  -H 'Accept-Language: zh-CN,zh;q=0.9' \
  -H 'Cookie: ' \
  --data-raw 'share=0&photn=1' \
  --compressed
 

   echo -E "已经发送 $count 次http请求,点赞了$count 次!" >> "sendingLog.txt"
done

Finally execute the command:nohup sh MyShell.sh &

If you want, you can open multiple threads to loop the call.

postscript

This article is only for related technical discussion, please do not apply maliciously. In fact, the technical content is not complicated, just use curl to simulate HTTP request and send it with shell script. The code is above, you can refer to similar scenarios.

Guess you like

Origin blog.csdn.net/weixin_44757863/article/details/123582883