From a94c9da9c7dda359e4be994a2cf3a38cc401657e Mon Sep 17 00:00:00 2001 From: Eunbee Kim Date: Wed, 30 Sep 2020 15:28:41 -0400 Subject: [PATCH] issue-2 fixed --- .gitignore | 1 + bin/Kernel32.class | Bin 196 -> 205 bytes bin/UrlCheck.class | Bin 8404 -> 7140 bytes bin/window/UrlCheck.jar | Bin 1501336 -> 1503424 bytes src/UrlCheck.java | 150 +++++++------------------------------ src/UrlCheckForMac.java | 62 +++++++++++++++ src/UrlCheckForWindow.java | 82 ++++++++++++++++++++ 7 files changed, 170 insertions(+), 125 deletions(-) create mode 100644 src/UrlCheckForMac.java create mode 100644 src/UrlCheckForWindow.java diff --git a/.gitignore b/.gitignore index e10e727..2715f36 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /.metadata/ +/bin/ diff --git a/bin/Kernel32.class b/bin/Kernel32.class index 64707a249edbfb31eda5c086f815351713994a09..56f86e480a5dd2bb02345c20311567d130d2d94b 100644 GIT binary patch delta 28 jcmX@Yc$RTOpO9E+QI2y)YI3$)eo=U4UP^xX#Ob;KncfQD delta 19 acmX@hc!Y66A17~UQI2y)YI63(1-bx7r3W_v diff --git a/bin/UrlCheck.class b/bin/UrlCheck.class index 736eb86d3dbe2d835a12c3501c95e330dd5852ac..87651aa184d19c7e4b1ed50da9554befcb6c9ddc 100644 GIT binary patch literal 7140 zcmbVR349dQ9sXXj$?R?>0fG^hLl#6xLXrhk#0@usq=tY5&;(G2%_O^KFL!4HDz&!a zQG2QN3Ra3OHQ2+7ZI@Ik+G^E$RomKH?P0aHT5aupST+6L%xtn3n3^BIedquF-v9mI z@c4W89RYBPn4_RXz_}?AUK!K_y$T!xV=vVDG+$VY_W0Iqzfcbt0%ZxkN8c$>-8!Eu7Mwa0x804H`x~xwOu|)wk8RrBQ3VWO-xf+{V-A%vyHh zNlO=BcK)vE{)VRJZT0zUa%rn?TfKm*OAm)4Awy3%p;F40ty{Kko3UugY`3#=n?U)Z zP&8yL5h$&#+br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q!nSc1Qr72m z;TdwR(mUqZkv0)boSjnc7jvC6q-n82M~wS7v8Ezb#|rt~G9M>0t0g(~r-8*K|HUi{ zob{V)g&$SdSn^q7b8JL_bNoh;?@3AQeVi1vU|ccQWfRJ@b;J)rKLtnUF|-HG}> z(CbdR_ks3z!t)#Gd?%^Dfi8DKcmVWf!HgfY|2vo<`_Hfj3#*APh3*i@aF_MpX8ixG zeEO8k10cg)(RYVHdXO#;7M8QCHQy6{F@8aQXKT-wV0?mqg~>5%0S^nSXbp(j{SSlu BxYhsw diff --git a/src/UrlCheck.java b/src/UrlCheck.java index 2ad7252..f570777 100644 --- a/src/UrlCheck.java +++ b/src/UrlCheck.java @@ -4,22 +4,11 @@ import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; -import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.nio.charset.Charset; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.sun.jna.Library; -import com.sun.jna.Native; - -interface Kernel32 extends Library { - - boolean SetConsoleTextAttribute(int h_ConsoleOutput, int u16_Attributes); - - int GetStdHandle(int u32_Device); - -} public class UrlCheck { // url set regex @@ -27,112 +16,7 @@ public class UrlCheck { // delimiter to get url from input file final static String delimiter = "[\\[\\]\"<>'\n\b\r]"; - - //text for mac -// public static final String RED = "\033[0;31m"; -// public static final String GREEN = "\033[0;32m"; -// public static final String WHITE = "\033[0;37m"; -// public static final String BLUE ="\033[0;34m"; -// public static final String RESET = "\033[0m"; - - // text for window - static final int GRAY = 0x7; - static final int GREEN = 0xA; - static final int RED = 0xC; - static final int WHITE = 0xF; - static final int BLUE = 0x9; - static final int STD_OUTPUT_HANDLE = -11; - - - // request url and check the response - public static void availableURL(String host) - { - Kernel32 lib = Native.load("kernel32", Kernel32.class); - - try { - // request url - URL url = new URL(host); - URLConnection con; - con = url.openConnection(); - - // response - HttpURLConnection exitCode = (HttpURLConnection) con; - exitCode.setInstanceFollowRedirects(true); - HttpURLConnection.setFollowRedirects(true); - exitCode.setConnectTimeout(1000); - - - // response code result - if(exitCode.getResponseCode() >= 200 && exitCode.getResponseCode() < 300) - { - - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), GREEN); - System.out.println("["+exitCode.getResponseCode()+"] "+ host +" - Good"); - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); - } - else if(exitCode.getResponseCode() >= 400 && exitCode.getResponseCode() < 500) - { - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), RED); - System.out.println("["+exitCode.getResponseCode()+"] "+ host +" - Bad"); - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); - } - else if(exitCode.getResponseCode() == 301 || exitCode.getResponseCode() == 307 || exitCode.getResponseCode() == 308 ) - { - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), BLUE); - System.out.println("["+exitCode.getResponseCode()+"] "+ host +" - Redirect"); - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); - - // redirect to new location by Recursion itself when it is 301,307,308 - String newUrl = exitCode.getHeaderField("Location"); - availableURL(newUrl); - - } - else - { - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), GRAY); - System.out.println("["+exitCode.getResponseCode()+"] "+ host +" - Unknown"); - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); - } - - }catch (Exception e) { - // response fail, server is not existed - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), RED); - System.out.println("[599] "+ host +" - Fail" ); - lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); - } -// // for Mac -// if(exitCode.getResponseCode() >= 200 && exitCode.getResponseCode() < 300) -// { -// -// System.out.println(GREEN+"["+exitCode.getResponseCode()+"] "+ host +" - Good"+RESET); -// -// } -// else if(exitCode.getResponseCode() >= 400 && exitCode.getResponseCode() < 500) -// { -// System.out.println(RED+"["+exitCode.getResponseCode()+"] "+ host +" - Bad"+RESET); -// } -// else if(exitCode.getResponseCode() == 301 || exitCode.getResponseCode() == 307 || exitCode.getResponseCode() == 308 ) -// { -// System.out.println(BLUE + "["+exitCode.getResponseCode()+"] "+ host +" - Redirect"+ RESET); -// -// // redirect to new location by Recursion itself when it is 301,307,308 -// String newUrl = exitCode.getHeaderField("Location"); -// availableURL(newUrl); -// -// } -// else -// { -// System.out.println(RED+"["+exitCode.getResponseCode()+"] "+ host +" - Unknown"+RESET); -// } -// -// }catch (Exception e) { -// // response fail, server is not existed -// System.out.println(RED+"[599] "+ host +" - Fail" +RESET); -// -// } - - - } + public static void helpMessage() { @@ -147,7 +31,7 @@ public static void helpMessage() System.out.println("| |"); System.out.println("| 2) UrlCheck help |"); System.out.println("| |"); - System.out.println("| 3) Option a, s, v |"); + System.out.println("| 3) Option a, s, v, m |"); System.out.println("| |"); System.out.println("| For Window : |"); System.out.println("| |"); @@ -169,6 +53,11 @@ public static void helpMessage() System.out.println("| |"); System.out.println("| For Mac : |"); System.out.println("| |"); + System.out.println("| Option m : To run the tool in Mac |"); + System.out.println("| |"); + System.out.println("| UrlCheck /m |"); + System.out.println("| ex) UrlCheck /m index2.html |"); + System.out.println("| |"); System.out.println("| Option a : To check for archived versions of URLs |"); System.out.println("| |"); System.out.println("| UrlCheck /a |"); @@ -203,13 +92,13 @@ public static void endMessage() // list up url in input file - public static void fileUrlListUp(String fName, boolean archived, boolean secured) + public static void fileUrlListUp(String fName, boolean archived, boolean secured, boolean runMac) { String regSecure = "^(http)://"; Pattern pat = Pattern.compile(regex, Pattern.MULTILINE); BufferedReader br; - + try { br = new BufferedReader(new FileReader(fName)); String line = null; @@ -223,8 +112,15 @@ public static void fileUrlListUp(String fName, boolean archived, boolean secured { // change http to https if(secured) str = str.replaceFirst(regSecure, "https://"); - - availableURL(str); + + if(runMac) + { + UrlCheckForMac.availableURL(str); + } + else + { + UrlCheckForWindow.availableURL(str); + } // request archived if(archived) archiveUrl(str); @@ -277,6 +173,7 @@ public static void main(String[] args) { boolean archived = false; boolean secured = false; + boolean runMac = false; if(args.length == 0 || args[0].toLowerCase().equals("help")) { @@ -301,12 +198,15 @@ public static void main(String[] args) { // secure request flag handle if(args[0].contains("s")) secured = true; - if(archived || secured) + // secure request flag handle + if(args[0].contains("m")) runMac = true; + + if(archived || secured || runMac) { for(int i = 1; i < args.length; i++) { System.out.println("File : " + args[i]); - fileUrlListUp(args[i],archived,secured); + fileUrlListUp(args[i],archived,secured,runMac); } } @@ -316,7 +216,7 @@ public static void main(String[] args) { for(int i = 0; i < args.length; i++) { System.out.println("File : " + args[i]); - fileUrlListUp(args[i],archived,secured); + fileUrlListUp(args[i],archived,secured,runMac); } } } diff --git a/src/UrlCheckForMac.java b/src/UrlCheckForMac.java new file mode 100644 index 0000000..878ee5f --- /dev/null +++ b/src/UrlCheckForMac.java @@ -0,0 +1,62 @@ +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; + +public class UrlCheckForMac { + + //text for mac + public static final String RED = "\033[0;31m"; + public static final String GREEN = "\033[0;32m"; + public static final String WHITE = "\033[0;37m"; + public static final String BLUE ="\033[0;34m"; + public static final String RESET = "\033[0m"; + + // request url and check the response + public static void availableURL(String host) + { + + try { + // request url + URL url = new URL(host); + URLConnection con; + con = url.openConnection(); + + // response + HttpURLConnection exitCode = (HttpURLConnection) con; + exitCode.setInstanceFollowRedirects(true); + HttpURLConnection.setFollowRedirects(true); + exitCode.setConnectTimeout(1000); + + +// // for Mac + if(exitCode.getResponseCode() >= 200 && exitCode.getResponseCode() < 300) + { + + System.out.println(GREEN+"["+exitCode.getResponseCode()+"] "+ host +" - Good"+RESET); + + } + else if(exitCode.getResponseCode() >= 400 && exitCode.getResponseCode() < 500) + { + System.out.println(RED+"["+exitCode.getResponseCode()+"] "+ host +" - Bad"+RESET); + } + else if(exitCode.getResponseCode() == 301 || exitCode.getResponseCode() == 307 || exitCode.getResponseCode() == 308 ) + { + System.out.println(BLUE + "["+exitCode.getResponseCode()+"] "+ host +" - Redirect"+ RESET); + + // redirect to new location by Recursion itself when it is 301,307,308 + String newUrl = exitCode.getHeaderField("Location"); + availableURL(newUrl); + + } + else + { + System.out.println(RED+"["+exitCode.getResponseCode()+"] "+ host +" - Unknown"+RESET); + } + + }catch (Exception e) { + // response fail, server is not existed + System.out.println(RED+"[599] "+ host +" - Fail" +RESET); + + } + } +} diff --git a/src/UrlCheckForWindow.java b/src/UrlCheckForWindow.java new file mode 100644 index 0000000..c654e37 --- /dev/null +++ b/src/UrlCheckForWindow.java @@ -0,0 +1,82 @@ +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; +import com.sun.jna.Library; +import com.sun.jna.Native; + +interface Kernel32 extends Library { + + boolean SetConsoleTextAttribute(int h_ConsoleOutput, int u16_Attributes); + + int GetStdHandle(int u32_Device); + +} + +public class UrlCheckForWindow { + + // text for window + static final int GRAY = 0x7; + static final int GREEN = 0xA; + static final int RED = 0xC; + static final int WHITE = 0xF; + static final int BLUE = 0x9; + static final int STD_OUTPUT_HANDLE = -11; + + // request url and check the response + public static void availableURL(String host) + { + Kernel32 lib = Native.load("kernel32", Kernel32.class); + + try { + // request url + URL url = new URL(host); + URLConnection con; + con = url.openConnection(); + + // response + HttpURLConnection exitCode = (HttpURLConnection) con; + exitCode.setInstanceFollowRedirects(true); + HttpURLConnection.setFollowRedirects(true); + exitCode.setConnectTimeout(1000); + + + // response code result + if(exitCode.getResponseCode() >= 200 && exitCode.getResponseCode() < 300) + { + + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), GREEN); + System.out.println("["+exitCode.getResponseCode()+"] "+ host +" - Good"); + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); + } + else if(exitCode.getResponseCode() >= 400 && exitCode.getResponseCode() < 500) + { + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), RED); + System.out.println("["+exitCode.getResponseCode()+"] "+ host +" - Bad"); + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); + } + else if(exitCode.getResponseCode() == 301 || exitCode.getResponseCode() == 307 || exitCode.getResponseCode() == 308 ) + { + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), BLUE); + System.out.println("["+exitCode.getResponseCode()+"] "+ host +" - Redirect"); + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); + + // redirect to new location by Recursion itself when it is 301,307,308 + String newUrl = exitCode.getHeaderField("Location"); + availableURL(newUrl); + + } + else + { + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), GRAY); + System.out.println("["+exitCode.getResponseCode()+"] "+ host +" - Unknown"); + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); + } + + }catch (Exception e) { + // response fail, server is not existed + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), RED); + System.out.println("[599] "+ host +" - Fail" ); + lib.SetConsoleTextAttribute(lib.GetStdHandle(STD_OUTPUT_HANDLE), WHITE); + } + } +}