Skip to content

Instantly share code, notes, and snippets.

@LFriede
Last active May 25, 2024 23:51
Show Gist options
  • Save LFriede/3d4cde1bfdb211db4896a0a8b890660b to your computer and use it in GitHub Desktop.
Save LFriede/3d4cde1bfdb211db4896a0a8b890660b to your computer and use it in GitHub Desktop.
How to trick "Qt Maintenance Tool" to install old versions

How to trick "Qt Maintenance Tool" to install old versions

tl;dr

Use a software like mitmproxy to modify the (https)-request to iapi.qt.io/api/v2/repositories so it's response lists the old Qt directorys that are still on the servers.

If you never used mitmproxy before here is the guide that shows you how it's done.

why?

This guide was written because I've written a plugin for x64dbg and wanted to build it with the same Qt version (5.6.x) that was used to build the official x64dbg releases. Just to be sure that everything is compatible.

But since Qt 5.6 is not supported anymore it disappeared from the Qt Maintenance Tool. You can still download Qt 5.6 installers from the official Website, but those are seperate x86 and x64 installers. It's not possible to install both in the same directory, so it's not possible to have one instance of Qt Creator installed with x86 and x64 toolchain.

At this point I already googled a lot, lost some hairs and bitten my desk.

how?

Install mitmproxy and run the webinterface gui. Since we need to modify https traffic, we need to install a cert. Mitmproxy makes it very easy. Just open a webbrowser and configure it to use 127.0.0.1:8080 (default) as http-proxy. Then open http://mitm.it in it to download the cert. Windows will open an installation dialog if you try to open the cert file, just leave all settings as they are, enter no passwort and click though the wizard.

Start the Qt Maintenance Tool now, if you haven't installed Qt Creator yet you can use the following method on the Qt web installer as well. If you're using a VirtualBox guest for your build environment make sure that you activated 3D acceleration because Qt Creator needs OpenGL.

We want mitmproxy to intercept a request, to do this we can just paste the regex iapi\.qt\.io\/api\/v2\/repositories.+ to the form field with the pause symbol.

intercept.png

Click on the "Settings" button to make the maintenance tool or online installer use mitmproxy as proxy. Login with your credentials and click next. The installer should hang while showing Fetching repositorys..., on mitmproxy you should see an orange highlighted request with a pause symbol. Click on the Resume button on the Flow tab. This will send the reqeust to the server and pause again on the response. If it paused on the response click on the pencil symbol on the Response tab.

edit.png

Now I added the following snippet to the json response, you can copy&paste the response to https://beautifier.io to autoindent the json for easier editing.

{
    "action": "add",
    "categories": ["Latest releases", "Archive"],
    "name": "Qt Windows-x86 Desktop Qt5.6.3 online repository",
    "releasedate": "2017-06-30T11:00:00.000Z",
    "url": "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_563"
}, {
    "action": "add",
    "categories": ["Latest releases", "Archive"],
    "name": "Qt Windows-x86 Qt5.6.3 src online repository",
    "releasedate": "2017-06-30T11:00:00.000Z",
    "url": "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_563_src_doc_examples"
},

I just copied the entrys of Qt version 5.9.1 and edited the path to the 5.6.3 release, I also edited the name. You can open http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/ in your webbrowser to see all available directories. Note that I added "Latest releases" on the line "categories": ["Latest releases", "Archive"], to the categories, so it will be shown without setting a filter in the installer, but thats optional.

Click the "finish edit" symbol in the upper right corner and hit Resume agian. Click on Packet manager in the maintenance tool, now you should be able to install your favourite packages.

success.png

@mossypy
Copy link

mossypy commented Oct 7, 2022

    {
        "action": "add",
        "categories": ["Latest releases", "Archive"],
        "name": "Qt Windows-x86 Desktop Qt5.15.1 online repository",
        "releasedate": "2017-06-30T11:00:00.000Z",
        "url": "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5151/"
    }, {
        "action": "add",
        "categories": ["Latest releases", "Archive"],
        "name": "Qt Windows-x86 Qt5.15.1 src online repository",
        "releasedate": "2017-06-30T11:00:00.000Z",
        "url": "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5151_src_doc_examples/"
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment