-1
更深入的我有一个程序,我想提示用户键入他们给定的用户名和密码(由我给出),并让他们键入它,如果它是正确的,它将运行一个检查主机名以查看如果密码与他们告诉我的主机名相匹配。所以basicaly做这样的事情:如何找到某人的主机名?
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!
}
这是如此,如果我是卖一个节目,比给他的用户名和密码,而且比他给我他的主机名,所以他不能随便给黑客免费奉送,因为他给了我他的电脑名字!
哪个系统?在Linux下运行'hostname'并管道输出。 – 2015-02-23 20:36:13
最后一句话没有意义。 – Biffen 2015-02-23 20:37:38
主机名的问题是用户可以将它们设置为任何他们想要的。 – Collin 2015-02-23 20:38:00