def test_file_strings_is_good(self):
        expected = [
            u'__text',
            u'__TEXT',
            u'__cstring',
            u'__TEXT',
            u'__jump_table',
            u'__IMPORT',
            u'__textcoal_nt',
            u'__TEXT',
            u'_main',
            u'___i686.get_pc_thunk.bx',
            u'_setlocale',
            u'_yyparse',
            u'/sw/src/fink.build/bison-2.3-1002/bison-2.3/lib/',
            u'main.c',
            u'gcc2_compiled.',
            u'main:F(0,2)',
            u'int:t(0,2)=r(0,2);-2147483648;2147483647;'
        ]

        test_file = self.get_test_loc('strings/basic/main.o')
        result = [s for s in strings.file_strings(test_file)
                  if strings.is_good(s)]
        assert expected == result
    def test_strings_in_windows_pdb(self):
        test_file = self.get_test_loc('strings/pdb/QTMovieWin.pdb')
        result = list(strings.file_strings(test_file))
        expected = self.get_test_loc('strings/pdb/QTMovieWin.pdb.results')
#         with open(expected, 'wb') as o:
#             o.write('\n'.join(result))
        expected = open(expected, 'rb').read().splitlines()
        assert sorted(expected) == sorted(result)
    def test_strings_in_fonts(self):
        expected = self.get_test_loc('strings/font/DarkGardenMK.ttf.results')
        expected = open(expected, 'rb').read().splitlines()
        test_file = self.get_test_loc('strings/font/DarkGardenMK.ttf')
        result = [s for s in strings.file_strings(test_file)
                  if strings.is_good(s)]

        assert sorted(expected) == sorted(result)
Beispiel #4
0
 def test_strings_in_windows_pdb(self):
     test_file = self.get_test_loc('strings/pdb/QTMovieWin.pdb')
     result = list(strings.file_strings(test_file))
     expected = self.get_test_loc('strings/pdb/QTMovieWin.pdb.results')
     #         with open(expected, 'wb') as o:
     #             o.write('\n'.join(result))
     expected = open(expected, 'rb').read().splitlines()
     assert sorted(expected) == sorted(result)
    def test_strings_in_obj(self):
        test_file = self.get_test_loc('strings/obj/test.o')
        result = [s for s in strings.file_strings(test_file)
                  if strings.is_good(s)]
        expected = self.get_test_loc('strings/obj/test.o.results')
#         with open(expected, 'wb') as o:
#             o.write('\n'.join(result))
        expected = open(expected, 'rb').read().splitlines()
        assert sorted(expected) == sorted(result)
Beispiel #6
0
    def test_strings_in_fonts(self):
        expected = self.get_test_loc('strings/font/DarkGardenMK.ttf.results')
        expected = open(expected, 'rb').read().splitlines()
        test_file = self.get_test_loc('strings/font/DarkGardenMK.ttf')
        result = [
            s for s in strings.file_strings(test_file) if strings.is_good(s)
        ]

        assert sorted(expected) == sorted(result)
    def test_strings_in_all_bin(self):
        test_dir = self.get_test_loc('strings/bin', copy=True)
        expec_dir = self.get_test_loc('strings/bin-expected')
        for tf in os.listdir(test_dir):
            result = list(strings.file_strings(os.path.join(test_dir, tf)))
            expected = os.path.join(expec_dir, tf + '.strings')
#             with open(expected, 'wb') as o:
#                 o.write('\n'.join(result))
            expected = open(expected, 'rb').read().splitlines()
            assert sorted(expected) == sorted(result)
Beispiel #8
0
 def test_strings_in_elf(self):
     test_file = self.get_test_loc('strings/elf/shash.i686')
     result = [
         s for s in strings.file_strings(test_file) if strings.is_good(s)
     ]
     expected = self.get_test_loc('strings/elf/shash.i686.results')
     #         with open(expected, 'wb') as o:
     #             o.write('\n'.join(result))
     expected = open(expected, 'rb').read().splitlines()
     assert sorted(expected) == sorted(result)
Beispiel #9
0
 def test_strings_in_all_bin(self):
     test_dir = self.get_test_loc('strings/bin', copy=True)
     expec_dir = self.get_test_loc('strings/bin-expected')
     for tf in os.listdir(test_dir):
         result = list(strings.file_strings(os.path.join(test_dir, tf)))
         expected = os.path.join(expec_dir, tf + '.strings')
         #             with open(expected, 'wb') as o:
         #                 o.write('\n'.join(result))
         expected = open(expected, 'rb').read().splitlines()
         assert sorted(expected) == sorted(result)
Beispiel #10
0
    def test_file_strings_is_good(self):
        expected = [
            u'__text', u'__TEXT', u'__cstring', u'__TEXT', u'__jump_table',
            u'__IMPORT', u'__textcoal_nt', u'__TEXT', u'_main',
            u'___i686.get_pc_thunk.bx', u'_setlocale', u'_yyparse',
            u'/sw/src/fink.build/bison-2.3-1002/bison-2.3/lib/', u'main.c',
            u'gcc2_compiled.', u'main:F(0,2)',
            u'int:t(0,2)=r(0,2);-2147483648;2147483647;'
        ]

        test_file = self.get_test_loc('strings/basic/main.o')
        result = [
            s for s in strings.file_strings(test_file) if strings.is_good(s)
        ]
        assert expected == result