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

Error while scanning multiple host in against a policy (-T & -P) #284

Closed
dreizehnutters opened this issue Jul 7, 2024 · 2 comments
Closed

Comments

@dreizehnutters
Copy link
Contributor

Scaning multiple host against a given policy fails with this error

$ python3 ssh-audit.py -T targets.txt -P test.pol -j
[Traceback (most recent call last):
  File "/home/kali/dev/ssh-audit/ssh-audit.py", line 19, in <module>
    exit_code = main()
                ^^^^^^
  File "/home/kali/dev/ssh-audit/src/ssh_audit/ssh_audit.py", line 1599, in main
    worker_ret, worker_output = future.result()
                                ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/dev/ssh-audit/src/ssh_audit/ssh_audit.py", line 1438, in target_worker_thread
    my_aconf = copy.deepcopy(shared_aconf)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 271, in _reconstruct
    state = deepcopy(state, memo)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 146, in deepcopy
    y = copier(x, memo)
        ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
                             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 271, in _reconstruct
    state = deepcopy(state, memo)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 146, in deepcopy
    y = copier(x, memo)
        ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
                             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 161, in deepcopy
    rv = reductor(4)
         ^^^^^^^^^^^
TypeError: cannot pickle '_io.TextIOWrapper' object

hinting at some copy error which is caused by this line

dreizehnutters added a commit to dreizehnutters/ssh-audit that referenced this issue Jul 7, 2024
dreizehnutters added a commit to dreizehnutters/ssh-audit that referenced this issue Jul 7, 2024
@dreizehnutters
Copy link
Contributor Author

Using the fix from #285 allows to process multiple hosts.

$ python3 ssh-audit.py -T tmp -P test.pol    
Host:   kali:2222
Policy: Custom Policy (based on kali on 2024/07/07) (version 1)
Result: ✔ Passed
--------------------------------------------------------------------------------

Host:   kali:2222
Policy: Custom Policy (based on kali on 2024/07/07) (version 1)
Result: ✔ Passed
$ python3 ssh-audit.py -T tmp -P test.pol -j | jq .
[
  {
    "errors": [],
    "host": "kali",
    "passed": true,
    "policy": "Custom Policy (based on kali on 2024/07/07) (version 1)"
  },
  {
    "errors": [],
    "host": "kali",
    "passed": true,
    "policy": "Custom Policy (based on kali on 2024/07/07) (version 1)"
  }
]

@dreizehnutters dreizehnutters changed the title Error while using scanning multiple host in against a policy (-T & -P) Error while scanning multiple host in against a policy (-T & -P) Jul 7, 2024
@jtesta
Copy link
Owner

jtesta commented Sep 25, 2024

I believe this was fixed in dcbc43a. But if this doesn't solve the problem for you, please re-open this issue.

Thanks for reporting!

@jtesta jtesta closed this as completed Sep 25, 2024
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

2 participants