Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Cool IP Obscurer (submit code doesn't work)


devilsson2010's Avatar
Member
0 0

This is an IP Obscurer. It takes in the IP you give it and puts it into the 10 digit number form, which is just as valid as the IP itself when you enter it into a browser. Oh and the submit code won't work for me, I've tried so many times but it's not working.

Anyway, here it is:

#include <cstdlib>
#include <iostream>
#include <fstream>

using namespace std;

bool bagain;

int main()
{
    printf("** IP Obscurer By Aaron Hiniker **\n” );
    printf("-------------------------------------------------------------------------------\n” );

do
{
string ip;
string ip1;
string ip2;
string ip3;
string ip4;
unsigned int obs;
char again;

    printf("** Please Enter IP to Obscure (ex: 208.65.153.238) **\n” );
    cin >> ip;

    size_t found;
    int last;
    
    found=ip.find(".” );
    if (found!=string::npos)
       {
         for (int i=0;i<int(found);i++)
             {ip1+=ip[i];}
       }
    last=int(found)+1;
    
    found=ip.find(".",found+1);
    if (found!=string::npos)
       {
         for (int i=last;i<int(found);i++)
             {ip2+=ip[i];}
       }
    last=int(found)+1;
    
    found=ip.find(".",found+1);
    if (found!=string::npos)
       {
         for (int i=last;i<int(found);i++)
             {ip3+=ip[i];}
       }
    last=int(found)+1;

         for (int i=last;i<ip.size();i++)
             {ip4+=ip[i];}

    obs=0;
    obs=((((((atoi(ip1.c_str())*256)+atoi(ip2.c_str()))*256)+atoi(ip3.c_str()))*256)+atoi(ip4.c_str()));

    cout << "\n** Normal IP: " << ip1 << "." << ip2 << "." << ip3 << "." << ip4 << " **" << endl;
    cout << "** Obsure IP: " << obs << " **" << endl;

    ofstream obscure("Obscure_IP.txt” );
    if (obscure.is_open())
    {
     obscure << "Normal IP: " << ip1 << "." << ip2 << "." << ip3 << "." << ip4 << endl;
     obscure << "Obscure IP: " << obs << endl;
     obscure.close();
     printf("\n** The Above Info was Written to Obscure_IP.txt **\n\n” );
    } else {printf("** Obscure_IP.txt was Unable to be Opened and was NOT Written to **\n\n” );}

while (true)
{
    printf("** Obscure Another IP (y/n)? **\n” );
    cin >> again;
    
    if (again!='y' && again!='n' && again!='Y' && again!='N' )
       {printf("** That is not a Valid Response **\n” );
       } else if (again=='y' || again=='Y' )
       {bagain=true; system("cls” ); break;} else {bagain=false; break;}
}

} while (bagain);
    return EXIT_SUCCESS;
}

ghost's Avatar
0 0

I wrote exactly the same script not so long ago, but in python :D. Find it at the code bank if ya like.