Skip to content

Commit

Permalink
Create cip.java
Browse files Browse the repository at this point in the history
c段ip生成
  • Loading branch information
0c0c0f authored Jan 8, 2017
1 parent fa09226 commit 09d66b1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions port/cip.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit 09d66b1

Please sign in to comment.