Skip to content

Instantly share code, notes, and snippets.

@ohmypxl
Last active November 12, 2022 06:04
Show Gist options
  • Save ohmypxl/30daf34024130f7d928d7075e2056b68 to your computer and use it in GitHub Desktop.
Save ohmypxl/30daf34024130f7d928d7075e2056b68 to your computer and use it in GitHub Desktop.
Untested, by theory it should give output like: 192.168.x.1 or 156.242.xxx.xx1
CensorIp(ip[])
{
if (!IsValidIp(ip))
return 0;
for (new i = 0, j = strlen(ip), k = 0; i < j; i++)
{
if (ip[i] == '.')
{
k ++;
continue;
}
if (k >= 2 && i < j - 1)
{
ip[i] = 'x';
}
}
return 1;
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment