Skip to content

Instantly share code, notes, and snippets.

@wille-io
Last active March 5, 2021 21:32
Show Gist options
  • Select an option

  • Save wille-io/04b7c1805f967bcdff2f2b1099c86b34 to your computer and use it in GitHub Desktop.

Select an option

Save wille-io/04b7c1805f967bcdff2f2b1099c86b34 to your computer and use it in GitHub Desktop.
Find your Bitsquatting domain
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
char *d = argv[1];
size_t l = strlen(d);
for (int i = 0; (size_t)i < l; i++)
for (int k = 0; k < 8; k++)
{
char c = d[i] ^ (1 << k);
if ((c >= 48 && c <= 57) || (c >= 97 && c <= 122))
{
char *s = malloc(l + 1);
strcpy(s, d);
s[i] = c;
printf("> %s\n", s);
free(s);
}
}
puts("done");
return 0;
}
@wille-io
Copy link
Author

wille-io commented Mar 5, 2021

Compile with gcc bitsquatting.c -o bitsquatting
Then run with ./bitsquatting yourdomain

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