clitracker #79

Merged
louis_royer merged 14 commits from clitracker into etape4 2020-03-24 17:34:21 +01:00
Showing only changes of commit 9c5bfc5430 - Show all commits

View File

@ -0,0 +1,28 @@
package tools;
/** Test if IP are legitimate.
* @author Louis Royer
* @author Flavien Haas
* @author JS Auge
* @version 1.0
*/
public class TestLegitIP {
public boolean TestIP(String hostname) {
if(hostname.equals("localhost")){
return true;
}
else{
String[] ipArray = hostname.split("\\.");
if(ipArray.length != 4){
return false;
}
for(int i= 0; i < ipArray.length; i++){
if((Integer.parseInt(ipArray[i]) > 255) || (Integer.parseInt(ipArray[i]) < 0)){
return false;
}
}
}
return true;
}
}