Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regex_core.error: multiple repeat at position 1146 #22

Open
Russell-Jones opened this issue Oct 27, 2016 · 0 comments
Open

regex_core.error: multiple repeat at position 1146 #22

Russell-Jones opened this issue Oct 27, 2016 · 0 comments

Comments

@Russell-Jones
Copy link

Russell-Jones commented Oct 27, 2016

I was just playing with pygrok; I ran the following, which might be a useful basis for a test, and got the titular error.

#!/usr/bin/env python3
import os
import gc
import itertools as it
import pygrok as pg

fs = it.chain(*(os.scandir(d) for d in 
                pg.DEFAULT_PATTERNS_DIRS))
ps = it.chain(*(open(f.path).readlines() for f in fs))
gc.collect() # release file descriptors, I think. xonsh got upset without it.

for p in ps:
    try:
        pg.Grok(p)
    except Exception as e:
        print(p, e)

The offending pattern is

SHOREWALL (%{SYSLOGTIMESTAMP:timestamp}) (%{WORD:nf_host}) kernel:.*Shorewall:(%{WORD:nf_action1})?:(%{WORD:nf_action2})?.*IN=(%{USERNAME:nf_in_interface})?.*(OUT= *MAC=(%{COMMONMAC:nf_dst_mac}):(%{COMMONMAC:nf_src_mac})?|OUT=%{USERNAME:nf_out_interface}).*SRC=(%{IPV4:nf_src_ip}).*DST=(%{IPV4:nf_dst_ip}).*LEN=(%{WORD:nf_len}).?*TOS=(%{WORD:nf_tos}).?*PREC=(%{WORD:nf_prec}).?*TTL=(%{INT:nf_ttl}).?*ID=(%{INT:nf_id}).?*PROTO=(%{WORD:nf_protocol}).?*SPT=(%{INT:nf_src_port}?.*DPT=%{INT:nf_dst_port}?.*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant