Name: Anonymous 2007-04-20 1:49 ID:ej64cSDV
it is asking for a password
#
# Purpose: Find archive signatures in files
# License: Public domain
#
import sys, os
signatures = \
{
'RAR': 'Rar!\x1A\x07\x00',
'7Z': '7z\xBC\xAF\x27\x1C',
'ZIP': '\x50\x4B\x03\x04',
# 'GZ': '\x1F\x8B\x08', # False positives
# 'BZ2': 'BZh', # False positives
# 'TAR': 'ustar', # False positives
}
limit_scan = True # Set to False to scan for multiple archives in one file
chunk_size = 20480
#print str(signatures)
if len( sys.argv ) == 2:
scan_dir = sys.argv[ 1 ]
else:
scan_dir = ''
for root, dirs, files in os.walk( scan_dir ):
#print '[*] Scanning: ' + root + os.path.sep
for file in files:
file_path = os.path.join( root, file )
try:
fp = open( file_path, 'rb' )
scan = True
offset = 0
while scan:
tmp = fp.read( chunk_size )
if not tmp:
break
for k in signatures:
c = tmp.find( signatures[ k ] )
if c > -1:
print '%-3s [%u] %s' % ( k, offset + c, file_path )
if limit_scan:
scan = False
break
offset += chunk_size
fp.close()
except IOError:
print '[-] Could not open ' + file_path