Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sys
- from subprocess import *
- if len(sys.argv) != 3:
- print >>sys.stderr, 'Usage: %s binary source_bundle'%sys.argv[0]
- sys.exit(1)
- def readstrings(binfile):
- proc = Popen(['strings', binfile], stdout=PIPE)
- strings = proc.stdout.readlines()
- exitcode = proc.wait()
- if exitcode != 0:
- sys.exit(exitcode)
- return set([s.strip() for s in strings])
- str1 = readstrings(sys.argv[1])
- str2 = open(sys.argv[2]).read()
- common = []
- for s in str1:
- if s in str2:
- common.append(s)
- common.sort()
- for s in common:
- print s
Advertisement
Add Comment
Please, Sign In to add comment