I had a quick peek at the sources ("apt-get source e2fslibs-dev") for chattr/lsattr - they seem to be fairly straightforward examples of how to use functions like fgetflags/fsetflags from that e2fslibs library, so you might consider writing something that along those lines if you don't concoct some script-oriented approach.