From 09d66b1dcdddf25d65da582b042344d3fd3f0f41 Mon Sep 17 00:00:00 2001 From: 0c0c0f <892850447@qq.com> Date: Sun, 8 Jan 2017 16:15:48 +0800 Subject: [PATCH] Create cip.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit c段ip生成 --- port/cip.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 port/cip.java diff --git a/port/cip.java b/port/cip.java new file mode 100644 index 0000000..c920ff0 --- /dev/null +++ b/port/cip.java @@ -0,0 +1,36 @@ +package com.port.scan; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; +import java.io.PrintWriter; + +public class IP { + public static void main(String[] args) throws Exception { + String DbPath=System.getProperty("user.dir")+"\\ip.txt"; + String encoding="utf-8"; + File file=new File(DbPath); + if(file.isFile() && file.exists()){ //判断文件是否存在 + InputStreamReader read = new InputStreamReader( + new FileInputStream(file),encoding);//考虑到编码格式 + BufferedReader bufferedReader = new BufferedReader(read); + String lineTxt = null; + while((lineTxt = bufferedReader.readLine()) != null){ + for (int i = 1; i <=255; i++) { + System.out.println(lineTxt+"."+i); + writeurl(lineTxt+"."+i+"\r\n"); + } + } + } + + } + + public static void writeurl(String resulturl) throws Exception{ + String DbPath=System.getProperty("user.dir")+"\\result.txt"; + PrintWriter pw = new PrintWriter( new FileWriter( "result.txt",true ) ); + pw.print(resulturl); + pw.close(); + } +}