Use less memory when brute forcing with a large wordlist

This commit is contained in:
erwanlr
2013-10-05 20:03:34 +01:00
parent 90ade58842
commit 474816762f
8 changed files with 55 additions and 121 deletions

View File

@@ -165,3 +165,11 @@ end
def get_memory_usage
`ps -o rss= -p #{Process.pid}`.to_i * 1024 # ps returns the value in KB
end
# Use the wc system command to count the number of lines in the file
# instead of using File.open which will to much memory for large file (10 times the size of the file)
#
# @return [ Integer ] The number of lines in the given file
def count_file_lines(file)
`wc -l #{file.shellescape}`.split[0].to_i
end