Bug 1452025

Summary: [abrt] python3-idstools: rule.py:208:parse:TypeError: cannot use a string pattern on a bytes-like object
Product: [Fedora] Fedora Reporter: ali.sherif10
Component: python-idstoolsAssignee: marcindulak <Marcin.Dulak>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: jtfas90, Marcin.Dulak
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/20aed656a14c46c6ae1f3fe04e7bdd37e3e15f18
Whiteboard: abrt_hash:a63125dd9af7c4e32de738d603434dd1b57cbd56;VARIANT_ID=workstation;
Fixed In Version: python-idstools-0.6.1-2.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-11 18:24:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: environ none

Description ali.sherif10 2017-05-18 07:51:51 UTC
Description of problem:
I ran idstools-rulecat -o /etc/suricata/rules.
Output:
2017-05-18 09:45:41,306 - <INFO> -- Found Suricata version 3.2.1 at /usr/sbin/suricata.
2017-05-18 09:45:41,306 - <INFO> -- Last download less than 15 minutes ago. Not downloading https://rules.emergingthreats.net/open/suricata-1.3-enhanced/emerging.rules.tar.gz.
2017-05-18 09:45:43,398 - <INFO> -- Loaded 24210 rules.
2017-05-18 09:45:43,406 - <INFO> -- Disabled 0 rules.
2017-05-18 09:45:43,406 - <INFO> -- Enabled 0 rules.
2017-05-18 09:45:43,406 - <INFO> -- Modified 0 rules.
2017-05-18 09:45:43,406 - <INFO> -- Dropped 0 rules.
2017-05-18 09:45:43,606 - <INFO> -- Enabled 111 rules for flowbit dependencies.
2017-05-18 09:45:43,607 - <INFO> -- Writing rule files to /etc/suricata/rules.
Traceback (most recent call last):
  File "/usr/bin/idstools-rulecat", line 12, in <module>
    sys.exit(main())
  File "/usr/lib/python3.5/site-packages/idstools/scripts/rulecat.py", line 804, in main
    write_to_directory(args.output, files, rulemap)
  File "/usr/lib/python3.5/site-packages/idstools/scripts/rulecat.py", line 369, in write_to_directory
    rule = idstools.rule.parse(line)
  File "/usr/lib/python3.5/site-packages/idstools/rule.py", line 208, in parse
    m = rule_pattern.match(buf) or decoder_rule_pattern.match(buf)
TypeError: cannot use a string pattern on a bytes-like object

Version-Release number of selected component:
python3-idstools-0.6.0-1.fc25

Additional info:
reporter:       libreport-2.8.0
cmdline:        /usr/bin/python3 -s /usr/bin/idstools-rulecat -o /etc/suricata/rules
executable:     /usr/bin/idstools-rulecat
kernel:         4.10.15-200.fc25.x86_64
pkg_fingerprint: 4089 D8F2 FDB1 9C98
pkg_vendor:     Fedora Project
runlevel:       N 5
type:           Python3
uid:            0

Truncated backtrace:
rule.py:208:parse:TypeError: cannot use a string pattern on a bytes-like object

Traceback (most recent call last):
  File "/usr/bin/idstools-rulecat", line 12, in <module>
    sys.exit(main())
  File "/usr/lib/python3.5/site-packages/idstools/scripts/rulecat.py", line 804, in main
    write_to_directory(args.output, files, rulemap)
  File "/usr/lib/python3.5/site-packages/idstools/scripts/rulecat.py", line 369, in write_to_directory
    rule = idstools.rule.parse(line)
  File "/usr/lib/python3.5/site-packages/idstools/rule.py", line 208, in parse
    m = rule_pattern.match(buf) or decoder_rule_pattern.match(buf)
TypeError: cannot use a string pattern on a bytes-like object

Local variables in innermost frame:
buf: b'#\n'
group: None

Comment 1 ali.sherif10 2017-05-18 07:51:57 UTC
Created attachment 1279891 [details]
File: backtrace

Comment 2 ali.sherif10 2017-05-18 07:51:59 UTC
Created attachment 1279892 [details]
File: environ

Comment 3 marcindulak 2017-05-18 11:32:45 UTC
Reported at https://github.com/jasonish/py-idstools/issues/53

Use the workaround for now:

sudo python2 `which idstools-rulecat` -o /etc/suricata/rules

Comment 4 Fedora Update System 2017-05-25 17:08:05 UTC
python-idstools-0.6.1-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-1f3ec393b3

Comment 5 Fedora Update System 2017-05-25 17:33:46 UTC
python-idstools-0.6.1-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-52970a3b1b

Comment 6 Fedora Update System 2017-05-26 04:26:58 UTC
python-idstools-0.6.1-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-52970a3b1b

Comment 7 Fedora Update System 2017-05-26 06:03:51 UTC
python-idstools-0.6.1-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-1f3ec393b3

Comment 8 Fedora Update System 2017-05-26 18:36:03 UTC
python-idstools-0.6.1-2.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-da6d0d60f2

Comment 9 Fedora Update System 2017-05-26 18:51:34 UTC
python-idstools-0.6.1-2.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-806b6d9940

Comment 10 Fedora Update System 2017-05-27 03:02:04 UTC
python-idstools-0.6.1-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2017-05-27 03:25:22 UTC
python-idstools-0.6.1-2.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-806b6d9940

Comment 12 Fedora Update System 2017-05-27 20:36:38 UTC
python-idstools-0.6.1-2.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-da6d0d60f2

Comment 13 Fedora Update System 2017-06-09 19:13:08 UTC
python-idstools-0.6.1-2.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2017-06-11 18:24:14 UTC
python-idstools-0.6.1-2.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.