Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
420 views
in Technique[技术] by (71.8m points)

shell - need help in curl (BASH)

I found a script on the Internet that is login into account using cURL (checks if the password is correct or not) I tried run it and it didn't work, And I made some edits so that it works

#!/bin/bash
clear

read -p 'Username : ' user
read -p 'Password : ' pass

ig_sig="4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178"
header='Connection: "close", "Accept": "*/*", "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", "Cookie2": "$Version=1" "Accept-Language": "en-US", "User-Agent": "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"'
string8=$(cat /dev/urandom | tr -dc 'az0-9' | fold -w 8 | head -n 1)
string4=$(cat /dev/urandom | tr -dc 'az0-9' | fold -w 4 | head -n 1)
string12=$(cat /dev/urandom | tr -dc 'az0-9' | fold -w 12 | head -n 1)
string16=$(cat /dev/urandom | tr -dc 'az0-9' | fold -w 16 | head -n 1)
device="android-$string16"
uuid=$(cat /dev/urandom | tr -dc 'az0-9' | fold -w 32 | head -n 1)
phone="$string8-$string4-$string4-$string4-$string12"
guid="$string8-$string4-$string4-$string4-$string12"

x=1
while [ "$x" -ne "0" ]; do
var=$(curl -i -s -H "$header" "https://i.instagram.com/api/v1/si/fetch_headers/?challenge_type=signup&guid=$uuid" &> /dev/null)
x="$?"
done
var2=$(echo $var | awk -F ';' '{print $2}' | cut -d '=' -f3)


data='{"phone_id":"$phone", "_csrftoken":"$var2", "username":"'$user'", "guid":"$guid", "device_id":"$device", "password":"'$pass'", "login_attempt_count":"0"}'
ig_sig="4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178"
hmac=$(echo -n "$data" | openssl dgst -sha256 -hmac "${ig_sig}" | cut -d " " -f2)
printf "trying pass $pass 
"

x=1
while [ "$x" -ne "0" ]; do
        check=$(curl --socks5 127.0.0.1:9050 -d "ig_sig_key_version=4&signed_body=$hmac.$data" -s --user-agent 'User-Agent: "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"' -w "
%{http_code}
" -H "$header" "https://i.instagram.com/api/v1/accounts/login/")
        x="$?"
done

echo $check

But after I tried the script more than once, on the ninth or tenth time, it no longer worked and became giving me this output

{"message": "Please wait a few minutes before you try again.", "status": "fail"} 429

I waited half an hour, but nothing has changed and he is giving me this error until now and i heard someone say if I change the user agent and set up a new proxy it might work, but how do I do these thing

Any ideas for fixing this error and how can I make it work like before

question from:https://stackoverflow.com/questions/65641354/need-help-in-curl-bash

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...