Useful scripts

One console command to see how many IPs your Switchvox is blocking

A single read-only command you can paste into Chrome's console to count your Switchvox blocked IP list, and what the number tells you.

Wondering whether your Switchvox is under constant attack? One read-only command tells you how many addresses it’s currently blocking, without clicking through page after page of the Blocked IPs list.

How to run it

  1. Log in to the Switchvox admin portal in Google Chrome.
  2. Press F12 and click the Console tab (on Windows, Ctrl+Shift+J opens it directly).
  3. The first time you paste into the console, Chrome blocks it as a safety measure. Read the command, then type allow pasting and press Enter.
  4. Paste this and press Enter:
fetch('/json', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ request: { method: 'switchvox.blockedIps.getList', parameters: {} } }) }).then((r) => r.json()).then((d) => console.log('Blocked IPs:', d?.response?.result?.blocked_ips?.total_items ?? d));

It asks Switchvox’s own API for the blocked list and prints the total. It doesn’t change anything.

What the number means

  • A handful: normal. Phones with a typo’d password and the occasional scanner.
  • Hundreds or thousands: something is reachable from the internet that probably shouldn’t be, like SIP or the admin portal open to all networks. That’s worth fixing before anything else.

If the number is large and you want to export the list and clear it safely, the full walkthrough covers exposure checks, a CSV backup, and a paced clearing script: Clearing a Switchvox blocked IP list from Chrome’s console.

Sources

All articles