Added tests.

This commit is contained in:
Christian P. MOMON 2024-08-13 03:15:10 +02:00
parent d024d02409
commit eca3d45fb6

View file

@ -55,6 +55,12 @@ public class HttpAccessLogParserTest
// Line with many \". // Line with many \".
line = "10.141.57.46 - - [28/Apr/2023:13:46:34 +0200] \"GET /?\\\"<?=print(9347655345-4954366)?>\\\" HTTP/1.1\" 302 5143 \"https://www.gaagle.com/\\\"<?=print(9347655345-4954366);?>\\\"\" \"Mozilliqa\\\"<?=print(9347655345-4954366);?>\\\"\""; line = "10.141.57.46 - - [28/Apr/2023:13:46:34 +0200] \"GET /?\\\"<?=print(9347655345-4954366)?>\\\" HTTP/1.1\" 302 5143 \"https://www.gaagle.com/\\\"<?=print(9347655345-4954366);?>\\\"\" \"Mozilliqa\\\"<?=print(9347655345-4954366);?>\\\"\"";
Assert.assertNotNull(HttpAccessLogParser.parseLog(line)); Assert.assertNotNull(HttpAccessLogParser.parseLog(line));
line = "10.48.83.91 - - [30/May/2024:00:41:04 +0200] \"GET /user.php?act=login HTTP/1.0\" 302 3383 \"554fcae493e564ee0dc75bdf2ebf94caads|a:2:{s:3:\\\"num\\\";s:107:\\\"*/SELECT 1,0x2d312720554e494f4e2f2a,2,4,5,6,7,8,0x7b24617364275d3b706870696e666f0928293b2f2f7d787878,10-- -\\\";s:2:\\\"id\\\";s:11:\\\"-1' UNION/*\\\";}554fcae493e564ee0dc75bdf2ebf94ca\" \"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36\"";
Assert.assertNotNull(HttpAccessLogParser.parseLog(line));
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));
} }
/** /**