-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from redlib-org/improve_spoofing
Improve spoofing
- Loading branch information
Showing
11 changed files
with
426 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/bin/bash | ||
|
||
# Requirements | ||
# - curl | ||
# - rg | ||
# - jq | ||
|
||
# Fetch iOS app versions | ||
ios_version_list=$(curl -s "https://ipaarchive.com/app/usa/1064216828" | rg "(20\d{2}\.\d+.\d+) / (\d+)" --only-matching -r "Version \$1/Build \$2" | sort | uniq) | ||
|
||
# Count the number of lines in the version list | ||
ios_app_count=$(echo "$ios_version_list" | wc -l) | ||
|
||
echo -e "Fetching \e[34m$ios_app_count iOS app versions...\e[0m" | ||
|
||
|
||
# Specify the filename as a variable | ||
filename="src/oauth_resources.rs" | ||
|
||
# Add comment that it is user generated | ||
echo "// This file was generated by scripts/update_oauth_resources.sh" >> "$filename" | ||
echo "// Rerun scripts/update_oauth_resources.sh to update this file" >> "$filename" | ||
echo "// Please do not edit manually" >> "$filename" | ||
echo "// Filled in with real app versions" >> "$filename" | ||
|
||
# Open the array in the source file | ||
echo "pub static IOS_APP_VERSION_LIST: &[&str; $ios_app_count] = &[" >> "$filename" | ||
|
||
|
||
# Append the version list to the source file | ||
echo "$ios_version_list" | while IFS= read -r line; do | ||
echo " \"$line\"," >> "$filename" | ||
echo -e "Fetched \e[34m$line\e[0m." | ||
done | ||
|
||
# Close the array in the source file | ||
echo "];" >> "$filename" | ||
|
||
# Fetch Android app versions | ||
page_1=$(curl -s "https://apkcombo.com/reddit/com.reddit.frontpage/old-versions/" | rg "<a class=\"ver-item\" href=\"(/reddit/com\.reddit\.frontpage/download/phone-20\d{2}\.\d+\.\d+-apk)\" rel=\"nofollow\">" -r "https://apkcombo.com\$1" | sort | uniq) | ||
# Append with pages | ||
page_2=$(curl -s "https://apkcombo.com/reddit/com.reddit.frontpage/old-versions?page=2" | rg "<a class=\"ver-item\" href=\"(/reddit/com\.reddit\.frontpage/download/phone-20\d{2}\.\d+\.\d+-apk)\" rel=\"nofollow\">" -r "https://apkcombo.com\$1" | sort | uniq) | ||
page_3=$(curl -s "https://apkcombo.com/reddit/com.reddit.frontpage/old-versions?page=3" | rg "<a class=\"ver-item\" href=\"(/reddit/com\.reddit\.frontpage/download/phone-20\d{2}\.\d+\.\d+-apk)\" rel=\"nofollow\">" -r "https://apkcombo.com\$1" | sort | uniq) | ||
page_4=$(curl -s "https://apkcombo.com/reddit/com.reddit.frontpage/old-versions?page=4" | rg "<a class=\"ver-item\" href=\"(/reddit/com\.reddit\.frontpage/download/phone-20\d{2}\.\d+\.\d+-apk)\" rel=\"nofollow\">" -r "https://apkcombo.com\$1" | sort | uniq) | ||
page_5=$(curl -s "https://apkcombo.com/reddit/com.reddit.frontpage/old-versions?page=5" | rg "<a class=\"ver-item\" href=\"(/reddit/com\.reddit\.frontpage/download/phone-20\d{2}\.\d+\.\d+-apk)\" rel=\"nofollow\">" -r "https://apkcombo.com\$1" | sort | uniq) | ||
|
||
# Concatenate all pages | ||
versions="${page_1}" | ||
versions+=$'\n' | ||
versions+="${page_2}" | ||
versions+=$'\n' | ||
versions+="${page_3}" | ||
versions+=$'\n' | ||
versions+="${page_4}" | ||
versions+=$'\n' | ||
versions+="${page_5}" | ||
|
||
# Count the number of lines in the version list | ||
android_count=$(echo "$versions" | wc -l) | ||
|
||
echo -e "Fetching \e[32m$android_count Android app versions...\e[0m" | ||
|
||
# Append to the source file | ||
echo "pub static ANDROID_APP_VERSION_LIST: &[&str; $android_count] = &[" >> "$filename" | ||
|
||
# For each in versions, curl the page and extract the build number | ||
echo "$versions" | while IFS= read -r line; do | ||
fetch_page=$(curl -s "$line") | ||
build=$(echo "$fetch_page" | rg "<span class=\"vercode\">\((\d+)\)</span>" --only-matching -r "\$1" | head -n1) | ||
version=$(echo "$fetch_page" | rg "<span class=\"vername\">Reddit (20\d{2}\.\d+\.\d+)</span>" --only-matching -r "\$1" | head -n1) | ||
echo " \"Version $version/Build $build\"," >> "$filename" | ||
echo -e "Fetched \e[32mVersion $version/Build $build\e[0m" | ||
done | ||
|
||
# Close the array in the source file | ||
echo "];" >> "$filename" | ||
|
||
# Retrieve iOS versions | ||
table=$(curl -s "https://en.wikipedia.org/w/api.php?action=parse&page=IOS_17&prop=wikitext§ion=31&format=json" | jq ".parse.wikitext.\"*\"" | rg "(17\.[\d\.]*)\\\n\|(\w*)\\\n\|" --only-matching -r "Version \$1 (Build \$2)") | ||
|
||
# Count the number of lines in the version list | ||
ios_count=$(echo "$table" | wc -l) | ||
|
||
echo -e "Fetching \e[34m$ios_count iOS versions...\e[0m" | ||
|
||
# Append to the source file | ||
echo "pub static IOS_OS_VERSION_LIST: &[&str; $ios_count] = &[" >> "$filename" | ||
|
||
# For each in versions, curl the page and extract the build number | ||
echo "$table" | while IFS= read -r line; do | ||
echo " \"$line\"," >> "$filename" | ||
echo -e "Fetched $line\e[0m" | ||
done | ||
|
||
# Close the array in the source file | ||
echo "];" >> "$filename" | ||
|
||
echo -e "\e[34mRetrieved $ios_app_count iOS app versions.\e[0m" | ||
echo -e "\e[32mRetrieved $android_count Android app versions.\e[0m" | ||
echo -e "\e[34mRetrieved $ios_count iOS versions.\e[0m" | ||
|
||
echo -e "\e[34mTotal: $((ios_app_count + android_count + ios_count))\e[0m" | ||
|
||
echo -e "\e[32mSuccess!\e[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.