- 4 Haz 2023
- 36
- 9
Evet başlıkta gördüğünüz gibi mesela Vodafone kullanıyorsam gidip mesaj atmadan ya da online işlem sitesini kullanmadan güvenli interneti kapatmak istiyorum. Var mı bu işi çözebilecek bir usta. Hediye olarak bir tane c++ uygulaması yazdım konsolda derleyin ping testi uygulaması.
#include <iostream> //Prepared by NMS Programming
#include <cstdlib>
#include <string>
int main() {
std::string ipAddressList[] = {
"101.44.220.0", "101.44.223.255",
"101.44.252.0", "101.44.252.255",
"101.44.32.0", "101.44.47.255",
"102.129.167.0", "102.129.167.255",
"102.216.81.0", "102.216.81.255",
"103.130.145.0", "103.130.145.255",
"103.130.147.0", "103.130.147.255",
"103.14.1.0", "103.14.1.255",
"103.215.218.0", "103.215.218.255",
"103.252.221.0", "103.252.221.255",
"103.47.57.0", "103.47.57.255",
"103.76.128.0", "103.76.128.255",
"104.132.168.0", "104.132.168.255",
"104.166.156.0", "104.166.157.255",
"104.166.174.0", "104.166.174.255",
"104.166.176.0", "104.166.179.255",
"104.166.190.0", "104.166.190.255",
"104.234.121.0", "104.234.121.255"
};
std::string pingCommand = "ping -n 1 ";
for (const std::string& ipAddress : ipAddressList) {
std::string fullCommand = pingCommand + ipAddress;
std::cout << "Pinging " << ipAddress << "..." << std::endl;
int pingResult = system(fullCommand.c_str());
if (pingResult == 0) {
std::cout << ipAddress << " is reachable." << std::endl;
} else {
std::cout << ipAddress << " is unreachable." << std::endl;
}
}
return 0;
}
#include <iostream> //Prepared by NMS Programming
#include <cstdlib>
#include <string>
int main() {
std::string ipAddressList[] = {
"101.44.220.0", "101.44.223.255",
"101.44.252.0", "101.44.252.255",
"101.44.32.0", "101.44.47.255",
"102.129.167.0", "102.129.167.255",
"102.216.81.0", "102.216.81.255",
"103.130.145.0", "103.130.145.255",
"103.130.147.0", "103.130.147.255",
"103.14.1.0", "103.14.1.255",
"103.215.218.0", "103.215.218.255",
"103.252.221.0", "103.252.221.255",
"103.47.57.0", "103.47.57.255",
"103.76.128.0", "103.76.128.255",
"104.132.168.0", "104.132.168.255",
"104.166.156.0", "104.166.157.255",
"104.166.174.0", "104.166.174.255",
"104.166.176.0", "104.166.179.255",
"104.166.190.0", "104.166.190.255",
"104.234.121.0", "104.234.121.255"
};
std::string pingCommand = "ping -n 1 ";
for (const std::string& ipAddress : ipAddressList) {
std::string fullCommand = pingCommand + ipAddress;
std::cout << "Pinging " << ipAddress << "..." << std::endl;
int pingResult = system(fullCommand.c_str());
if (pingResult == 0) {
std::cout << ipAddress << " is reachable." << std::endl;
} else {
std::cout << ipAddress << " is unreachable." << std::endl;
}
}
return 0;
}