Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. To have a list of all IPs and then look for the resultant IP list
- 2. Use Nested Loop
- IP Bytes -> Bits -> Int32
- From: 10.0.10.10 -> 00001010 00000000 00001010 00001010 -> 167774730
- To: 10.1.45.1 -> 00001010 00000001 00101101 00000001 -> 167849217
- Start count from From to To and just check the unwanted Bytes witch is 11111111 and 00000000
- var startIp = 0x0A000001,
- endIp = 0x0A000F05;
- var temp, list = [],str;
- for(var i=startIp ; i <= endIp ; i++){
- temp = (i).toString(16);
- str ='';
- if(temp.length == 7){
- temp = "0"+temp;
- }
- for(var k=temp.length-1; k >= 0 ; k-=2){
- str = parseInt(temp[k-1] + "" + temp[k], 16) +"." + str ;
- }
- document.write(temp + " " + str+ "<br>");
- list.push(str.substring(0, str.length-1));
- }
-
Add Comment
Please, Sign In to add comment