- Expat is a prototype of proposed system for protecting appified smart-home platforms.
- This project contains Expat materials instantiated for OpenHAB system.
-
Expat is written in Python3 and for installing required modules, please use the following command:
$ pip3 install -r requirements.txt
-
This project also depends on z3 which needs to be built and installed according to the directions here
-
expat.py: This is the main python file needs to be run. The usage is as follows:
$ python3 expat.py <command> <policy_file> <target_rules_file> <instrumented_rules_file>
where
<command>
specifies which task it should perform. Thiscommand
can be eitheranalysis
orinstrument
.<policy_file>
is an input policy file name written in UEI.<target_rules_file>
is an input rules file that we want to target in the case that thecommand
isinstrument
.<instrumented_rules_file>
is an output rules file instrumented by theexpat.py
script whenever thecommand
isinstrument
.For instance, to do policy analysis you can run:
$ python3 expat.py analysis simulation/policies.uei
and for deployment, run:
$ python3 expat.py instrument simulation/policies.uei simulation/user.rules simulation/inst_user.rules
-
parser-generator: In this folder, you can find the source of all UEI/PAL parser scripts generated by ANTLR4. Mainly,
OPOL.g4
contains the grammar of the policy language and usinggenerate.sh
, you can run ANTLR4 to spit out the parser-related scripts. Notice that you don't have to have ANTLR4 installed to run expat. You need ANTLR4, whenever you want to make changes in grammar and thus generating new parser-related scripts. -
lib: This folder contains the parser-related scripts generated by ANTLR4 (i.e., copied from parser-generator folder) which is being used in expat.py.
-
syntax-highlighter: In this folder, you can find a very simple syntax highlighter of UEI for Sublime or TextMate. You can install it, if you wish.
-
simulation: This folder contains a sample policy and a test rule, both defined by a user that can be fed into
expat.py
as well as a sample instrumented rules file (i.e.,inst_user.rules
). This folder also containstestbed-config
subfolder including the OpenHAB necessary config files to simulate a virtual smart home environment. For more details, read this. -
device_list.csv: This csv file contains the list of devices used in defining device data type in z3. Each row includes the item name (exactly the same as what defined in openhab
.items
config file) and its type (i.e., Switch, Contact, etc).