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 = {
151
151
152
152
if ( sonar . debug ) {
153
153
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 ) ) ;
155
155
}
156
156
157
157
// Queue IP address range
158
- var ip_parts = ip_min . slice ( ) ;
159
158
var d = ip_min [ 3 ] + 1 ;
160
159
for ( var a = ip_min [ 0 ] ; a <= ip_max [ 0 ] ; a ++ ) {
161
160
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
+ }
162
164
for ( var b = ip_min [ 1 ] ; b <= ip_max [ 1 ] ; b ++ ) {
163
165
ip_parts [ 1 ] = b ;
166
+ if ( ae == 1 && b == ip_max [ 1 ] ) {
167
+ var be = 1 ;
168
+ }
164
169
for ( var c = ip_min [ 2 ] ; c <= ip_max [ 2 ] ; c ++ ) {
165
170
ip_parts [ 2 ] = c ;
171
+ if ( be == 1 && c == ip_max [ 2 ] ) {
172
+ ip_max [ 3 ] -- ; // Prevent the broadcast address from getting queued
173
+ }
166
174
while ( d <= ip_max [ 3 ] ) {
167
175
ip_parts [ 3 ] = d ;
168
176
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