Posted by Security is just an illusion at Saturday, February 23, 2013
Read our previous post
Here my Next Simple release IpRange-Gen-Agent,some times you need to generate some IpRange.If not you dont need it
Download Compiled Exe:
http://www.directmirror.com/files/0AEGWHLT
http://www.mirrorupload.net/file/IWPJRHWC/#!iprange-gen.rar
main.java
package com;
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
/**
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* This class contains methods to generate IP Address(IPV4) Sequence.
*/
public class main {
/**
* Program starts here
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
System.out.println("Welcome to IpRange-Gen-Agent by cr4shyyy : ");
System.out.println("_________________________________");
System.out.println("|.--------_--_------------_--__--.|");
System.out.println("|| Security-is-just-an-Illusion||");
System.out.println(";;`,_ by cr4shyyy __ ,:|");
System.out.println("((_(-,-----------.-.----------.-.)`)");
System.out.println("__ ) ,' `. _/");
System.out.println(": : |_________| : :");
System.out.println("|-'| ,'-.-.--.-.`. |`-|");
System.out.println("|_.| (( (* )(* ))) |._|");
System.out.println("| | `.-`-'--`-'.' | |");
System.out.println("|-'| | ,-.-.-. | |._|");
System.out.println("| | |(|-|-|-|)| | |");
System.out.println(":,': |_`-'-'-'_| ;`.;");
System.out.println(" ,' `. /._/");
System.out.println(" `._ ________________,' /");
System.out.println(" : ___________ : ,'");
System.out.println(" `.| | | | |,'");
System.out.println(" `.| | g0tr00t ? | | |");
System.out.println(" | | | |");
System.out.println("Hello nobody. Tonight we have a very special g33k Presentation.");
System.out.println("So, kick back and stretch your sack.");
System.out.println(" ");
System.out.println(" +++The Mentor+++ ");
System.out.println("We explore... and you call us criminals.");
System.out.println("We seek after knowledge... and you call us criminals.");
System.out.println("We exist without skin color, without nationality, without religious bias... and you call us criminals.");
System.out.println("You build atomic bombs, you wage wars, you murder, cheat,");
System.out.println("and lie to us and try to make us believe it's for our own good, yet we're the criminals.");
System.out.println(" ");
System.out.println("Please Enter Ip Range : ");
System.out.println("Enter '127.0.0.1' its gen IP-Range to '127.255.255.255: ");
String eingabe = scanner.nextLine();
main ipGen = new main();
String ipStartingSeq = ""+ eingabe;
if(eingabe == null || eingabe.length() == 0) { /* DO STUFF */
System.out.println("Enter range n000b ........");
}
else{
// 256*256*256 = 16777216 Ips 1 FullRange
int numberOfIP = 16777216;
ipGen.generateNextIPSequence(ipStartingSeq, numberOfIP);
scanner.close();
}
}
public void generateNextIPSequence(String address, int count)
throws Exception {
String nextIpAddress = address;
for (int i = 0; i < count; i++) {
System.out.println(nextIpAddress);
//File writer for Ips
FileWriter writer;
File file;
file = new File("ip.txt");
writer = new FileWriter(file ,true);
writer.write(""+nextIpAddress);
writer.write(System.getProperty("line.separator"));
writer.flush();
writer.close();
nextIpAddress = getNextIPAddress(nextIpAddress);
}
}
public String[] getPartsOfIpAddress(String ipAddress) {
String[] elements = ipAddress.split("\\.");
return elements;
}
public String getNextIPAddress(String ipAddress) throws Exception {
String[] elements = getPartsOfIpAddress(ipAddress);
if (elements != null && elements.length == 4) {
Integer part1 = Integer.parseInt(elements[0]);
Integer part2 = Integer.parseInt(elements[1]);
Integer part3 = Integer.parseInt(elements[2]);
Integer part4 = Integer.parseInt(elements[3]);
if (part4 < 255) {
String ip = part1 + "." + part2 + "." + part3 + "." + (++part4);
return ip;
} else if (part4 == 255) {
if (part3 < 255) {
String ip = part1 + "." + part2 + "." + (++part3) + "."
+ (0);
return ip;
} else if (part3 == 255) {
if (part2 < 255) {
String ip = part1 + "." + (++part2) + "." + (0) + "."
+ (0);
return ip;
} else if (part2 == 255) {
if (part1 < 255) {
String ip = (++part1) + "." + (0) + "." + (0) + "."
+ (0);
return ip;
} else if (part1 == 255) {
throw new Exception("IP Range Exceeded -> "+ipAddress);
}
}
}
}
}
return null;
}
}
Have pfun …….
No comments:
Post a Comment