Added automatic offset updater

Offsets from https://github.com/a2x/cs2-dumper
This commit is contained in:
IMXNOOBX
2023-10-14 17:38:14 +02:00
parent bf47b43561
commit dcf86b1e23
3 changed files with 87 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
name: Update Offsets
on:
schedule:
- cron: '0 * * * *' # Runs every hour
jobs:
update_offsets:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install requests
shell: bash
- name: Run Python Script
id: run-python-script
run: |
python ./offsets/update_offsets.py
continue-on-error: true
- name: Check Python Script Exit Code
if: steps.run-python-script.outcome == 'failure'
run: |
echo "Repository has no updates"
exit 0
- name: Commit and push changes
if: steps.run-python-script.outcome == 'success'
run: |
git config --global user.email ${{ secrets.GIT_USER_EMAIL }}
git config --global user.name ${{ secrets.GIT_USER_NAME }}
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add offsets/offsets.json
git commit -m "Automatically updated offsets from https://github.com/a2x/cs2-dumper"
git push
shell: bash
+1
View File
@@ -58,6 +58,7 @@ Simple external esp using gdi overlay to render esp boxes on top of cs2 highligh
## 💫 Credits ## 💫 Credits
* [UnnamedZ03](https://github.com/UnnamedZ03) for providing [offsets](https://www.unknowncheats.me/forum/3846642-post734.html) and guide with his [CS2-external-base](https://github.com/UnnamedZ03/CS2-external-base) * [UnnamedZ03](https://github.com/UnnamedZ03) for providing [offsets](https://www.unknowncheats.me/forum/3846642-post734.html) and guide with his [CS2-external-base](https://github.com/UnnamedZ03/CS2-external-base)
* [a2x](https://github.com/a2x) for his [offset dumper](https://github.com/a2x/cs2-dumper) and constant updates to it
* [Bekston](https://github.com/Bekston) for his [contributions](https://github.com/IMXNOOBX/cs2-external-esp/pull/20) to the project and ideas * [Bekston](https://github.com/Bekston) for his [contributions](https://github.com/IMXNOOBX/cs2-external-esp/pull/20) to the project and ideas
* [Apxaey](https://github.com/Apxaey) for releasing an easy way to implement [handle hijacking](https://github.com/Apxaey/Handle-Hijacking-Anti-Cheat-Bypass) * [Apxaey](https://github.com/Apxaey) for releasing an easy way to implement [handle hijacking](https://github.com/Apxaey/Handle-Hijacking-Anti-Cheat-Bypass)
* Unknowncheats comunity for their reseach! * Unknowncheats comunity for their reseach!
+39
View File
@@ -0,0 +1,39 @@
import sys
import requests
import json
source_url = "https://github.com/a2x/cs2-dumper/raw/main/generated/offsets.json"
commits_url = "https://api.github.com/repos/a2x/cs2-dumper/commits"
dest_path = "./offsets/offsets.json"
# Fetch the source JSON
source_response = requests.get(source_url)
source_data = source_response.json()
# Fetch build Number
response = requests.get(commits_url)
build_number = 0
if response.status_code == 200:
commit_data = response.json()
if commit_data:
last_commit_message = commit_data[0]['commit']['message']
build_number = last_commit_message.split()[-1]
with open(dest_path, 'r') as dest_file:
dest_data = json.load(dest_file)
if dest_data["build_number"] == int(build_number):
print("There are no updates in the remote reposioty")
sys.exit(1) # Exit so we know that there hasnt been any updates and the current offsets are up to date
dest_data["build_number"] = int(build_number)
dest_data["dwBuildNumber"] = source_data["engine2_dll"]["dwBuildNumber"]
dest_data["dwLocalPlayer"] = source_data["client_dll"]["dwLocalPlayerPawn"]
dest_data["dwEntityList"] = source_data["client_dll"]["dwEntityList"]
dest_data["dwViewMatrix"] = source_data["client_dll"]["dwViewMatrix"]
with open(dest_path, 'w') as dest_file:
json.dump(dest_data, dest_file, indent=4)
print("Offsets updated in the local file.") # We dont exit so we know that the game has been updated and that we have to commit the new offsets