/* QnDUB, version 0.1. This is Open Source Software. Anyone can use it. For free. Just give me some credit, mmkay? ;) Copyright Cat Chapman, 2006. */ #include #include #include using namespace std; int main() { string blockme; char choice; cout << "Welcome to QnDUB, the Quick n Dirty URL Blocker for Windows.\n\n"; cout << "What URL would you like to block? Follow this format: website.com" << endl; cin >> blockme; cout << "What OS are you running? \n\ta: Windows XP \n\tb: Windows 2000\n\tc: Windows 98/ME" << endl; cin >> choice; if( choice == 'a' ) { ofstream file("/Windows/System32/Drivers/etc/hosts", ios::app); if (! file) { cout << "Error opening output file" << endl; return -1; } file << "\n127.0.0.1 " << blockme << endl; file.close(); cout << "Success! " << blockme << " was successfully blocked!" << endl; } else if( choice == 'b' ) { ofstream file2("/Winnt/System32/Drivers/etc/hosts", ios::app); if (! file2) { cout << "Error opening output file" << endl; return -1; } file2 << "\n127.0.0.1 " << blockme << endl; file2.close(); cout << "Success! " << blockme << " was successfully blocked!" << endl; } else if(choice == 'c' ) { ofstream file3("/Windows/hosts", ios::app); if (! file3) { cout << "Error opening output file" << endl; return -1; } file3 << "\n127.0.0.1 " << blockme << endl; file3.close(); cout << "Success! " << blockme << " was successfully blocked!" << endl; } else cout << "Invalid choice. Please run this program again" << endl; system("pause"); return 0; system("pause"); return 0; }