Skip to content

Commit

Permalink
ping_remark
Browse files Browse the repository at this point in the history
  • Loading branch information
harp077 committed May 2, 2022
1 parent f921dfa commit f470822
Show file tree
Hide file tree
Showing 10 changed files with 862 additions and 6 deletions.
13 changes: 13 additions & 0 deletions log/jul.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
.level=INFO
############
java.util.logging.FileHandler.level=INFO
java.util.logging.FileHandler.pattern = log/app.log
java.util.logging.FileHandler.limit = 999000
java.util.logging.FileHandler.count = 3
java.util.logging.FileHandler.append = true
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
############
java.util.logging.ConsoleHandler.level =INFO
java.util.logging.ConsoleHandler.formatter =java.util.logging.SimpleFormatter
#############
15 changes: 15 additions & 0 deletions log/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
log4j.debug=false
log4j.rootLogger=INFO, FILE, CONSOLE
##############
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=log/app.log
log4j.appender.FILE.maxFileSize=999KB
log4j.appender.FILE.maxBackupIndex=1
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
#############
###############
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Encoding=utf-8
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
25 changes: 25 additions & 0 deletions log/log4j.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE log4j:configuration PUBLIC
"-//APACHE//DTD LOG4J 1.2//EN"
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration debug="false">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Encoding" value="utf-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="log/app.log"/>
<param name="maxFileSize" value="999KB"/>
<param name="maxBackupIndex" value="1"/>
<param name="Encoding" value="utf-8"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<root>
<priority value="INFO"/>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</log4j:configuration>
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

<dependencies>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>

<dependency>
<groupId>org.snmp4j</groupId>
<artifactId>snmp4j</artifactId>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/my/harp07/GenericPJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class GenericPJ {
public static SubnetUtils su;
public static InetAddressValidator ipv = InetAddressValidator.getInstance();
public static DomainValidator dnsv = DomainValidator.getInstance();
public static String ping_remark="Works well and tested with Root privileges on Linux ! Run as root/admin user !\n";

// ВИСНЕТ КОГДА НЕ РАБОТАЕТ DNS И БЛОКИ CATCH ПУСТЫЕ !!!
public static Boolean pingIp(String ipad, int timeout) {
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/my/harp07/PjFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import javax.swing.event.HyperlinkListener;
import javax.swing.text.html.HTMLEditorKit;
import static my.harp07.GenericPJ.ipv;
import static my.harp07.GenericPJ.ping_remark;
import static my.harp07.PjCalc.CIDRS_MASKS;
import static my.harp07.PjPing.COUNTS;
import static my.harp07.PjPing.TIMEOUTS;
Expand All @@ -51,7 +52,7 @@ public class PjFrame extends javax.swing.JFrame {
public static String currentLAF = "de.muntjak.tinylookandfeel.TinyLookAndFeel";
public static String currentTheme = "lib/themes/Default.theme";
public static List<String> tinyTemes = new ArrayList<>();
public static String zagolovok = "Pure Java Network Tools, v1.0.62, build 02-05-2022";
public static String zagolovok = "Pure Java Network Tools, v1.0.63, build 02-05-2022";
//public static String currentLAF = "org.pushingpixels.substance.api.skin.SubstanceSaharaLookAndFeel";
//public static String currentLAF = "javax.swing.plaf.metal.MetalLookAndFeel";
//public ImageIcon snmpIcon33 = new ImageIcon(getClass().getResource("/mib-tree-3.jpg"));
Expand Down Expand Up @@ -123,7 +124,9 @@ public void paint(Graphics g) {
}; */
PjSnmpOidHelp.runSnmpHelp(taSnmpOidHelp);
taSnmpOidHelp.setEditable(false);
taPingFloodResult.setText("Works well and tested with Root privileges on Linux ! Run as root/admin user !\n");
taPingResult.setText(ping_remark);
taPingScannerResult.setText(ping_remark);
taPingFloodResult.setText(ping_remark);
}

public static void MyInstLF(String lf) {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/my/harp07/PjPing.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static my.harp07.GenericPJ.dnsv;
import static my.harp07.GenericPJ.ipv;
import static my.harp07.GenericPJ.pingIp;
import static my.harp07.GenericPJ.ping_remark;
import static my.harp07.PjFrame.frame;
import org.apache.commons.validator.routines.DomainValidator;
import org.apache.commons.validator.routines.InetAddressValidator;
Expand Down Expand Up @@ -50,7 +51,7 @@ public class PjPing {
public static String getResult(String ip_dns, JTextArea ta) {
pingtimeout=Integer.parseInt(PjFrame.comboPingTimeouts.getSelectedItem().toString());
int loss=0;
String result = "TimeOut = " + pingtimeout + " ms, Count = "+PjFrame.comboPingCounts.getSelectedItem().toString()+":\n\n";
String result = ping_remark + "TimeOut = " + pingtimeout + " ms, Count = "+PjFrame.comboPingCounts.getSelectedItem().toString()+":\n\n";
if (ip_dns != null) {
for (int j = 1; j <= 1+Integer.parseInt(PjFrame.comboPingCounts.getSelectedItem().toString()); j++) {
if (j==1) {
Expand Down Expand Up @@ -79,7 +80,8 @@ public static String getResult(String ip_dns, JTextArea ta) {
}

public static void runGetResult(JTextField ipq, JTextArea ta) {
ta.setText("");
// ta.setText("");
ta.setText("Works well and tested with Root privileges on Linux ! Run as root/admin user !\n");
String input = ipq.getText().trim();
//System.out.println(input);
if (ipv.isValid(input)) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/my/harp07/PjPingScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javax.swing.JTextField;
import static my.harp07.GenericPJ.ipv;
import static my.harp07.GenericPJ.pingIp;
import static my.harp07.GenericPJ.ping_remark;
import static my.harp07.GenericPJ.su;
import static my.harp07.PjFrame.frame;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -61,7 +62,7 @@ public static String getResult(String ipadr, JTextArea tap) {
su = new SubnetUtils(ipadr);
//su=new SubnetUtils("10.73.2.111/23");
//su=new SubnetUtils("10.73.2.111", "255.255.254.0");
result = "\n Network IP-data:\n";
result = ping_remark + "\n Network IP-data:\n";
result = result + "\n Low Address = " + su.getInfo().getLowAddress();
result = result + "\n High Address = " + su.getInfo().getHighAddress();
result = result + "\n Broadcast Address = " + su.getInfo().getBroadcastAddress();
Expand All @@ -88,7 +89,7 @@ public static String getResult(String ipadr, JTextArea tap) {
resultDOWN = resultDOWN + j + ") " + x + " = DOWN\n";
j++;
}
tap.setText("\nCheck by small 2 ping for every IP.\n\n Please Wait ! ........" + j);
tap.setText(ping_remark + "\nCheck by small 2 ping for every IP.\n\n Please Wait ! ........" + j);
});
changeInterface(true);
return result;
Expand Down
Loading

0 comments on commit f470822

Please sign in to comment.