Many people have published code that will report on the current state of the gpio pins.
For a command line utility, see
http://abyz.co.uk/rpi/pigpio/examples.html and look at
gpio test or
gpio status.
For a web interface that also allows you to set/clear the pins, see
https://code.google.com/p/webiopi/