Skip to content

Instantly share code, notes, and snippets.

@glibg10b
Created December 15, 2023 11:48
Show Gist options
  • Save glibg10b/26586d9885defa99754c6a07f5c77b3b to your computer and use it in GitHub Desktop.
Save glibg10b/26586d9885defa99754c6a07f5c77b3b to your computer and use it in GitHub Desktop.
Access hidden Huawei router settings

Huawei reuses the same interface for many of their routers, but chooses to hide some features. Some of these may not be supported by the hardware, but others may work fine.

The features are hidden using the HTML hidden attribute. To turn this attribute off for all elements on a page, open your browser's dev tools and type $('#*').show() into the console.

On my B315, this allows me to change the DNS server addresses sent via DHCP:

image

@lolmam
Copy link

lolmam commented Mar 23, 2024

i tried it on Huawei B530-936, but i just get an error in the console:

Uncaught DOMException: Failed to execute '$' on 'CommandLineAPI': '#*' is not a valid selector.

also i tried another command : $('#dhcp_dns').show(); but this also gives an error:

Uncaught TypeError: Cannot read properties of null (reading 'show')

i'm trying to set a custom dns on my router, but i lack the JavaScript knowledge to dig deeper and make it happen.

@glibg10b
Copy link
Author

@lolmam My JavaScript knowledge is close to zero, but I suspect your router's login page doesn't use jQuery. This should work without it:

document.querySelectorAll('*').forEach(element => {
    element.style.display = 'block';
});

@lolmam
Copy link

lolmam commented Mar 25, 2024

thanks for replying. i tried it and it gave "undefined" in the console.

also the whole page layout went crazy, look at the attached picture:
Capture2

@glibg10b
Copy link
Author

Can you try this?

document.querySelectorAll('[id]').forEach(element => {
    if (window.getComputedStyle(element).display === 'none') {
        element.style.display = 'block';
    }
});

@CryptDNS
Copy link

Hi
Please help me it doesn't show me anything
Huawei B5318-42
Capture

@glibg10b
Copy link
Author

@CryptDNS Please look at the comment above yours

@CryptDNS
Copy link

CryptDNS commented Mar 27, 2024

@CryptDNS Please look at the comment above yours

@glibg10b Hey, you
It didn't work either

document.querySelectorAll('[id]').forEach(element => { if (window.getComputedStyle(element).display === 'none') { element.style.display = 'block'; } });

@CryptDNS
Copy link

Capture

@glibg10b
Copy link
Author

@CryptDNS I can't think of anything else to try, unfortunately. Maybe the newer interface adds and removes elements instead of hiding and unhiding them. Accessing hidden settings in that case would require some reverse engineering, which I can't do without having access to a few different routers with this interface

@lolmam
Copy link

lolmam commented Mar 29, 2024

Can you try this?

document.querySelectorAll('[id]').forEach(element => {
    if (window.getComputedStyle(element).display === 'none') {
        element.style.display = 'block';
    }
});

Thanks for your help. unfortunately it didn't work either, it just gives undefined and nothing happens to the page. it looks like it may not be possible to show the dns field without deep tinkering in the page code. I'm going to stop here. and i will just set the dns on my devices instead of the router.

Again, thanks for trying to help me. hopefully in the future we would be able to find a way to set a custom dns.

@Mohamed3bdelwahab
Copy link

Can i from this get the simunlock code or goto to router configuration to enable for all isp

@glibg10b
Copy link
Author

@Mohamed3bdelwahab No, Huawei wouldn't make it that easy ;)

@Mohamed3bdelwahab
Copy link

Is there anyway to do it my router is locked for ISP and i need to use other sim ISP instead and can't find online way to do it .
they use v5 and not available yet free

can you help with this if there way can give me access to open router configuration or anything can help

@Mohamed3bdelwahab
Copy link

Capture

this mean it's working see your configuration and you must be on page advance mode to see the options

@glibg10b
Copy link
Author

That's not something I can help with, unfortunately.

If you can find someone else that had success with your router model, and you're certain they're legit, you may be able to ask them for guidance. Otherwise, you'll just have to buy another router and make sure your SIM works in it.

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