Created
July 3, 2026 19:24
-
-
Save askrabal/93708aa88789473b914d22177b7c261b to your computer and use it in GitHub Desktop.
Random Ark Survival Ascended Tools
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # ARGCOMPLETE_OKAY | |
| import requests | |
| import re | |
| from argparse import ArgumentParser | |
| from datetime import datetime | |
| from threading import Event | |
| from signal import signal, SIGINT, SIGTERM | |
| from time import sleep | |
| try: | |
| from argcomplete import autocomplete | |
| except ImportError: | |
| def autocomplete(*_oargs, **_kwargs): | |
| pass | |
| url = "https://cdn2.arkdedicated.com/asa/officialserverstatus.ini" | |
| do_exit = Event() | |
| def get_asa_offical_version() -> str: | |
| try: | |
| response = requests.get(url, timeout=10) | |
| response.raise_for_status() | |
| # Search the entire text for the version pattern | |
| match = re.search(r'\(v(.*?)\)', response.text) | |
| return match.group(1) | |
| except Exception as e: | |
| print(f"Error: {e}", file=open(2, "w")) | |
| def quit(*_oargs, **_kwargs): | |
| do_exit.set() | |
| def main(m_args=None) -> int: | |
| stdout = open(1, "w") | |
| ap = ArgumentParser() | |
| mg = ap.add_mutually_exclusive_group() | |
| mg.add_argument("--print", action="store_true", help="Print current offical version") | |
| mg.add_argument("--wait", action="store_true", help="Wait the version to change") | |
| signal(SIGINT, quit) | |
| signal(SIGTERM, quit) | |
| args = ap.parse_args(m_args) | |
| if args.wait: | |
| stdout.write("\033[2J") | |
| stdout.flush() | |
| cur_ver = get_asa_offical_version() | |
| while not do_exit.is_set(): | |
| stdout.write("\033[H\033[K") | |
| stdout.flush() | |
| new_ver = get_asa_offical_version() | |
| if new_ver != cur_ver: | |
| print(f"Version changed from {cur_ver} to {new_ver}") | |
| break | |
| else: | |
| print(f"Version still {cur_ver} {datetime.now():%b %d %Y %H:%M:%S}") | |
| sleep(300) | |
| else: | |
| print(get_asa_offical_version()) | |
| return 0 | |
| if __name__ == "__main__": | |
| exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment