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

Added recursion support #58

Merged
merged 21 commits into from
Jun 9, 2021
Merged

Added recursion support #58

merged 21 commits into from
Jun 9, 2021

Conversation

amadejpapez
Copy link
Collaborator

@amadejpapez amadejpapez commented May 30, 2021

Want to search the whole folder and see what all of the files in that folder contain? pyWhat can now do exactly that!

  • if input is a directory, recursively search through it (Using a folder path as input #43)
  • now that pyWhat is searching for multiple files at once, if a file is identified with magic numbers, it will also print the name of the file, so it will be easier to see which one is identified
  • it pyWhat is printing matches from multiple files, it will also print in which file each match is located in a new Filename row (if input is only text, this row is not there)
  • API now by default also checks if input is a file or a folder. If you want to disable this and only treat input as text, add True to identify() like this identify("file.txt", True)
  • hidden file found with recursion has a CTF flag in the name? pyWhat is now also searching for matches inside of filenames!
  • added recursion support to the README and to --help command
  • added links to all of the badges in README (Strange behaviour of README badges #60)
  • Discover Number can no longer be matched inside of a string

@bee-san
Copy link
Owner

bee-san commented May 30, 2021

Can I get a screenshot to see what this looks like, pls? 💖

@amadejpapez
Copy link
Collaborator Author

Can I get a screenshot to see what this looks like, pls?

image

@bee-san
Copy link
Owner

bee-san commented May 30, 2021

Do you think it'd be better if we printed what file it came from in the table as a new column?

@amadejpapez
Copy link
Collaborator Author

amadejpapez commented May 30, 2021

Do you think it'd be better if we printed what file it came from in the table as a new column?

Oo that's a good idea but I don't think there is enough space to add another column. Maybe a separate table for each file would be better?

@bee-san
Copy link
Owner

bee-san commented May 30, 2021

Do you think it'd be better if we printed what file it came from in the table as a new column?

Oo that's a good idea but I don't there is enough space to add another column. Maybe a separate table for each file would be better?

I don't there is enough space to add another column

Why not? Most lines continue onto the next line if its too long? 😄

@amadejpapez
Copy link
Collaborator Author

Why not? Most lines continue onto the next line if its too long?

Yeah you are right, there is enough space 😁

image

pywhat/identifier.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
pywhat/printer.py Outdated Show resolved Hide resolved
pywhat/what.py Outdated Show resolved Hide resolved
bee-san
bee-san previously requested changes Jun 1, 2021
tests/test_click.py Outdated Show resolved Hide resolved
tests/test_click.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
pywhat/printer.py Outdated Show resolved Hide resolved
pywhat/printer.py Outdated Show resolved Hide resolved
pywhat/regex_identifier.py Outdated Show resolved Hide resolved
tests/test_identifier.py Outdated Show resolved Hide resolved
tests/test_regex_identifier.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
@amadejpapez
Copy link
Collaborator Author

Okay @bee-san I think this PR is done now. I have reverted all of the changes to tests, so they all work as before. Also pyWhat is now searching filenames, so if there is a file found with recursion that has a CTF flag in the name, pyWhat will be able to identify it. :D

@bee-san
Copy link
Owner

bee-san commented Jun 6, 2021

Conflicting merge issues 😢 Did you say that links didn't work on this PR? 🙏🏻

@amadejpapez
Copy link
Collaborator Author

Conflicting merge issues Did you say that links didn't work on this PR? 🙏🏻

Just saw the new release yes, so will fix them! 😁

About the links, this issue is affecting the latest version of pyWhat and not only this PR. Links only work for some terminals - I tested in Arch and Kali, and they do not open the full URL but only the visible part. This PR is not causing this but when tests broke, I noticed that links do not open for me. Here is a screenrecording from Kali, running pyWhat from PyPi, so you can see what is happening:

github-issue.mp4

@amadejpapez
Copy link
Collaborator Author

amadejpapez commented Jun 6, 2021

I have fixed almost every test, but as soon as I add recursion support, filtration brakes. I just cannot get my head around why.. Could you @piatrashkakanstantinass please take a look at this as you have written filtration? 🥺

If I run pywhat --include_tags finance fixtures/file, distribution in regex-identifier.py prints as Distribution({'Tags': {'finance'}... (what it should be) but in my version it is Distribution({'Tags': {'password', 'credentials', 'hacking', 'geo-location', 'token', 'media', 'finance', 'internet', 'cryptocurrency', 'username', 'networking', 'website', 'security', 'aws', 'cyber security', 'identifiers', 'credit card'}... so it is not seeing what to filter and it just returns all of the regexes.

@bee-san
Copy link
Owner

bee-san commented Jun 7, 2021

they do not open the full URL but only the visible part.

This is actually very normal and quite expected, hyperlinks are not supported in all terminals.

This is why it is essential that we show the full link with no cut-off or new lines to make it work everywhere :)

@bee-san
Copy link
Owner

bee-san commented Jun 7, 2021

What if we removed:

Click here to analyse in the browser

So there was more space? Or we changed the wording?

@amadejpapez
Copy link
Collaborator Author

So there was more space? Or we changed the wording?

This would sadly not fix it. The only way I was able to get it to work for me is if the URL is from the start to the end in one line, without ....

If we did something like this:
image

This makes links to work unless they again go over the line... 😢 Maybe we could add recursion to pyWhat and make this into an issue 😄

README.md Outdated Show resolved Hide resolved
pywhat/what.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
pywhat/printer.py Outdated Show resolved Hide resolved
pywhat/regex_identifier.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
pywhat/identifier.py Outdated Show resolved Hide resolved
This was linked to issues Jun 9, 2021
@SkeletalDemise SkeletalDemise merged commit 6756100 into main Jun 9, 2021
@SkeletalDemise SkeletalDemise deleted the recursion branch June 9, 2021 08:59
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

Successfully merging this pull request may close these issues.

Strange behaviour of README badges Using a folder path as input
3 participants