File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -151,18 +151,26 @@ var sonar = {
151151
152152 if ( sonar . debug ) {
153153 alert ( '[DEBUG][The samallest IP adress to be scaned is:]' + ip_min [ 0 ] + '.' + ip_min [ 1 ] + '.' + ip_min [ 2 ] + '.' + ( ip_min [ 3 ] + 1 ) ) ;
154- alert ( '[DEBUG][The largest IP adress to be scaned is:]' + ip_max [ 0 ] + '.' + ip_max [ 1 ] + '.' + ip_max [ 2 ] + '.' + ip_max [ 3 ] ) ;
154+ alert ( '[DEBUG][The largest IP adress to be scaned is:]' + ip_max [ 0 ] + '.' + ip_max [ 1 ] + '.' + ip_max [ 2 ] + '.' + ( ip_max [ 3 ] - 1 ) ) ;
155155 }
156156
157157 // Queue IP address range
158- var ip_parts = ip_min . slice ( ) ;
159158 var d = ip_min [ 3 ] + 1 ;
160159 for ( var a = ip_min [ 0 ] ; a <= ip_max [ 0 ] ; a ++ ) {
161160 ip_parts [ 0 ] = a ;
161+ if ( a == ip_max [ 0 ] ) { // Check if we are approaching the end of the subnet
162+ var ae = 1 ;
163+ }
162164 for ( var b = ip_min [ 1 ] ; b <= ip_max [ 1 ] ; b ++ ) {
163165 ip_parts [ 1 ] = b ;
166+ if ( ae == 1 && b == ip_max [ 1 ] ) {
167+ var be = 1 ;
168+ }
164169 for ( var c = ip_min [ 2 ] ; c <= ip_max [ 2 ] ; c ++ ) {
165170 ip_parts [ 2 ] = c ;
171+ if ( be == 1 && c == ip_max [ 2 ] ) {
172+ ip_max [ 3 ] -- ; // Prevent the broadcast address from getting queued
173+ }
166174 while ( d <= ip_max [ 3 ] ) {
167175 ip_parts [ 3 ] = d ;
168176 var tmp_ip = ip_parts [ 0 ] + '.' + ip_parts [ 1 ] + '.' + ip_parts [ 2 ] + '.' + ip_parts [ 3 ] ;
You can’t perform that action at this time.
0 commit comments