From 6aaf532af69f5bec18b83c2c35714e29637107b6 Mon Sep 17 00:00:00 2001 From: BOUTELIER Sebastien <sebastien.boutelier@lis-lab.fr> Date: Thu, 2 Nov 2023 17:16:39 +0100 Subject: [PATCH] Correction des regexp. Les dates entre 1 et 9 ont une espace devant... --- parselog.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/parselog.rs b/parselog.rs index 590d70a..773fc8d 100644 --- a/parselog.rs +++ b/parselog.rs @@ -196,12 +196,12 @@ fn main() { let port = getport().unwrap(); let hostname = Some(gethostname().into_string().unwrap()); let _ = HOSTNAME.set(hostname); - let _ = REGEXP_LAUNCH.set(Regex::new(r"^\S+ \S+ \S+ \S+ \S+ (?<con>\S+) (?<op>\S+) (?<command>\S+)").unwrap()); - let _ = REGEXP_OTHERLOG.set(Regex::new(r"^\S+ \S+ \S+ \S+ \S+ (?<log>.+)").unwrap()); - let _ = REGEXP_RESULT.set(Regex::new(r"^\S+ \S+ \S+ \S+ \S+ conn=(?<con>[0-9]+) op=(?<op>[0-9]+)( SEARCH)? RESULT \S+ (?<err>\S+)( nentries=(?<nentries>[0-9]+))?").unwrap()); - let _ = REGEXP_CMD.set(Regex::new(r"^\S+ \S+ \S+ \S+ \S+ conn=(?<con>[0-9]+) op=(?<op>[0-9]+) (?<cmd>(ADD|DEL|BIND|CMP|MOD|PASSMOD|SRCH)) (?<v>[a-z]+)=(?<val1>\S+)( \S+ \S+)?( (attr|filter)=(?<val2>\S+))?").unwrap()); - let _ = REGEXP_CONNECT.set(Regex::new(r"^\S+ \S+ \S+ \S+ \S+ conn=(?<con>[0-9]+) \S+ ACCEPT from IP=(?<ip>[0-9.:]+):[0-9]+").unwrap()); - let _ = REGEXP_CLOSE.set(Regex::new(r"^\S+ \S+ \S+ \S+ \S+ conn=(?<con>[0-9]+) \S+ (closed|ABANDON)").unwrap()); + let _ = REGEXP_LAUNCH.set(Regex::new(r"^\S+ [0-9 ]{2} \S+ \S+ \S+ (?<con>\S+) (?<op>\S+) (?<command>\S+)").unwrap()); + let _ = REGEXP_OTHERLOG.set(Regex::new(r"^\S+ [0-9 ]{2} \S+ \S+ \S+ (?<log>.+)").unwrap()); + let _ = REGEXP_RESULT.set(Regex::new(r"^\S+ [0-9 ]{2} \S+ \S+ \S+ conn=(?<con>[0-9]+) op=(?<op>[0-9]+)( SEARCH)? RESULT \S+ (?<err>\S+)( nentries=(?<nentries>[0-9]+))?").unwrap()); + let _ = REGEXP_CMD.set(Regex::new(r"^\S+ [0-9 ]{2} \S+ \S+ \S+ conn=(?<con>[0-9]+) op=(?<op>[0-9]+) (?<cmd>(ADD|DEL|BIND|CMP|MOD|PASSMOD|SRCH)) (?<v>[a-z]+)=(?<val1>\S+)( \S+ \S+)?( (attr|filter)=(?<val2>\S+))?").unwrap()); + let _ = REGEXP_CONNECT.set(Regex::new(r"^\S+ [0-9 ]{2} \S+ \S+ \S+ conn=(?<con>[0-9]+) \S+ ACCEPT from IP=(?<ip>[0-9.:]+):[0-9]+").unwrap()); + let _ = REGEXP_CLOSE.set(Regex::new(r"^\S+ [0-9 ]{2} \S+ \S+ \S+ conn=(?<con>[0-9]+) \S+ (closed|ABANDON)").unwrap()); let s = format!("127.0.0.1:{}",port); let listener = TcpListener::bind(s).unwrap(); for stream in listener.incoming() { -- GitLab