[Solved] Reading Android's sepolicy file

Due to some unknow reason I seem to be unable to read my phones sepolicy file. I downloaded it through the ADB bridge and tried to read it by typing: seinfo sepolicy (seinfo can be found in the setools package). Unfortunately I get the following error: [Errno 0] Error: 'sepolicy'. Does anyone know whats causing this error?

Edit: the sepolicy file can be found in the root directory

are you root?

1 Like

I actually forgot about that, but running sudo seinfo sepolicy yields the same result.

might need to disable selinux first

1 Like

SELinux isn’t running, I just installed setools to read Android’s policy file.

Is the file you dumped corrupted? Maybe try running file on it to see if it has all its headers in tact and hexdump it to make sure it’s not all zeroes or something.

3 Likes

file sepolicy yields:
sepolicy: SE Linux policy v30 MLS 8 symbols 7 ocons

hexdump seems fine and cat produces semi-readable output.

Apparently setoolsseinfo is unable to read Android sepolicy files.
Luckily though, there exists setools for android on GitHub: https://github.com/xmikos/setools-android
This seems to do the trick :slight_smile:

2 Likes

yep. android tries todo its own thing so im not surprised