MCPcopy Create free account
hub / github.com/bit4woo/burp-api-common / isValidIP

Method isValidIP

src/main/java/burp/IPAddressUtils.java:60–85  ·  view source on GitHub ↗
(String ip)

Source from the content-addressed store, hash-verified

58
59 //校验字符串是否是一个合格的IP地址
60 public static boolean isValidIP (String ip) {
61 try {
62 if ( ip == null || ip.isEmpty() ) {
63 return false;
64 }
65
66 String[] parts = ip.split( "\\." );
67 if ( parts.length != 4 ) {
68 return false;
69 }
70
71 for ( String s : parts ) {
72 int i = Integer.parseInt( s );
73 if ( (i < 0) || (i > 255) ) {
74 return false;
75 }
76 }
77 if ( ip.endsWith(".") ) {
78 return false;
79 }
80
81 return true;
82 } catch (NumberFormatException nfe) {
83 return false;
84 }
85 }
86
87 @Deprecated
88 public static boolean isValidSubnet(String subnet) {

Callers 4

isValidSubnetMethod · 0.95
toClassCSubNetsMethod · 0.95
toSmallerSubNetsMethod · 0.95
ipset2cidrMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected