使用方法:
1.下載檔案下載
2.解壓縮,解壓密碼demo1234
3.對資料夾內的ForceSafeSearch.exe (以系統管理員身分執行)點兩下,完成。
以下是思考過程:
根據資料來源2.How to: Enforcing Google SafeSearch, YouTube, and Bing
我們得知幾件事
1.要在單機主機內C:\Windows\System32\drivers\etc\hosts,新增幾行。其意義如下:
(1)強制google安全搜尋 -> 216.239.38.120
(2)強制bing安全搜尋 ->會有個IP
(3)強制youtube安全搜尋 ->會有個IP
包含:www.youtube.com、m.youtube.com、youtubei.googleapis.com
youtube.googleapis.com、www.youtube-nocookie.com
以下是資料來源2的截圖:
所以,我們就去ping來得知這些網站的IP
1)強制google安全搜尋 -> 216.239.38.120
(2)強制bing安全搜尋 ->204.79.197.220
(3)強制youtube安全搜尋 ->216.239.38.120
檔案名稱:ForceSafeSearch.cpp
內容:
#include <fstream>
using namespace std;
int main() {
ofstream outfile;
outfile.open("C:\\Windows\\System32\\drivers\\etc\\hosts", std::ios_base::app);
outfile << "204.79.197.220" <<" "<<"www.bing.com"<<endl;
outfile << "216.239.38.120" <<" "<<"www.google.com"<<endl;
outfile << "216.239.38.120" <<" "<<"www.google.com"<<endl;
outfile << "216.239.38.120" <<" "<<"www.youtube.com"<<endl;
outfile << "216.239.38.120" <<" "<<"m.youtube.com"<<endl;
outfile << "216.239.38.120" <<" "<<"youtubei.googleapis.com"<<endl;
outfile << "216.239.38.120" <<" "<<"youtube.googleapis.com"<<endl;
outfile << "216.239.38.120" <<" "<<"www.youtube-nocookie.com"<<endl;
}
結果:
1.打開 C:\Windows\System32\drivers\etc\hosts。可看到:
資料來源:
1.How to append text to a text file in C++?
2.How to: Enforcing Google SafeSearch, YouTube, and Bing
outfile << "216.239.38.120" <<" "<<"www.youtube.com"<<endl;
outfile << "216.239.38.120" <<" "<<"m.youtube.com"<<endl;
outfile << "216.239.38.120" <<" "<<"youtubei.googleapis.com"<<endl;
outfile << "216.239.38.120" <<" "<<"youtube.googleapis.com"<<endl;
outfile << "216.239.38.120" <<" "<<"www.youtube-nocookie.com"<<endl;
outfile << "[2001:4860:4802:32::78]" <<" "<<"www.google.com"<<endl;
outfile << "[2001:4860:4802:32::78]" <<" "<<"www.google.com.tw"<<endl;
return 0;}
結果:
1.打開 C:\Windows\System32\drivers\etc\hosts。可看到:
資料來源:
1.How to append text to a text file in C++?
2.How to: Enforcing Google SafeSearch, YouTube, and Bing
沒有留言:
張貼留言