Discovering an Ambiguous URL with Brace Expansion

Imagine a non-technical person has sent you a URL with a long random string in it, printed on paper in a font where I and l look identical (true story). Apart from educating them about the merits of URL-shortening, what do you do?

Bash Brace Expansion to the rescue. Using a simple one-liner you can get this solved in next to no time.

Brace Yourself

Using wget (in this example, you could also use curl) we can enumerate all possible permutations with a single command. Open a bash terminal and enter something like the following (note the {I,l} bits where we are unsure of the character):

wget http://example.com/abc{I,l}d_ef{I,l}-GH{I,l}jklmn{I,l}op0qrts

The response that returns 200 OK and not 404 Not Found is the correct link. Simple.

Header image CC BY-NC-SA 4.0 Science Museum Group.


Would you like help solving a technology problem in your business?
Email me for a free consultation. I'm always open to new opportunities!

This blog is treeware! If you found it useful then please plant a tree.
Donate a treeDonate a tree🌳🌳