Files
Mobile-Security-Framework-M…/mobsf/StaticAnalyzer/tools/strings.py
T
Ajin Abraham cf59941081 HOTFIX: setup.py and directory refactoring
Python setup.py #1585
directory refactoring
2021-01-17 01:47:49 -05:00

25 lines
757 B
Python
Executable File

import io
"""
Python Strings.
Strings-module to be undependend from operating systems
Taken from: http://stackoverflow.com/a/17197027
"""
def strings_util(filename, minimum=6):
"""Print out all connected series of readable chars longer than minimum."""
with io.open(filename, mode='rb') as f:
result = ''
for c in f.read().decode('utf-8', 'ignore'):
if c in ('0123456789abcdefghijklmnopqrs'
'tuvwxyzABCDEFGHIJKLMNOPQRSTUV'
'WXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ '):
result += c
continue
if len(result) >= minimum and result[0].isalnum():
yield '\'' + result + '\''
result = ''