Apparatus: A Framework for Security Analysis in Internet of Things Systems