|
@@ -2,10 +2,13 @@ package de.tudarmstadt.informatik.hostage.commons;
|
|
|
|
|
|
import java.security.SecureRandom;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * This class holds informations for all protocols, e.g. server name, version etc.
|
|
|
+ * It provides getters and setters.
|
|
|
+ * @author Wulf Pfeiffer
|
|
|
+ */
|
|
|
public class ProtocolSettings {
|
|
|
|
|
|
-
|
|
|
private static SecureRandom rndm = new SecureRandom();
|
|
|
private static String[][][] possibleHttpVersions = {
|
|
|
{{"Apache/2.0."},{"28","32","35","36","39","40","42","43","44","45","46","47","48","49","50","51","52","53","54","55","58","59","61","63","64","65"}},
|
|
@@ -18,17 +21,23 @@ public class ProtocolSettings {
|
|
|
{{"5.6."},{"2","3","4","5","6","7","8","9","10","11","12","13","14"}},
|
|
|
{{"5.5."},{"27","28","29","30","31","32","33","34"}}
|
|
|
};
|
|
|
- private static String[][] possibleSmbVersions = {
|
|
|
+ private static String[][] possibleSmbVersions = {
|
|
|
{"Windows Server 2008 R2 Enterprise 7600","Windows Server 2008 R2 Enterprise 6.1"},
|
|
|
{"Windows 7 Professional 7600","Windows 7 Professional 6.1"},
|
|
|
{"Windows 8 Enterprise 9200", "Windows 8 Enterprise 9200"},
|
|
|
{"Windows Server 2012 Standard 6.2", "Windows Server 2012 Standard 6.2"},
|
|
|
{"Unix", "Samba"}
|
|
|
};
|
|
|
+ private static String[][][] possibleSshVersions = {
|
|
|
+ {{"3."},{"4","5","6","7","8","9"}},
|
|
|
+ {{"4."},{"0","1","2","3","4","5","6","7","9"}},
|
|
|
+ {{"5."},{"0","1","2","3","4","5","6","7","8","9"}},
|
|
|
+ {{"6."},{"0","1","2","3","4"}}
|
|
|
+ };
|
|
|
|
|
|
private static String httpQotd ;
|
|
|
private static String httpVersion = initHttpVersion();
|
|
|
- private static boolean useHttpQotd = true;
|
|
|
+ private static boolean useHttpQotd = true;
|
|
|
|
|
|
private static String mysqlVersion = initMysqlVersion();
|
|
|
|
|
@@ -36,18 +45,19 @@ public class ProtocolSettings {
|
|
|
private static String[] smbVersion = initSmbVersion();
|
|
|
|
|
|
private static String telnetName = initTelnetName();
|
|
|
- private static String telnetVersion = initTelnetVersion();
|
|
|
|
|
|
private static String sshVersion = initSshVersion();
|
|
|
private static String sshType = initSshType();
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private static String initHttpVersion() {
|
|
|
- int majorVersion = rndm.nextInt(3);
|
|
|
+ int majorVersion = rndm.nextInt(possibleHttpVersions.length);
|
|
|
return possibleHttpVersions[majorVersion][0][0] + possibleHttpVersions[majorVersion][1][rndm.nextInt(possibleHttpVersions[majorVersion][1].length)];
|
|
|
}
|
|
|
|
|
|
private static String initMysqlVersion() {
|
|
|
- int majorVersion = rndm.nextInt(3);
|
|
|
+ int majorVersion = rndm.nextInt(possibleMysqlVersions.length);
|
|
|
return possibleMysqlVersions[majorVersion][0][0] + possibleMysqlVersions[majorVersion][1][rndm.nextInt(possibleMysqlVersions[majorVersion][1].length)];
|
|
|
}
|
|
|
|
|
@@ -63,18 +73,13 @@ public class ProtocolSettings {
|
|
|
return HelperUtils.getRandomString(16, false);
|
|
|
}
|
|
|
|
|
|
- private static String initTelnetVersion() {
|
|
|
-
|
|
|
- return "ToBeDone";
|
|
|
- }
|
|
|
-
|
|
|
private static String initSshVersion() {
|
|
|
return "SSH-2.0-";
|
|
|
}
|
|
|
|
|
|
private static String initSshType() {
|
|
|
-
|
|
|
- return "OpenSSH_6.0p1";
|
|
|
+ int majorVersion = rndm.nextInt(possibleSshVersions.length);
|
|
|
+ return "OpenSSH_" + possibleSshVersions[majorVersion][0][0] + possibleSshVersions[majorVersion][1][rndm.nextInt(possibleSshVersions[majorVersion][1].length)];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -135,14 +140,6 @@ public class ProtocolSettings {
|
|
|
ProtocolSettings.telnetName = telnetName;
|
|
|
}
|
|
|
|
|
|
- public static String getTelnetVersion() {
|
|
|
- return telnetVersion;
|
|
|
- }
|
|
|
-
|
|
|
- public static void setTelnetVersion(String telnetVersion) {
|
|
|
- ProtocolSettings.telnetVersion = telnetVersion;
|
|
|
- }
|
|
|
-
|
|
|
public static String getSshVersion() {
|
|
|
return sshVersion;
|
|
|
}
|