Compare commits

..

5 commits

6 changed files with 61 additions and 9 deletions

View file

@ -5,7 +5,7 @@
#
function help
{
echo "Kiss4web build script."
echo "Build script."
echo "Usage: build.sh [ -h | -help | --help | -snapshot | -local | -full ]"
echo " -h, -help, --help display this help."
echo " -snapshot, --snapshot build a snapshot."
@ -40,12 +40,13 @@ function check_env
fi
# Java version check.
JAVA_VERSION=17;
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
if [[ "$javaVersionCheck" =~ ^.*\ ${JAVA_VERSION}. ]]; then
echo "Java ${JAVA_VERSION} version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
echo "Java ${JAVA_VERSION} version requirement..... MISSING"
fi
# Git check.

View file

@ -72,8 +72,8 @@ public final class StatoolInfosLauncher
else
{
//
Level logEnvLevel = Level.getLevel(StringUtils.defaultString(System.getenv().get("LOG4J_LEVEL"), ""));
Level logPropertyLevel = Level.getLevel(StringUtils.defaultString(System.getProperty("log4j2.level", "")));
Level logEnvLevel = Level.getLevel(StringUtils.defaultString(System.getenv().get("LOG4J_LEVEL"), " "));
Level logPropertyLevel = Level.getLevel(StringUtils.defaultString(System.getProperty("log4j2.level", " ")));
Level level;
if (logPropertyLevel != null)

View file

@ -307,7 +307,21 @@ public class HttpAccessLogAnalyzer
/**
* Checks if is page.
*
*
* <pre>
* null => false
* "" => false
* " " => false
* "GET /foo" => true
* "GET /foo42" => true
* "GET /foo.cgi" => true
* "GET /foo.htm" => true
* "GET /foo.html" => true
* "GET /foo.php" => true
* "GET /foo.xhtml" => true
* "GET /foo.jpg" => false
* </pre>
*
* @param request
* the request
* @return true, if is page

View file

@ -34,7 +34,7 @@ public class HttpAccessLogParser
// '"$request" $status $body_bytes_sent '
// '"$http_referer" "$http_user_agent"';
public static final Pattern COMBINED_PATTERN = Pattern.compile(
"^(?<remoteAddress>[a-fA-F0-9\\:\\.]+) - (?<remoteUser>[^\\[]+) \\[(?<time>[^\\]]+)\\] \"(?<request>([^\"]|\\\")*)\" (?<status>\\d+) (?<bodyBytesSent>\\d+) \"(?<referer>([^\"]|\\\")*)\" \"(?<userAgent>([^\"]|\\\")*)\".*$");
"^(?<remoteAddress>[a-fA-F0-9\\:\\.]+) - (?<remoteUser>[^\\[]+) \\[(?<time>[^\\]]+)\\] \"(?<request>(?>[^\"]|\\\")*)\" (?<status>\\d+) (?<bodyBytesSent>\\d+) \"(?<referer>(?>[^\"]|\\\")*)\" \"(?<userAgent>(?>[^\"]|\\\")*)\".*$");
public static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern("dd/MMM/yyyy:HH:mm:ss Z").withLocale(Locale.ENGLISH);

View file

@ -40,7 +40,7 @@ public class HttpAccessLogParserTest
* the exception
*/
@Test
public void test01() throws Exception
public void testParseLog01() throws Exception
{
// Nominal line.
String line = "172.104.137.47 - - [30/Apr/2023:23:25:15 +0200] \"GET /default.jsp HTTP/1.1\" 302 534 \"-\" \"curl/7.54.0\"";
@ -59,6 +59,22 @@ public class HttpAccessLogParserTest
line = "10.9.74.87 - - [03/Aug/2023:21:11:59 +0200] \"GET /plus/flink.php?dopost=save&c=cat%20/etc/passwd HTTP/1.1\" 302 5438 \"<?php \\\"system\\\"($c);die;/*ref\" \"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/44.0.2403.155 Safari/537.36\"";
Assert.assertNotNull(HttpAccessLogParser.parseLog(line));
line = "41.80.118.70 - - [04/Jan/2024:00:38:58 +0100] \"GET /services/audio.xhtml?url=http://go.a.gle.email.2.%5C%5Cn1@sarahjohttonw.estbrooxxertrew.e.r@hu.fe.ng.k.ua.ngniu.bi..uk41@www.zaxxle@silxxa.wooxx.o.r.t.h@ba.tt.le9.578@jxd.1.4.7m.nb.v.3.6.9.cx.z.9"
+ "51.4@ex.p.lo.si.v.edhq.g@sixxia.wooxx.o.r.t.h@r.eces.si.v.e.x.g.z@leaxxa.lanxxon@vi.rt.u.ali.rd.j@h.att.ie.m.c.d.o.w.e.ll2.56.6.3@buxxon.rene@fullxxuestickyriddl.edyxxmi.c.t.r.a@johndf.gfjhfgjf.ghfdjfhjhjhjfdgh@sybbr%3Er.eces.si.v.e.x.g.z@lexxna.l"
+ "axxton@c.o.nne.c.t.tn.tu@go.a.gle.email.2.%5C%5C%5C%5C%5C%5C%5C%5Cn1@saxxhjohxxonw.estbxxokbertrew.e.r@hu.fe.ng.k.ua.nxxiu.bi..uk41@www.zxxele@sixxia.woxxw.o.r.t.h@fullgluxxtickyriddl.edyxxmi.c.t.r.a@johndf.gfjhfgjf.ghfdjfhjhjhjfdgh@sybbr%3Er.eces"
+ ".si.v.e.x.g.z@lexxna.lxxgton@c.o.nne.c.t.tn.tu@go.a.gle.email.2.%5C%5C%5C%5C%5C%5C%5C%5Cn1@sarahxxnsonw.estbrookbxxtrew.e.r@hu.fe.ng.k.ua.nxxiu.bi..uk41@www.zaxxle@silxxa.wooxx.o.r.t.h@p.a.r.a.ju.mp.e.r.sj.a.s.s.en20.14@maxxalena.tuxx@h.att.ie.m."
+ "c.d.o.w.e.ll2.56.6.3buxxon.rene@c.o.nne.c.t.tn.tu@go.a.gle.email.2.%5C%5Cn1@saxxhjohnsonw.estbrooxxertrew.e.r@hu.fe.ng.k.ua.nxxiu.bi..uk41@www.zxxele@silvxx.wooxx.o.r.t.h@winkxxr-sanxxini.it/info/mwst01i.pdf/rk=0/rs=fzqfiq9omocv.7bggtuxxnthpge-%3F"
+ "a%5B%5D=%3Ca+href%3Dhttps%3A%2F%2Fwww.rssxxg.com%2Frequest.php%3Freq%3Dfurl%26i%3D3759037%26r%3D17559%26url%3Dhttp%253A%252F%252Fbuxxssayuk.us%3xxuy+essays%3C%2Fa%3E%3Cmeta+http-equiv%3Drefresh+content%3D0%3Burl%3Dhttps%3A%2F%2Fwww.spxxtsbook.ag%2"
+ "Fctr%2Facctmgt%2Fpl%2FopxxLink.ctr%3FctrPage%3Dhttps%3A%2F%2Fbuxxssayuk.us%2F+%2F%3E HTTP/1.0\" 200 4521 \"https://www.toxoyz.com/t/spip_cookie.php?url=http://go.a.gle.email.2.%5C%5Cn1@sarxxxohnsonw.estbrxxkbertrew.e.r@hu.fe.ng.k.ua.nxxiu.bi..uk"
+ "41@www.zaxxle@silvia.wooxx.o.r.t.h@ba.tt.le9.578@jxd.1.4.7m.nb.v.3.6.9.cx.z.951.4@ex.p.lo.si.v.edhq.g@sixxia.wooxx.o.r.t.h@r.eces.si.v.e.x.g.z@xxnna.lxxxton@vi.rt.u.ali.rd.j@h.att.ie.m.c.d.o.w.e.ll2.56.6.3@burton.rene@fullgxxestickyriddl.exxxami."
+ "c.t.r.a@johndf.gfjhfgjf.ghfdjfhjhjhjfdgh@sybbr%3Er.eces.si.v.e.x.g.z@leaxxa.laxxton@c.o.nne.c.t.tn.tu@go.a.gle.email.2.%5C%5C%5C%5C%5C%5C%5C%5Cn1@sarxxjohnxxnw.estbroxxbertrew.e.r@hu.fe.ng.k.ua.ngxxu.bi..uk41@www.zxxele@silxxa.woxxw.o.r.t.h@fullgl"
+ "uesxxckyriddl.exxnami.c.t.r.a@johxxf.gfjhfgjf.ghfdjfhjhjhjfdgh@sybbr%3Er.eces.si.v.e.x.g.z@lexxna.laxxton@c.o.nne.c.t.tn.tu@go.a.gle.email.2.%5C%5C%5C%5C%5C%5C%5C%5Cn1@sarxxjohnxxnw.estbxxokbertrew.e.r@hu.fe.ng.k.ua.ngniu.bi..ux41@www.zaxxle@sxxvi"
+ "a.wooxx.o.r.t.h@p.a.r.a.ju.mp.e.r.sj.a.s.s.en20.14@magxxlena.txxn@h.att.ie.m.c.d.o.w.e.ll2.56.6.3burxxn.rene@c.o.nne.c.t.tn.tu@go.a.gle.email.2.%5C%5Cn1@sarahjohxxonw.estbrookxxrtrew.e.r@hu.fe.ng.k.ua.nxxiu.bi..ux41@www.zxxele@sixxia.woxxw.o.r.t.h"
+ "@winxxer-sanxxini.it/info/mwst01i.pdf/rk=0/rs=fzqfixxomocv.7bggtuxxnthpge-%3Fa%5B%5D=%3Ca+href%3Dhttps%3A%2F%2Fwww.rsxxng.com%2Frequest.php%3Freq%3Dfurl%26i%3D3759037%26r%3D17559%26url%3Dhttp%253A%252F%252Fbuyexxayuk.us%3Ebuy+essays%3C%2Fa%3E%3Cme"
+ "ta+http-equiv%3Drefresh+content%3D0%3Burl%3Dhttps%3A%2F%2Fwww.sportxxook.ag%2Fctr%2Facctmgt%2Fpl%2Fopenxxnk.ctr%3FctrPage%3Dhttps%3A%2F%2Fbuxxssayuk.us%2F+%2F%3E\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Ch"
+ "rome/114.0.0.0 Safari/537.36\"";
Assert.assertNotNull(HttpAccessLogParser.parseLog(line));
}
/**

View file

@ -38,6 +38,27 @@ import fr.devinsy.statoolinfos.util.FilesUtils;
*/
public class HttpAccessLogsAnalyzerTest
{
/**
* Checks if is page test 01.
*/
@Test
public void isPageTest01()
{
Assert.assertFalse(HttpAccessLogAnalyzer.isPage(null));
Assert.assertFalse(HttpAccessLogAnalyzer.isPage(""));
Assert.assertFalse(HttpAccessLogAnalyzer.isPage(" "));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo42"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.html"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HTML"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HtMl"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HtMl"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo/bar/foo.php"));
Assert.assertFalse(HttpAccessLogAnalyzer.isPage("GET /foo.jpg"));
}
/**
* @throws Exception
*/