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

ValueError: unknown reasons (During run application on EC2 RedHat) #248

Closed
D-Kalinin opened this issue Mar 2, 2021 · 12 comments
Closed

Comments

@D-Kalinin
Copy link

If anyone can help I will be appreciate!
Describe the bug
Having an error during running the app on EC2 RedHat :
ValueError: unknown reasons

I installed on redhat ec2 instance trufflehog. By default there python 2.7 and 3.6
Trufflehog was installed from pip3.
pip3 freeze shows that everything installed :
gitdb==4.0.5
gitdb2==4.0.2
GitPython==3.0.6
smmap==3.0.5
truffleHog==2.2.1
truffleHogRegexes==0.0.7

After installation and running next command ( just to check does it work or not)
trufflehog --regex --entropy=False https://github.com/dxa4481/truffleHog.git
( I got next error) :
Traceback (most recent call last):
File "/usr/local/bin/trufflehog", line 11, in
sys.exit(main())
File "/usr/local/lib64/python3.6/site-packages/truffleHog/truffleHog.py", line 93, in main
surpress_output=False, branch=args.branch, repo_path=args.repo_path, path_inclusions=path_inclusions, path_exclusions=path_exclusions, allow=allow)
File "/usr/local/lib64/python3.6/site-packages/truffleHog/truffleHog.py", line 351, in find_strings
diff_hash = hashlib.md5((str(prev_commit) + str(curr_commit)).encode('utf-8')).digest()
ValueError: unknown reasons

@dxa4481
Copy link
Collaborator

dxa4481 commented Mar 2, 2021

That's an odd error, can you maybe see if it's reproducible in a centos docker container so I can debug it a little easier?

@D-Kalinin
Copy link
Author

On Win 10 everything works good.
There python 3.9 v.
But on ec2 redhat i got this. More over, i was trying it on 3 different ec2 redhat instances , getting same error.
I will try today use docker file on centos. I will let you know results latter.

@D-Kalinin
Copy link
Author

So, I installed locally vm with centos and pulled your docker file, then run command and it works
docker run --rm -v "$(pwd):/proj" dxa4481/trufflehog https://github.com/dxa4481/truffleHog.git
I had same python 2.7 and python 3.6 , then I installed again on this centos vm thru pip3 trufflehog and run on centos same command
truffleHog --regex --entropy=False https://github.com/dxa4481/truffleHog.git
And it worked too.
I do not understand why on Centos it works, but on RedHat EC2 instance it does not...And errors weird ValueError: unknow reasons.
Thats it...

@D-Kalinin
Copy link
Author

On EC2 RedHat thru docker works too. But I just do not have permissions to use docker on our RedHat EC2, thats an issue too.
Only directly thru trufflehog app.

@D-Kalinin
Copy link
Author

UPDATE:
I was doing pip3 install trufflehog.
And then : trufflehog --regex --entropy=False https://github.com/dxa4481/truffleHog.git
And had the error ValueError: unknown reasons
Then i found trufflehog3 in pip3
I did run: pip3 install trufflehog3, successfully installed that
Then used similar command:
trufflehog3 --regex --entropy=False https://github.com/dxa4481/truffleHog.git
But got error : trufflehog3: error: unrecognized arguments: --regex --entropy=False
Then I got run: trufflehog3 https://github.com/dxa4481/truffleHog.git
And here results:
Reason: High entropy
Path: test_all.py
Branch: origin/dev
Commit: Fixed since_commit and tests (#219)

  • Fixed since_commit and tests

  • Updated testing comment

Co-authored-by: Dylan Ayrey dxa4481@rit.edu
Hash: 288f35e

  •    since_commit = 'd15627104d07846ac2914a976e8e347a663bbd9b'
    
  •    # Start at commit d15627104d07846ac2914a976e8e347a663bbd9b, which
    
  •    commit_w_secret = '9ed54617547cfca783e0f81f8dc5c927e3d1e345'
    
  •    # https://github.com/dxa4481/truffleHog/commit/9ed54617547cfca783e0f81f8dc5c927e3d1e345
    
  •    since_commit = '202564cf776b402800a4aab8bb14fa4624888475'
    
  •    # https://github.com/dxa4481/truffleHog/commit/d15627104d07846ac2914a976e8e347a663bbd9b
    
  •    # Start at commit 202564cf776b402800a4aab8bb14fa4624888475, which
    
  •    commit_w_secret = 'd15627104d07846ac2914a976e8e347a663bbd9b'
    
ETC
Seems its working....But kind a weird , i can not use any options with trufflehog3 ? Just confused.

@dxa4481
Copy link
Collaborator

dxa4481 commented Mar 4, 2021

@RepositoryOfCode I don't know what trufflehog3 is, but it's not maintained by me

@D-Kalinin
Copy link
Author

D-Kalinin commented Mar 4, 2021

I got it . I do not know, maybe an issue because I installed trufflehog from pip3, not from pip, when i installed it from pip i see the error : Could not find a version that satisfies the requirement GitPython==3.0.6 (from trufflehog) (from versions : 0.1.7 etc)

And another error:
No matching distribution found for GitPython==3.0.6 (from trufflehog)

Thats why i installed it from pip3. Maybe thats a reason of ValueError

@dxa4481
Copy link
Collaborator

dxa4481 commented Mar 4, 2021

I think that's unrelated. I had to drop python2 support a little while ago since GitPython had backwards incompatible changes

@D-Kalinin
Copy link
Author

I think that's unrelated. I had to drop python2 support a little while ago since GitPython had backwards incompatible changes

Maybe any ideas why i have ValueError on RedHat EC2? )
I do not even know already what i need to check.
I have tried a lot of ways...

@dxa4481
Copy link
Collaborator

dxa4481 commented Mar 4, 2021

No it's a mystery. If you keep the ticket open I'll spin up an EC2 and test it when I get some time.

One thing to try is just cloning the code locally on the ec2 and seeing if the error is thrown. And if it is maybe add print statements on line 351 to figure out what's going on with str(prev_commit) + str(curr_commit)

@D-Kalinin
Copy link
Author

Ok, I will keep it open

@dustin-decker
Copy link
Contributor

Hey there, we've just released the next major version of TruffleHog!

It is a complete rewrite that scans more data sources and now supports detecting and verifying over 600 credentials.
Please check it out when you can.

https://trufflesecurity.com/blog/introducing-trufflehog-v3

We're no longer maintaining v2 so I am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants