Skip to content

tool: testssl issues with file output flags #54

Closed

Description

@fullstackpotato

Issue
Interlace is unable to complete testssl if one of the output flags are used for the tool (html/log/all etc).
Not 100% this is an interlace issue, but the output when using testssl on it's own works, this behaviour is only encountered when used with Interlace.

Error Encountered

testssl: line 492: printf: write error: Broken pipe

Versions used

  • Interlace - Fresh clone from here, 10th August 2019.
  • Testssl - Latest master branch clone, 10th August 2019.

Commands used to replicate

# When used as a single command
interlace -tL target_list.txt -c "testssl -E --warnings batch --quiet --outprefix "ciphers-" -oA ssl/testssl/ _target_" --silent

# When used as part of a command list
interlace -tL target_list.txt -o /path/to/directory/ -cL interlace_commands.txt
# Relevant lines from interlace_commands.txt
testssl -E --color=3 --htmlfile=ssl/testssl/ciphers._target_.html https://_target_
testssl --color=3 --htmlfile=ssl/testssl/full._target_.html https://_target_

Environment

  • Linux Mint 19 Tara
  • Not running with sudo/root
  • Have permission to write to target folders and folders exist

Activity

  1. prodigysml commented on Aug 15, 2019

    @prodigysml
    Collaborator

    I haven't looked into this too much yet, but based off the error message, that seems to be a testssl issue. Have you tried running the command alone without interlace @bjmarr ?

  2. fullstackpotato commented on Aug 15, 2019

    @fullstackpotato
    Author

    As mentioned above I have and it works as expected without error. The errors encountered are only present when using Interlace and an output flag for testssl.

  3. codingo commented on Aug 15, 2019

    @codingo
    Owner

    @bjmarr the changes being introduced in #52 are quite significant and will impact how we work with buffers, which does likely fix this by proxy. With that in mind I'm going to shelve testing this until we've fully landed that change. After that I'll then revisit this and see if I can identify if it's still happening, and if so why.

  4. fullstackpotato commented on Aug 15, 2019

    @fullstackpotato
    Author

    @codingo Np, hopefully it does.
    @prodigysml Thank you both for replying and looking into this. Interlace is a great tool and I use it regularly within my workflows. Appreciate the hard work you guys put in 👍

  5. prodigysml commented on Aug 15, 2019

    @prodigysml
    Collaborator
  6. codingo commented on Aug 15, 2019

    @codingo
    Owner

    Hi @bjmarr,

    @prodigysml took a look into this early this morning and believes this line is at fault for at least some write issues:

    https://github.com/codingo/Interlace/blob/master/Interlace/lib/core/input.py#L106

            # checking for whether output is writable and whether it exists
            if arguments.output:
                if not access(arguments.output, W_OK):
                    raise Exception("Directory provided isn't writable")
    

    The problem is if the destination doesn't exist (such as a new directory) then it can't throw W_OK and we're escaping too early, instead of persisting with the write. We're going to patch this later today and will update this thread with the pull request reference once this has been done.

    I'm not certain that resolves this case, but I'm confident that it leads up closer to fully understanding write based issues and squashing them.

  7. codingo commented on Aug 16, 2019

    @codingo
    Owner

    Potentially closed with #57, to be fully tested once #52 has been merged

  8. codingo commented on Aug 19, 2019

    @codingo
    Owner

    We've now landed version 1.6. I don't have time tonight, but I'll revisit this soon.

  9. codingo commented on Aug 19, 2019

    @codingo
    Owner

    @bjmarr could this be related to #63?

  10. fullstackpotato commented on Aug 20, 2019

    @fullstackpotato
    Author

    Apologies, it's been a busy week! Appreciate the hard work into this issue.

    @codingo; I'm not sure that this is the same issue, however I have experienced some of these bugs when trying to identify the cause of the bug posted above.

    I have included quite a bit of info below to help with the identification of the issues.

    I get the same printf error from testssl when using:

    interlace -tL target_list.txt -o ssl/testssl/test/ -cL testssl-list.txt
    
    # testssl-list.txt lines
    testssl --warnings batch --quiet --outprefix full- -oA ssl/testssl/test/ _target_
    testssl -E --warnings batch --quiet --outprefix ciphers- -oA ssl/testssl/test/ _target

    testssl seems to get started up and runs through to approximately where the reverse dns checks are made, then interlace seems to intervene and kill the process there. I'm not sure if this is time based but the outputs seem to be consistently killed off at around the same position. at 620-640 bytes written, or just after the reverse dns check is completed in testssl.

    I now receive a separate error, not sure if this would be worth raising as a new issue? But when using the following I get some python errors from Interlace:

    $ interlace -t https://bjmarr.uk -c "testssl -E --quiet --htmlfile test.html _cleantarget_"
    =====================================================
    Interlace v1.6	by Michael Skelton (@codingo_)
                      	& Sajeeb Lohani (@sml555_)
    =====================================================
    Traceback (most recent call last):
      File "/usr/local/bin/interlace", line 11, in <module>
        load_entry_point('Interlace==1.6', 'console_scripts', 'interlace')()
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.6-py3.6.egg/Interlace/interlace.py", line 25, in main
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.6-py3.6.egg/Interlace/interlace.py", line 11, in build_queue
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.6-py3.6.egg/Interlace/lib/core/input.py", line 239, in process_commands
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.6-py3.6.egg/Interlace/lib/core/input.py", line 167, in _replace_variable_with_commands
    AttributeError: 'str' object has no attribute 'name'

    This seems to consistently happen with the -c, but not with the -cL,-t nor the -tL flags. Has the -c flag changed since the previous release and/or have I not updated correctly? I did the updating doing the following:

    • Deleted the folder contents
    • Downloaded the new release from the repo's release page
    • Ran the setup script

    I hope that this info is of use, if not please let me know and I'll assist where I can.

  11. codingo commented on Aug 20, 2019

    @codingo
    Owner

    Ah! Sorry for clarity, _cleantarget_ isn't implemented yet, it should be landing today. We do need to change the way we handle exceptions to make this kind of a fault more clear.

  12. fullstackpotato commented on Aug 21, 2019

    @fullstackpotato
    Author

    Sorry for mis-reading. I did just give it a try with a regular target and get the same error with the -c flag and _target_. Please correct me if I've done something incorrect (I did get the same error with a simple curl _target_):

    $ interlace -t https://bjmarr.uk -c "testssl -E --quiet --htmlfile test.html _target_"
    =====================================================
    Interlace v1.6	by Michael Skelton (@codingo_)
                      	& Sajeeb Lohani (@sml555_)
    =====================================================
    Traceback (most recent call last):
      File "/usr/local/bin/interlace", line 11, in <module>
        load_entry_point('Interlace==1.6', 'console_scripts', 'interlace')()
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.6-py3.6.egg/Interlace/interlace.py", line 25, in main
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.6-py3.6.egg/Interlace/interlace.py", line 11, in build_queue
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.6-py3.6.egg/Interlace/lib/core/input.py", line 239, in process_commands
      File "/usr/local/lib/python3.6/dist-packages/Interlace-1.6-py3.6.egg/Interlace/lib/core/input.py", line 167, in _replace_variable_with_commands
    AttributeError: 'str' object has no attribute 'name'
  13. iamOgunyinka commented on Aug 23, 2019

    @iamOgunyinka
    Contributor

    @bjmarr Sorry about the inconvenience. It was an oversight made while implementing #52 and I kind of introduced the bug. There's a PR issued to fix that.

  14. codingo commented on Aug 23, 2019

    @codingo
    Owner

    Closed in #72, let me know if you have any other issues and will reopen.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions