Skip to content

customer.json 'NoneType' object has no attribute 'group' #121

Description

@gilesdowner

Checklist

  • I have read the README and know the correct effect of the functional design.
  • There are no similar reports on existing issues (including closed ones).
  • I found the bug on the latest code of the master branch.

Describe the bug

When using custom config through the Docker image

 docker run -v "$(pwd):/home/nonroot/workdir" brootware/pyredactkit input-file.log -c custom.json

I get this error

\______   \___.__. \______   \ ____   __| _/____    _____/  |_  |    |/ _|__|/  |_ 
 |     ___<   |  |  |       _// __ \ / __ |\__  \ _/ ___\   __\ |      < |  \   __\
 |    |    \___  |  |    |   \  ___// /_/ | / __ \\  \___|  |   |    |  \|  ||  |  
 |____|    / ____|  |____|_  /\___  >____ |(____  /\___  >__|   |____|__ \__||__|  
           \/              \/     \/     \/     \/     \/               \/                                                                                                                 
                    +-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+-+
                    |P|o|w|e|r|e|d| |b|y| |B|r|o|o|t|w|a|r|e|
                    +-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+-+
            
    https://github.com/brootware
    https://brootware.github.io     
    https://twitter.com/brootware                                                                        
    
[+] Processing starts now. This may take some time depending on the file size. Monitor the redacted file size to monitor progress
[+] custom.json file supplied, will be redacting all supplied custom regex patterns
Traceback (most recent call last):
  File "/usr/local/bin/prk", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/pyredactkit/runner.py", line 157, in main
    execute_redact_logic()
  File "/usr/local/lib/python3.9/site-packages/pyredactkit/runner.py", line 146, in execute_redact_logic
    custom_redact.process_custom_file(file, args.customfile)
  File "/usr/local/lib/python3.9/site-packages/pyredactkit/custom_redactor.py", line 120, in process_custom_file
    data = self.redact_custom(line, customfile)
  File "/usr/local/lib/python3.9/site-packages/pyredactkit/custom_redactor.py", line 65, in redact_custom
    pattern_string = pattern_string.group(0)
AttributeError: 'NoneType' object has no attribute 'group'

To Reproduce

Steps to reproduce the behavior:

  1. Go to WSL Ubuntu
  2. make sure docker is installed
  3. grab the custom.json from this repo
  4. run docker run -v "$(pwd):/home/nonroot/workdir" brootware/pyredactkit input-file.log -c custom.json
  5. See error

Expected behavior

it shouldn't break and the log should be redacted

Screenshots

Software

  • Python version: by running: python --version
  • pip version: by running: pip --version
  • Power shell version: by running: $PSVersionTable.PSVersion

Desktop

  • MacOS: [e.g. macOS 10.15.6] by running: sw_vers -productVersion
  • Windows: by running: Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer
  • Terminal or Power-shell:

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions