Giter VIP home page Giter VIP logo

gramify's People

Contributors

0xvavaldi avatar realender avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gramify's Issues

recommended grep command doesn't work for utf8

please change this:
print("cat output_file.txt | sort | uniq -c | sort -rn | grep -oP '^ [0-9]+ \K.' > sorted_output.txt")
to this:
print("cat output_file.txt | sort | uniq -c | sort -rn | grep -oaP '^ [0-9]+ \K.' > sorted_output.txt")

Processing $HEX[]

Some string may be in $HEX[] format and gramify treats them as words, without decoding them first, leading to some "unusable" results in the output.

Improved Recommended Command

gramify/gramify.py

Lines 792 to 794 in 64ef8cf

print("Don't forget to de-duplicate and sort the output.\nRecommended commands:")
for item in output_file_names:
print("cat \"" + item + "\" | sort | uniq -c | sort -rn | awk '($1 >= 5)' | cut -c9- > \"" + item + ".sorted\"")

I suggest updating this recommendation so that it is more likely to work as expected.
cut -c9- cuts at the 9th character position. But the size of each row can vary; uniq -c adds padding before the number and the number may be large depending on how large the gramify output is.

% echo "password" | uniq -c | sort -rn | awk '($1 >=1)' | cut -c9-
sword

A simple way to do this in awk would be to use {print $2}, but that would remove any ngrams with a space.

So the solution I found is to use a bit more complex awk command:

awk '{if ($1 >=1) {$1=""; print substr($0, index($0, $2))}}'

You can try it out with different variations with this test command:

% printf -- 'pass word\n%.0s' {1..99999} | uniq -c | sort -rn | awk '{if ($1 >=1) {$1=""; print substr($0, index($0, $2))}}'
pass word

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.