| 1 | import re # Required by the function |
| 2 | import os # Required by the interface |
| 3 | |
| 4 | def find_gdps_endpoint(data: bytes): # Input data should be the bytes of the whole binary file ! |
| 5 | # DO NOT REMOVE THE FOLLOWING COMMENT |
| 6 | # THIS FUNCTION IS COPYRIGHTED UNDER MIT LICENSE BY HGSTYLE 2023-end of the time |
| 7 | # READ THE LICENSE AT: https://hgstyle.mit-license.org/ |
| 8 | # Get the URLs using a regex that I copy-pasted from Stack Overflow |
| 9 | result = re.findall(r"\w+://\w+\.\w+\.\w+/?[\w\.\?=#]*".encode(), data) |
| 10 | # Set the domains to exclude |
| 11 | domains_to_exclude = [ |
| 12 | b"robtopgames.com", # RobTop's website (used below the user icon on the main screen) |
| 13 | b"youtube.com", # YouTube (used to credit main levels tracks artists) |
| 14 | b"facebook.com", # Facebook (same as YouTube) |
| 15 | b"newgrounds.com", # Newgrounds (same as Youtube) |
| 16 | b"haxx.se", # Haxx group (they are the creators of cURL, the library used to send HTTP requests, unknown use in-game) |
| 17 | b"openssl.org", # OpenSSL (the OpenSSL project used to send (inexistant) secure HTTPS requests, unknown use in-game) |
| 18 | b"twitter.com", # Twitter (same as YouTube - wait actually it's now called X) |
| 19 | b"twitch.tv", # Twitch (same as YouTube) |
| 20 | b"apple.com", # Apple (used in the iOS version of Geometry Dash for some reason, unknown use in-game) |
| 21 | b"steampowered.com", # Steam (used too in the Steam version of Geometry Dash, unknown use in-game) |
| 22 | b"w3.org", # W3 group (they are the group that defines the web standarts, unknown use in-game) |
| 23 | b"cocos2d-x.org", # Cocos2d X (used in the settings help screen to credit the creators of the game engine used by Geometry Dash) |
| 24 | b"discord.gg", # Discord short links (I predict that there will be Discord links in GD 2.2) |
| 25 | b"discord.com", # Discord app (see Discord short links) |
| 26 | b"discordapp.com", # Discord app (see Discord short links) |
| 27 | b"discord.app", # Discord app (see Discord short links) |
| 28 | b"cocos.com", # Cocos (just in case the URL is updated in 2.2) |
| 29 | b"fmod.com", # FMOD (just in case GD 2.2 credits FMOD) |
| 30 | b"github.com", # GitHub (just in case GD 2.2 credits people or projects and gave their GitHub like in GDBrowser) |
| 31 | b"curl.se", # cURL (just in case the cURL link is updated in 2.2) |
| 32 | b"x.com", # X (just in case the link gets updated in 2.2 - old name Twitter) |
| 33 | b"geometrydash.com", # Exclued for now since it's completely useless right now, we'll see in 2.21 if it is usefull this time... |
| 34 | ] # EDIT: the game got updated to 2.2 (rn its 2.201) but i have dont want to look now to see if these domains are present |
| 35 | # Filter the links using the domain exclusion list |
| 36 | for domain in domains_to_exclude: |
| 37 | result = [url for url in result if domain not in url] |
| 38 | # Filter the links to remove the useless links to the files folder and the links to the "databas" folder |
| 39 | # with a typing error (this last one is unused) |
| 40 | urls = [url for url in result if not((b"/files" in url) or (b"/databas/" in url + b'/'))] |
| 41 | if not urls: # No match |
| 42 | return None |
| 43 | # Return the last URL of the list (since the last one is generaly more accruate than the first one), decode it and handle decoding errors by |
| 44 | # replacing undecodable characters by unicode 0xFFFD (official replacement character), then split to the first 0xFFFD character and keep only |
| 45 | # the first part of it, and finally removes the http:// and https:// schemes if one is present |
| 46 | return urls[-1].decode(errors="replace").split("\uFFFD")[0].replace('http://', '').replace('https://', '') |
| 47 | |
| 48 | if __name__ == "__main__": |
| 49 | print("TOOL CREATED BY HGSTYLE AND COPYRIGHTED UNDER MIT LICENSE 2023-end of time") |
| 50 | print("INFO ABOUT GD BINARY") |
| 51 | print("On Android, its the libcocos2dcpp.so") |
| 52 | print("On Windows, its the file ending by .exe (by default GeometryDash.exe)") |
| 53 | print("On MacOS and iOS, its the GeometryJump file") |
| 54 | print("On MacOS, make sure to NOT put the path of the .app file !") |
| 55 | print("It should be the path of the file called GeometryJump that you can find inside using tools like 7-zip.") |
| 56 | print("NOTE: It may work weirdly on GDPSes hosted on by FruitSpace") |
| 57 | while True: |
| 58 | path = input("Path to GD binary: ") |
| 59 | if os.path.exists(path): |
| 60 | print("Endpoint is", find_gdps_endpoint(open(path, 'rb').read())) |
| 61 |
HGStyle / GDPS endpoint finder
Last active 3 months ago
Finds the endpoint/server URL of any GDPS easily