我怎样才能找到某人的主机名?
How can I find someones hostname?
为了更深入,我有一个程序,我想提示用户输入他们给定的用户名和密码(由我提供)并让他们输入,如果正确,它将 运行检查主机名以查看密码是否与他们告诉我的主机名相匹配。所以基本上做这样的事情:
cout << "Type in your username: ";
cin >> username;
cout << "Type in your password: ";
cin >> password;
if (username == "Example" && password == "Example") { /* Checks if correct
combination.*/
cout << "Correct combination, running Hostname scan\n";
// Than scan hostname and assign it to this string "hostname"
if (hostname == "Example's Computer") {
cout << "Access granted\n";
system("cls"); // And clear the screan!
}
如果我要出售一个程序,而不是给他用户名和密码,然后他给了我他的主机名,那么他就不能免费赠送 hack,因为他已经给了我他的计算机名称!
如果您想获取 Windows 上本地计算机的主机名,您可以根据需要调用 gethostname()
或相关的 winsock 函数之一。
为了更深入,我有一个程序,我想提示用户输入他们给定的用户名和密码(由我提供)并让他们输入,如果正确,它将 运行检查主机名以查看密码是否与他们告诉我的主机名相匹配。所以基本上做这样的事情:
cout << "Type in your username: ";
cin >> username;
cout << "Type in your password: ";
cin >> password;
if (username == "Example" && password == "Example") { /* Checks if correct
combination.*/
cout << "Correct combination, running Hostname scan\n";
// Than scan hostname and assign it to this string "hostname"
if (hostname == "Example's Computer") {
cout << "Access granted\n";
system("cls"); // And clear the screan!
}
如果我要出售一个程序,而不是给他用户名和密码,然后他给了我他的主机名,那么他就不能免费赠送 hack,因为他已经给了我他的计算机名称!
如果您想获取 Windows 上本地计算机的主机名,您可以根据需要调用 gethostname()
或相关的 winsock 函数之一。