Backport of core PR12972
https://github.com/bitcoin/bitcoin/pull/12972/files
This converts the test-security.py script to python3 and add a linter
to enforce python3 shebang.
Core ignores python files with no shebang. I prefer to add them to the
files missing it (with the exception of the __init__.py files).
Depends on D3927.