landscapeio / dodgy Goto Github PK
View Code? Open in Web Editor NEWLooks at Python code to search for things which look "dodgy" such as passwords or diffs
License: MIT License
Looks at Python code to search for things which look "dodgy" such as passwords or diffs
License: MIT License
$ dodgy ---help │
Traceback (most recent call last):
File "/usr/bin/dodgy", line 4, in <module>
dodgy.run.run()
File "/usr/lib/python3/dist-packages/dodgy/run.py", line 56, in run
warnings = run_checks(os.getcwd())
File "/usr/lib/python3/dist-packages/dodgy/run.py", line 44, in run_checks
for msg_parts in check_file(filepath):
File "/usr/lib/python3/dist-packages/dodgy/checks.py", line 72, in check_file
return check_file_contents(to_check.read())
File "/usr/lib/python3.6/codecs.py", line 700, in read
return self.reader.read(size)
File "/usr/lib/python3.6/codecs.py", line 503, in read
newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 787: invalid continuation byte
$ dpkg -l dodgy │
ii dodgy 0.1.9-3 all searches for dodgy looking lines in Python code
Dodgy on pypi is currently in 0.2.1 and there is no such tag on github (latest is 0.1.9)
Would it be possible to please tag the release on github?
Line 2 in b3fbaf0
PYTHONWARNINGS=always python setup.py install
/root/checked_repos_clone_1500_1600/dodgy/setup.py:2: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.core import setup
It should be possible to run it on a single file / path only.
Additionally, dodgy --help
should not run, but display help.
Dodgy will not find passwords or keys if there is no whitespace around the =
:
SECRET_KEY='mysecret'
When I try to use prospector in the following way, I get a traceback
prospector
These also fail with the same error message
prospector --help
prospector --strictness high
The error message is
Traceback (most recent call last):
File "D:\Python27_x86\Scripts\prospector-script.py", line 9, in
load_entry_point('prospector==0.6.4', 'console_scripts', 'prospector')()
File "D:\Python27_x86\lib\site-packages\pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "D:\Python27_x86\lib\site-packages\pkg_resources.py", line 2476, in load_entry_point
return ep.load()
File "D:\Python27_x86\lib\site-packages\pkg_resources.py", line 2190, in load
['name'])
File "D:\Python27_x86\lib\site-packages\prospector\run.py", line 7, in
from prospector import config as cfg, tools, blender
File "D:\Python27_x86\lib\site-packages\prospector\config.py", line 6, in
from prospector.tools import TOOLS, DEFAULT_TOOLS
File "D:\Python27_x86\lib\site-packages\prospector\tools__init__.py", line 1, in
from prospector.tools.dodgy import DodgyTool
File "D:\Python27_x86\lib\site-packages\prospector\tools\dodgy__init__.py", line 5, in
from dodgy.run import check_file
File "D:\Python27_x86\lib\site-packages\dodgy\run.py", line 12, in
r'%(sep)stests?(%(sep)s|$)',
File "D:\Python27_x86\lib\re.py", line 190, in compile
return _compile(pattern, flags)
File "D:\Python27_x86\lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis
On Windows 7, I'm using:
python 2.7 64-bit
argparse (1.2.1)
astroid (1.2.1)
dodgy (0.1.5)
enum34 (1.0)
pep8 (1.5.7)
pep8-naming (0.2.2)
pies (2.6.1)
pies2overrides (2.6.1)
prospector (0.6.4)
pycairo (1.10.0)
pyflakes (0.8.1)
pylint (1.3.1)
pylint-celery (0.3)
pylint-common (0.2.1)
pylint-django (0.5.5)
pylint-plugin-utils (0.2.2)
I think that covers all the packages dodgy cares about :)
I could be great to be able to configure dodgy by a configuration file.
It could be simply dodge.cfg
or contained in setup.cfg
.
Deprecation warnings are raised due to invalid escape sequences in Python 3.8 . Below is a log of the warnings raised during compiling all the python files. Using raw strings or escaping them will fix this issue.
find . -iname '*.py' | xargs -P 4 -I{} python -Walways -m py_compile {}
./tests/testdata/amazon.py:2: DeprecationWarning: invalid escape sequence \A
AWS_SECRET_ACCESS_KEY = 'A8+6AN5TSUZ3vysJg68Rt\A9E7duMlfKODwb3ZD8'
Install the library and try to execute dodgy script in the directory where are no Python files. Instead of the stack trace, I would imagine an error message or at least empty dict...
<mock-chroot> sh-4.4# dodgy
Traceback (most recent call last):
File "/usr/bin/dodgy", line 4, in <module>
dodgy.run.run()
File "/usr/lib/python2.7/site-packages/dodgy/run.py", line 56, in run
warnings = run_checks(os.getcwd())
File "/usr/lib/python2.7/site-packages/dodgy/run.py", line 44, in run_checks
for msg_parts in check_file(filepath):
File "/usr/lib/python2.7/site-packages/dodgy/checks.py", line 72, in check_file
return check_file_contents(to_check.read())
File "/usr/lib64/python2.7/codecs.py", line 686, in read
return self.reader.read(size)
File "/usr/lib64/python2.7/codecs.py", line 492, in read
newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
<mock-chroot> sh-4.4# dodgy-3.6
Traceback (most recent call last):
File "/usr/bin/dodgy-3.6", line 4, in <module>
dodgy.run.run()
File "/usr/lib/python3.6/site-packages/dodgy/run.py", line 56, in run
warnings = run_checks(os.getcwd())
File "/usr/lib/python3.6/site-packages/dodgy/run.py", line 44, in run_checks
for msg_parts in check_file(filepath):
File "/usr/lib/python3.6/site-packages/dodgy/checks.py", line 72, in check_file
return check_file_contents(to_check.read())
File "/usr/lib64/python3.6/codecs.py", line 698, in read
return self.reader.read(size)
File "/usr/lib64/python3.6/codecs.py", line 501, in read
newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.