mitre / inspec_tools

A command-line and ruby API of utilities, converters and tools for creating, converting and processing security baseline formats, results and data
https://inspec-tools.mitre.org/
Other
91 stars 30 forks source link

pdf2inspec results in Exception #180

Closed ghunsl closed 2 years ago

ghunsl commented 4 years ago

When I run following command to convert pdf to inspec, I get an exception error.

# inspec_tools pdf2inspec -p CIS_Red_Hat_Enterprise_Linux_7_Benchmark_v2.2.0.pdf
Exception: Zip end of central directory signature not found
Existing...

Running with debug option does not output anything else, either.

Bialogs commented 4 years ago

@ghunsl Were you attempting to run with Docker? Can you please try again with docker image tagged 2.0.7?

tomrobison commented 4 years ago

I had the same error for CentOS 7.

With the container tagged 2.0.7 for CentOS 7, I received the following undefined method 'split' for nil:NilClass error:

Traceback (most recent call last):
    12: from /usr/local/bundle/bin/inspec_tools:23:in `<main>'
    11: from /usr/local/bundle/bin/inspec_tools:23:in `load'
    10: from /usr/local/bundle/gems/inspec_tools-2.0.7/exe/inspec_tools:14:in `<top (required)>'
     9: from /usr/local/bundle/gems/inspec-core-4.22.1/lib/inspec/base_cli.rb:35:in `start'
     8: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
     7: from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
     6: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
     5: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
     4: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/plugin_cli.rb:133:in `pdf2inspec'
     3: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:37:in `to_inspec'
     2: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:59:in `parse_controls'
     1: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:59:in `each'
/usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:62:in `block in parse_controls': undefined method `split' for nil:NilClass (NoMethodError)

The included Ubuntu benchmark in examples completed successfully.

rbclark commented 4 years ago

I had the same error for CentOS 7.

With the container tagged 2.0.7 for CentOS 7, I received the following undefined method 'split' for nil:NilClass error:

Traceback (most recent call last):
  12: from /usr/local/bundle/bin/inspec_tools:23:in `<main>'
  11: from /usr/local/bundle/bin/inspec_tools:23:in `load'
  10: from /usr/local/bundle/gems/inspec_tools-2.0.7/exe/inspec_tools:14:in `<top (required)>'
   9: from /usr/local/bundle/gems/inspec-core-4.22.1/lib/inspec/base_cli.rb:35:in `start'
   8: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
   7: from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
   6: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
   5: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
   4: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/plugin_cli.rb:133:in `pdf2inspec'
   3: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:37:in `to_inspec'
   2: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:59:in `parse_controls'
   1: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:59:in `each'
/usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:62:in `block in parse_controls': undefined method `split' for nil:NilClass (NoMethodError)

The included Ubuntu benchmark in examples completed successfully.

Is the PDF you are trying to convert a publicly available PDF?

Bialogs commented 4 years ago

@tomrobison Your current issue will probably come down to the way the PDF is formatted. But from what you said it sounds like 2.0.7 fixed the original problem...

tomrobison commented 4 years ago

I did run the RedHat Benchmark so to be inline with the original poster. The output was

Traceback (most recent call last):
    12: from /usr/local/bundle/bin/inspec_tools:23:in `<main>'
    11: from /usr/local/bundle/bin/inspec_tools:23:in `load'
    10: from /usr/local/bundle/gems/inspec_tools-2.0.7/exe/inspec_tools:14:in `<top (required)>'
     9: from /usr/local/bundle/gems/inspec-core-4.22.1/lib/inspec/base_cli.rb:35:in `start'
     8: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
     7: from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
     6: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
     5: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
     4: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/plugin_cli.rb:133:in `pdf2inspec'
     3: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:37:in `to_inspec'
     2: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:59:in `parse_controls'
     1: from /usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:59:in `each'
/usr/local/bundle/gems/inspec_tools-2.0.7/lib/inspec_tools/pdf.rb:62:in `block in parse_controls': undefined method `split' for nil:NilClass (NoMethodError)

If the issue was that the PDF benchmark was not correctly processed, then the issue is not resolved.

If the issue was there was no stacktrace, then the issue is resolved.

camdenmoors commented 2 years ago

PDF2InSpec is no longer being maintained as inspec_tools is being depreciated, for more information see the SAF CLI