initial
This commit is contained in:
commit
26090b1ee7
115
.clang-format
Executable file
115
.clang-format
Executable file
@ -0,0 +1,115 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
24
.editorconfig
Executable file
24
.editorconfig
Executable file
@ -0,0 +1,24 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{c,h,cpp,hpp}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.sql]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
93
.gitignore
vendored
Executable file
93
.gitignore
vendored
Executable file
@ -0,0 +1,93 @@
|
||||
bin/
|
||||
|
||||
libs/
|
||||
|
||||
# vim ycm file
|
||||
.ycm*
|
||||
|
||||
# Tag files
|
||||
tags
|
||||
|
||||
# Mac files
|
||||
.DS_Store
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
!libtomcrypt.a
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
|
||||
# CMake
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
CTestTestfile.cmake
|
||||
build
|
||||
|
||||
# ctags
|
||||
.tags*
|
||||
|
||||
# Doxygen
|
||||
*~
|
||||
.*sw?
|
||||
\#*
|
||||
.DS_Store
|
||||
|
||||
*.rej
|
||||
*.orig
|
||||
|
||||
*.pro
|
||||
/packages/rpm/doxygen.spec
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
/docs/doxygen
|
||||
/doxygen_docs
|
||||
/doxygen.tag
|
||||
|
||||
.idea/
|
||||
cmake*/
|
||||
config.txt
|
||||
|
||||
# flex and bison files
|
||||
*.hh
|
||||
*.tab.hpp
|
||||
*.tab.cpp
|
||||
|
||||
._*
|
||||
|
||||
*.dot
|
||||
*.circo
|
||||
*.svg
|
||||
|
||||
148
CMakeLists.txt
Executable file
148
CMakeLists.txt
Executable file
@ -0,0 +1,148 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
# Uncomment for gcc
|
||||
# set(CMAKE_C_COMPILER "gcc-8")
|
||||
# set(CMAKE_CXX_COMPILER "g++-8")
|
||||
|
||||
project(ag_gen)
|
||||
|
||||
set_source_files_properties(
|
||||
mem.c
|
||||
PROPERTIES
|
||||
COMPILE_DEFINITIONS UNIT_TEST=1
|
||||
)
|
||||
|
||||
# Common compiler options among built types
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
|
||||
# Specific compiler options for Debug or Release builds
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -ggdb -Wall -fopenmp -pedantic")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -fopenmp -pedantic -O1")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O1 -fopenmp")
|
||||
|
||||
set(PostgreSQL_TYPE_INCLUDE_DIR "9.5")
|
||||
set(PostgreSQL_ADDITIONAL_VERSIONS "10.1" "10" "9.5")
|
||||
|
||||
find_program(LSB_RELEASE lsb_release)
|
||||
execute_process(COMMAND ${LSB_RELEASE} -is
|
||||
OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
include_directories("/usr/include/postgresql")
|
||||
|
||||
# Apple has a different openssl directory when using brew
|
||||
if(APPLE)
|
||||
set(BISON_EXECUTABLE "/usr/local/opt/bison/bin/bison")
|
||||
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
|
||||
endif()
|
||||
|
||||
set(ENV{PKG_CONFIG_PATH} "/usr/local/lib/pkgconfig")
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(PostgreSQL REQUIRED)
|
||||
find_package(OpenMP)
|
||||
|
||||
find_package(BISON 2.4 REQUIRED)
|
||||
find_package(FLEX REQUIRED)
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
find_package(OpenSSL)
|
||||
find_package(Doxygen)
|
||||
|
||||
pkg_check_modules(CMOCKA cmocka)
|
||||
pkg_check_modules(CPPREDIS cpp_redis)
|
||||
|
||||
if(OpenSSL_FOUND)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# Enable thread-level parallelization if OpenMP is found.
|
||||
if(OpenMP_CXX_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||
add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen"
|
||||
VERBATIM)
|
||||
endif(DOXYGEN_FOUND)
|
||||
|
||||
include_directories("${CMAKE_SOURCE_DIR}/src/")
|
||||
|
||||
file(GLOB ag_gen_src "${CMAKE_SOURCE_DIR}/src/ag_gen/*.cpp")
|
||||
file(GLOB utils_src "${CMAKE_SOURCE_DIR}/src/util/*.c" "${CMAKE_SOURCE_DIR}/src/util/*.cpp")
|
||||
|
||||
########################
|
||||
### Network Model Parser
|
||||
########################
|
||||
|
||||
BISON_TARGET(nm_parser "${CMAKE_SOURCE_DIR}/src/parser/nm-parser/nm_parser.yy"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/nm_parser.c"
|
||||
DEFINES_FILE "${CMAKE_CURRENT_BINARY_DIR}/nm_parser.tab.h")
|
||||
FLEX_TARGET(nm_scanner "${CMAKE_SOURCE_DIR}/src/parser/nm-parser/nm_scanner.l"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/nm_scanner.c"
|
||||
COMPILE_FLAGS "-Pnm")
|
||||
ADD_FLEX_BISON_DEPENDENCY(nm_scanner nm_parser)
|
||||
|
||||
#add_executable(nm_test ${FLEX_nm_scanner_OUTPUTS} ${BISON_nm_parser_OUTPUTS} ${utils_src})
|
||||
#target_include_directories(nm_test PRIVATE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_SOURCE_DIR}/src/compiler/nm-parser")
|
||||
|
||||
##########################
|
||||
### Exploit Pattern Parser
|
||||
##########################
|
||||
|
||||
BISON_TARGET(xp_parser "${CMAKE_SOURCE_DIR}/src/parser/xp-parser/xp_parser.yy"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/xp_parser.c"
|
||||
DEFINES_FILE "${CMAKE_CURRENT_BINARY_DIR}/xp_parser.tab.h")
|
||||
FLEX_TARGET(xp_scanner "${CMAKE_SOURCE_DIR}/src/parser/xp-parser/xp_scanner.l"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/xp_scanner.c"
|
||||
COMPILE_FLAGS "-Pxp")
|
||||
ADD_FLEX_BISON_DEPENDENCY(xp_scanner xp_parser)
|
||||
|
||||
#add_executable(xp_test ${FLEX_xp_scanner_OUTPUTS} ${BISON_xp_parser_OUTPUTS} ${utils_src})
|
||||
#target_include_directories(xp_test PRIVATE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_SOURCE_DIR}/src/compiler/xp-parser")
|
||||
|
||||
####################
|
||||
### Main application
|
||||
####################
|
||||
|
||||
add_executable(ag_gen "${CMAKE_SOURCE_DIR}/src/main.cpp"
|
||||
${FLEX_nm_scanner_OUTPUTS} ${BISON_nm_parser_OUTPUTS}
|
||||
${FLEX_xp_scanner_OUTPUTS} ${BISON_xp_parser_OUTPUTS}
|
||||
${ag_gen_src} ${utils_src})
|
||||
target_link_libraries(ag_gen ${PostgreSQL_LIBRARIES})
|
||||
|
||||
add_executable(decode "${CMAKE_SOURCE_DIR}/src/tools/decode.cpp"
|
||||
${ag_gen_src} ${utils_src})
|
||||
target_link_libraries(decode ${PostgreSQL_LIBRARIES})
|
||||
|
||||
if(CPPREDIS_FOUND)
|
||||
#include_directories("${CPPREDIS_INCLUDE_DIRS}")
|
||||
link_directories("${CPPREDIS_LIBRARY_DIRS}")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DREDIS")
|
||||
|
||||
target_link_libraries(ag_gen cpp_redis tacopie)
|
||||
target_link_libraries(decode cpp_redis tacopie)
|
||||
endif()
|
||||
|
||||
################
|
||||
### Unit Testing
|
||||
################
|
||||
|
||||
if(CMOCKA_FOUND)
|
||||
add_executable(dynstr_test ${CMAKE_SOURCE_DIR}/src/util/mem.c ${CMAKE_SOURCE_DIR}/src/tests/mem_test.c)
|
||||
target_link_libraries(dynstr_test ${CMOCKA_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Files to be added to build directory
|
||||
configure_file("config.ini" "config.ini" COPYONLY)
|
||||
|
||||
if(CPPREDIS_FOUND)
|
||||
add_custom_command(TARGET ag_gen PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_SOURCE_DIR}/redis_scripts $<TARGET_FILE_DIR:ag_gen>/redis_scripts)
|
||||
endif()
|
||||
2482
Doxyfile.in
Executable file
2482
Doxyfile.in
Executable file
File diff suppressed because it is too large
Load Diff
69
README.md
Executable file
69
README.md
Executable file
@ -0,0 +1,69 @@
|
||||
# ag_gen: Attack Graph Generation System
|
||||
|
||||
## Installation
|
||||
|
||||
### Dependencies
|
||||
|
||||
Run the `deps.sh` command to install necessary dependencies.
|
||||
This script supports debian based systems and Mac OSX (with homebrew)
|
||||
|
||||
### PostgreSQL
|
||||
|
||||
#### Create a user
|
||||
|
||||
Use the createuser and createdb scripts to create the necessary account and database in PostgreSQL.
|
||||
|
||||
createuser -d -l -P ag_gen
|
||||
createdb -O ag_gen ag_gen
|
||||
|
||||
#### Populate the database
|
||||
|
||||
Use the `db_manage.sh` utility to populate the database (this will overwrite anything in the `ag_gen` database).
|
||||
An example use of this is:
|
||||
|
||||
./db_manage.sh -d ag_gen
|
||||
|
||||
## Building
|
||||
|
||||
This application uses CMake to build.
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
For debug builds:
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ../
|
||||
|
||||
For release builds:
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ../
|
||||
|
||||
Build the application:
|
||||
|
||||
make ag_gen
|
||||
|
||||
## Configuration
|
||||
|
||||
RAGE uses an ini-style configuration, located in config.ini.
|
||||
|
||||
- name: name of the database
|
||||
- host: IP or hostname of the database server
|
||||
- port: port number of the database server
|
||||
- username: database user name
|
||||
- password (optional): database password
|
||||
|
||||
## Running
|
||||
|
||||
Execute example from the examples directory.
|
||||
|
||||
./ag_gen -n ../examples/thesis_example.nm -x ../examples/thesis_example.xp
|
||||
|
||||
## Contributing
|
||||
|
||||
### Editorconfig
|
||||
|
||||
When contributing code, please install the "editorconfig" plugin for your text editor.
|
||||
|
||||
- Adds extra newline to end of file if not already there.
|
||||
- Removes whitespace at end of lines
|
||||
- Automatically sets indentation to tabs set to 4 spaces
|
||||
53
ag_gen_perf.sh
Executable file
53
ag_gen_perf.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PREFIX="$HOME/dev/ag_gen"
|
||||
EXAMPLES="$PREFIX/examples"
|
||||
|
||||
NM=(
|
||||
$EXAMPLES/thesis_example.nm
|
||||
$EXAMPLES/thesis_example2.nm
|
||||
$EXAMPLES/SystemV12cda4.2.nm
|
||||
)
|
||||
|
||||
XP=(
|
||||
$EXAMPLES/thesis_example.xp
|
||||
$EXAMPLES/thesis_example2.xp
|
||||
$EXAMPLES/cda4.1-SUPERSIMPLIFIED.xp
|
||||
)
|
||||
|
||||
# Python
|
||||
source activate agpy27
|
||||
#cd $PREFIX
|
||||
|
||||
CSV="python_results.csv"
|
||||
#CSV="rage_results.csv"
|
||||
|
||||
counter="0"
|
||||
|
||||
while [ $counter -lt $1 ]; do
|
||||
TIMES=()
|
||||
for (( i=0; i<${#NM[@]}; i++)) do
|
||||
result=$((/usr/bin/time python dev/ag_generator/hagGenerator.py \
|
||||
-nm ${NM[$i]} \
|
||||
-xp ${XP[$i]} \
|
||||
--no-viz-ag \
|
||||
--no-viz-states \
|
||||
--no-viz-matrix \
|
||||
--no-viz-paths \
|
||||
--no-viz-attacks \
|
||||
--state-graph 20 > /dev/null) 2>&1 \
|
||||
| perl -ne '/([0-9]+\.[0-9]+)user/ && print $1')
|
||||
# result=$($PREFIX/run.sh \
|
||||
# ${NM[$i]} \
|
||||
# ${XP[$i]} \
|
||||
# | perl -ne '/Total Time: ([0-9+\.[0-9]+)/ && print $1')
|
||||
TIMES+=("$result")
|
||||
done
|
||||
|
||||
function join { local IFS="$1"; shift; echo "$*"; echo "$*" >> $CSV; }
|
||||
join , ${TIMES[@]}
|
||||
|
||||
counter=$[$counter+1]
|
||||
done
|
||||
|
||||
source deactivate
|
||||
70
car_examples/generic_fourmaint.xp
Normal file
70
car_examples/generic_fourmaint.xp
Normal file
@ -0,0 +1,70 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_vio=true;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,brake_months=0;
|
||||
.
|
||||
|
||||
exploit exhaust_service(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_vio=true;
|
||||
postconditions:
|
||||
update quality:a,exhaust_vio=false;
|
||||
update quality:a,exhaust_months=0;
|
||||
.
|
||||
|
||||
exploit ac_service(a)=
|
||||
preconditions:
|
||||
quality:a,ac_vio=true;
|
||||
postconditions:
|
||||
update quality:a,ac_vio=false;
|
||||
update quality:a,ac_odometer=0;
|
||||
.
|
||||
|
||||
exploit vacuum_service(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_vio=true;
|
||||
postconditions:
|
||||
update quality:a,vacuum_vio=false;
|
||||
update quality:a,vacuum_odometer=0;
|
||||
.
|
||||
32
car_examples/generic_maintenance.nm
Normal file
32
car_examples/generic_maintenance.nm
Normal file
@ -0,0 +1,32 @@
|
||||
network model =
|
||||
assets:
|
||||
# Cars
|
||||
car1;
|
||||
car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=6;
|
||||
quality:car1,exhaust_months=12;
|
||||
quality:car1,ac_odometer=120000;
|
||||
quality:car1,vacuum_odometer=120000;
|
||||
quality:car1,engine=gas;
|
||||
quality:car1,brake_vio=false;
|
||||
quality:car1,exhaust_vio=false;
|
||||
quality:car1,ac_vio=false;
|
||||
quality:car1,vacuum_vio=false;
|
||||
quality:car1,compliance_vio=false;
|
||||
|
||||
quality:car2,brake_months=6;
|
||||
quality:car2,exhaust_months=12;
|
||||
quality:car2,ac_odometer=120000;
|
||||
quality:car2,vacuum_odometer=120000;
|
||||
quality:car2,engine=diesel;
|
||||
quality:car2,brake_vio=false;
|
||||
quality:car2,exhaust_vio=false;
|
||||
quality:car2,ac_vio=false;
|
||||
quality:car2,vacuum_vio=false;
|
||||
quality:car2,compliance_vio=false;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
47
car_examples/generic_maintenance.xp
Normal file
47
car_examples/generic_maintenance.xp
Normal file
@ -0,0 +1,47 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_vio=true;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,brake_months=0;
|
||||
.
|
||||
|
||||
43
car_examples/generic_maintenance.xp.bckp
Normal file
43
car_examples/generic_maintenance.xp.bckp
Normal file
@ -0,0 +1,43 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,odometer>=120000;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_vio=true;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,brake_months=0;
|
||||
.
|
||||
|
||||
35
car_examples/generic_timeline_maintenance.nm
Normal file
35
car_examples/generic_timeline_maintenance.nm
Normal file
@ -0,0 +1,35 @@
|
||||
network model =
|
||||
assets:
|
||||
# Cars
|
||||
car1;
|
||||
car2;
|
||||
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=0;
|
||||
quality:car1,exhaust_months=0;
|
||||
quality:car1,ac_odometer=0;
|
||||
quality:car1,vacuum_odometer=0;
|
||||
quality:car1,engine=gas;
|
||||
quality:car1,brake_vio=false;
|
||||
quality:car1,exhaust_vio=false;
|
||||
quality:car1,ac_vio=false;
|
||||
quality:car1,vacuum_vio=false;
|
||||
quality:car1,compliance_vio=false;
|
||||
quality:car1,TIME_ADVANCE_STEP=0;
|
||||
|
||||
quality:car2,brake_months=0;
|
||||
quality:car2,exhaust_months=0;
|
||||
quality:car2,ac_odometer=0;
|
||||
quality:car2,vacuum_odometer=0;
|
||||
quality:car2,engine=diesel;
|
||||
quality:car2,brake_vio=false;
|
||||
quality:car2,exhaust_vio=false;
|
||||
quality:car2,ac_vio=false;
|
||||
quality:car2,vacuum_vio=false;
|
||||
quality:car2,compliance_vio=false;
|
||||
quality:car2,TIME_ADVANCE_STEP=0;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
273
car_examples/generic_timeline_maintenance.xp
Normal file
273
car_examples/generic_timeline_maintenance.xp
Normal file
@ -0,0 +1,273 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=1;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,brake_months=0;
|
||||
.
|
||||
|
||||
exploit time_advance_0(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=1;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_1(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=1;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=2;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_2(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=2;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=3;
|
||||
.
|
||||
|
||||
exploit time_advance_3(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=3;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=4;
|
||||
.
|
||||
|
||||
exploit time_advance_4(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=4;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=5;
|
||||
.
|
||||
|
||||
exploit time_advance_5(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=5;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=6;
|
||||
.
|
||||
|
||||
exploit time_advance_6(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=6;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=7;
|
||||
.
|
||||
|
||||
exploit time_advance_7(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=7;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=8;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_8(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=8;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=9;
|
||||
.
|
||||
|
||||
exploit time_advance_9(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=9;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=10;
|
||||
.
|
||||
|
||||
exploit time_advance_10(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=10;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=11;
|
||||
.
|
||||
|
||||
exploit time_advance_11(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=11;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=12;
|
||||
.
|
||||
|
||||
exploit time_advance_12(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=12;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=13;
|
||||
.
|
||||
22
car_examples/generic_timeline_maintenance_1car.nm
Normal file
22
car_examples/generic_timeline_maintenance_1car.nm
Normal file
@ -0,0 +1,22 @@
|
||||
network model =
|
||||
assets:
|
||||
# Cars
|
||||
car1;
|
||||
car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=0;
|
||||
quality:car1,exhaust_months=0;
|
||||
quality:car1,ac_odometer=0;
|
||||
quality:car1,vacuum_odometer=0;
|
||||
quality:car1,engine=gas;
|
||||
quality:car1,brake_vio=false;
|
||||
quality:car1,exhaust_vio=false;
|
||||
quality:car1,ac_vio=false;
|
||||
quality:car1,vacuum_vio=false;
|
||||
quality:car1,compliance_vio=false;
|
||||
quality:car1,TIME_ADVANCE_STEP=0;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
337
car_examples/generic_timeline_maintenance_1car.xp
Normal file
337
car_examples/generic_timeline_maintenance_1car.xp
Normal file
@ -0,0 +1,337 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=1;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,brake_months=0;
|
||||
.
|
||||
|
||||
exploit exhaust_service(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months=1;
|
||||
postconditions:
|
||||
update quality:a,exhaust_vio=false;
|
||||
update quality:a,exhaust_months=0;
|
||||
.
|
||||
|
||||
exploit ac_service(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer=10000;
|
||||
postconditions:
|
||||
update quality:a,ac_vio=false;
|
||||
update quality:a,ac_odometer=0;
|
||||
.
|
||||
|
||||
exploit vacuum_service(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer=10000;
|
||||
postconditions:
|
||||
update quality:a,vacuum_vio=false;
|
||||
update quality:a,vacuum_odometer=0;
|
||||
.
|
||||
|
||||
exploit time_advance_0(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=1;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_1(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=1;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=2;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_2(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=2;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=3;
|
||||
.
|
||||
|
||||
exploit time_advance_3(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=3;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=4;
|
||||
.
|
||||
|
||||
exploit time_advance_4(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=4;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=5;
|
||||
.
|
||||
|
||||
exploit time_advance_5(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=5;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=6;
|
||||
.
|
||||
|
||||
exploit time_advance_6(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=6;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=7;
|
||||
.
|
||||
|
||||
exploit time_advance_7(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=7;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=8;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_8(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=8;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=9;
|
||||
.
|
||||
|
||||
exploit time_advance_9(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=9;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=10;
|
||||
.
|
||||
|
||||
exploit time_advance_10(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=10;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=11;
|
||||
.
|
||||
|
||||
exploit time_advance_11(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=11;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=12;
|
||||
.
|
||||
|
||||
exploit time_advance_12(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=12;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=13;
|
||||
.
|
||||
337
car_examples/generic_timeline_maintenance_4cars.xp
Normal file
337
car_examples/generic_timeline_maintenance_4cars.xp
Normal file
@ -0,0 +1,337 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=1;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,brake_months=0;
|
||||
.
|
||||
|
||||
exploit exhaust_service(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months=1;
|
||||
postconditions:
|
||||
update quality:a,exhaust_vio=false;
|
||||
update quality:a,exhaust_months=0;
|
||||
.
|
||||
|
||||
exploit ac_service(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer=10000;
|
||||
postconditions:
|
||||
update quality:a,ac_vio=false;
|
||||
update quality:a,ac_odometer=0;
|
||||
.
|
||||
|
||||
exploit vacuum_service(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer=10000;
|
||||
postconditions:
|
||||
update quality:a,vacuum_vio=false;
|
||||
update quality:a,vacuum_odometer=0;
|
||||
.
|
||||
|
||||
exploit time_advance_0(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=1;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_1(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=1;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=2;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_2(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=2;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=3;
|
||||
.
|
||||
|
||||
exploit time_advance_3(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=3;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=4;
|
||||
.
|
||||
|
||||
exploit time_advance_4(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=4;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=5;
|
||||
.
|
||||
|
||||
exploit time_advance_5(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=5;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=6;
|
||||
.
|
||||
|
||||
exploit time_advance_6(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=6;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=7;
|
||||
.
|
||||
|
||||
exploit time_advance_7(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=7;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=8;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_8(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=8;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=9;
|
||||
.
|
||||
|
||||
exploit time_advance_9(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=9;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=10;
|
||||
.
|
||||
|
||||
exploit time_advance_10(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=10;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=11;
|
||||
.
|
||||
|
||||
exploit time_advance_11(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=11;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=12;
|
||||
.
|
||||
|
||||
exploit time_advance_12(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=12;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=13;
|
||||
.
|
||||
212
car_examples/generic_timeline_maintenance_test.xp
Normal file
212
car_examples/generic_timeline_maintenance_test.xp
Normal file
@ -0,0 +1,212 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=1;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,brake_months=0;
|
||||
.
|
||||
|
||||
exploit time_advance_0(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=1;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_1(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=1;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=2;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_2(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=2;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=3;
|
||||
.
|
||||
|
||||
exploit time_advance_3(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=3;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=4;
|
||||
.
|
||||
|
||||
exploit time_advance_4(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=4;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=5;
|
||||
.
|
||||
|
||||
exploit time_advance_5(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=5;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=6;
|
||||
.
|
||||
|
||||
exploit time_advance_6(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=6;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=7;
|
||||
.
|
||||
|
||||
exploit time_advance_7(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=7;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=8;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_8(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=8;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=9;
|
||||
.
|
||||
|
||||
exploit time_advance_9(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=9;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=10;
|
||||
.
|
||||
|
||||
exploit time_advance_10(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=10;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=11;
|
||||
.
|
||||
|
||||
exploit time_advance_11(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=11;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=12;
|
||||
.
|
||||
|
||||
exploit time_advance_12(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=12;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=13;
|
||||
.
|
||||
324
car_examples/generic_timeline_supermaintenance_1car.xp
Normal file
324
car_examples/generic_timeline_supermaintenance_1car.xp
Normal file
@ -0,0 +1,324 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit super_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=1;
|
||||
quality:a,exhaust_months=1;
|
||||
quality:a,ac_odometer=10000;
|
||||
quality:a,vacuum_odometer=10000;
|
||||
postconditions:
|
||||
update quality:a,brake_months=0;
|
||||
update quality:a,exhaust_months=0;
|
||||
update quality:a,ac_odometer=0;
|
||||
update quality:a,vacuum_odometer=0;
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,exhaust_vio=false;
|
||||
update quality:a,ac_vio=false;
|
||||
update quality:a,vacuum_vio=false;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_0(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=1;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_1(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=1;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=2;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_2(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=2;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=3;
|
||||
.
|
||||
|
||||
exploit time_advance_3(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=3;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=4;
|
||||
.
|
||||
|
||||
exploit time_advance_4(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=4;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=5;
|
||||
.
|
||||
|
||||
exploit time_advance_5(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=5;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=6;
|
||||
.
|
||||
|
||||
exploit time_advance_6(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=6;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=7;
|
||||
.
|
||||
|
||||
exploit time_advance_7(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=7;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=8;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance_8(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=8;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=9;
|
||||
.
|
||||
|
||||
exploit time_advance_9(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=9;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=10;
|
||||
.
|
||||
|
||||
exploit time_advance_10(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=10;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=11;
|
||||
.
|
||||
|
||||
exploit time_advance_11(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=11;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=12;
|
||||
.
|
||||
|
||||
exploit time_advance_12(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
quality:a,brake_vio=false;
|
||||
quality:a,exhaust_vio=false;
|
||||
quality:a,ac_vio=false;
|
||||
quality:a,vacuum_vio=false;
|
||||
quality:a,TIME_ADVANCE_STEP=12;
|
||||
postconditions:
|
||||
update quality:a,brake_months=1;
|
||||
update quality:a,exhaust_months=1;
|
||||
update quality:a,ac_odometer=10000;
|
||||
update quality:a,vacuum_odometer=10000;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP=13;
|
||||
.
|
||||
47
car_examples/group_generic_maintenance.xp
Normal file
47
car_examples/group_generic_maintenance.xp
Normal file
@ -0,0 +1,47 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_vio=true;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=false;
|
||||
update quality:a,brake_months=0;
|
||||
.
|
||||
|
||||
24
car_examples/maintenance.nm
Normal file
24
car_examples/maintenance.nm
Normal file
@ -0,0 +1,24 @@
|
||||
network model =
|
||||
assets:
|
||||
# Car
|
||||
car1;
|
||||
car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=6;
|
||||
quality:car1,exhaust_months:=12;
|
||||
quality:car1,odometer=120000;
|
||||
quality:car1,engine=gas;
|
||||
|
||||
quality:car1,is_in_compliance=true;
|
||||
|
||||
quality:car2,car2_brake_months=6;
|
||||
quality:car2,car2_exhaust_months:=12;
|
||||
quality:car2,car2_odometer=120000;
|
||||
quality:car2,car2_engine=diesel;
|
||||
|
||||
quality:car2,car2_is_in_compliance=true;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
52
car_examples/maintenance.xp
Normal file
52
car_examples/maintenance.xp
Normal file
@ -0,0 +1,52 @@
|
||||
exploit brake_pads(car1)=
|
||||
preconditions:
|
||||
quality:car1,brake_months=6;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(car1)=
|
||||
preconditions:
|
||||
quality:car1,exhaust_months=12;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit ac_filter(car1)=
|
||||
preconditions:
|
||||
quality:car1,odometer=120000;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
insert quality:car1,is_critical=true;
|
||||
.
|
||||
|
||||
exploit afilter_v2(car2)=
|
||||
preconditions:
|
||||
quality:car2,car2_odometer=120000;
|
||||
postconditions:
|
||||
update quality:car2,car2_is_in_compliance=false;
|
||||
insert quality:car2,car2_is_critical=true;
|
||||
.
|
||||
|
||||
exploit bpads_v2(car2)=
|
||||
preconditions:
|
||||
quality:car2,car2_brake_months=6;
|
||||
postconditions:
|
||||
update quality:car2,car2_is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit epipes_v2(car2)=
|
||||
preconditions:
|
||||
quality:car2,car2_exhaust_months=12;
|
||||
postconditions:
|
||||
update quality:car2,car2_is_in_compliance=false;
|
||||
.
|
||||
exploit vacuum_pump(car2)=
|
||||
preconditions:
|
||||
quality:car2,car2_odometer=120000;
|
||||
quality:car2,car2_engine=diesel;
|
||||
postconditions:
|
||||
update quality:car2,car2_is_in_compliance=false;
|
||||
insert quality:car2,car2_is_critical=true;
|
||||
.
|
||||
|
||||
10
car_examples/simult_maintenance.nm
Normal file
10
car_examples/simult_maintenance.nm
Normal file
@ -0,0 +1,10 @@
|
||||
network model =
|
||||
assets:
|
||||
civic;
|
||||
wall;
|
||||
facts:
|
||||
quality:civic,compromised=true;
|
||||
quality:civic,status=up;
|
||||
topology:civic<->wall,distance:=50;
|
||||
tags:
|
||||
.
|
||||
26
car_examples/simult_maintenance.xp
Normal file
26
car_examples/simult_maintenance.xp
Normal file
@ -0,0 +1,26 @@
|
||||
global group(time) exploit car_depart(c,w)=
|
||||
preconditions:
|
||||
quality:c,compromised!=true;
|
||||
quality:c,staus=up;
|
||||
postconditions:
|
||||
update topology:c<->w,distance+=25;
|
||||
.
|
||||
|
||||
global group(time) exploit car_approach(c,w)=
|
||||
preconditions:
|
||||
quality:c,compromised=true;
|
||||
quality:c,status=up;
|
||||
topology:c<->w,distance>25;
|
||||
postconditions:
|
||||
update topology:c<->w,distance=-25;
|
||||
.
|
||||
|
||||
global group(time) exploit car_crash(c,w)=
|
||||
preconditions:
|
||||
quality:c,compromised=true;
|
||||
quality:c,status=up;
|
||||
topology:c<->w,distance<=25;
|
||||
postconditions:
|
||||
update topology:c<->w,distance:=0;
|
||||
update quality:c,status=down;
|
||||
.
|
||||
86
car_examples/sync_timeline_maintenance.xp
Normal file
86
car_examples/sync_timeline_maintenance.xp
Normal file
@ -0,0 +1,86 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months=0;
|
||||
update quality:a,brake_vio=false;
|
||||
.
|
||||
|
||||
|
||||
exploit exhaust_service(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=0;
|
||||
postconditions:
|
||||
update quality:a,exhaust_months=0;
|
||||
update quality:a,exhaust_vio=false;
|
||||
.
|
||||
|
||||
exploit ac_service(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=0;
|
||||
postconditions:
|
||||
update quality:a,ac_odometer=0;
|
||||
update quality:a,ac_vio=false;
|
||||
.
|
||||
|
||||
exploit vacuum_service(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=0;
|
||||
postconditions:
|
||||
update quality:a,vacuum_odometer=0;
|
||||
update quality:a,vacuum_vio=false;
|
||||
.
|
||||
|
||||
time group exploit time_advance(a)=
|
||||
preconditions:
|
||||
quality:a,TIME_ADVANCE_STEP<13;
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
quality:a,ac_odometer=0;
|
||||
quality:a,vacuum_odometer=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,ac_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP+=1;
|
||||
.
|
||||
89
car_examples/test.xp
Normal file
89
car_examples/test.xp
Normal file
@ -0,0 +1,89 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,TIME_ADVANCE_FLAG=0;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months=0;
|
||||
update quality:a,brake_vio=false;
|
||||
.
|
||||
|
||||
exploit exhaust_service(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=0;
|
||||
postconditions:
|
||||
update quality:a,ac_odometer=0;
|
||||
update quality:a,ac_vio=false;
|
||||
.
|
||||
|
||||
exploit ac_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months=0;
|
||||
update quality:a,brake_vio=false;
|
||||
.
|
||||
|
||||
exploit vacuum_service(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=0;
|
||||
quality:a,engine=diesel;
|
||||
postconditions:
|
||||
update quality:a,vacuum_odometer=0;
|
||||
update quality:a,vacuum_vio=false;
|
||||
.
|
||||
|
||||
|
||||
|
||||
time group exploit time_advance_0(a)=
|
||||
preconditions:
|
||||
quality:a,TIME_ADVANCE_STEP<12;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_FLAG=1;
|
||||
update quality:a,TIME_ADVANCE_STEP+=1;
|
||||
.
|
||||
|
||||
68
car_examples/tmp.xp
Normal file
68
car_examples/tmp.xp
Normal file
@ -0,0 +1,68 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
|
||||
exploit brake_service(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months=0;
|
||||
update quality:a,brake_vio=false;
|
||||
.
|
||||
|
||||
exploit exhaust_service(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=0;
|
||||
postconditions:
|
||||
update quality:a,exhaust_months=0;
|
||||
update quality:a,exhaust_vio=false;
|
||||
.
|
||||
|
||||
|
||||
exploit time_advance(a)=
|
||||
preconditions:
|
||||
quality:a,TIME_ADVANCE_STEP<13;
|
||||
quality:a,brake_months=0;
|
||||
quality:a,exhaust_months=0;
|
||||
postconditions:
|
||||
update quality:a,brake_months+=1;
|
||||
update quality:a,vacuum_odometer+=10000;
|
||||
update quality:a,ac_odometer+=10000;
|
||||
update quality:a,exhaust_months+=1;
|
||||
update quality:a,TIME_ADVANCE_STEP+=1;
|
||||
.
|
||||
17
car_examples_old/1car.nm
Normal file
17
car_examples_old/1car.nm
Normal file
@ -0,0 +1,17 @@
|
||||
network model =
|
||||
assets:
|
||||
# Car 1= Brake Pads, car2=exhaust
|
||||
car1;
|
||||
car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=6;
|
||||
quality:car1,exhaust_months=12;
|
||||
quality:car1,odometer=120000;
|
||||
quality:car1,engine=gas;
|
||||
|
||||
quality:car1,is_in_compliance=true;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
22
car_examples_old/1car.xp
Normal file
22
car_examples_old/1car.xp
Normal file
@ -0,0 +1,22 @@
|
||||
exploit brake_pads(car1)=
|
||||
preconditions:
|
||||
quality:car1,brake_months=6;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(car1)=
|
||||
preconditions:
|
||||
quality:car1,exhaust_months=12;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit ac_filter(car1)=
|
||||
preconditions:
|
||||
quality:car1,odometer=120000;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
insert quality:car1,is_critical=true;
|
||||
.
|
||||
|
||||
29
car_examples_old/error_maintenance.xp
Normal file
29
car_examples_old/error_maintenance.xp
Normal file
@ -0,0 +1,29 @@
|
||||
exploit brake_pads(car1)=
|
||||
preconditions:
|
||||
quality:car1,months=6;
|
||||
quality:car1,is_in_compliance=true;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(car2)=
|
||||
preconditions:
|
||||
quality:car2,months=6;
|
||||
quality:car2,is_in_compliance=true;
|
||||
postconditions:
|
||||
update quality:car2,is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit compliance(car1)=
|
||||
preconditions:
|
||||
quality:car1,is_in_compliance=false;
|
||||
postconditions:
|
||||
insert quality:car1,reg=true;
|
||||
.
|
||||
|
||||
exploit error(car1)=
|
||||
preconditions:
|
||||
quality:car1,months>8;
|
||||
postconditions:
|
||||
insert quality:car1,e=true;
|
||||
.
|
||||
24
car_examples_old/maintenance.nm
Normal file
24
car_examples_old/maintenance.nm
Normal file
@ -0,0 +1,24 @@
|
||||
network model =
|
||||
assets:
|
||||
# Car 1= Brake Pads, car2=exhaust
|
||||
car1;
|
||||
car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months:=6;
|
||||
quality:car1,exhaust_months:=12;
|
||||
quality:car1,odometer:=120000;
|
||||
quality:car1,engine=gas;
|
||||
|
||||
quality:car1,is_in_compliance=true;
|
||||
|
||||
quality:car2,car2_brake_months:=6;
|
||||
quality:car2,car2_exhaust_months:=12;
|
||||
quality:car2,car2_odometer:=120000;
|
||||
quality:car2,car2_engine=diesel;
|
||||
|
||||
quality:car2,car2_is_in_compliance=true;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
52
car_examples_old/maintenance.xp
Normal file
52
car_examples_old/maintenance.xp
Normal file
@ -0,0 +1,52 @@
|
||||
exploit brake_pads(car1)=
|
||||
preconditions:
|
||||
quality:car1,brake_months=6;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(car1)=
|
||||
preconditions:
|
||||
quality:car1,exhaust_months>11;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit ac_filter(car1)=
|
||||
preconditions:
|
||||
quality:car1,odometer=120000;
|
||||
postconditions:
|
||||
update quality:car1,is_in_compliance=false;
|
||||
insert quality:car1,is_critical=true;
|
||||
.
|
||||
|
||||
exploit afilter_v2(car2)=
|
||||
preconditions:
|
||||
quality:car2,car2_odometer=120000;
|
||||
postconditions:
|
||||
update quality:car2,car2_is_in_compliance=false;
|
||||
insert quality:car2,car2_is_critical=true;
|
||||
.
|
||||
|
||||
exploit bpads_v2(car2)=
|
||||
preconditions:
|
||||
quality:car2,car2_brake_months=6;
|
||||
postconditions:
|
||||
update quality:car2,car2_is_in_compliance=false;
|
||||
.
|
||||
|
||||
exploit epipes_v2(car2)=
|
||||
preconditions:
|
||||
quality:car2,car2_exhaust_months=12;
|
||||
postconditions:
|
||||
update quality:car2,car2_is_in_compliance=false;
|
||||
.
|
||||
exploit vacuum_pump(car2)=
|
||||
preconditions:
|
||||
quality:car2,car2_odometer=120000;
|
||||
quality:car2,car2_engine=diesel;
|
||||
postconditions:
|
||||
update quality:car2,car2_is_in_compliance=false;
|
||||
insert quality:car2,car2_is_critical=true;
|
||||
.
|
||||
|
||||
222
compile_commands.json
Normal file
222
compile_commands.json
Normal file
@ -0,0 +1,222 @@
|
||||
[
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/dynstr_test.dir/src/util/mem.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/mem.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/mem.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/dynstr_test.dir/src/tests/mem_test.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/tests/mem_test.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/tests/mem_test.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/tools/decode.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/tools/decode.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/tools/decode.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/ag_gen.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/ag_gen.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/ag_gen.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/asset.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/asset.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/asset.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/assetgroup.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/assetgroup.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/assetgroup.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/edge.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/edge.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/edge.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/exploit.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/exploit.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/exploit.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/factbase.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/factbase.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/factbase.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/network_state.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/network_state.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/network_state.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/quality.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/quality.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/quality.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/ag_gen/topology.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/topology.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/topology.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/decode.dir/src/util/build_sql.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/build_sql.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/build_sql.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/util/common.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/common.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/common.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/util/db_functions.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/db_functions.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/db_functions.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/decode.dir/src/util/hash.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/hash.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/hash.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/decode.dir/src/util/list.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/list.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/list.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/decode.dir/src/util/mem.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/mem.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/mem.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/decode.dir/src/util/redis_manager.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/redis_manager.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/redis_manager.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/decode.dir/src/util/str_array.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/str_array.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/str_array.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/decode.dir/src/util/vector.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/vector.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/vector.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/main.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/main.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/main.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/nm_scanner.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/build/nm_scanner.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/build/nm_scanner.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/nm_parser.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/build/nm_parser.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/build/nm_parser.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/xp_scanner.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/build/xp_scanner.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/build/xp_scanner.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/xp_parser.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/build/xp_parser.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/build/xp_parser.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/ag_gen.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/ag_gen.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/ag_gen.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/asset.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/asset.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/asset.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/assetgroup.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/assetgroup.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/assetgroup.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/edge.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/edge.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/edge.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/exploit.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/exploit.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/exploit.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/factbase.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/factbase.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/factbase.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/network_state.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/network_state.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/network_state.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/quality.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/quality.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/quality.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/ag_gen/topology.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/topology.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/ag_gen/topology.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/src/util/build_sql.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/build_sql.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/build_sql.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/util/common.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/common.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/common.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/util/db_functions.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/db_functions.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/db_functions.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/src/util/hash.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/hash.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/hash.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/src/util/list.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/list.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/list.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/src/util/mem.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/mem.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/mem.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/c++ -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -std=c++14 -fopenmp -DREDIS -g -g -O0 -ggdb -Wall -fopenmp -pedantic -o CMakeFiles/ag_gen.dir/src/util/redis_manager.cpp.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/redis_manager.cpp\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/redis_manager.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/src/util/str_array.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/str_array.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/str_array.c"
|
||||
},
|
||||
{
|
||||
"directory": "/home/noah/Documents/School/Thesis Work/ag_parallel/build",
|
||||
"command": "/usr/bin/cc -I/usr/include/postgresql -I\"/home/noah/Documents/School/Thesis Work/ag_parallel/src\" -g -o CMakeFiles/ag_gen.dir/src/util/vector.c.o -c \"/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/vector.c\"",
|
||||
"file": "/home/noah/Documents/School/Thesis Work/ag_parallel/src/util/vector.c"
|
||||
}
|
||||
]
|
||||
6
config.ini
Executable file
6
config.ini
Executable file
@ -0,0 +1,6 @@
|
||||
[database]
|
||||
name = ag_gen
|
||||
host = 127.0.0.1
|
||||
port = 5432
|
||||
username = ag_gen
|
||||
password = 8PZQc79NUZ3FjqSB
|
||||
169
db_manage.sh
Executable file
169
db_manage.sh
Executable file
@ -0,0 +1,169 @@
|
||||
#!/bin/bash
|
||||
|
||||
function init() {
|
||||
echo -n "Loading Schema: "
|
||||
SCHEMA="sql/schema.sql"
|
||||
OUTPUT="$(psql $DB < $SCHEMA 2>&1)"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error" >&2
|
||||
echo $OUTPUT >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
if [[ -f "$FILE" ]]; then
|
||||
echo -n "Importing Data: "
|
||||
OUTPUT="$(psql $DB < $FILE 2>&1)"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error"
|
||||
echo $OUTPUT
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
fi
|
||||
|
||||
# Execute extra sql files
|
||||
echo -n "Adding support functions: "
|
||||
OUTPUT="$(psql $DB < "sql/factbase.sql" 2>&1)"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error"
|
||||
echo $OUTPUT
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
echo "Database Initialization Complete."
|
||||
}
|
||||
|
||||
function update() {
|
||||
if [[ -z "$FILE" ]]; then
|
||||
echo "-i is required for the update action."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$FILE" ]]; then
|
||||
echo "$FILE must exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$DB" ]]; then
|
||||
echo "-d is required for the update action."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "Running SQL script $FILE: "
|
||||
OUTPUT="$(psql $DB < $FILE 2>&1)"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error" >&2
|
||||
echo $OUTPUT >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Complete"
|
||||
}
|
||||
|
||||
function drop() {
|
||||
if [[ -z "$DB" ]]; then
|
||||
echo "-d is required for the drop action." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "Dropping $DB: "
|
||||
OUTPUT="$(dropdb $DB 2>&1)"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error"
|
||||
echo $OUTPUT
|
||||
exit 1
|
||||
fi
|
||||
echo "Dropped"
|
||||
}
|
||||
|
||||
function test() {
|
||||
echo "Test!"
|
||||
echo "File: $FILE"
|
||||
echo "Database: $DB"
|
||||
echo "Action: $ACTION"
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "usage: db_manage [OPTIONS]" >&2
|
||||
echo "A script to help manage the attack graph generation database" >&2
|
||||
echo "" >&2
|
||||
echo " -a, --action Action to perform on the database" >&2
|
||||
echo " Defaults to \"init\"" >&2
|
||||
echo " -d, --database The database to manage" >&2
|
||||
echo " Defaults to \"ag_gen\"" >&2
|
||||
echo " -f, --force Forces a database to be overwritten" >&2
|
||||
echo " -h, --help Displays this help message" >&2
|
||||
echo " -i, --import SQL data to import to the database" >&2
|
||||
echo " -s, --schema Schema file to initialize database with" >&2
|
||||
echo " Defaults to \"sql/schema.sql\"" >&2
|
||||
echo "" >&2
|
||||
}
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-i | --import)
|
||||
# Include SQL file
|
||||
FILE="$2"
|
||||
shift 2
|
||||
;;
|
||||
-d | --database)
|
||||
# Use this database
|
||||
DB="$2"
|
||||
shift 2
|
||||
;;
|
||||
-a | --action)
|
||||
ACTION=$2
|
||||
shift 2
|
||||
;;
|
||||
-s | --schema)
|
||||
SCHEMA="$2"
|
||||
shift 2
|
||||
;;
|
||||
-f | --force)
|
||||
FORCE=true
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
# Display help
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
# End of options
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echo "Unknown option: $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$ACTION" ]]; then
|
||||
ACTION="init"
|
||||
fi
|
||||
$ACTION # Call the action as a function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
29
deps.sh
Executable file
29
deps.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
OS=$(uname | tr 'A-Z' 'a-z')
|
||||
|
||||
if [[ $OS = 'darwin' ]]; then
|
||||
if hash brew 2>/dev/null; then
|
||||
xcode-select --install > /dev/null
|
||||
brew cask install postgres
|
||||
brew install postgresql cmake boost cmocka cppcheck doxygen graphviz tbb libconfig
|
||||
else
|
||||
echo "Please install homebrew first."
|
||||
fi
|
||||
elif [[ $OS = 'linux' ]]; then
|
||||
if hash pacman 2>/dev/null; then
|
||||
sudo pacman -S cmake postgresql boost cppcheck clang doxygen graphviz libconfig
|
||||
elif hash apt-get 2>/dev/null; then
|
||||
sudo apt-get -y install libboost-graph-dev postgresql postgresql-contrib \
|
||||
libpq-dev cppcheck clang valgrind doxygen graphviz cmake \
|
||||
build-essential bison flex libssl-dev libconfig++-dev libyaml-cpp-dev
|
||||
elif hash yum 2>/dev/null; then
|
||||
sudo yum install cmake epel-release postgresql-devel boost-devel \
|
||||
openssl-devel graphviz-devel bison-devel flex-devel cppcheck valgrind \
|
||||
tbb libconfig-devel
|
||||
else
|
||||
echo "Your distro is currently not supported."
|
||||
fi
|
||||
else
|
||||
echo "Your operating system is not currently supported."
|
||||
fi
|
||||
55
docs/exploit-pattern-grammar.txt
Executable file
55
docs/exploit-pattern-grammar.txt
Executable file
@ -0,0 +1,55 @@
|
||||
<exploit-pattern> ::= <exploit-list>
|
||||
<exploit-list> ::= <exploit-list> <exploit>
|
||||
| <exploit>
|
||||
<exploit> ::= "exploit" <identifier> , ( <parameter-list> ) = <options> <precondition-list> <postcondition-list> .
|
||||
|
||||
<parameter-list> ::= <parameters>
|
||||
| <EOL>
|
||||
<parameters> ::= <identifier> , <parameters>
|
||||
| <identifier>
|
||||
|
||||
<preconditions> ::= preconditions : <preconditions-list>
|
||||
<preconditions-list> ::= <preconditions-list> <precondition>
|
||||
| <precondition>
|
||||
<precondition> ::= <f>
|
||||
|
||||
<postconditions> ::= postconditions : <postconditions-list>
|
||||
<postconditions-list> ::= <postconditions-list> <postcondition>
|
||||
| <postcondition>
|
||||
<postcondition> ::= <operation> <f>
|
||||
|
||||
<operation> ::= insert
|
||||
| delete
|
||||
| update
|
||||
|
||||
<f> ::= quality : <identifier> , <statement> ;
|
||||
| topology : <identifier> <direction> <identifier> , <statement> ;
|
||||
|
||||
<statement> ::= <identifier> <operator> <value>
|
||||
|
||||
<identifier> ::= [A-Za-z][A-Za-z0-9_]*
|
||||
|
||||
<value> ::= <string>
|
||||
| <number>
|
||||
<string> ::= [A-Za-z0-9_]*
|
||||
<number> ::= -?[1-9][0-9]*
|
||||
|
||||
<operator> ::= <eqlop>
|
||||
| <addop>
|
||||
| <relop>
|
||||
| <-
|
||||
<eqlop> ::= =
|
||||
| :=
|
||||
<relop> ::= <
|
||||
| >
|
||||
| <=
|
||||
| >=
|
||||
<addop> ::= +=
|
||||
| -=
|
||||
|
||||
|
||||
<direction> ::= ->
|
||||
| <-
|
||||
| <->
|
||||
|
||||
<whitespace> ::= [\t\n ]
|
||||
31
docs/network-model-grammar.txt
Executable file
31
docs/network-model-grammar.txt
Executable file
@ -0,0 +1,31 @@
|
||||
<network-model> ::= network <identifier> = assets : <asset-list> facts : <f-list> .
|
||||
<asset-list> ::= <asset-list> <identifier> ;
|
||||
| <EOL>
|
||||
<f-list> ::= <f-list> <f> ;
|
||||
| <EOL>
|
||||
<f> ::= quality : <identifier> , <statement> ;
|
||||
| topology : <identifier> <direction> <identifier> , <statement> ;
|
||||
|
||||
<statement> ::= <identifier> <operator> <value>
|
||||
<identifier> ::= [A-Za-z][A-Za-z0-9_]*
|
||||
|
||||
<value> ::= <string>
|
||||
| <number>
|
||||
<string> ::= [A-Za-z0-9_]*
|
||||
<number> ::= [1-9][0-9]*
|
||||
|
||||
<operator> ::= <eqlop>
|
||||
| <relop>
|
||||
<eqlop> ::= =
|
||||
| :=
|
||||
<relop> ::= <
|
||||
| >
|
||||
| <=
|
||||
| >=
|
||||
|
||||
<direction> ::= ->
|
||||
| <->
|
||||
|
||||
<whitespace> ::= " "
|
||||
| \t
|
||||
| \n
|
||||
94
examples/1.nm
Executable file
94
examples/1.nm
Executable file
@ -0,0 +1,94 @@
|
||||
network model =
|
||||
assets:
|
||||
# Router
|
||||
border_router;
|
||||
border_router2;
|
||||
|
||||
# DMZ
|
||||
website;
|
||||
public_api;
|
||||
|
||||
# Internal
|
||||
storage_server;
|
||||
active_directory;
|
||||
icehrm;
|
||||
splunk;
|
||||
|
||||
# Workstations
|
||||
workstation1;
|
||||
workstation2;
|
||||
workstation3;
|
||||
|
||||
# Wifi
|
||||
ap;
|
||||
ap2;
|
||||
personal_laptop;
|
||||
personal_phone;
|
||||
personal_phone2;
|
||||
personal_laptop2;
|
||||
personal_laptop3;
|
||||
|
||||
facts:
|
||||
quality:border_router,vendor=paloalto;
|
||||
quality:border_router,os=panos;
|
||||
quality:border_router,version:=8;
|
||||
quality:border_router2,vendor=paloalto;
|
||||
quality:border_router2,os=panos;
|
||||
quality:border_router2,version:=8;
|
||||
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,version:=12.04;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version:=2.2;
|
||||
topology:border_router<->website,dmz;
|
||||
|
||||
|
||||
quality:public_api,os=ubuntu;
|
||||
quality:public_api,version:=12.04;
|
||||
quality:public_api,backend=flask;
|
||||
quality:public_api,backend_version:=6;
|
||||
topology:border_router<->public_api,dmz;
|
||||
topology:border_router2<->public_api,dmz;
|
||||
|
||||
quality:storage_server,os=freebsd;
|
||||
quality:storage_server,version:=10;
|
||||
quality:storage_server,smb=enabled;
|
||||
quality:storage_server,nfs=enabled;
|
||||
topology:border_router<->storage_server,private_firewall;
|
||||
topology:border_router2<->storage_server,private_firewall;
|
||||
|
||||
quality:active_directory,os=win2008r2;
|
||||
quality:active_directory,domain_controller=true;
|
||||
topology:border_router<->active_directory,private_firewall;
|
||||
|
||||
topology:border_router<->icehrm,private_firewall;
|
||||
|
||||
topology:border_router2<->icehrm,private_firewall;
|
||||
|
||||
topology:border_router<->splunk,private_firewall;
|
||||
|
||||
topology:border_router2<->splunk,private_firewall;
|
||||
|
||||
topology:border_router<->workstation1,private_nat;
|
||||
|
||||
topology:border_router<->workstation2,private_nat;
|
||||
|
||||
topology:border_router<->border_router2,private_nat;
|
||||
|
||||
topology:border_router2<->workstation3,private_nat;
|
||||
|
||||
topology:border_router<->ap,private_nat;
|
||||
|
||||
topology:border_router2<->ap2,private_nat;
|
||||
|
||||
topology:ap<->personal_laptop,wifi_private;
|
||||
|
||||
topology:ap2<->personal_laptop2,wifi_private;
|
||||
|
||||
topology:ap<->personal_laptop3,wifi_private;
|
||||
|
||||
topology:ap<->personal_phone,wifi_private;
|
||||
|
||||
topology:ap2<->personal_phone2,wifi_private;
|
||||
tags:
|
||||
.
|
||||
56
examples/1.xp
Executable file
56
examples/1.xp
Executable file
@ -0,0 +1,56 @@
|
||||
exploit ubuntu_apache_exploit(website)=
|
||||
preconditions:
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version==2.2;
|
||||
postconditions:
|
||||
insert quality:website,command_injection=true;
|
||||
.
|
||||
|
||||
exploit ubuntu_linux_priv_esc(machine)=
|
||||
preconditions:
|
||||
quality:machine,os=ubuntu;
|
||||
quality:machine,version==12.04;
|
||||
postconditions:
|
||||
insert quality:machine,priv_esc=true;
|
||||
.
|
||||
|
||||
exploit inject_command(machine)=
|
||||
preconditions:
|
||||
quality:machine,command_injection=true;
|
||||
quality:machine,priv_esc=true;
|
||||
postconditions:
|
||||
insert quality:machine,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_nat(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,private_nat;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_dmz(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,dmz;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_firewall(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,private_firewall;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_wifi(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,wifi_private;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
106
examples/2.nm
Executable file
106
examples/2.nm
Executable file
@ -0,0 +1,106 @@
|
||||
network model =
|
||||
assets:
|
||||
# Router
|
||||
border_router;
|
||||
border_router2;
|
||||
border_router3;
|
||||
|
||||
# DMZ
|
||||
website;
|
||||
public_api;
|
||||
|
||||
# Internal
|
||||
storage_server;
|
||||
active_directory;
|
||||
icehrm;
|
||||
splunk;
|
||||
|
||||
# Workstations
|
||||
workstation1;
|
||||
workstation2;
|
||||
workstation3;
|
||||
workstation4;
|
||||
|
||||
# Wifi
|
||||
ap;
|
||||
ap2;
|
||||
personal_laptop;
|
||||
personal_phone;
|
||||
personal_phone2;
|
||||
personal_laptop2;
|
||||
personal_laptop3;
|
||||
|
||||
facts:
|
||||
quality:border_router,vendor=paloalto;
|
||||
quality:border_router,os=panos;
|
||||
quality:border_router,version:=8;
|
||||
quality:border_router2,vendor=paloalto;
|
||||
quality:border_router2,os=panos;
|
||||
quality:border_router2,version:=8;
|
||||
quality:border_router3,vendor=paloalto;
|
||||
quality:border_router3,os=panos;
|
||||
quality:border_router3,version:=8;
|
||||
|
||||
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,version:=12.04;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version:=2.2;
|
||||
topology:border_router<->website,dmz;
|
||||
topology:border_router3<->website,dmz;
|
||||
|
||||
|
||||
quality:public_api,os=ubuntu;
|
||||
quality:public_api,version:=12.04;
|
||||
quality:public_api,backend=flask;
|
||||
quality:public_api,backend_version:=6;
|
||||
topology:border_router<->public_api,dmz;
|
||||
topology:border_router2<->public_api,dmz;
|
||||
|
||||
quality:storage_server,os=freebsd;
|
||||
quality:storage_server,version:=10;
|
||||
quality:storage_server,smb=enabled;
|
||||
quality:storage_server,nfs=enabled;
|
||||
topology:border_router2<->storage_server,private_firewall;
|
||||
topology:border_router3<->storage_server,private_firewall;
|
||||
|
||||
quality:active_directory,os=win2008r2;
|
||||
quality:active_directory,domain_controller=true;
|
||||
topology:border_router<->active_directory,private_firewall;
|
||||
|
||||
topology:border_router<->icehrm,private_firewall;
|
||||
|
||||
topology:border_router2<->icehrm,private_firewall;
|
||||
|
||||
topology:border_router<->splunk,private_firewall;
|
||||
|
||||
topology:border_router2<->splunk,private_firewall;
|
||||
|
||||
topology:border_router<->workstation1,private_nat;
|
||||
|
||||
topology:border_router<->workstation2,private_nat;
|
||||
|
||||
topology:border_router<->border_router2,private_nat;
|
||||
|
||||
topology:border_router2<->border_router3,private_nat;
|
||||
|
||||
topology:border_router2<->workstation3,private_nat;
|
||||
|
||||
topology:border_router3<->workstation4,private_nat;
|
||||
|
||||
topology:border_router<->ap,private_nat;
|
||||
|
||||
topology:border_router2<->ap2,private_nat;
|
||||
|
||||
topology:ap<->personal_laptop,wifi_private;
|
||||
|
||||
topology:ap2<->personal_laptop2,wifi_private;
|
||||
|
||||
topology:ap<->personal_laptop3,wifi_private;
|
||||
|
||||
topology:ap<->personal_phone,wifi_private;
|
||||
|
||||
topology:ap2<->personal_phone2,wifi_private;
|
||||
|
||||
tags:
|
||||
.
|
||||
743
examples/SystemV12cda4.2.nm
Executable file
743
examples/SystemV12cda4.2.nm
Executable file
@ -0,0 +1,743 @@
|
||||
network model =
|
||||
assets :
|
||||
#Digital
|
||||
tempSensor1; #CS/CDA
|
||||
tempSensor2; #CS/CDA
|
||||
seismicSensor1; #CS/CDA
|
||||
automaticScram; #CS/CDA
|
||||
operator; #CS/CDA
|
||||
controlRodController; #CS/CDA
|
||||
controlBlade1; #CS/CDA
|
||||
controlBlade2; #CS/CDA
|
||||
controlBlade5; #CS/CDA
|
||||
controlBlade4; #CS/CDA
|
||||
pulseControlRod; #CS/CDA
|
||||
buildingCompressedAir; # Affects control rod movment, which is a CS, thus CDA
|
||||
pressureTankSolenoidValve; # Affects control rod movment, which is a CS, thus CDA
|
||||
linearPowerSensor;#aka CIC #CS/CDA
|
||||
nlogPowerSensor; #CS/CDA
|
||||
pulsePowerSensor;#aka UIC #CS/CDA
|
||||
controlSystemRecorder; #Listed as CS in Fig 2., thus CDA if digital
|
||||
buildingEvacAlarm; #CS/CDA (S/EP)
|
||||
beamRoomScramChain; #CS/CDA if digital
|
||||
highFluxMonitor; #CS/CDA
|
||||
periodSensor; #CS/CDA
|
||||
logNHVFailureSensor; #CS/CDA
|
||||
linearHVFailureSensor; #CS/CDA
|
||||
pulseHVFailureSensor; #CS/CDA
|
||||
continuousAirMonitor; #CS/CDA (Safety)
|
||||
areaMonitoringSystem; #CS/CDA (Safety)
|
||||
diffuser; #CS/CDA (Safety)
|
||||
coolantLevelSensor; #Can casue operator to be instructed to SCRAM, thus CDA
|
||||
backupPower; #CS/CDA
|
||||
bridge; #CDA since it can affect radiation levels, which is safety-realted
|
||||
|
||||
#water purification system
|
||||
waterMakeupPump; #CS, CDA if digital
|
||||
purificationRecirculationPump; #CS, CDA if digital
|
||||
flowmeter; #Not normally visible, doesn't communicate... not a CS...
|
||||
conductivityCell1; #CS/CDA
|
||||
conductivityCell2; #CS/CDA
|
||||
ionExchanger; #Not digital
|
||||
poolTotalizer; #Not digital, but would be a CDA if replaced with a digital component
|
||||
|
||||
#heat exchange system
|
||||
coolantTempSensor; #CS/CDA
|
||||
heatExchangePump1; #CS/CDA
|
||||
heatExchangePump2; #CS/CDA
|
||||
conductivityCell3; #CS/CDA
|
||||
towerTotalizer; #Not digital, but problably a CS. If so, would be a CDA if digital
|
||||
coolingTowerFan; #Probably CS/CDA. Want to check on consequences of failure and update asset list
|
||||
|
||||
#Ventilation System
|
||||
ventilationController; #CS/CDA
|
||||
ventilationIntakeFan; #CS/CDA
|
||||
ventilationOuttakeFan; #CS/CDA
|
||||
ventilationAirDetector; #CS/CDA
|
||||
ventilationDampers; #CS/CDA
|
||||
ventilationDiluteFan; #CS/CDA
|
||||
|
||||
#Physical
|
||||
#combining values
|
||||
reactor; #CS
|
||||
coolant; #CS
|
||||
airborneRadiation; #CS
|
||||
buildingPower;
|
||||
seismicActivity;
|
||||
|
||||
# For CDA Generation
|
||||
finishTag;
|
||||
|
||||
facts :
|
||||
# Initial Critical Assets List
|
||||
quality:reactor,critical=true;
|
||||
|
||||
# Statement of which assets are digital
|
||||
quality:tempSensor1,digital=true;
|
||||
quality:tempSensor2,digital=true;
|
||||
quality:seismicSensor1,digital=true;
|
||||
quality:automaticScram,digital=true;
|
||||
quality:operator,digital=true;
|
||||
quality:controlRodController,digital=true;
|
||||
quality:controlBlade1,digital=true;
|
||||
quality:controlBlade2,digital=true;
|
||||
quality:controlBlade5,digital=true;
|
||||
quality:controlBlade4,digital=true;
|
||||
quality:pulseControlRod,digital=true;
|
||||
quality:buildingCompressedAir,digital=true;
|
||||
quality:pressureTankSolenoidValve,digital=true;
|
||||
quality:linearPowerSensor,digital=true;
|
||||
quality:nlogPowerSensor,digital=true;
|
||||
quality:pulsePowerSensor,digital=true;
|
||||
quality:controlSystemRecorder,digital=true;
|
||||
quality:buildingEvacAlarm,digital=true;
|
||||
quality:beamRoomScramChain,digital=true;
|
||||
quality:highFluxMonitor,digital=true;
|
||||
quality:periodSensor,digital=true;
|
||||
quality:logNHVFailureSensor,digital=true;
|
||||
quality:linearHVFailureSensor,digital=true;
|
||||
quality:pulseHVFailureSensor,digital=true;
|
||||
quality:continuousAirMonitor,digital=true;
|
||||
quality:areaMonitoringSystem,digital=true;
|
||||
quality:diffuser,digital=true;
|
||||
quality:coolantLevelSensor,digital=true;
|
||||
quality:backupPower,digital=true;
|
||||
quality:bridge,digital=true;
|
||||
|
||||
# Tag for when CDAs can no longer be generated
|
||||
quality:finishTag,completed=false;
|
||||
|
||||
#TempSensor Facts
|
||||
quality:tempSensor1,status=ok;
|
||||
quality:tempSensor2,status=ok;
|
||||
quality:tempSensor1,temp:=50;
|
||||
quality:tempSensor2,temp:=50;
|
||||
quality:tempSensor1,calibration=normal;
|
||||
quality:tempSensor2,calibration=normal;
|
||||
quality:tempSensor1,powerStatus=on;
|
||||
quality:tempSensor2,powerStatus=on;
|
||||
|
||||
topology:tempSensor1->automaticScram,connected_modbus_slave;
|
||||
quality:tempSensor1,spoofed=false;
|
||||
topology:tempSensor2->automaticScram,connected_modbus_slave;
|
||||
quality:tempSensor2,spoofed=false;
|
||||
topology:tempSensor1->controlSystemRecorder,connected_modbus_slave;
|
||||
topology:tempSensor2->controlSystemRecorder,connected_modbus_slave;
|
||||
topology:tempSensor1->operator,connected_modbus_slave;
|
||||
quality:tempSensor1,spoofed=false;
|
||||
topology:tempSensor2->operator,connected_modbus_slave;
|
||||
quality:tempSensor2,spoofed=false;
|
||||
topology:reactor<->tempSensor1,physical;
|
||||
topology:reactor<->tempSensor2,physical;
|
||||
topology:buildingPower->tempSensor1,power:=120;
|
||||
topology:buildingPower->tempSensor2,power:=120;
|
||||
|
||||
quality:tempSensor1,platform=tempSensor;
|
||||
quality:tempSensor2,platform=tempSensor;
|
||||
|
||||
#SeismicSensor Facts
|
||||
quality:seismicSensor1,status=ok;
|
||||
quality:seismicSensor1,powerStatus=on;
|
||||
quality:seismicSensor1,magnitude:=.003;
|
||||
|
||||
topology:seismicSensor1->automaticScram,connected_modbus_slave;
|
||||
quality:seismicSensor1,spoofed=false;
|
||||
topology:seismicActivity<->seismicSensor1,physical;
|
||||
topology:buildingPower->seismicSensor1,power:=120;
|
||||
|
||||
quality:seismicSensor1,platform=seismicSensor;
|
||||
|
||||
#Automatic Scram Facts
|
||||
quality:automaticScram,status=ok;
|
||||
quality:automaticScram,powerStatus=on;
|
||||
quality:automaticScram,mode=manual;
|
||||
quality:automaticScram,activated=false;
|
||||
|
||||
topology:automaticScram->controlRodController,connected_emag_power;
|
||||
topology:automaticScram->tempSensor1,connected_modbus_master;
|
||||
topology:automaticScram->tempSensor2,connected_modbus_master;
|
||||
topology:automaticScram->seismicSensor1,connected_modbus_master;
|
||||
topology:automaticScram->highFluxMonitor,connected_modbus_master;
|
||||
topology:automaticScram->buildingEvacAlarm,connected_modbus_master;
|
||||
topology:automaticScram->beamRoomScramChain,connected_modbus_master;
|
||||
topology:automaticScram->logNHVFailureSensor,connected_modbus_master;
|
||||
topology:automaticScram->linearHVFailureSensor,connected_modbus_master;
|
||||
topology:automaticScram->pulseHVFailureSensor,connected_modbus_master;
|
||||
topology:automaticScram->operator,connected_modbus_master;
|
||||
topology:buildingPower->automaticScram,power:=120;
|
||||
|
||||
quality:automaticScram,platform=scramUnit;
|
||||
|
||||
#Operator Facts
|
||||
quality:operator,status=ok;
|
||||
quality:operator,powerStatus=on;
|
||||
quality:operator,manualScram=false;
|
||||
quality:operator,operationMode=manual;
|
||||
quality:operator,consoleKey=inserted;
|
||||
|
||||
topology:operator->automaticScram,connected_modbus_slave;
|
||||
quality:operator,spoofed=false;
|
||||
topology:operator->coolantLevelSensor,audible;
|
||||
topology:operator->coolantTempSensor,connected_modbus_master;
|
||||
topology:operator->controlRodController,connected_modbus_master;
|
||||
topology:operator->buildingEvacAlarm,connected_modbus_master;
|
||||
topology:operator->tempSensor1,connected_modbus_master;
|
||||
topology:operator->tempSensor2,connected_modbus_master;
|
||||
topology:operator->linearPowerSensor,connected_modbus_master;
|
||||
topology:operator->nlogPowerSensor,connected_modbus_master;
|
||||
topology:operator->pulsePowerSensor,connected_modbus_master;
|
||||
topology:operator->continuousAirMonitor,connected_modbus_master;
|
||||
topology:operator->bridge,connected_modbus_master;
|
||||
topology:operator->periodSensor,connected_modbus_master;
|
||||
topology:operator->areaMonitoringSystem,connected_modbus_master;
|
||||
topology:operator->ventilationAirDetector,connected_modbus_master;
|
||||
topology:operator->conductivityCell1,connected_modbus_master;
|
||||
topology:operator->conductivityCell2,connected_modbus_master;
|
||||
topology:operator->conductivityCell3,connected_modbus_master;
|
||||
topology:operator->heatExchangePump1,connected_modbus_master;
|
||||
topology:operator->heatExchangePump2,connected_modbus_master;
|
||||
topology:operator->diffuser,connected_modbus_master;
|
||||
topology:buildingPower->operator,power:=120;
|
||||
|
||||
quality:operator,platform=operatorStation;
|
||||
|
||||
#Control Rod Facts
|
||||
quality:controlRodController,status=ok;
|
||||
quality:controlRodController,powerStatus=on;
|
||||
quality:controlRodController,emagPower=on;
|
||||
|
||||
topology:controlRodController->operator,connected_modbus_slave;
|
||||
quality:controlRodController,spoofed=false;
|
||||
topology:controlRodController->pressureTankSolenoidValve,connected_modbus_master;
|
||||
topology:controlRodController->nlogPowerSensor,connected_modbus_master;
|
||||
topology:buildingPower->controlRodController,power:=120;
|
||||
|
||||
quality:controlRodController,platform=controlRodController;
|
||||
|
||||
#Control rod position intended to represent percent of max height
|
||||
quality:controlBlade1,motorStatus=ok;
|
||||
quality:controlBlade2,motorStatus=ok;
|
||||
quality:controlBlade4,motorStatus=ok;
|
||||
quality:controlBlade5,motorStatus=ok;
|
||||
|
||||
quality:controlBlade1,scrammable=true;
|
||||
quality:controlBlade2,scrammable=true;
|
||||
quality:controlBlade4,scrammable=true;
|
||||
quality:controlBlade5,scrammable=false;
|
||||
|
||||
quality:controlBlade1,actualPosition:=.5;
|
||||
quality:controlBlade2,actualPosition:=.5;
|
||||
quality:controlBlade5,actualPosition:=1;
|
||||
quality:controlBlade4,actualPosition:=.5;
|
||||
|
||||
quality:controlBlade1,reportedPosition:=.5;
|
||||
quality:controlBlade2,reportedPosition:=.5;
|
||||
quality:controlBlade5,reportedPosition:=1;
|
||||
quality:controlBlade4,reportedPosition:=.5;
|
||||
|
||||
quality:pulseControlRod,actualPosition:=1;
|
||||
quality:pulseControlRod,cylinderPosition:=1;
|
||||
quality:pulseControlRod,reportedPosition:=1;
|
||||
quality:pulseControlRod,pulsed=false;
|
||||
quality:pulseControlRod,scrammable=true;
|
||||
|
||||
quality:controlBlade1,register=0;
|
||||
quality:controlBlade2,register=4;
|
||||
quality:controlBlade5,register=16;
|
||||
quality:controlBlade4,register=12;
|
||||
quality:pulseControlRod,register=8;
|
||||
|
||||
quality:controlBlade1,platform=controlBlade;
|
||||
quality:controlBlade2,platform=controlBlade;
|
||||
quality:controlBlade5,platform=controlBlade;
|
||||
quality:controlBlade4,platform=controlBlade;
|
||||
quality:pulseControlRod,platform=pulseControlRod;
|
||||
|
||||
#Subcomponent Connections
|
||||
topology:controlBlade1->controlRodController,subcomponent;
|
||||
topology:controlBlade2->controlRodController,subcomponent;
|
||||
topology:controlBlade5->controlRodController,subcomponent;
|
||||
topology:controlBlade4->controlRodController,subcomponent;
|
||||
topology:pulseControlRod->controlRodController,subcomponent;
|
||||
#pressureTankSolenoidValve conncetion is unidirectional
|
||||
|
||||
#Building Compressed Air
|
||||
quality:buildingCompressedAir,status=ok;
|
||||
quality:buildingCompressedAir,powerStatus=on;
|
||||
quality:buildingCompressedAir,compressor=on;
|
||||
quality:buildingCompressedAir,ctValve=open;#Compressor to Tank
|
||||
quality:buildingCompressedAir,tankPressure:=80;#psi
|
||||
|
||||
topology:buildingCompressedAir->pressureTankSolenoidValve,pneumatic_closed;
|
||||
topology:buildingPower->buildingCompressedAir,power:=120;
|
||||
|
||||
quality:buildingCompressedAir,platform=airCompressor;
|
||||
|
||||
#Pressure Tank Solenoid Valve
|
||||
quality:pressureTankSolenoidValve,status=ok;
|
||||
quality:pressureTankSolenoidValve,powerStatus=on;
|
||||
quality:pressureTankSolenoidValve,tankPressure=80;#psi
|
||||
|
||||
topology:pressureTankSolenoidValve->controlRodController,connected_modbus_slave;
|
||||
topology:pressureTankSolenoidValve->pulseControlRod,pneumatic_closed;
|
||||
#buildingCompressedAir conncetion is unidirectional
|
||||
|
||||
#Power Sensors
|
||||
#Power units are in percent max
|
||||
#Linear
|
||||
quality:linearPowerSensor,status=ok;
|
||||
quality:linearPowerSensor,powerStatus=on;
|
||||
quality:linearPowerSensor,powerLevel:=0.1;
|
||||
|
||||
topology:linearPowerSensor->highFluxMonitor,connected_modbus_slave;
|
||||
topology:linearPowerSensor->controlSystemRecorder,connected_modbus_slave;
|
||||
topology:linearPowerSensor->operator,connected_modbus_slave;
|
||||
quality:linearPowerSensor,spoofed=false;
|
||||
|
||||
topology:reactor<->linearPowerSensor,physical;
|
||||
topology:buildingPower->linearPowerSensor,power:=120;
|
||||
|
||||
quality:linearPowerSensor,platform=powerSensor;
|
||||
|
||||
#nlog
|
||||
quality:nlogPowerSensor,status=ok;
|
||||
quality:nlogPowerSensor,powerStatus=on;
|
||||
quality:nlogPowerSensor,powerLevel:=0.1;
|
||||
|
||||
topology:nlogPowerSensor->operator,connected_modbus_slave;
|
||||
quality:nlogPowerSensor,spoofed=false;
|
||||
topology:nlogPowerSensor->controlRodController,connected_modbus_slave;
|
||||
topology:reactor<->nlogPowerSensor,physical;
|
||||
topology:buildingPower->nlogPowerSensor,power:=120;
|
||||
|
||||
quality:nlogPowerSensor,platform=powerSensor;
|
||||
|
||||
#Pulse
|
||||
quality:pulsePowerSensor,status=ok;
|
||||
quality:pulsePowerSensor,powerStatus=on;
|
||||
quality:pulsePowerSensor,powerLevel:=0.1;
|
||||
|
||||
topology:pulsePowerSensor->highFluxMonitor,connected_modbus_slave;
|
||||
topology:pulsePowerSensor->operator,connected_modbus_slave;
|
||||
quality:pulsePowerSensor,spoofed=false;
|
||||
topology:reactor<->pulsePowerSensor,physical;
|
||||
topology:buildingPower->pulsePowerSensor,power:=120;
|
||||
|
||||
quality:pulsePowerSensor,platform=powerSensor;
|
||||
|
||||
#Control System Recorder
|
||||
quality:controlSystemRecorder,status=ok;
|
||||
quality:controlSystemRecorder,powerStatus=on;
|
||||
quality:controlSystemRecorder,dataValid=true;
|
||||
|
||||
topology:controlSystemRecorder->tempSensor1,connected_modbus_master;
|
||||
topology:controlSystemRecorder->tempSensor2,connected_modbus_master;
|
||||
topology:controlSystemRecorder->linearPowerSensor,connected_modbus_master;
|
||||
topology:buildingPower->controlSystemRecorder,power:=120;
|
||||
|
||||
quality:controlSystemRecorder,platform=controlSystemRecorder;
|
||||
|
||||
#Building Evacuation Alarm
|
||||
quality:buildingEvacAlarm,status=ok;
|
||||
quality:buildingEvacAlarm,powerStatus=on;
|
||||
quality:buildingEvacAlarm,activated=false;
|
||||
|
||||
topology:buildingEvacAlarm->areaMonitoringSystem,connected_modbus_master;
|
||||
topology:buildingEvacAlarm->coolingTowerFan,connected_modbus_slave;
|
||||
topology:buildingEvacAlarm->operator,connected_modbus_slave;
|
||||
quality:buildingEvacAlarm,spoofed=false;
|
||||
topology:buildingEvacAlarm->automaticScram,connected_modbus_slave;
|
||||
quality:buildingEvacAlarm,spoofed=false;
|
||||
topology:buildingPower->buildingEvacAlarm,power:=120;
|
||||
|
||||
quality:buildingEvacAlarm,platform=evacuationAlarm;
|
||||
|
||||
#Beam Room Scram Chain
|
||||
quality:beamRoomScramChain,status=ok;
|
||||
quality:beamRoomScramChain,powerStatus=on;
|
||||
quality:beamRoomScramChain,activated=false;
|
||||
quality:beamRoomScramChain,accessGate=closed;
|
||||
quality:beamRoomScramChain,keysInserted=true;
|
||||
|
||||
topology:beamRoomScramChain->automaticScram,connected_modbus_slave;
|
||||
quality:beamRoomScramChain,spoofed=false;
|
||||
topology:buildingPower->beamRoomScramChain,power:=120;
|
||||
|
||||
quality:beamRoomScramChain,platform=scramInput;#Need to check
|
||||
|
||||
#High Flux Monitor
|
||||
quality:highFluxMonitor,status=ok;
|
||||
quality:highFluxMonitor,powerStatus=on;
|
||||
quality:highFluxMonitor,alarmActivated=false;
|
||||
quality:highFluxMonitor,scramActivated=false;
|
||||
|
||||
topology:highFluxMonitor->linearPowerSensor,connected_modbus_master;
|
||||
topology:highFluxMonitor->pulsePowerSensor,connected_modbus_master;
|
||||
topology:highFluxMonitor->automaticScram,connected_modbus_slave;
|
||||
quality:highFluxMonitor,spoofed=false;
|
||||
topology:buildingPower->highFluxMonitor,power:=120;
|
||||
|
||||
quality:highFluxMonitor,platform=fluxMonitor;
|
||||
|
||||
#Period Sensor
|
||||
quality:periodSensor,status=ok;
|
||||
quality:periodSensor,powerStatus=on;
|
||||
quality:periodSensor,output=5;#Period in seconds
|
||||
|
||||
topology:periodSensor->operator,connected_modbus_slave;
|
||||
quality:periodSensor,spoofed=false;
|
||||
topology:buildingPower->periodSensor,power:=120;
|
||||
|
||||
quality:periodSensor,platform=periodSensor;
|
||||
|
||||
#HV Failure Sensors
|
||||
quality:logNHVFailureSensor,status=ok;
|
||||
quality:logNHVFailureSensor,powerStatus=on;
|
||||
quality:logNHVFailureSensor,activated=false;
|
||||
quality:linearHVFailureSensor,status=ok;
|
||||
quality:linearHVFailureSensor,powerStatus=on;
|
||||
quality:linearHVFailureSensor,activated=false;
|
||||
quality:pulseHVFailureSensor,status=ok;
|
||||
quality:pulseHVFailureSensor,powerStatus=on;
|
||||
quality:pulseHVFailureSensor,activated=false;
|
||||
|
||||
topology:logNHVFailureSensor->automaticScram,connected_modbus_slave;
|
||||
quality:logNHVFailureSensor,spoofed=false;
|
||||
topology:linearHVFailureSensor->automaticScram,connected_modbus_slave;
|
||||
quality:linearHVFailureSensor,spoofed=false;
|
||||
topology:pulseHVFailureSensor->automaticScram,connected_modbus_slave;
|
||||
quality:pulseHVFailureSensor,spoofed=false;
|
||||
topology:logNHVFailureSensor->nlogPowerSensor,power_monitor;
|
||||
topology:linearHVFailureSensor->linearPowerSensor,power_monitor;
|
||||
topology:pulseHVFailureSensor->pulsePowerSensor,power_monitor;
|
||||
topology:buildingPower->logNHVFailureSensor,power:=120;
|
||||
topology:buildingPower->linearHVFailureSensor,power:=120;
|
||||
topology:buildingPower->pulseHVFailureSensor,power:=120;
|
||||
|
||||
quality:logNHVFailureSensor,platform=HVSensor;
|
||||
quality:linearHVFailureSensor,platform=HVSensor;
|
||||
quality:pulseHVFailureSensor,platform=HVSensor;
|
||||
|
||||
#Continous Air Monitor
|
||||
quality:continuousAirMonitor,status=ok;
|
||||
quality:continuousAirMonitor,powerStatus=on;
|
||||
quality:continuousAirMonitor,airborneRadiation:=50;#cpm
|
||||
quality:continuousAirMonitor,alarmActivated=false;
|
||||
|
||||
topology:continuousAirMonitor->operator,connected_modbus_slave;
|
||||
quality:continuousAirMonitor,spoofed=false;
|
||||
topology:continuousAirMonitor->ventilationController,connected_modbus_slave;
|
||||
topology:airborneRadiation<->continuousAirMonitor,physical;
|
||||
topology:buildingPower->continuousAirMonitor,power:=120;
|
||||
|
||||
quality:continuousAirMonitor,platform=CAM;
|
||||
|
||||
#Area Monitoring System
|
||||
quality:areaMonitoringSystem,status=ok;
|
||||
quality:areaMonitoringSystem,powerStatus=on;
|
||||
quality:areaMonitoringSystem,cave_N16_level:=0;#mrem/hr
|
||||
quality:areaMonitoringSystem,nBeamRoom_N16_level:=0;
|
||||
quality:areaMonitoringSystem,sBeamRoom_N16_level:=0;
|
||||
quality:areaMonitoringSystem,sample_N16_level:=0;
|
||||
quality:areaMonitoringSystem,bridge_N16_level:=0;
|
||||
quality:areaMonitoringSystem,room101_N16_level:=0;
|
||||
|
||||
topology:areaMonitoringSystem->buildingEvacAlarm,connected_modbus_slave;
|
||||
topology:areaMonitoringSystem->coolingTowerFan,connected_modbus_slave;
|
||||
topology:areaMonitoringSystem->operator,connected_modbus_slave;
|
||||
quality:areaMonitoringSystem,spoofed=false;
|
||||
topology:airborneRadiation<->areaMonitoringSystem,physical;
|
||||
topology:buildingPower->areaMonitoringSystem,power:=120;
|
||||
|
||||
quality:areaMonitoringSystem,platform=N16Detector;
|
||||
|
||||
#Diffuser
|
||||
quality:diffuser,status=ok;
|
||||
quality:diffuser,powerStatus=on;
|
||||
quality:diffuser,pressure=30;#psi
|
||||
|
||||
topology:diffuser->operator,connected_modbus_slave;
|
||||
quality:diffuser,spoofed=false;
|
||||
topology:buildingPower->diffuser,power:=120;
|
||||
|
||||
quality:diffuser,platform=diffuser;
|
||||
|
||||
#Coolant Level Sensor
|
||||
quality:coolantLevelSensor,status=ok;
|
||||
quality:coolantLevelSensor,powerStatus=on;
|
||||
quality:coolantLevelSensor,level:=0.0;#defining 0 as neutral
|
||||
|
||||
topology:coolantLevelSensor->operator,connected_modbus_slave;
|
||||
quality:coolantLevelSensor,spoofed=false;
|
||||
topology:coolant<->coolantLevelSensor,physical;
|
||||
topology:buildingPower->coolantLevelSensor,power:=120;
|
||||
|
||||
quality:coolantLevelSensor,platform=coolantLevelSensor;
|
||||
|
||||
#Backup power and connections
|
||||
quality:backupPower,status=ok;
|
||||
quality:backupPower,powerStatus=on;
|
||||
quality:backupPower,chargeLevel:=1;#percent, 1 down to 0
|
||||
|
||||
#Only provides power when main power is off
|
||||
topology:backupPower->buildingEvacAlarm,power:=0.0;
|
||||
topology:backupPower->continuousAirMonitor,power:=0.0;
|
||||
topology:backupPower->areaMonitoringSystem,power:=0.0;
|
||||
topology:backupPower->coolantLevelSensor,power:=0.0;
|
||||
topology:backupPower->seismicSensor1,power:=0.0;
|
||||
topology:backupPower->nlogPowerSensor,power:=0.0;
|
||||
topology:backupPower->linearPowerSensor,power:=0.0;
|
||||
topology:backupPower->pulsePowerSensor,power:=0.0;
|
||||
topology:buildingPower->backupPower,power:=120;#needs to charge
|
||||
|
||||
quality:backupPower,platform=backupPower;
|
||||
|
||||
#Bridge
|
||||
quality:bridge,status=ok;
|
||||
quality:bridge,powerStatus=on;
|
||||
quality:bridge,actualPosition:=7.0;
|
||||
quality:bridge,reportedPosition:=7.0;
|
||||
|
||||
topology:bridge->operator,connected_modbus_slave;
|
||||
quality:bridge,spoofed=false;
|
||||
topology:buildingPower->backupPower,power:=120;#needs power to move
|
||||
|
||||
quality:bridge,platform=bridge;
|
||||
|
||||
|
||||
#Water Puritfication Systems
|
||||
|
||||
#Water Makeup Pump
|
||||
quality:waterMakeupPump,status=ok;
|
||||
quality:waterMakeupPump,powerStatus=on;
|
||||
quality:waterMakeupPump,pumpStatus=off;
|
||||
|
||||
topology:coolant<->waterMakeupPump,physical;
|
||||
topology:buildingPower->waterMakeupPump,power:=120;
|
||||
#poolTotalizer connection is unidirectional
|
||||
|
||||
quality:waterMakeupPump,platform=pump;
|
||||
|
||||
#Purification Recirculation Pump
|
||||
quality:purificationRecirculationPump,status=ok;
|
||||
quality:purificationRecirculationPump,powerStatus=on;
|
||||
quality:purificationRecirculationPump,pumpStatus=on;
|
||||
|
||||
topology:coolant<->purificationRecirculationPump,physical;
|
||||
topology:buildingPower->purificationRecirculationPump,power:=120;
|
||||
|
||||
quality:purificationRecirculationPump,platform=pump;
|
||||
|
||||
#Flowmeter
|
||||
quality:flowmeter,status=ok;
|
||||
quality:flowmeter,powerStatus=on;
|
||||
quality:flowmeter,flowRate:=10;#gpm
|
||||
|
||||
topology:coolant<->flowmeter,physical;
|
||||
topology:buildingPower->flowmeter,power:=120;
|
||||
|
||||
quality:flowmeter,platform=flowmeter;
|
||||
|
||||
#Conductivity Cells 1 and 2
|
||||
quality:conductivityCell1,status=ok;
|
||||
quality:conductivityCell1,powerStatus=on;
|
||||
quality:conductivityCell1,conductivity:=0.4;#in micromhos/cm
|
||||
quality:conductivityCell2,status=ok;
|
||||
quality:conductivityCell2,powerStatus=on;
|
||||
quality:conductivityCell2,resistance:=0.1;#in MOhms
|
||||
|
||||
topology:conductivityCell1->operator,connected_modbus_slave;
|
||||
quality:conductivityCell1,spoofed=false;
|
||||
topology:conductivityCell2->operator,connected_modbus_slave;
|
||||
quality:conductivityCell2,spoofed=false;
|
||||
topology:coolant<->conductivityCell1,physical;
|
||||
topology:coolant<->conductivityCell2,physical;
|
||||
topology:buildingPower->conductivityCell1,power:=120;
|
||||
topology:buildingPower->conductivityCell2,power:=120;
|
||||
|
||||
quality:conductivityCell1,platform=conductivitySensor;
|
||||
quality:conductivityCell2,platform=conductivitySensor;
|
||||
|
||||
#Ion Exchanger (no power)
|
||||
quality:ionExchanger,status=ok;
|
||||
|
||||
topology:coolant<->ionExchanger,physical;
|
||||
|
||||
quality:ionExchanger,platform=ionExchanger;
|
||||
|
||||
#Pool Totalizer (no power)
|
||||
quality:poolTotalizer,status=ok;
|
||||
|
||||
topology:poolTotalizer<->waterMakeupPump,physical_switch;
|
||||
topology:coolant<->poolTotalizer,physical;
|
||||
|
||||
quality:poolTotalizer,platform=totalizer;
|
||||
|
||||
|
||||
|
||||
#Heat Exchange System
|
||||
|
||||
#Coolant Temperature Sensor
|
||||
quality:coolantTempSensor,status=ok;
|
||||
quality:coolantTempSensor,powerStatus=on;
|
||||
quality:coolantTempSensor,temp:=35;
|
||||
|
||||
topology:coolantTempSensor->operator,connected_modbus_slave;
|
||||
quality:coolantTempSensor,spoofed=false;
|
||||
topology:coolant<->coolantTempSensor,physical;
|
||||
topology:buildingPower->coolantTempSensor,power:=120;
|
||||
|
||||
quality:coolantTempSensor,platform=coolantTempSensor;
|
||||
|
||||
#Heat Exchange Pumps
|
||||
quality:heatExchangePump1,status=ok;
|
||||
quality:heatExchangePump1,powerStatus=on;
|
||||
quality:heatExchangePump1,pressureIn:=1.2;#psi
|
||||
quality:heatExchangePump1,pressureOut:=1;
|
||||
|
||||
quality:heatExchangePump2,status=ok;
|
||||
quality:heatExchangePump2,powerStatus=on;
|
||||
quality:heatExchangePump2,pressureIn:=21.1;#psi
|
||||
quality:heatExchangePump2,pressureOut:=3.7;
|
||||
|
||||
topology:heatExchangePump1->operator,connected_modbus_slave;
|
||||
quality:heatExchangePump1,spoofed=false;
|
||||
topology:heatExchangePump2->operator,connected_modbus_slave;
|
||||
quality:heatExchangePump2,spoofed=false;
|
||||
topology:coolant<->heatExchangePump1,physical;
|
||||
topology:coolant<->heatExchangePump2,physical;
|
||||
topology:buildingPower->heatExchangePump1,power:=120;
|
||||
topology:buildingPower->heatExchangePump2,power:=120;
|
||||
|
||||
quality:heatExchangePump1,platform=pump;
|
||||
quality:heatExchangePump2,platform=pump;
|
||||
|
||||
#Conductivity Cell 3
|
||||
quality:conductivityCell3,status=ok;
|
||||
quality:conductivityCell3,powerStatus=on;
|
||||
quality:conductivityCell3,conductivity:=.75;#in micromhos/cm
|
||||
|
||||
topology:conductivityCell3->operator,connected_modbus_slave;
|
||||
quality:conductivityCell3,spoofed=false;
|
||||
topology:coolant<->conductivityCell3,physical;
|
||||
topology:buildingPower->conductivityCell3,power:=120;
|
||||
|
||||
quality:conductivityCell3,platform=conductivitySensor;
|
||||
|
||||
#Tower Totalizer (no power)
|
||||
quality:towerTotalizer,status=ok;
|
||||
|
||||
topology:coolant<->towerTotalizer,physical;
|
||||
|
||||
quality:towerTotalizer,platform=totalizer;
|
||||
|
||||
#Cooling Tower Fan
|
||||
quality:coolingTowerFan,status=ok;
|
||||
quality:coolingTowerFan,powerStatus=on;
|
||||
quality:coolingTowerFan,fan=on;
|
||||
quality:coolingTowerFan,secondaryCoolantTemp:=25;
|
||||
|
||||
topology:coolingTowerFan->buildingEvacAlarm,connected_modbus_master;
|
||||
topology:coolingTowerFan->areaMonitoringSystem,connected_modbus_master;
|
||||
topology:buildingPower->coolingTowerFan,power:=120;
|
||||
|
||||
quality:coolingTowerFan,platform=fan;
|
||||
|
||||
#Ventilation System
|
||||
|
||||
#Ventilaton Controller
|
||||
quality:ventilationController,status=ok;
|
||||
quality:ventilationController,powerStatus=on;
|
||||
quality:ventilationController,mode=normal;
|
||||
|
||||
topology:ventilationController->ventilationIntakeFan,connected_modbus_master;
|
||||
topology:ventilationController->ventilationOuttakeFan,connected_modbus_master;
|
||||
topology:ventilationController->ventilationDiluteFan,connected_modbus_master;
|
||||
topology:ventilationController->continuousAirMonitor,connected_modbus_master;
|
||||
topology:ventilationController->ventilationDampers,connected_modbus_master;
|
||||
topology:ventilationController->operator,connected_modbus_slave;
|
||||
quality:ventilationController,spoofed=false;
|
||||
topology:buildingPower->ventilationController,power:=120;
|
||||
|
||||
quality:ventilationController,platform=ventilationController;
|
||||
|
||||
#Intake Fan
|
||||
quality:ventilationIntakeFan,status=ok;
|
||||
quality:ventilationIntakeFan,powerStatus=on;
|
||||
quality:ventilationIntakeFan,fan=on;
|
||||
|
||||
topology:ventilationIntakeFan->ventilationController,connected_modbus_slave;
|
||||
topology:buildingPower->ventilationIntakeFan,power:=120;
|
||||
|
||||
quality:ventilationIntakeFan,platform=fan;
|
||||
|
||||
#Outtake Fan
|
||||
quality:ventilationOuttakeFan,status=ok;
|
||||
quality:ventilationOuttakeFan,powerStatus=on;
|
||||
quality:ventilationOuttakeFan,fan=on;
|
||||
|
||||
topology:ventilationOuttakeFan->ventilationController,connected_modbus_slave;
|
||||
topology:buildingPower->ventilationOuttakeFan,power:=120;
|
||||
|
||||
quality:ventilationOuttakeFan,platform=fan;
|
||||
|
||||
#Ventilation Air Detector
|
||||
quality:ventilationAirDetector,status=ok;
|
||||
quality:ventilationAirDetector,powerStatus=on;
|
||||
quality:ventilationAirDetector,Ar41_level:=9.9;#cpm
|
||||
quality:ventilationAirDetector,alarmActivated=false;
|
||||
|
||||
topology:ventilationAirDetector->operator,connected_modbus_slave;
|
||||
quality:ventilationAirDetector,spoofed=false;
|
||||
topology:buildingPower->ventilationAirDetector,power:=120;
|
||||
topology:airborneRadiation<->ventilationAirDetector,physical;
|
||||
|
||||
quality:ventilationAirDetector,platform=Ar41Detector;
|
||||
|
||||
#Ventilation Dampers
|
||||
quality:ventilationDampers,status=ok;
|
||||
quality:ventilationDampers,powerStatus=on;
|
||||
quality:ventilationDampers,dampers=open;
|
||||
|
||||
topology:ventilationDampers->ventilationController,connected_modbus_slave;
|
||||
topology:buildingPower->ventilationDampers,power:=120;
|
||||
|
||||
quality:ventilationDampers,platform=dampers;
|
||||
|
||||
|
||||
#Ventilation Dilute Fan
|
||||
quality:ventilationDiluteFan,status=ok;
|
||||
quality:ventilationDiluteFan,powerStatus=on;
|
||||
quality:ventilationDiluteFan,fan=off;
|
||||
|
||||
topology:ventilationDiluteFan->ventilationController,connected_modbus_slave;
|
||||
topology:buildingPower->ventilationDiluteFan,power:=120;
|
||||
|
||||
quality:ventilationDiluteFan,platform=fan;
|
||||
|
||||
|
||||
#Physical qualites
|
||||
#This is probably bad practice, reusing these names
|
||||
quality:reactor,fuelTemp:=50;
|
||||
quality:reactor,reactorPower:=0.1;
|
||||
quality:coolant,coolantLevel:=0.0;
|
||||
quality:coolant,coolantTemp:=35;
|
||||
quality:airborneRadiation,cave_N16_level:=0;#mrem/hr appears to be the appropriate measurement.
|
||||
quality:airborneRadiation,nBeamRoom_N16_level:=0;
|
||||
quality:airborneRadiation,sBeamRoom_N16_level:=0;
|
||||
quality:airborneRadiation,sample_N16_level:=0;
|
||||
quality:airborneRadiation,bridge_N16_level:=0;
|
||||
quality:airborneRadiation,room101_N16_level:=0;
|
||||
quality:airborneRadiation,Ar41_level:=0;
|
||||
quality:airborneRadiation,airborneRadiationLevel:=50;#cpm
|
||||
quality:buildingPower,buildingPower=on;
|
||||
quality:seismicActivity,seismicActivity:=0.003;
|
||||
|
||||
#Physical items are of the "physical" platform for now.
|
||||
quality:reactor,platform=physical;
|
||||
quality:coolant,platform=physical;
|
||||
quality:airborneRadiation,platform=physical;
|
||||
quality:buildingPower,platform=physical;
|
||||
quality:seismicActivity,platform=physical;
|
||||
tags:
|
||||
.
|
||||
31
examples/cda4.1-SUPERSIMPLIFIED.xp
Executable file
31
examples/cda4.1-SUPERSIMPLIFIED.xp
Executable file
@ -0,0 +1,31 @@
|
||||
exploit create_cda(a)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
quality:a,digital=true;
|
||||
postconditions:
|
||||
insert quality:a,cda=true;
|
||||
.
|
||||
|
||||
exploit expand_critical_1_1(a, b)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
topology:a->b,physical;
|
||||
postconditions:
|
||||
insert quality:b,critical=true;
|
||||
.
|
||||
|
||||
exploit expand_critical_2_1(a, b)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
topology:b->a,physical;
|
||||
postconditions:
|
||||
insert quality:b,critical=true;
|
||||
.
|
||||
|
||||
#exploit expand_critical_1_2(a, b)=
|
||||
# preconditions:
|
||||
# quality:a,critical=true;
|
||||
# topology:a<->b,physical;
|
||||
# postconditions:
|
||||
# insert quality:b,critical=true;
|
||||
#.
|
||||
55
examples/cda4.1-Simplified.xp
Executable file
55
examples/cda4.1-Simplified.xp
Executable file
@ -0,0 +1,55 @@
|
||||
exploit create_cda(a)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
quality:a,digital=true;
|
||||
postconditions:
|
||||
insert quality:a,cda=true;
|
||||
.
|
||||
|
||||
exploit expand_critical_1_1(a, b)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
topology:a->b,physical;
|
||||
postconditions:
|
||||
insert quality:b,critical=true;
|
||||
.
|
||||
|
||||
exploit expand_critical_1_2(a, b)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
topology:a<->b,physical;
|
||||
postconditions:
|
||||
insert quality:b,critical=true;
|
||||
.
|
||||
|
||||
exploit expand_critical_2_1(a, b)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
topology:a->b,connected_modbus_slave;
|
||||
postconditions:
|
||||
insert quality:b,critical=true;
|
||||
.
|
||||
|
||||
exploit expand_critical_2_2(a, b)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
topology:a<->b,connected_modbus_slave;
|
||||
postconditions:
|
||||
insert quality:b,critical=true;
|
||||
.
|
||||
|
||||
exploit expand_critical_3_1(a, b)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
topology:a->b,connected_modbus_master;
|
||||
postconditions:
|
||||
insert quality:b,critical=true;
|
||||
.
|
||||
|
||||
exploit expand_critical_3_2(a, b)=
|
||||
preconditions:
|
||||
quality:a,critical=true;
|
||||
topology:a<->b,connected_modbus_master;
|
||||
postconditions:
|
||||
insert quality:b,critical=true;
|
||||
.
|
||||
17
examples/full-example.nm
Executable file
17
examples/full-example.nm
Executable file
@ -0,0 +1,17 @@
|
||||
network test =
|
||||
assets:
|
||||
workstation;
|
||||
printer;
|
||||
router;
|
||||
internet;
|
||||
|
||||
facts:
|
||||
quality:workstation,os=win7;
|
||||
quality:workstation,adobe_ver=8.6;
|
||||
topology:workstation<->router,connected;
|
||||
|
||||
quality:printer,make=hp;
|
||||
quality:printer,password=none;
|
||||
quality:printer,firmware=3.5;
|
||||
topology:printer<->router,connected;
|
||||
.
|
||||
16
examples/full-example.xp
Executable file
16
examples/full-example.xp
Executable file
@ -0,0 +1,16 @@
|
||||
exploit firmware_rollback(printer) =
|
||||
preconditions:
|
||||
quality:printer,make=hp;
|
||||
quality:printer,password=none;
|
||||
quality:printer,firmware=3.5;
|
||||
postconditions:
|
||||
insert quality:printer,root=true;
|
||||
.
|
||||
|
||||
exploit adobe_vuln(computer) =
|
||||
preconditions:
|
||||
quality:computer,os=win7;
|
||||
quality:computer,adobe_ver=8.6;
|
||||
postconditions:
|
||||
insert quality:computer,admin=true;
|
||||
.
|
||||
43
examples/larger_full_example.nm
Normal file
43
examples/larger_full_example.nm
Normal file
@ -0,0 +1,43 @@
|
||||
network test =
|
||||
assets:
|
||||
internet1;
|
||||
router1;
|
||||
router2;
|
||||
router3;
|
||||
workstation1;
|
||||
workstation2;
|
||||
workstation3;
|
||||
workstation4;
|
||||
workstation5;
|
||||
printer1;
|
||||
printer2;
|
||||
printer3;
|
||||
facts:
|
||||
quality:workstation1,os=win7;
|
||||
quality:workstation1,adobe_ver=8.8;
|
||||
topology:workstation1<->router3,connected;
|
||||
quality:workstation2,os=win7;
|
||||
quality:workstation2,adobe_ver=8.6;
|
||||
topology:workstation2<->router1,connected;
|
||||
quality:workstation3,os=win7;
|
||||
quality:workstation3,adobe_ver=8.6;
|
||||
topology:workstation3<->router2,connected;
|
||||
quality:workstation4,os=win7;
|
||||
quality:workstation4,adobe_ver=8.6;
|
||||
topology:workstation4<->router2,connected;
|
||||
quality:workstation5,os=win10;
|
||||
quality:workstation5,adobe_ver=8.6;
|
||||
topology:workstation5<->router2,connected;
|
||||
quality:printer1,make=hp;
|
||||
quality:printer1,password=none;
|
||||
quality:printer1,firmware=3.5;
|
||||
topology:printer1<->router1,connected;
|
||||
quality:printer2,make=hp;
|
||||
quality:printer2,password=none;
|
||||
quality:printer2,firmware=3.5;
|
||||
topology:printer2<->router1,connected;
|
||||
quality:printer3,make=hp;
|
||||
quality:printer3,password=none;
|
||||
quality:printer3,firmware=3.8;
|
||||
topology:printer3<->router2,connected;
|
||||
.
|
||||
26
examples/new_thesis_example.nm
Executable file
26
examples/new_thesis_example.nm
Executable file
@ -0,0 +1,26 @@
|
||||
network model =
|
||||
assets:
|
||||
router;
|
||||
website;
|
||||
database;
|
||||
nas;
|
||||
workstation;
|
||||
|
||||
facts:
|
||||
topology:router<->website,dmz;
|
||||
topology:router<->workstation,private_nat;
|
||||
|
||||
quality:website,service_type=web_server;
|
||||
quality:website,sql_injection=true;
|
||||
topology:website<->database,private_segment;
|
||||
topology:website<->nas,private_segment;
|
||||
|
||||
quality:workstation,user_phished=true;
|
||||
quality:workstation,malware_downloaded=false;
|
||||
quality:workstation,user_admin_privs=true;
|
||||
topology:workstation<->nas,private_segment;
|
||||
|
||||
quality:nas,service_type=storage;
|
||||
|
||||
quality:database,service_type=database;
|
||||
.
|
||||
34
examples/new_thesis_example.xp
Executable file
34
examples/new_thesis_example.xp
Executable file
@ -0,0 +1,34 @@
|
||||
exploit website_sql_injection(website, database)=
|
||||
preconditions:
|
||||
quality:website,sql_injection=true;
|
||||
quality:database,service_type=database;
|
||||
topology:website<->database,private_segment;
|
||||
postconditions:
|
||||
insert quality:database,data_extraction=true;
|
||||
insert quality:database,data_removal=true;
|
||||
.
|
||||
|
||||
exploit malware_download(machine)=
|
||||
preconditions:
|
||||
quality:machine,malware_downloaded=false;
|
||||
quality:machine,user_phished=true;
|
||||
postconditions:
|
||||
update quality:machine,malware_downloaded=true;
|
||||
.
|
||||
|
||||
exploit malware_execute(machine)=
|
||||
preconditions:
|
||||
quality:machine,malware_downloaded=true;
|
||||
quality:machine,user_admin_privs=true;
|
||||
postconditions:
|
||||
insert quality:machine,intruder_admin=true;
|
||||
.
|
||||
|
||||
exploit pivot_storage(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,intruder_admin=true;
|
||||
quality:machine2,service_type=storage;
|
||||
topology:machine1->machine2,private_segment;
|
||||
postconditions:
|
||||
insert quality:machine2,intruder_access=true;
|
||||
.
|
||||
66
examples/thesis_example.nm
Executable file
66
examples/thesis_example.nm
Executable file
@ -0,0 +1,66 @@
|
||||
network model =
|
||||
assets:
|
||||
# Router
|
||||
border_router;
|
||||
|
||||
# DMZ
|
||||
website;
|
||||
public_api;
|
||||
|
||||
# Internal
|
||||
storage_server;
|
||||
active_directory;
|
||||
icehrm;
|
||||
splunk;
|
||||
|
||||
# Workstations
|
||||
workstation1;
|
||||
workstation2;
|
||||
|
||||
# Wifi
|
||||
ap;
|
||||
personal_laptop;
|
||||
personal_phone;
|
||||
|
||||
facts:
|
||||
quality:border_router,vendor=paloalto;
|
||||
quality:border_router,os=panos;
|
||||
quality:border_router,version:=8;
|
||||
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,version:=12.04;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version:=2.2;
|
||||
topology:border_router<->website,dmz;
|
||||
|
||||
quality:public_api,os=ubuntu;
|
||||
quality:public_api,version:=12.04;
|
||||
quality:public_api,backend=flask;
|
||||
quality:public_api,backend_version:=6;
|
||||
topology:border_router<->public_api,dmz;
|
||||
|
||||
quality:storage_server,os=freebsd;
|
||||
quality:storage_server,version:=10;
|
||||
quality:storage_server,smb=enabled;
|
||||
quality:storage_server,nfs=enabled;
|
||||
topology:border_router<->storage_server,private_firewall;
|
||||
|
||||
quality:active_directory,os=win2008r2;
|
||||
quality:active_directory,domain_controller=true;
|
||||
topology:border_router<->active_directory,private_firewall;
|
||||
|
||||
topology:border_router<->icehrm,private_firewall;
|
||||
|
||||
topology:border_router<->splunk,private_firewall;
|
||||
|
||||
topology:border_router<->workstation1,private_nat;
|
||||
|
||||
topology:border_router<->workstation2,private_nat;
|
||||
|
||||
topology:border_router<->ap,private_nat;
|
||||
|
||||
topology:ap<->personal_laptop,wifi_private;
|
||||
|
||||
topology:ap<->personal_phone,wifi_private;
|
||||
tags:
|
||||
.
|
||||
56
examples/thesis_example.xp
Executable file
56
examples/thesis_example.xp
Executable file
@ -0,0 +1,56 @@
|
||||
exploit ubuntu_apache_exploit(website)=
|
||||
preconditions:
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version==2.2;
|
||||
postconditions:
|
||||
insert quality:website,command_injection=true;
|
||||
.
|
||||
|
||||
exploit ubuntu_linux_priv_esc(machine)=
|
||||
preconditions:
|
||||
quality:machine,os=ubuntu;
|
||||
quality:machine,version==12.04;
|
||||
postconditions:
|
||||
insert quality:machine,priv_esc=true;
|
||||
.
|
||||
|
||||
exploit inject_command(machine)=
|
||||
preconditions:
|
||||
quality:machine,command_injection=true;
|
||||
quality:machine,priv_esc=true;
|
||||
postconditions:
|
||||
insert quality:machine,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_nat(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,private_nat;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_dmz(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,dmz;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_firewall(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,private_firewall;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_wifi(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,wifi_private;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
73
examples/thesis_example2.nm
Executable file
73
examples/thesis_example2.nm
Executable file
@ -0,0 +1,73 @@
|
||||
network model =
|
||||
assets:
|
||||
# Router
|
||||
border_router;
|
||||
|
||||
# DMZ
|
||||
website;
|
||||
public_api;
|
||||
|
||||
# Internal
|
||||
storage_server;
|
||||
active_directory;
|
||||
icehrm;
|
||||
splunk;
|
||||
|
||||
# Workstations
|
||||
workstation1;
|
||||
workstation2;
|
||||
|
||||
# Wifi
|
||||
ap;
|
||||
personal_laptop;
|
||||
personal_phone;
|
||||
|
||||
facts:
|
||||
quality:border_router,vendor=paloalto;
|
||||
quality:border_router,os=panos;
|
||||
quality:border_router,version:=8;
|
||||
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,version:=12.04;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version:=2.2;
|
||||
topology:border_router<->website,dmz;
|
||||
|
||||
quality:public_api,os=ubuntu;
|
||||
quality:public_api,version:=12.04;
|
||||
quality:public_api,backend=flask;
|
||||
quality:public_api,backend_version:=6;
|
||||
topology:border_router<->public_api,dmz;
|
||||
|
||||
quality:storage_server,os=freebsd;
|
||||
quality:storage_server,version:=10;
|
||||
quality:storage_server,smb=enabled;
|
||||
quality:storage_server,nfs=enabled;
|
||||
topology:border_router<->storage_server,private_firewall;
|
||||
|
||||
quality:active_directory,os=win2008r2;
|
||||
quality:active_directory,domain_controller=true;
|
||||
topology:border_router<->active_directory,private_firewall;
|
||||
|
||||
quality:icehrm,webserver=apache;
|
||||
quality:icehrm,webserver_version:=2.2;
|
||||
quality:icehrm,icehrm_version:=7.0;
|
||||
topology:border_router<->icehrm,private_firewall;
|
||||
|
||||
quality:splunk,webserver=apache;
|
||||
quality:splunk,webserver_version:=2.2;
|
||||
quality:splunk,splunk_saml_enabled=true;
|
||||
quality:splunk,splunk_version:=6.5;
|
||||
topology:border_router<->splunk,private_firewall;
|
||||
|
||||
topology:border_router<->workstation1,private_nat;
|
||||
|
||||
topology:border_router<->workstation2,private_nat;
|
||||
|
||||
topology:border_router<->ap,private_nat;
|
||||
|
||||
topology:ap<->personal_laptop,wifi_private;
|
||||
|
||||
topology:ap<->personal_phone,wifi_private;
|
||||
tags:
|
||||
.
|
||||
73
examples/thesis_example2.xp
Executable file
73
examples/thesis_example2.xp
Executable file
@ -0,0 +1,73 @@
|
||||
exploit ubuntu_apache_exploit(website)=
|
||||
preconditions:
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version==2.2;
|
||||
postconditions:
|
||||
insert quality:website,command_injection=true;
|
||||
.
|
||||
|
||||
exploit ubuntu_linux_priv_esc(machine)=
|
||||
preconditions:
|
||||
quality:machine,os=ubuntu;
|
||||
quality:machine,version==12.04;
|
||||
postconditions:
|
||||
insert quality:machine,priv_esc=true;
|
||||
.
|
||||
|
||||
# https://www.exploit-db.com/exploits/35490/
|
||||
exploit icehrm_code_exec(machine)=
|
||||
preconditions:
|
||||
quality:machine,icehrm_version==7.0;
|
||||
postconditions:
|
||||
insert quality:machine,command_injection=true;
|
||||
.
|
||||
|
||||
# https://www.cvedetails.com/cve/CVE-2017-17067/
|
||||
exploit splunk_saml_bypass(machine)=
|
||||
preconditions:
|
||||
quality:machine,splunk_version==6.5;
|
||||
quality:machine,splunk_saml_enabled=true;
|
||||
postconditions:
|
||||
insert quality:machine,priv_esc=true;
|
||||
.
|
||||
|
||||
exploit inject_command(machine)=
|
||||
preconditions:
|
||||
quality:machine,command_injection=true;
|
||||
quality:machine,priv_esc=true;
|
||||
postconditions:
|
||||
insert quality:machine,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_nat(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,private_nat;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_dmz(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,dmz;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_firewall(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,private_firewall;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_wifi(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,wifi_private;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
77
examples/thesis_example3.nm
Executable file
77
examples/thesis_example3.nm
Executable file
@ -0,0 +1,77 @@
|
||||
network model =
|
||||
assets:
|
||||
# Router
|
||||
border_router;
|
||||
|
||||
# DMZ
|
||||
website;
|
||||
public_api;
|
||||
|
||||
# Internal
|
||||
storage_server;
|
||||
active_directory;
|
||||
icehrm;
|
||||
splunk;
|
||||
|
||||
# Workstations
|
||||
workstation1;
|
||||
workstation2;
|
||||
|
||||
# Wifi
|
||||
ap;
|
||||
personal_laptop;
|
||||
personal_phone;
|
||||
|
||||
facts:
|
||||
quality:border_router,vendor=paloalto;
|
||||
quality:border_router,os=panos;
|
||||
quality:border_router,version:=8;
|
||||
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,version:=12.04;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version:=2.2;
|
||||
topology:border_router<->website,dmz;
|
||||
|
||||
quality:public_api,os=ubuntu;
|
||||
quality:public_api,version:=12.04;
|
||||
quality:public_api,backend=flask;
|
||||
quality:public_api,backend_version:=6;
|
||||
topology:border_router<->public_api,dmz;
|
||||
|
||||
quality:storage_server,os=freebsd;
|
||||
quality:storage_server,version:=10;
|
||||
quality:storage_server,smb=enabled;
|
||||
quality:storage_server,nfs=enabled;
|
||||
topology:border_router<->storage_server,private_firewall;
|
||||
|
||||
quality:active_directory,os=win2008r2;
|
||||
quality:active_directory,domain_controller=true;
|
||||
topology:border_router<->active_directory,private_firewall;
|
||||
|
||||
quality:icehrm,webserver=apache;
|
||||
quality:icehrm,webserver_version:=2.2;
|
||||
quality:icehrm,icehrm_version:=7.0;
|
||||
topology:border_router<->icehrm,private_firewall;
|
||||
|
||||
quality:splunk,webserver=apache;
|
||||
quality:splunk,webserver_version:=2.2;
|
||||
quality:splunk,splunk_saml_enabled=true;
|
||||
quality:splunk,splunk_version:=6.5;
|
||||
topology:border_router<->splunk,private_firewall;
|
||||
|
||||
quality:workstation1,type=workstation;
|
||||
quality:workstation1,user_admin=true;
|
||||
topology:border_router<->workstation1,private_nat;
|
||||
|
||||
quality:workstation2,type=workstation;
|
||||
quality:workstation2,user_admin=true;
|
||||
topology:border_router<->workstation2,private_nat;
|
||||
|
||||
topology:border_router<->ap,private_nat;
|
||||
|
||||
topology:ap<->personal_laptop,wifi_private;
|
||||
|
||||
topology:ap<->personal_phone,wifi_private;
|
||||
tags:
|
||||
.
|
||||
88
examples/thesis_example3.xp
Executable file
88
examples/thesis_example3.xp
Executable file
@ -0,0 +1,88 @@
|
||||
exploit ubuntu_apache_exploit(website)=
|
||||
preconditions:
|
||||
quality:website,os=ubuntu;
|
||||
quality:website,webserver=apache;
|
||||
quality:website,webserver_version==2.2;
|
||||
postconditions:
|
||||
insert quality:website,command_injection=true;
|
||||
.
|
||||
|
||||
exploit ubuntu_linux_priv_esc(machine)=
|
||||
preconditions:
|
||||
quality:machine,os=ubuntu;
|
||||
quality:machine,version==12.04;
|
||||
postconditions:
|
||||
insert quality:machine,priv_esc=true;
|
||||
.
|
||||
|
||||
# https://www.exploit-db.com/exploits/35490/
|
||||
exploit icehrm_code_exec(machine)=
|
||||
preconditions:
|
||||
quality:machine,icehrm_version==7.0;
|
||||
postconditions:
|
||||
insert quality:machine,command_injection=true;
|
||||
.
|
||||
|
||||
# https://www.cvedetails.com/cve/CVE-2017-17067/
|
||||
exploit splunk_saml_bypass(machine)=
|
||||
preconditions:
|
||||
quality:machine,splunk_version==6.5;
|
||||
quality:machine,splunk_saml_enabled=true;
|
||||
postconditions:
|
||||
insert quality:machine,priv_esc=true;
|
||||
.
|
||||
|
||||
exploit inject_command(machine)=
|
||||
preconditions:
|
||||
quality:machine,command_injection=true;
|
||||
quality:machine,priv_esc=true;
|
||||
postconditions:
|
||||
insert quality:machine,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_nat(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,private_nat;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_dmz(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,dmz;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_firewall(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,private_firewall;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit pivot_private_wifi(machine1, machine2)=
|
||||
preconditions:
|
||||
quality:machine1,root=true;
|
||||
topology:machine1->machine2,wifi_private;
|
||||
postconditions:
|
||||
insert quality:machine2,root=true;
|
||||
.
|
||||
|
||||
exploit social_engineer_workstation(workstation)=
|
||||
preconditions:
|
||||
quality:workstation,type=workstation;
|
||||
postconditions:
|
||||
insert quality:workstation,malware_download=true;
|
||||
.
|
||||
|
||||
exploit malware_execute(workstation)=
|
||||
preconditions:
|
||||
quality:workstation,malware_download=true;
|
||||
quality:workstation,user_admin=true;
|
||||
postconditions:
|
||||
insert quality:workstation,root=true;
|
||||
.
|
||||
32
fpga_examples/Network_1/car_network1.nm
Normal file
32
fpga_examples/Network_1/car_network1.nm
Normal file
@ -0,0 +1,32 @@
|
||||
network model =
|
||||
assets:
|
||||
# Cars
|
||||
car1;
|
||||
#car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=6;
|
||||
quality:car1,exhaust_months=12;
|
||||
quality:car1,ac_odometer=120000;
|
||||
#quality:car1,vacuum_odometer=120000;
|
||||
quality:car1,engine=gas;
|
||||
quality:car1,brake_vio=false;
|
||||
quality:car1,exhaust_vio=false;
|
||||
quality:car1,ac_vio=false;
|
||||
#quality:car1,vacuum_vio=false;
|
||||
quality:car1,compliance_vio=false;
|
||||
|
||||
#quality:car2,brake_months=6;
|
||||
#quality:car2,exhaust_months=12;
|
||||
#quality:car2,ac_odometer=120000;
|
||||
#quality:car2,vacuum_odometer=120000;
|
||||
#quality:car2,engine=diesel;
|
||||
#quality:car2,brake_vio=false;
|
||||
#quality:car2,exhaust_vio=false;
|
||||
#quality:car2,ac_vio=false;
|
||||
#quality:car2,vacuum_vio=false;
|
||||
#quality:car2,compliance_vio=false;
|
||||
|
||||
topology:car1<->car1,road;
|
||||
tags:
|
||||
.
|
||||
30
fpga_examples/Network_1/car_network1.xp
Normal file
30
fpga_examples/Network_1/car_network1.xp
Normal file
@ -0,0 +1,30 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
|
||||
|
||||
32
fpga_examples/Network_2/car_network2.nm
Normal file
32
fpga_examples/Network_2/car_network2.nm
Normal file
@ -0,0 +1,32 @@
|
||||
network model =
|
||||
assets:
|
||||
# Cars
|
||||
car1;
|
||||
#car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=6;
|
||||
quality:car1,exhaust_months=12;
|
||||
quality:car1,ac_odometer=120000;
|
||||
quality:car1,vacuum_odometer=120000;
|
||||
quality:car1,engine=gas;
|
||||
quality:car1,brake_vio=false;
|
||||
quality:car1,exhaust_vio=false;
|
||||
quality:car1,ac_vio=false;
|
||||
quality:car1,vacuum_vio=false;
|
||||
quality:car1,compliance_vio=false;
|
||||
|
||||
#quality:car2,brake_months=6;
|
||||
#quality:car2,exhaust_months=12;
|
||||
#quality:car2,ac_odometer=120000;
|
||||
#quality:car2,vacuum_odometer=120000;
|
||||
#quality:car2,engine=diesel;
|
||||
#quality:car2,brake_vio=false;
|
||||
#quality:car2,exhaust_vio=false;
|
||||
#quality:car2,ac_vio=false;
|
||||
#quality:car2,vacuum_vio=false;
|
||||
#quality:car2,compliance_vio=false;
|
||||
|
||||
topology:car1<->car1,road;
|
||||
tags:
|
||||
.
|
||||
38
fpga_examples/Network_2/car_network2.xp
Normal file
38
fpga_examples/Network_2/car_network2.xp
Normal file
@ -0,0 +1,38 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
32
fpga_examples/Network_3/car_network3.nm
Normal file
32
fpga_examples/Network_3/car_network3.nm
Normal file
@ -0,0 +1,32 @@
|
||||
network model =
|
||||
assets:
|
||||
# Cars
|
||||
car1;
|
||||
car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=6;
|
||||
quality:car1,exhaust_months=12;
|
||||
#quality:car1,ac_odometer=120000;
|
||||
#quality:car1,vacuum_odometer=120000;
|
||||
quality:car1,engine=gas;
|
||||
quality:car1,brake_vio=false;
|
||||
quality:car1,exhaust_vio=false;
|
||||
#quality:car1,ac_vio=false;
|
||||
#quality:car1,vacuum_vio=false;
|
||||
quality:car1,compliance_vio=false;
|
||||
|
||||
quality:car2,brake_months=6;
|
||||
quality:car2,exhaust_months=12;
|
||||
#quality:car2,ac_odometer=120000;
|
||||
#quality:car2,vacuum_odometer=120000;
|
||||
quality:car2,engine=diesel;
|
||||
quality:car2,brake_vio=false;
|
||||
quality:car2,exhaust_vio=false;
|
||||
#quality:car2,ac_vio=false;
|
||||
#quality:car2,vacuum_vio=false;
|
||||
quality:car2,compliance_vio=false;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
17
fpga_examples/Network_3/car_network3.xp
Normal file
17
fpga_examples/Network_3/car_network3.xp
Normal file
@ -0,0 +1,17 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
32
fpga_examples/Network_4/car_network4.nm
Normal file
32
fpga_examples/Network_4/car_network4.nm
Normal file
@ -0,0 +1,32 @@
|
||||
network model =
|
||||
assets:
|
||||
# Cars
|
||||
car1;
|
||||
car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=6;
|
||||
quality:car1,exhaust_months=12;
|
||||
quality:car1,ac_odometer=120000;
|
||||
#quality:car1,vacuum_odometer=120000;
|
||||
quality:car1,engine=gas;
|
||||
quality:car1,brake_vio=false;
|
||||
quality:car1,exhaust_vio=false;
|
||||
quality:car1,ac_vio=false;
|
||||
#quality:car1,vacuum_vio=false;
|
||||
quality:car1,compliance_vio=false;
|
||||
|
||||
quality:car2,brake_months=6;
|
||||
quality:car2,exhaust_months=12;
|
||||
quality:car2,ac_odometer=120000;
|
||||
#quality:car2,vacuum_odometer=120000;
|
||||
quality:car2,engine=diesel;
|
||||
quality:car2,brake_vio=false;
|
||||
quality:car2,exhaust_vio=false;
|
||||
quality:car2,ac_vio=false;
|
||||
#quality:car2,vacuum_vio=false;
|
||||
quality:car2,compliance_vio=false;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
27
fpga_examples/Network_4/car_network4.xp
Normal file
27
fpga_examples/Network_4/car_network4.xp
Normal file
@ -0,0 +1,27 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
32
fpga_examples/Network_5/car_network5.nm
Normal file
32
fpga_examples/Network_5/car_network5.nm
Normal file
@ -0,0 +1,32 @@
|
||||
network model =
|
||||
assets:
|
||||
# Cars
|
||||
car1;
|
||||
car2;
|
||||
|
||||
facts:
|
||||
quality:car1,brake_months=6;
|
||||
quality:car1,exhaust_months=12;
|
||||
quality:car1,ac_odometer=120000;
|
||||
quality:car1,vacuum_odometer=120000;
|
||||
quality:car1,engine=gas;
|
||||
quality:car1,brake_vio=false;
|
||||
quality:car1,exhaust_vio=false;
|
||||
quality:car1,ac_vio=false;
|
||||
quality:car1,vacuum_vio=false;
|
||||
quality:car1,compliance_vio=false;
|
||||
|
||||
quality:car2,brake_months=6;
|
||||
quality:car2,exhaust_months=12;
|
||||
quality:car2,ac_odometer=120000;
|
||||
quality:car2,vacuum_odometer=120000;
|
||||
quality:car2,engine=diesel;
|
||||
quality:car2,brake_vio=false;
|
||||
quality:car2,exhaust_vio=false;
|
||||
quality:car2,ac_vio=false;
|
||||
quality:car2,vacuum_vio=false;
|
||||
quality:car2,compliance_vio=false;
|
||||
|
||||
topology:car1<->car2,road;
|
||||
tags:
|
||||
.
|
||||
38
fpga_examples/Network_5/car_network5.xp
Normal file
38
fpga_examples/Network_5/car_network5.xp
Normal file
@ -0,0 +1,38 @@
|
||||
exploit brake_pads(a)=
|
||||
preconditions:
|
||||
quality:a,brake_months>=6;
|
||||
quality:a,brake_vio=false;
|
||||
postconditions:
|
||||
update quality:a,brake_vio=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
.
|
||||
|
||||
exploit exhaust_pipes(a)=
|
||||
preconditions:
|
||||
quality:a,exhaust_months>=12;
|
||||
quality:a,exhaust_vio=false;
|
||||
postconditions:
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,exhaust_vio=true;
|
||||
.
|
||||
|
||||
exploit ac_filter(a)=
|
||||
preconditions:
|
||||
quality:a,ac_odometer>=120000;
|
||||
quality:a,ac_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,ac_vio=true;
|
||||
.
|
||||
|
||||
exploit vacuum_pump(a)=
|
||||
preconditions:
|
||||
quality:a,vacuum_odometer>=120000;
|
||||
quality:a,engine=diesel;
|
||||
quality:a,vacuum_vio=false;
|
||||
postconditions:
|
||||
insert quality:a,is_critical=true;
|
||||
update quality:a,compliance_vio=true;
|
||||
update quality:a,vacuum_vio=true;
|
||||
.
|
||||
11
redis_scripts/collisions.lua
Executable file
11
redis_scripts/collisions.lua
Executable file
@ -0,0 +1,11 @@
|
||||
local hash = KEYS[1]
|
||||
local id = ARGV[1]
|
||||
|
||||
redis.call("sadd", "collisions", hash)
|
||||
local count = redis.call("incr", "count:"..hash)
|
||||
|
||||
local new_string = hash.."_"..count
|
||||
|
||||
redis.call("hset", "idmap:"..new_string, "id", id)
|
||||
|
||||
return new_string
|
||||
6
run.sh
Executable file
6
run.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
./db_manage.sh -d ag_gen -f
|
||||
./build/ag_gen $*
|
||||
#dot -Tsvg -o ag.svg ag.dot
|
||||
|
||||
762
sql/arvin_example.sql
Executable file
762
sql/arvin_example.sql
Executable file
@ -0,0 +1,762 @@
|
||||
INSERT INTO exploit VALUES
|
||||
(1,' closeAirSupplyValve', 1),
|
||||
(2, 'earthquake', 2),
|
||||
(3, 'backupPowerOn', 3),
|
||||
(4, 'backupPowerChargeLoss', 3),
|
||||
(5, 'powerRestored', 3),
|
||||
(6, 'rechargeBackup', 2),
|
||||
(7, 'moveControlBladeUp1', 3),
|
||||
(8, 'moveControlBladeUp2', 3),
|
||||
(9, 'moveControlBladeDown1', 2),
|
||||
(10, 'moveControlBladeDown2', 2),
|
||||
(11, 'changeOperationModeManual', 2),
|
||||
(12, 'changeOperationModePulse', 2),
|
||||
(13, 'changeOperationModeRundown', 2),
|
||||
(14, 'changeOperationModeTest', 3),
|
||||
(15, 'CAMAlarmDilute', 2),
|
||||
(16, 'diffuserLeak1', 2),
|
||||
(17, 'diffuserLeak2', 2),
|
||||
(18, 'updateAreaMonitoringSystem', 2),
|
||||
(19, 'areaMonitoringSystemAlarm', 2),
|
||||
(20, 'pressurizeAirTank', 1),
|
||||
(21, 'pulseControlRod', 2),
|
||||
(22, 'pulseControlRodFall1', 2),
|
||||
(23, 'pulseControlRodFall2', 2),
|
||||
(24, 'tempScram', 2),
|
||||
(25, 'seismicScram', 2),
|
||||
(26, 'highFluxScram', 2),
|
||||
(27, 'buildingEvacScram', 2),
|
||||
(28, 'manualBeamRoomScram', 2),
|
||||
(29, 'manualScram', 2),
|
||||
(30, 'HVSensorScram', 2),
|
||||
(31, 'executeScram', 2),
|
||||
(32, 'dropBlades1', 2),
|
||||
(33, 'dropBlades2', 2),
|
||||
(34, 'coolantLossShutdown', 2),
|
||||
(35, 'coolantTempShutdown', 2),
|
||||
(36, 'fuelTempShutdown', 2),
|
||||
(37, 'CAMShutdown', 2),
|
||||
(38, 'areaMonitoringSystemShutdown', 2),
|
||||
(39, 'ventilationAirDetectorShutdown', 2),
|
||||
(40, 'coolantLeakShutdown', 2),
|
||||
(41, 'sensorPowerLoss', 2),
|
||||
(42, 'controlRodPowerLoss', 2),
|
||||
(43, 'miscalibrateTempSensorLow', 1),
|
||||
(44, 'miscalibrateTempSensorHigh', 1),
|
||||
(45, 'miscalibrateTempSensorHighPowerBase', 2),
|
||||
(46, 'incTempReading', 1),
|
||||
(47, 'incSeismicReading', 1),
|
||||
(48, 'incPowerReading', 1),
|
||||
(49, 'incFluxReading', 1),
|
||||
(50, 'triggerCAMAlarm', 1),
|
||||
(51, 'triggerN16Alarm', 1),
|
||||
(52, 'triggerAr41Alarm', 1),
|
||||
(53, 'decCoolantLevelReading', 1),
|
||||
(54, 'incCoolantTempReading', 1),
|
||||
(55, 'lockAirSupplyValve', 1),
|
||||
(56, 'manipulateRecorder', 1),
|
||||
(57, 'dosScramSensorTrigger', 2),
|
||||
(58, 'dosScramSensorUntrigger', 2),
|
||||
(59, 'triggerManualScram', 1),
|
||||
(60, 'desyncOperationModeScramPulse', 1),
|
||||
(61, 'desyncOperationModeScramManual', 1),
|
||||
(62, 'desyncOperationModeOperatorPulse1', 1),
|
||||
(63, 'desyncOperationModeOperatorPulse2', 2),
|
||||
(64, 'desyncOperationModeOperatorManual1', 1),
|
||||
(65, 'desyncOperationModeOperatorManual2', 2),
|
||||
(66, 'desyncOperationModeOperatorRundown1', 1),
|
||||
(67, 'desyncOperationModeOperatorRundown2', 2),
|
||||
(68, 'desyncOperationModeOperatorTest1', 1),
|
||||
(69, 'desyncOperationModeOperatorTest2', 2),
|
||||
(70, 'desyncBladePositionHigh1', 2),
|
||||
(71, 'desyncBladePositionHigh2', 2),
|
||||
(72, 'desyncBladePositionLow1', 2),
|
||||
(73, 'desyncBladePositionLow2', 2),
|
||||
(74, 'moveBladeUpDesync1', 2),
|
||||
(75, 'moveBladeUpDesync2', 2),
|
||||
(76, 'moveBladeDownDesync1', 2),
|
||||
(77, 'moveBladeDownDesync2', 2),
|
||||
(78, 'compromiseScram', 1);
|
||||
|
||||
|
||||
|
||||
INSERT INTO exploit_precodition VALUES
|
||||
/*CREATE TABLE exploit_precondition (
|
||||
id SERIAL PRIMARY KEY,
|
||||
exploit_id INTEGER REFERENCES exploit(id),
|
||||
type INTEGER, -- 0 for quality, 1 for topology
|
||||
param1 INTEGER,
|
||||
param2 INTEGER,
|
||||
property TEXT,
|
||||
value TEXT,
|
||||
op TEXT,
|
||||
dir TEXT
|
||||
);*/
|
||||
/* (DEFAULT, 1, 0, 1, NULL, 'type', 'router', '=', NULL),*/
|
||||
|
||||
|
||||
(1, 1, 0, 1, NULL, 'platform', 'airCompressor', '=', NULL),
|
||||
(1, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(1, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(1, 4, 0, 1, NULL, 'ctValve', 'open', '=', NULL),
|
||||
(1, 5, 0, 1, NULL, 'tankPressure', '20', '>', NULL),
|
||||
|
||||
(2, 1, 0, 1, NULL, 'platform', 'physical', '=', NULL),
|
||||
(2, 2, 0, 1, NULL, 'seismicActivity', '.0061', '<', NULL),
|
||||
(2, 3, 0, NULL, 1, 'platform', 'seismicSensor', '=', NULL),
|
||||
(2, 4, 0, NULL, 1, 'status', 'ok', '=', NULL),
|
||||
(2, 5, 1, 1, 2, 'physical', NULL, NULL, '<->'),
|
||||
|
||||
(3, 1, 0, 2, NULL, 'platform', 'backupPower', '=', NULL),
|
||||
(3, 2. 1, 1, 2, 'power', '114', '<', '->'),
|
||||
(3, 3, 1, 2, 3, 'power', '114', '<', '->'),
|
||||
(3, 4, 0, 2, NULL, 'chargeLevel', 0, '>', NULL),
|
||||
(3, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
|
||||
(4, 1, 0, 2, NULL, 'platform', 'backupPower', '=', NULL),
|
||||
(4, 2, 1, 1, 2, 'power', '114', '<', NULL),
|
||||
(4, 3, 1, 2, 3, 'power', '114', '>=', NULL),
|
||||
(4, 4, 0, 2, NULL, 'chargeLevel', '0', '>', NULL),
|
||||
(4, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
|
||||
(5, 1, 0, 2, NULL, 'platform', 'backupPower', '=', NULL),
|
||||
(5, 2, 1, 1, 2, 'power', '114', '>=', NULL),
|
||||
(5, 3, 1, 2, 3, 'power', '114', '>=', NULL),
|
||||
(5, 4, 0, 2, 0, 'status', 'ok', '=', NULL),
|
||||
|
||||
(6, 1, 0, 2, NULL, 'platform', 'backupPower', '=', NULL),
|
||||
(6, 2, 1, 1, 2, 'power', '114', '>=', NULL),
|
||||
(6, 3, 0, 2, NULL, 'chargeLevel', '1', '<', NULL),
|
||||
(6, 4, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
|
||||
(7, 1, 0, 1, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(7, 2, 0, 2, NULL, 'platform', 'controlBlade', '=', NULL),
|
||||
(7, 3, 0, 3, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(7, 4, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(7, 5, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(7, 6, 0, 1, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(7, 7, 0, 2, NULL, 'actualPosition', '15', '<', NULL),
|
||||
(7, 8, 0, 2, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
(7, 9, 1, 2, 1, 'subcomponent', NULL, NULL, '->'),
|
||||
(7, 10, 0, 3, NULL, 'operationMode', 'test', '!=', NULL),
|
||||
(7, 11, 0, 3, NULL, 'operationMode', 'rundown', '!=', NULL),
|
||||
|
||||
(8, 1, 0, 1, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(8, 2, 0, 2, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(8, 3, 0, 3, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(8, 4, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(8, 5, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(8, 6, 0, 1, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(8, 7, 0, 2, NULL, 'actualPosition', '15', '<', NULL),
|
||||
(8, 8, 0, 2, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
(8, 9, 1, 2, 1, 'subcomponent', NULL, NULL, '->'),
|
||||
(8, 10, 0, 3, NULL, 'operationMode', 'test', '!=', NULL),
|
||||
(8, 11, 0, 3, NULL, 'operationMode', 'rundown', '!=', NULL),
|
||||
|
||||
(9, 1, 0, 1, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(9, 2, 0, 2, NULL, 'platform', 'controlBlade', '=', NULL),
|
||||
(9, 3, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(9, 4, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(9, 5, 0, 1, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(9, 6, 0, 2, NULL, 'actualPosition', '15', '<', NULL),
|
||||
(9, 7, 0, 2, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
|
||||
(10, 1, 0, 1, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(10, 2, 0, 2, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(10, 3, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(10, 4, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(10, 5, 0, 1, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(10, 6, 0, 2, NULL, 'actualPosition', '15', '<', NULL),
|
||||
(10, 7, 0, 2, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
|
||||
|
||||
(11, 1, 0, 1, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(11, 2, 0, 2, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(11, 3, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(11, 4, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(11, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(11, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(11, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(11, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(12, 1, 0, 1, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(12, 2, 0, 2, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(12, 3, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(12, 4, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(12, 5, 0, 1, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(12, 6, 0, 2, NULL, 'actualPosition', '15', '<', NULL),
|
||||
(12, 7, 0, 2, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
|
||||
(13, 1, 0, 1, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(13, 2, 0, 2, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(13, 3, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(13, 4, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(13, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(13, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(13, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(13, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(14, 1, 0, 1, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(14, 2, 0, 2, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(14, 3, 0, 3, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(14, 4, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(14, 5, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(14, 6, 0, 1, NULL, 'emagPower', 'off', '=', NULL),
|
||||
(14, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(14, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
(14, 9, 1, 2, 3, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
(14, 10, 1, 3, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
|
||||
(15, 1, 0, 1, NULL, 'platform', 'CAM', '=', NULL),
|
||||
(15, 2, 0, 2, NULL, 'platform', 'ventilationController', '=', NULL),
|
||||
(15, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(15, 4, 0, 1, NULL, 'airborneRadiation', 'high','=', NULL),
|
||||
(15, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(15, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(15, 7, 0, 2, NULL, 'mode', 'dilute', '!=', NULL),
|
||||
(15, 8, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(15, 9, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(16, 1, 0, 1, NULL, 'platform', 'diffuser', '=', NULL),
|
||||
(16, 2, 0, 2, NULL, 'platform', 'physical', '=', NULL),
|
||||
(16, 3, 0, 1, NULL, 'powerStatus', 'off', '=', NULL),
|
||||
(16, 4, 0, 2, NULL, 'N16_level', '100', '<', NULL),
|
||||
|
||||
(17, 1, 0, 1, NULL, 'platform', 'diffuser', '=', NULL),
|
||||
(17, 2, 0, 2, NULL, 'platform', 'physical', '=', NULL),
|
||||
(17, 3, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
(17, 4, 0, 2, NULL, 'N16_level', '100', '<', NULL),
|
||||
|
||||
(18, 1, 0, 1, NULL, 'platform', 'N16Detector', '=', NULL),
|
||||
(18, 2, 0, 2, NULL, 'platform', 'physical', '=', NULL),
|
||||
(18, 3, 0, 1, NULL, 'powerStatus', 'ok', '=', NULL),
|
||||
(18, 4, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(18, 5, 0, 1, NULL, 'N16_level', 'airRed.N16_level', '<>', NULL),
|
||||
(18, 6, 1, 2, 1, 'physical', NULL, NULL, '<->'),
|
||||
|
||||
(19, 1, 0, 1, NULL, 'platform', 'N16Detector', '=', NULL),
|
||||
(19, 2, 0, 2, NULL, 'platform', 'evacuationAlarm', '=', NULL),
|
||||
(19, 3, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(19, 4, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(19, 5, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(19, 6, 0, 1, NULL, 'N16_level', '10', '>', NULL),
|
||||
(19, 7, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
(19, 8, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
|
||||
(20, 1, 0, 1, NULL, 'platform', 'buildingCompressedAir', '=', NULL),
|
||||
(20, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(20, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(20, 4, 0, 1, NULL, 'compressor', 'on', '=', NULL),
|
||||
(20, 5, 0, 1, NULL, 'ctValve', 'open', '=', NULL),
|
||||
(20, 6, 0, 1, NULL, 'tankPressure', '50', '<', NULL),
|
||||
|
||||
(21, 1, 0, 1, NULL, 'platform', 'buildingCompressedAir', '=', NULL),
|
||||
(21, 2, 0, 1, NULL, 'tankPressure', '5', '<', NULL),
|
||||
(21, 3, 0, 2, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(21, 4, 1, 1, 2, 'pneumatic_open', NULL, NULL, '->'),
|
||||
|
||||
(22, 1, 0, 1, NULL, 'platform', 'buildingCompressedAir', '=', NULL),
|
||||
(22, 2, 0, 2, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(22, 3, 1, 1, 2, 'pneumatic_closed', NULL, NULL, '->'),
|
||||
|
||||
(23, 1, 0, 1, NULL, 'platform', 'buildingCompressedAir', '=', NULL),
|
||||
(23, 2, 0, 1, NULL, 'tankPressure', '5', '<', NULL),
|
||||
(23, 3, 0, 2, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(23, 4, 1, 1, 2, 'pneumatic_open', NULL, NULL, '->'),
|
||||
|
||||
(24, 1, 0, 1, NULL, 'platform', 'tempSensor', '=', NULL),
|
||||
(24, 2, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(24, 3, 0, 1, NULL, 'temp', '500', '>', NULL),
|
||||
(24, 4, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(24, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(24, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(24, 7, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(24, 8, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(25, 1, 0, 1, NULL, 'platform', 'seismicSensor', '=', NULL),
|
||||
(25, 2, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(25, 3, 0, 1, NULL, 'magnitude', '.0061', '>', NULL),
|
||||
(25, 4, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(25, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(25, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(25, 7, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(25, 8, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(26, 1, 0, 1, NULL, 'platform', 'fluxMonitor', '=', NULL),
|
||||
(26, 2, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(26, 3, 0, 1, NULL, 'alarmActivated', 'true', '=', NULL),
|
||||
(26, 4, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(26, 5, 0, 2, NULL, 'mode', 'pulse', '!=', NULL),
|
||||
(26, 6, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(26, 7, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(26, 8, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(26, 9, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(27, 1, 0, 1, NULL, 'platform', 'evacuationAlarm', '=', NULL),
|
||||
(27, 2, 0, 1, NULL, 'activated', 'true', '=', NULL),
|
||||
(27, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(27, 4, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(27, 5, 0, 2, NULL, 'status', 'on', '=', NULL),
|
||||
(27, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(27, 7, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(27, 8, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(28, 1, 0, 1, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(28, 2, 0, 1, NULL, 'activated', 'true', '=', NULL),
|
||||
(28, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(28, 4, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(28, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(28, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(28, 7, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(28, 8, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(29, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(29, 2, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
(29, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(29, 4, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(29, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(29, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(29, 7, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(29, 8, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(30, 1, 0, 1, NULL, 'platform', 'HVSensor', '=', NULL),
|
||||
(30, 2, 0, 1, NULL, 'activated', 'true', '=', NULL),
|
||||
(30, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(30, 4, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(30, 5, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(30, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(30, 7, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(30, 8, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(31, 1, 0, 1, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(31, 2, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(31, 3, 0, 2, NULL, 'status', 'ok', '=', NULL),
|
||||
(31, 4, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
(31, 5, 1, 2, 1, 'connected_emag_power', NULL, NULL, '->'),
|
||||
|
||||
(32, 1, 0, 1, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(32, 2, 0, 2, NULL, 'platform', 'controlBlade', '=', NULL),
|
||||
(32, 3, 0, 1, NULL, 'emagPower', 'off', '=', NULL),
|
||||
(32, 4, 1, 2, 1, 'subcomponent', NULL, NULL, '->'),
|
||||
|
||||
(33, 1, 0, 1, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(33, 2, 0, 2, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(33, 3, 0, 1, NULL, 'emagPower', 'off', '=', NULL),
|
||||
(33, 4, 1, 2, 1, 'subcomponent', NULL, NULL, '->'),
|
||||
|
||||
(34, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(34, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(34, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(34, 4, 0, 2, NULL, 'platform', 'coolantLevelSensor', '=', NULL),
|
||||
(34, 5, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(34, 6, 0, 2, NULL, 'level', '-8.0', '<', NULL),
|
||||
(34, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(34, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(35, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(35, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(35, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(35, 4, 0, 2, NULL, 'platform', 'coolantTempSensor', '=', NULL),
|
||||
(35, 5, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(35, 6, 0, 2, NULL, 'temp', '400', '>', NULL),
|
||||
(35, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(35, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(36, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(36, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(36, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(36, 4, 0, 2, NULL, 'platform', 'tempSensor', '=', NULL),
|
||||
(36, 5, 0, 2, NULL, 'temp', '350', '>', NULL),
|
||||
(36, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(36, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(36, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(37, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(37, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(37, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(37, 4, 0, 2, NULL, 'platform', 'powerSensor', '=', NULL),
|
||||
(37, 5, 0, 2, NULL, 'powerLevel', '0.9', '>', NULL),
|
||||
(37, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(37, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(37, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(38, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(38, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(38, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(38, 4, 0, 2, NULL, 'platform', 'CAM', '=', NULL),
|
||||
(38, 5, 0, 2, NULL, 'airborneFissionProducts', 'high', '=', NULL),
|
||||
(38, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(38, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(38, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(39, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(39, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(39, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(39, 4, 0, 2, NULL, 'platform', 'N16_Detector', '=', NULL),
|
||||
(39, 5, 0, 2, NULL, 'N16_level', '10', '>', NULL),
|
||||
(39, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(39, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(39, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(40, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(40, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(40, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(40, 4, 0, 2, NULL, 'platform', 'Ar41Detector', '=', NULL),
|
||||
(40, 5, 0, 2, NULL, 'Ar41_level', '10', '>', NULL),
|
||||
(40, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(40, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(40, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(41, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(41, 2, 0, 1, NULL, 'status', 'ok', '=', NULL),
|
||||
(41, 3, 0, 1, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(41, 4, 0, 2, NULL, 'platform', 'conductivitySensor', '=', NULL),
|
||||
(41, 5, 0, 2, NULL, 'leakDetected', 'true', '=', NULL),
|
||||
(41, 6, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(41, 7, 1, 2, 1, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(41, 8, 1, 1, 2, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(42, 1, 1, 1, 2, 'power', '126', '<=', '->'),
|
||||
(42, 2, 1, 1, 2, 'power', '114', '>=', '->'),
|
||||
(42, 3, 0, 1, NULL, 'platform', 'physical', '=', NULL),
|
||||
(42, 4, 0, 1, NULL, 'buildingPower', 'on', '=', NULL),
|
||||
(42, 5, 0, 2, NULL, 'platform', 'controlRodController', '!=', NULL),
|
||||
(42, 6, 0, 2, NULL, 'platform', 'operatorStation', '!=', NULL),
|
||||
(42, 7, 0, 2, NULL, 'platform', 'scramUnit', '!=', NULL),
|
||||
(42, 8, 0, 2, NULL, 'platform', 'controlSystemRecorder', '!=', NULL),
|
||||
|
||||
(43, 1, 1, 1, 2, 'power', '126', '<=', '->'),
|
||||
(43, 2, 1, 1, 2, 'power', '114', '>=', '->'),
|
||||
(43, 3, 0, 1, NULL, 'platform', 'physical', '=', NULL),
|
||||
(43, 4, 0, 1, NULL, 'buildingPower', 'on', '=', NULL),
|
||||
(43, 5, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
|
||||
(44, 1, 0, 1, NULL, 'platform', 'tempSensor', '=', NULL),
|
||||
(44, 2, 0, 1, NULL, 'calibration', 'normal', '=', NULL),
|
||||
|
||||
(45, 1, 0, 1, NULL, 'platform', 'tempSensor', '=', NULL),
|
||||
(45, 2, 0, 1, NULL, 'calibration', 'normal', '=', NULL),
|
||||
|
||||
(46, 1, 0, 1, NULL, 'platform', 'tempSensor', '=', NULL),
|
||||
(46, 2, 0, 1, NULL, 'calibration', 'normal', '=', NULL),
|
||||
(46, 3, 0, 2, NULL, 'platform', 'physical', '=', NULL),
|
||||
(46, 4, 1, 2, 1, 'power', '114', '<', '->'),
|
||||
|
||||
(47, 1, 0, 1, NULL, 'platform', 'tempSensor', '=', NULL),
|
||||
(47, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(48, 1, 0, 1, NULL, 'platform', 'seismicSensor', '=', NULL),
|
||||
(48, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(49, 1, 0, 1, NULL, 'platform', 'powerSensor', '=', NULL),
|
||||
(49, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(50, 1, 0, 1, NULL, 'platform', 'fixMonitor', '=', NULL),
|
||||
(50, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(51, 1, 0, 1, NULL, 'platform', 'CAM', '=', NULL),
|
||||
(51, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(52, 1, 0, 1, NULL, 'platform', 'N16_Detector', '=', NULL),
|
||||
(52, 2, 0, 1, NULL, 'calibration', 'normal', '=', NULL),
|
||||
|
||||
(53, 1, 0, 1, NULL, 'platform', 'Ar41Detector', '=', NULL),
|
||||
(53, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(54, 1, 0, 1, NULL, 'platform', 'coolantLevelSensor', '=', NULL),
|
||||
(54, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(55, 1, 0, 1, NULL, 'platform', 'coolantTempSensor', '=', NULL),
|
||||
(55, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(56, 1, 0, 1, NULL, 'platform', 'buildingCompressedAir', '=', NULL),
|
||||
(56, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(57, 1, 0, 1, NULL, 'platform', 'controlSystemRecorder', '=', NULL),
|
||||
(57, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(58, 1, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(58, 2, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(58, 3, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(59, 1, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(59, 2, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(59, 3, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(60, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(60, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(61, 1, 0, 1, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(61, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(62, 1, 0, 1, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(62, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(63, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(63, 2, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(63, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
(63, 4, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(63, 5, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(64, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(64, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(65, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(65, 2, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(65, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
(65, 4, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(65, 5, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(66, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(66, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(67, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(67, 2, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(67, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
(67, 4, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(67, 5, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(68, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(68, 2, 0, 1, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(69, 1, 0, 1, NULL, 'platform', 'operatorStation', '=', NULL),
|
||||
(69, 2, 0, 2, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(69, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
(69, 4, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(69, 5, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(70, 1, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(70, 2, 0, 1, NULL, 'platform', 'controlBlade', '=', NULL),
|
||||
(70, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(71, 1, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(71, 2, 0, 1, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(71, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(72, 1, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(72, 2, 0, 1, NULL, 'platform', 'controlBlade', '=', NULL),
|
||||
(72, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(73, 1, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(73, 2, 0, 1, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(73, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
|
||||
(74, 1, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(74, 2, 0, 1, NULL, 'platform', 'controlBlade', '=', NULL),
|
||||
(74, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
(74, 4, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(74, 5, 0, 2, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(74, 6, 0, 1, NULL, 'actualPosition', '15', '<', NULL),
|
||||
(74, 7, 0, 1, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
|
||||
(75, 1, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(75, 2, 0, 1, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(75, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
(75, 4, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(75, 5, 0, 2, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(75, 6, 0, 1, NULL, 'actualPosition', '15', '<', NULL),
|
||||
(75, 7, 0, 1, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
|
||||
(76, 1, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(76, 2, 0, 1, NULL, 'platform', 'controlBlade', '=', NULL),
|
||||
(76, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
(76, 4, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(76, 5, 0, 2, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(76, 6, 0, 1, NULL, 'actualPosition', '0', '>', NULL),
|
||||
(76, 7, 0, 1, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
|
||||
(77, 1, 0, 2, NULL, 'platform', 'controlRodController', '=', NULL),
|
||||
(77, 2, 0, 1, NULL, 'platform', 'pulseControlRod', '=', NULL),
|
||||
(77, 3, 0, 2, NULL, 'status', 'compromised', '=', NULL),
|
||||
(77, 4, 0, 2, NULL, 'powerStatus', 'on', '=', NULL),
|
||||
(77, 5, 0, 2, NULL, 'emagPower', 'on', '=', NULL),
|
||||
(77, 6, 0, 1, NULL, 'actualPosition', '0', '>', NULL),
|
||||
(77, 7, 0, 1, NULL, 'motorStatus', 'ok', '=', NULL),
|
||||
|
||||
(78, 1, 0, 1, NULL, 'platform', 'scramUnit', '=', NULL),
|
||||
(78, 2, 0, 1, NULL, 'status', 'ok', '=', NULL);
|
||||
|
||||
INSERT INTO exploit_postcondition VALUES
|
||||
(1, 1, 0, 1, NULL, 'ctValve', 'closed', '=', NULL),
|
||||
|
||||
(2, 1, 0, 1, NULL, 'seismicActivity', '.007', '=', NULL),
|
||||
(2, 2, 0, 2, NULL, 'magnitude', '.007', '=', NULL),
|
||||
|
||||
(3, 1, 1, 2, 3, 'power', '120', ':=', '->'),
|
||||
|
||||
(4, 1, 0, 2, NULL, 'chargeLevel', '0.05', '-=', NULL),
|
||||
|
||||
(5, 1, 1, 2, 3, 'system,power', '0', ':=', '->'),
|
||||
|
||||
(6, 1, 0, 2, NULL, 'chargeLevel', '1', ':=', NULL),
|
||||
|
||||
(7, 1, 0, 2, NULL, 'actualPosition', '.5', '+=', NULL),
|
||||
(7, 2, 0, 2, NULL, 'reportedPosition', '.5', '+=', NULL),
|
||||
|
||||
(8, 1, 0, 2, NULL, 'actualPosition', '.5', '+=', NULL),
|
||||
(8, 2, 0, 2, NULL, 'cylinderPosition', '.5', '+=', NULL),
|
||||
(8, 3, 0, 2, NULL, 'reportedPosition', '.5', '+=', NULL),
|
||||
|
||||
(9, 1, 0, 2, NULL, 'actualPosition', '.5', '-=', NULL),
|
||||
(9, 2, 0, 2, NULL, 'reportedPosition', '.5', '-=', NULL),
|
||||
|
||||
(10, 1, 0, 2, NULL, 'actualPosition', '.5', '-=', NULL),
|
||||
(10, 2, 0, 2, NULL, 'cylinderPosition', '.5', '-=', NULL),
|
||||
(10, 3, 0, 2, NULL, 'reportedPosition', '.5', '-=', NULL),
|
||||
|
||||
(11, 1, 0, 2, NULL, 'operationMode', 'manual', '=', NULL),
|
||||
(11, 2, 0, 1, NULL, 'mode', 'manual', '=', NULL),
|
||||
|
||||
(12, 1, 0, 2, NULL, 'operationMode', 'pulse', '=', NULL),
|
||||
(12, 2, 0, 1, NULL, 'mode', 'pulse', '=', NULL),
|
||||
|
||||
(13, 1, 0, 2, NULL, 'operationMode', 'rundown', '=', NULL),
|
||||
(13, 2, 0, 1, NULL, 'mode', 'rundown', '=', NULL),
|
||||
|
||||
(14, 1, 0, 2, NULL, 'operationMode', 'test', '=', NULL),
|
||||
(14, 2, 0, 1, NULL, 'mode', 'test', '=', NULL),
|
||||
|
||||
(15, 1, 0, 2, NULL, 'mode', 'dilute', '=', NULL),
|
||||
|
||||
(16, 1, 0, 2, NULL, 'N16_level', '100', ':=', NULL),
|
||||
|
||||
(17, 1, 0, 2, NULL, 'N16_level', '100', ':=', NULL),
|
||||
|
||||
(18, 1, 0, 1, NULL, 'N16_level', 'airRed.N16_level', ':=', NULL),
|
||||
|
||||
(19, 1, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
|
||||
(20, 1, 0, 1, NULL, 'tankPressure', '5', '=+', NULL),
|
||||
|
||||
(21, 1, 0, 2, NULL, 'actualPosition', '15', ':=', NULL),
|
||||
(21, 2, 0, 2, NULL, 'pulsed', 'true', '=', NULL),
|
||||
(21, 3, 0, 1, NULL, 'tankPressure', '5', '-=', NULL),
|
||||
|
||||
(22, 1, 0, 2, NULL, 'actualPosition', 'pulseRod.cylinderPosition', ':=', NULL),
|
||||
(22, 2, 0, 2, NULL, 'pulsed', 'false', '=', NULL),
|
||||
|
||||
(23, 1, 0, 2, NULL, 'actualPosition', 'pulseRod.cylinderPosition', ':=', NULL),
|
||||
(23, 2, 0, 2, NULL, 'pulse', 'false', '=', NULL),
|
||||
|
||||
(24, 1, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
|
||||
(25, 1, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
|
||||
(26, 1, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
|
||||
(27, 1, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
|
||||
(28, 1, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
|
||||
(29, 1, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
|
||||
(30, 1, 0, 2, NULL, 'activated', 'true', '=', NULL),
|
||||
|
||||
(31, 1, 0, 1, NULL, 'emagPower', 'off', '=', NULL),
|
||||
(31, 2, 1, 2, 1, 'connected_emag_power', NULL, NULL, '->'),
|
||||
|
||||
(32, 1, 0, 2, NULL, 'actualPosition', '0', ':=', NULL),
|
||||
|
||||
(33, 1, 0, 2, NULL, 'actualPosition', '0', ':=', NULL),
|
||||
|
||||
(34, 1, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
|
||||
(35, 1, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
|
||||
(36, 1, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
|
||||
(37, 1, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
|
||||
(38, 1, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
|
||||
(39, 1, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
|
||||
(40, 1, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
|
||||
(41, 1, 0, 1, NULL, 'buildingPower', 'off', '=', NULL),
|
||||
(41, 2, 0, 2, NULL, 'powerStatus', 'off', '=', NULL),
|
||||
(41, 3, 1, 1, 2, 'power', '0', ':=', NULL),
|
||||
|
||||
(42, 1, 0, 1, NULL, 'buildingPower', 'off', '=', NULL),
|
||||
(42, 2, 0, 2, NULL, 'powerStatus', 'off', '=', NULL),
|
||||
(42, 3, 0, 2, NULL, 'emagPower', 'off', '=', NULL),
|
||||
(42, 4, 1, 1, 2, 'power', '0', ':=', NULL),
|
||||
|
||||
(43, 1, 0, 1, NULL, 'calibration', 'low', '=', NULL),
|
||||
(43, 2, 0, 1, NULL, 'temp', '50', '-=', NULL),
|
||||
|
||||
(44, 1, 0, 1, NULL, 'calibration', 'high', '=', NULL),
|
||||
(44, 2, 0, 1, NULL, 'temp', '50', '+=', NULL),
|
||||
|
||||
(45, 1, 0, 1, NULL, 'calibration', 'high', '=', NULL),
|
||||
(45, 2, 0, 1, NULL, 'temp', '50', '+=', NULL),
|
||||
|
||||
(46, 1, 0, 1, NULL, 'temp', '600', ':=', NULL),
|
||||
|
||||
(47, 1, 0, 1, NULL, 'magnitude', '.007', ':=', NULL),
|
||||
|
||||
(48, 1, 0, 1, NULL, 'powerLevel', '1.5', ':=', NULL),
|
||||
|
||||
(49, 1, 0, 1, NULL, 'alarmActivated', 'true', '=', NULL),
|
||||
|
||||
(50, 1, 0, 1, NULL, 'airborneRadiation', 'high', '=', NULL),
|
||||
|
||||
(51, 1, 0, 1, NULL, 'N16_level', '15', ':=', NULL),
|
||||
|
||||
(52, 1, 0, 1, NULL, 'Ar41_level', '15', ':=', NULL),
|
||||
|
||||
(53, 1, 0, 1, NULL, 'level', '-10', ':=', NULL),
|
||||
|
||||
(54, 1, 0, 1, NULL, 'temp', '600', ':=', NULL),
|
||||
|
||||
(55, 1, 0, 1, NULL, 'compressor', 'on', '=', NULL),
|
||||
(55, 2, 0, 1, NULL, 'ctValve', 'open', '=', NULL),
|
||||
|
||||
(56, 1, 0, 1, NULL, 'dataValid', 'false', '=', NULL),
|
||||
|
||||
(57, 1, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(57, 2, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
(57, 3, 0, 2, NULL, 'activated', 'true', '='),
|
||||
|
||||
(58, 1, 1, 1, 2, 'connected_modbus_slave', NULL, NULL, '->'),
|
||||
(58, 2, 1, 2, 1, 'connected_modbus_master', NULL, NULL, '->'),
|
||||
|
||||
(59, 1, 0, 1, NULL, 'manualScram', 'true', '=', NULL),
|
||||
|
||||
(60, 1, 0, 1, NULL, 'mode', 'pulse', '=', NULL),
|
||||
|
||||
(61, 1, 0, 1, NULL, 'mode', 'manual', '=', NULL),
|
||||
|
||||
(62, 1, 0, 1, NULL, 'mode', 'pulse', '=', NULL),
|
||||
|
||||
(63, 1, 0, 1, NULL, 'mode', 'pulse', '=', NULL),
|
||||
|
||||
(64, 1, 0, 1, NULL, 'mode', 'manual', '=', NULL),
|
||||
|
||||
(65, 1, 0, 1, NULL, 'mode', 'manual', '=', NULL),
|
||||
|
||||
(66, 1, 0, 1, NULL, 'mode', 'rundown', '=', NULL),
|
||||
|
||||
(67, 1, 0, 1, NULL, 'mode', 'rundown', '=', NULL),
|
||||
|
||||
(68, 1, 0, 1, NULL, 'mode', 'test', '=', NULL),
|
||||
|
||||
(69, 1, 0, 1, NULL, 'mode', 'test', '=', NULL),
|
||||
|
||||
(70, 1, 0, 1, NULL, 'reportedPosition', '.5', '+=', NULL),
|
||||
|
||||
(71, 1, 0, 1, NULL, 'reportedPosition', '.5', '+=', NULL),
|
||||
|
||||
(72, 1, 0, 1, NULL, 'reportedPosition', '.5', '-=', NULL),
|
||||
|
||||
(73, 1, 0, 1, NULL, 'reportedPosition', '.5', '-=', NULL),
|
||||
|
||||
(74, 1, 0, 1, NULL, 'actualPosition', '.5', '+=', NULL),
|
||||
|
||||
(75, 1, 0, 1, NULL, 'actualPosition', '.5', '+=', NULL),
|
||||
|
||||
(76, 1, 0, 1, NULL, 'actualPosition', '.5', '-=', NULL),
|
||||
|
||||
(77, 1, 0, 1, NULL, 'actualPosition', '.5', '-=', NULL),
|
||||
|
||||
(78, 1, 0, 1, NULL, 'status', 'compromised', '=', NULL);
|
||||
190
sql/example_data.sql
Executable file
190
sql/example_data.sql
Executable file
@ -0,0 +1,190 @@
|
||||
INSERT INTO asset VALUES
|
||||
(DEFAULT, 'routerA'),
|
||||
(DEFAULT, 'routerB'),
|
||||
(DEFAULT, 'routerC'),
|
||||
(DEFAULT, 'laptopA'),
|
||||
(DEFAULT, 'laptopB'),
|
||||
(DEFAULT, 'laptopC'),
|
||||
(DEFAULT, 'tabletA'),
|
||||
(DEFAULT, 'tabletB'),
|
||||
(DEFAULT, 'tabletC'),
|
||||
(DEFAULT, 'smartphoneA'),
|
||||
(DEFAULT, 'smartphoneB'),
|
||||
(DEFAULT, 'smartphoneC'),
|
||||
(DEFAULT, 'tvA'),
|
||||
(DEFAULT, 'tvB'),
|
||||
(DEFAULT, 'tvC'),
|
||||
(DEFAULT, 'desktopA'),
|
||||
(DEFAULT, 'desktopB'),
|
||||
(DEFAULT, 'desktopC'),
|
||||
(DEFAULT, 'printerA'),
|
||||
(DEFAULT, 'printerB'),
|
||||
(DEFAULT, 'printerC'),
|
||||
(DEFAULT, 'nas'),
|
||||
(DEFAULT, 'emailserver'),
|
||||
(DEFAULT, 'internet'),
|
||||
|
||||
(DEFAULT, 'test_router'),
|
||||
(DEFAULT, 'test_workstation');
|
||||
|
||||
|
||||
INSERT INTO quality VALUES
|
||||
(1, 'type', '=', 'router'),
|
||||
(1, 'version', '=', '1.6'),
|
||||
(2, 'type', '=', 'router'),
|
||||
(2, 'version', '=', '1.5'),
|
||||
(3, 'type', '=', 'router'),
|
||||
(3, 'version', '=', '1.4'),
|
||||
|
||||
(4, 'type', '=', 'laptop'),
|
||||
(4, 'os', '=', 'winxp'),
|
||||
(4, 'adobereader', '=', '4'),
|
||||
(5, 'type', '=', 'laptop'),
|
||||
(5, 'os', '=', 'win7'),
|
||||
(5, 'adobereader', '=', '5'),
|
||||
(6, 'type', '=', 'laptop'),
|
||||
(6, 'os', '=', 'win10'),
|
||||
(6, 'adobereader', '=', '6'),
|
||||
|
||||
(7, 'type', '=', 'tablet'),
|
||||
(7, 'os', '=', 'ios'),
|
||||
(8, 'type', '=', 'tablet'),
|
||||
(8, 'os', '=', 'android'),
|
||||
(9, 'type', '=', 'tablet'),
|
||||
(9, 'os', '=', 'kindle'),
|
||||
|
||||
(10, 'type', '=', 'smartphone'),
|
||||
(10, 'os', '=', 'ios'),
|
||||
(10, 'light', '=', 'off'),
|
||||
(11, 'type', '=', 'smartphone'),
|
||||
(11, 'os', '=', 'android'),
|
||||
(11, 'light', '=', 'off'),
|
||||
(12, 'type', '=', 'smartphone'),
|
||||
(12, 'os', '=', 'blackberry'),
|
||||
(12, 'light', '=', 'off'),
|
||||
|
||||
(13, 'type', '=', 'samsung'),
|
||||
(14, 'type', '=', 'visio'),
|
||||
(15, 'type', '=', 'sony'),
|
||||
|
||||
(16, 'type', '=', 'desktop'),
|
||||
(16, 'os', '=', 'win8'),
|
||||
(16, 'photoshop', '=', '5'),
|
||||
(17, 'type', '=', 'desktop'),
|
||||
(17, 'os', '=', 'macosx'),
|
||||
(17, 'photoshop', '=', '5'),
|
||||
(18, 'type', '=', 'desktop'),
|
||||
(18, 'os', '=', 'win10'),
|
||||
(18, 'photoshop', '=', '5'),
|
||||
|
||||
(19, 'type', '=', 'printer'),
|
||||
(19, 'model', '=', 'hp123'),
|
||||
(20, 'type', '=', 'printer'),
|
||||
(20, 'model', '=', 'hp456'),
|
||||
(21, 'type', '=', 'printer'),
|
||||
(21, 'model', '=', 'hp789'),
|
||||
|
||||
(22, 'type', '=', 'nas'),
|
||||
(22, 'os', '=', 'freebsd'),
|
||||
(23, 'type', '=', 'emailserver'),
|
||||
(23, 'owner', '=', 'hillaryclinton'),
|
||||
(23, 'contents', '=', 'topsecrets'),
|
||||
(23, 'status', '=', 'compromised'),
|
||||
|
||||
(24, 'type', '=', 'internet');
|
||||
|
||||
INSERT INTO topology VALUES
|
||||
(1, 2, '->', 'connected', NULL, NULL),
|
||||
(2, 3, '->','connected', NULL, NULL),
|
||||
(1, 3, '->', 'connected', NULL, NULL),
|
||||
(1, 2, '->', 'trusted', NULL, NULL),
|
||||
(2, 3, '->', 'trusted', NULL, NULL),
|
||||
(1, 3, '->', 'trusted', NULL, NULL),
|
||||
|
||||
(1, 24, '->', 'connected', NULL, NULL),
|
||||
(2, 24, '->', 'connected', NULL, NULL),
|
||||
(3, 24, '->', 'connected', NULL, NULL),
|
||||
(1, 24, '->', 'trusted', NULL, NULL),
|
||||
(2, 24, '->', 'trusted', NULL, NULL),
|
||||
(3, 24, '->', 'trusted', NULL, NULL),
|
||||
|
||||
(1, 4, '->', 'connected', NULL, NULL),
|
||||
(1, 4, '->', 'trusted', NULL, NULL),
|
||||
|
||||
(1, 7, '->', 'connected', NULL, NULL),
|
||||
(1, 10, '->', 'connected', NULL, NULL),
|
||||
(1, 13, '->', 'connected', NULL, NULL),
|
||||
(1, 16, '->', 'connected', NULL, NULL),
|
||||
(1, 19, '->', 'connected', NULL, NULL),
|
||||
|
||||
(1, 22, '->', 'connected', NULL, NULL),
|
||||
(1, 23, '->', 'connected', NULL, NULL),
|
||||
(1, 22, '->', 'trusted', NULL, NULL),
|
||||
(1, 23, '->', 'trusted', NULL, NULL),
|
||||
|
||||
(2, 5, '->', 'connected', NULL, NULL),
|
||||
(2, 8, '->', 'connected', NULL, NULL),
|
||||
(2, 11, '->', 'connected', NULL, NULL),
|
||||
(2, 14, '->', 'connected', NULL, NULL),
|
||||
(2, 17, '->', 'connected', NULL, NULL),
|
||||
(2, 20, '->', 'connected', NULL, NULL),
|
||||
|
||||
(2, 22, '->', 'connected', NULL, NULL),
|
||||
(2, 23, '->', 'connected', NULL, NULL),
|
||||
(2, 22, '->', 'trusted', NULL, NULL),
|
||||
(2, 23, '->', 'trusted', NULL, NULL),
|
||||
|
||||
(3, 6, '->', 'connected', NULL, NULL),
|
||||
(3, 9, '->', 'connected', NULL, NULL),
|
||||
(3, 12, '->', 'connected', NULL, NULL),
|
||||
(3, 15, '->', 'connected', NULL, NULL),
|
||||
(3, 18, '->', 'connected', NULL, NULL),
|
||||
(3, 21, '->', 'connected', NULL, NULL),
|
||||
|
||||
(3, 22, '->', 'connected', NULL, NULL),
|
||||
(3, 23, '->', 'connected', NULL, NULL),
|
||||
(3, 22, '->', 'trusted', NULL, NULL),
|
||||
(3, 23, '->', 'trusted', NULL, NULL),
|
||||
|
||||
(10, 24, '->', 'connected', NULL, NULL),
|
||||
(11, 24, '->', 'connected', NULL, NULL),
|
||||
(12, 24, '->', 'connected', NULL, NULL),
|
||||
(10, 24, '->', 'trusted', NULL, NULL),
|
||||
(11, 24, '->', 'trusted', NULL, NULL),
|
||||
(12, 24, '->', 'trusted', NULL, NULL);
|
||||
|
||||
INSERT INTO exploit VALUES
|
||||
(DEFAULT, 'router_vuln', 1),
|
||||
(DEFAULT, 'printer_vuln', 1),
|
||||
(DEFAULT, 'adobereader_vuln', 1),
|
||||
(DEFAULT, 'photoshop_vuln', 1),
|
||||
(DEFAULT, 'kindle_vuln', 1),
|
||||
(DEFAULT, 'hacked', 1);
|
||||
|
||||
INSERT INTO exploit_precondition VALUES
|
||||
(DEFAULT, 1, 0, 1, NULL, 'type', 'router', '=', NULL),
|
||||
(DEFAULT, 1, 0, 1, NULL, 'version', '1.6', '=', NULL),
|
||||
|
||||
(DEFAULT, 2, 0, 1, NULL, 'type', 'printer', '=', NULL),
|
||||
(DEFAULT, 2, 0, 1, NULL, 'model', 'hp456', '=', NULL),
|
||||
|
||||
(DEFAULT, 3, 0, 1, NULL, 'type', 'laptop', '=', NULL),
|
||||
(DEFAULT, 3, 0, 1, NULL, 'os', 'winxp', '=', NULL),
|
||||
(DEFAULT, 3, 0, 1, NULL, 'adobereader', '4', '=', NULL),
|
||||
|
||||
(DEFAULT, 4, 0, 1, NULL, 'type', 'desktop', '=', NULL),
|
||||
(DEFAULT, 4, 0, 1, NULL, 'os', 'macosx', '=', NULL),
|
||||
(DEFAULT, 4, 0, 1, NULL, 'photoshop', '5', '=', NULL),
|
||||
|
||||
(DEFAULT, 5, 0, 1, NULL, 'type', 'tablet', '=', NULL),
|
||||
(DEFAULT, 5, 0, 1, NULL, 'os', 'kindle', '=', NULL),
|
||||
|
||||
(DEFAULT, 6, 0, 1, NULL, 'access', 'root', '=', NULL);
|
||||
|
||||
INSERT INTO exploit_postcondition VALUES
|
||||
(DEFAULT, 1, 0, 1, NULL, 'access', 'root', '=', NULL, 'add'),
|
||||
(DEFAULT, 2, 0, 1, NULL, 'access', 'root', '=', NULL, 'add'),
|
||||
(DEFAULT, 3, 0, 1, NULL, 'access', 'root', '=', NULL, 'add'),
|
||||
(DEFAULT, 4, 0, 1, NULL, 'access', 'root', '=', NULL, 'add'),
|
||||
(DEFAULT, 5, 0, 1, NULL, 'access', 'root', '=', NULL, 'add'),
|
||||
(DEFAULT, 6, 0, 1, NULL, 'planet', 'hacked', '=', NULL, 'add');
|
||||
27
sql/factbase.sql
Executable file
27
sql/factbase.sql
Executable file
@ -0,0 +1,27 @@
|
||||
CREATE FUNCTION new_factbase(myhash TEXT) RETURNS INTEGER AS $$
|
||||
DECLARE
|
||||
myid INTEGER;
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM factbase WHERE hash = myhash) THEN
|
||||
INSERT INTO factbase VALUES (DEFAULT, myhash) RETURNING id INTO myid;
|
||||
ELSE
|
||||
SELECT id INTO myid FROM factbase WHERE hash = myhash;
|
||||
END IF;
|
||||
|
||||
RETURN myid;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE FUNCTION new_edge(from_id INTEGER, to_id INTEGER, exploit INTEGER) RETURNS INTEGER AS $$
|
||||
DECLARE
|
||||
myid INTEGER;
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM edge WHERE from_node = from_id AND to_node = to_id AND exploit_id = exploit) THEN
|
||||
INSERT INTO edge VALUES (DEFAULT, from_id, to_id, exploit) RETURNING id INTO myid;
|
||||
ELSE
|
||||
SELECT id INTO myid FROM edge WHERE from_node = from_id AND to_node = to_id AND exploit_id = exploit;
|
||||
END IF;
|
||||
|
||||
RETURN myid;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
84
sql/schema.sql
Executable file
84
sql/schema.sql
Executable file
@ -0,0 +1,84 @@
|
||||
CREATE TABLE factbase (
|
||||
id SERIAL PRIMARY KEY,
|
||||
hash TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE factbase_item (
|
||||
factbase_id INTEGER REFERENCES factbase(id),
|
||||
f BIGINT,
|
||||
type TEXT,
|
||||
PRIMARY KEY (factbase_id, f, type)
|
||||
);
|
||||
|
||||
CREATE TABLE asset (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE quality (
|
||||
asset_id INTEGER REFERENCES asset(id),
|
||||
property TEXT,
|
||||
op TEXT,
|
||||
value TEXT,
|
||||
PRIMARY KEY (asset_id, property)
|
||||
);
|
||||
|
||||
CREATE TABLE topology (
|
||||
asset_from_id INTEGER REFERENCES asset(id),
|
||||
asset_to_id INTEGER REFERENCES asset(id),
|
||||
direction TEXT,
|
||||
property TEXT,
|
||||
op TEXT,
|
||||
value TEXT,
|
||||
PRIMARY KEY (asset_from_id, asset_to_id, property)
|
||||
);
|
||||
|
||||
CREATE TABLE exploit (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT,
|
||||
params INTEGER,
|
||||
"group" TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE exploit_precondition (
|
||||
id SERIAL PRIMARY KEY,
|
||||
exploit_id INTEGER REFERENCES exploit(id),
|
||||
type INTEGER, -- 0 for quality, 1 for topology
|
||||
param1 INTEGER,
|
||||
param2 INTEGER,
|
||||
property TEXT,
|
||||
value TEXT,
|
||||
op TEXT,
|
||||
dir TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE exploit_postcondition (
|
||||
id SERIAL PRIMARY KEY,
|
||||
exploit_id INTEGER REFERENCES exploit(id),
|
||||
type INTEGER, -- 0 for quality, 1 for topology
|
||||
param1 INTEGER,
|
||||
param2 INTEGER,
|
||||
property TEXT,
|
||||
value TEXT,
|
||||
op TEXT,
|
||||
dir TEXT,
|
||||
action TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE edge (
|
||||
id SERIAL PRIMARY KEY,
|
||||
from_node INTEGER REFERENCES factbase(id),
|
||||
to_node INTEGER REFERENCES factbase(id),
|
||||
exploit_id INTEGER REFERENCES exploit(id)
|
||||
);
|
||||
|
||||
CREATE TABLE edge_asset_binding (
|
||||
edge_id INTEGER REFERENCES edge(id),
|
||||
exploit_param INTEGER,
|
||||
asset_id INTEGER REFERENCES asset(id)
|
||||
);
|
||||
|
||||
CREATE TABLE keyvalue (
|
||||
id INTEGER PRIMARY KEY,
|
||||
property TEXT
|
||||
);
|
||||
26
sql/test_data.sql
Executable file
26
sql/test_data.sql
Executable file
@ -0,0 +1,26 @@
|
||||
INSERT INTO network VALUES
|
||||
(DEFAULT, 'home');
|
||||
|
||||
INSERT INTO asset VALUES
|
||||
(DEFAULT, 'router', (SELECT id FROM network WHERE name = 'home')),
|
||||
(DEFAULT, 'laptop', (SELECT id FROM network WHERE name = 'home')),
|
||||
(DEFAULT, 'attacker', (SELECT id FROM network WHERE name = 'home'));
|
||||
|
||||
INSERT INTO quality VALUES
|
||||
(1, 'type', '=', 'router'),
|
||||
(1, 'version', '=', '1.6');
|
||||
|
||||
INSERT INTO topology VALUES
|
||||
(3, 1, '->', 'connected_web', NULL, NULL),
|
||||
(2, 1, '->', 'connected', NULL, NULL);
|
||||
|
||||
INSERT INTO exploit VALUES
|
||||
(DEFAULT, 'router_vuln', 1);
|
||||
|
||||
INSERT INTO exploit_precondition VALUES
|
||||
(DEFAULT, 1, 0, 1, NULL, 'type', 'router', '=', NULL),
|
||||
(DEFAULT, 1, 0, 1, NULL, 'version', '1.6', '=', NULL);
|
||||
|
||||
INSERT INTO exploit_postcondition VALUES
|
||||
(DEFAULT, 1, 0, 1, NULL, 'access', 'root', '=', NULL),
|
||||
(DEFAULT, 1, 0, 1, NULL, 'light', 'on', '=', NULL);
|
||||
279
src/CMakeDoxyfile.in
Normal file
279
src/CMakeDoxyfile.in
Normal file
@ -0,0 +1,279 @@
|
||||
#
|
||||
# DO NOT EDIT! THIS FILE WAS GENERATED BY CMAKE!
|
||||
#
|
||||
|
||||
DOXYFILE_ENCODING = @DOXYGEN_DOXYFILE_ENCODING@
|
||||
PROJECT_NAME = @DOXYGEN_PROJECT_NAME@
|
||||
PROJECT_NUMBER = @DOXYGEN_PROJECT_NUMBER@
|
||||
PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
|
||||
PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
|
||||
OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
|
||||
CREATE_SUBDIRS = @DOXYGEN_CREATE_SUBDIRS@
|
||||
ALLOW_UNICODE_NAMES = @DOXYGEN_ALLOW_UNICODE_NAMES@
|
||||
OUTPUT_LANGUAGE = @DOXYGEN_OUTPUT_LANGUAGE@
|
||||
OUTPUT_TEXT_DIRECTION = @DOXYGEN_OUTPUT_TEXT_DIRECTION@
|
||||
BRIEF_MEMBER_DESC = @DOXYGEN_BRIEF_MEMBER_DESC@
|
||||
REPEAT_BRIEF = @DOXYGEN_REPEAT_BRIEF@
|
||||
ABBREVIATE_BRIEF = @DOXYGEN_ABBREVIATE_BRIEF@
|
||||
ALWAYS_DETAILED_SEC = @DOXYGEN_ALWAYS_DETAILED_SEC@
|
||||
INLINE_INHERITED_MEMB = @DOXYGEN_INLINE_INHERITED_MEMB@
|
||||
FULL_PATH_NAMES = @DOXYGEN_FULL_PATH_NAMES@
|
||||
STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
|
||||
STRIP_FROM_INC_PATH = @DOXYGEN_STRIP_FROM_INC_PATH@
|
||||
SHORT_NAMES = @DOXYGEN_SHORT_NAMES@
|
||||
JAVADOC_AUTOBRIEF = @DOXYGEN_JAVADOC_AUTOBRIEF@
|
||||
JAVADOC_BANNER = @DOXYGEN_JAVADOC_BANNER@
|
||||
QT_AUTOBRIEF = @DOXYGEN_QT_AUTOBRIEF@
|
||||
MULTILINE_CPP_IS_BRIEF = @DOXYGEN_MULTILINE_CPP_IS_BRIEF@
|
||||
PYTHON_DOCSTRING = @DOXYGEN_PYTHON_DOCSTRING@
|
||||
INHERIT_DOCS = @DOXYGEN_INHERIT_DOCS@
|
||||
SEPARATE_MEMBER_PAGES = @DOXYGEN_SEPARATE_MEMBER_PAGES@
|
||||
TAB_SIZE = @DOXYGEN_TAB_SIZE@
|
||||
ALIASES = @DOXYGEN_ALIASES@
|
||||
OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
|
||||
OPTIMIZE_OUTPUT_JAVA = @DOXYGEN_OPTIMIZE_OUTPUT_JAVA@
|
||||
OPTIMIZE_FOR_FORTRAN = @DOXYGEN_OPTIMIZE_FOR_FORTRAN@
|
||||
OPTIMIZE_OUTPUT_VHDL = @DOXYGEN_OPTIMIZE_OUTPUT_VHDL@
|
||||
OPTIMIZE_OUTPUT_SLICE = @DOXYGEN_OPTIMIZE_OUTPUT_SLICE@
|
||||
EXTENSION_MAPPING = @DOXYGEN_EXTENSION_MAPPING@
|
||||
MARKDOWN_SUPPORT = @DOXYGEN_MARKDOWN_SUPPORT@
|
||||
TOC_INCLUDE_HEADINGS = @DOXYGEN_TOC_INCLUDE_HEADINGS@
|
||||
AUTOLINK_SUPPORT = @DOXYGEN_AUTOLINK_SUPPORT@
|
||||
BUILTIN_STL_SUPPORT = @DOXYGEN_BUILTIN_STL_SUPPORT@
|
||||
CPP_CLI_SUPPORT = @DOXYGEN_CPP_CLI_SUPPORT@
|
||||
SIP_SUPPORT = @DOXYGEN_SIP_SUPPORT@
|
||||
IDL_PROPERTY_SUPPORT = @DOXYGEN_IDL_PROPERTY_SUPPORT@
|
||||
DISTRIBUTE_GROUP_DOC = @DOXYGEN_DISTRIBUTE_GROUP_DOC@
|
||||
GROUP_NESTED_COMPOUNDS = @DOXYGEN_GROUP_NESTED_COMPOUNDS@
|
||||
SUBGROUPING = @DOXYGEN_SUBGROUPING@
|
||||
INLINE_GROUPED_CLASSES = @DOXYGEN_INLINE_GROUPED_CLASSES@
|
||||
INLINE_SIMPLE_STRUCTS = @DOXYGEN_INLINE_SIMPLE_STRUCTS@
|
||||
TYPEDEF_HIDES_STRUCT = @DOXYGEN_TYPEDEF_HIDES_STRUCT@
|
||||
LOOKUP_CACHE_SIZE = @DOXYGEN_LOOKUP_CACHE_SIZE@
|
||||
NUM_PROC_THREADS = @DOXYGEN_NUM_PROC_THREADS@
|
||||
EXTRACT_ALL = @DOXYGEN_EXTRACT_ALL@
|
||||
EXTRACT_PRIVATE = @DOXYGEN_EXTRACT_PRIVATE@
|
||||
EXTRACT_PRIV_VIRTUAL = @DOXYGEN_EXTRACT_PRIV_VIRTUAL@
|
||||
EXTRACT_PACKAGE = @DOXYGEN_EXTRACT_PACKAGE@
|
||||
EXTRACT_STATIC = @DOXYGEN_EXTRACT_STATIC@
|
||||
EXTRACT_LOCAL_CLASSES = @DOXYGEN_EXTRACT_LOCAL_CLASSES@
|
||||
EXTRACT_LOCAL_METHODS = @DOXYGEN_EXTRACT_LOCAL_METHODS@
|
||||
EXTRACT_ANON_NSPACES = @DOXYGEN_EXTRACT_ANON_NSPACES@
|
||||
HIDE_UNDOC_MEMBERS = @DOXYGEN_HIDE_UNDOC_MEMBERS@
|
||||
HIDE_UNDOC_CLASSES = @DOXYGEN_HIDE_UNDOC_CLASSES@
|
||||
HIDE_FRIEND_COMPOUNDS = @DOXYGEN_HIDE_FRIEND_COMPOUNDS@
|
||||
HIDE_IN_BODY_DOCS = @DOXYGEN_HIDE_IN_BODY_DOCS@
|
||||
INTERNAL_DOCS = @DOXYGEN_INTERNAL_DOCS@
|
||||
CASE_SENSE_NAMES = @DOXYGEN_CASE_SENSE_NAMES@
|
||||
HIDE_SCOPE_NAMES = @DOXYGEN_HIDE_SCOPE_NAMES@
|
||||
HIDE_COMPOUND_REFERENCE= @DOXYGEN_HIDE_COMPOUND_REFERENCE@
|
||||
SHOW_INCLUDE_FILES = @DOXYGEN_SHOW_INCLUDE_FILES@
|
||||
SHOW_GROUPED_MEMB_INC = @DOXYGEN_SHOW_GROUPED_MEMB_INC@
|
||||
FORCE_LOCAL_INCLUDES = @DOXYGEN_FORCE_LOCAL_INCLUDES@
|
||||
INLINE_INFO = @DOXYGEN_INLINE_INFO@
|
||||
SORT_MEMBER_DOCS = @DOXYGEN_SORT_MEMBER_DOCS@
|
||||
SORT_BRIEF_DOCS = @DOXYGEN_SORT_BRIEF_DOCS@
|
||||
SORT_MEMBERS_CTORS_1ST = @DOXYGEN_SORT_MEMBERS_CTORS_1ST@
|
||||
SORT_GROUP_NAMES = @DOXYGEN_SORT_GROUP_NAMES@
|
||||
SORT_BY_SCOPE_NAME = @DOXYGEN_SORT_BY_SCOPE_NAME@
|
||||
STRICT_PROTO_MATCHING = @DOXYGEN_STRICT_PROTO_MATCHING@
|
||||
GENERATE_TODOLIST = @DOXYGEN_GENERATE_TODOLIST@
|
||||
GENERATE_TESTLIST = @DOXYGEN_GENERATE_TESTLIST@
|
||||
GENERATE_BUGLIST = @DOXYGEN_GENERATE_BUGLIST@
|
||||
GENERATE_DEPRECATEDLIST= @DOXYGEN_GENERATE_DEPRECATEDLIST@
|
||||
ENABLED_SECTIONS = @DOXYGEN_ENABLED_SECTIONS@
|
||||
MAX_INITIALIZER_LINES = @DOXYGEN_MAX_INITIALIZER_LINES@
|
||||
SHOW_USED_FILES = @DOXYGEN_SHOW_USED_FILES@
|
||||
SHOW_FILES = @DOXYGEN_SHOW_FILES@
|
||||
SHOW_NAMESPACES = @DOXYGEN_SHOW_NAMESPACES@
|
||||
FILE_VERSION_FILTER = @DOXYGEN_FILE_VERSION_FILTER@
|
||||
LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
|
||||
CITE_BIB_FILES = @DOXYGEN_CITE_BIB_FILES@
|
||||
QUIET = @DOXYGEN_QUIET@
|
||||
WARNINGS = @DOXYGEN_WARNINGS@
|
||||
WARN_IF_UNDOCUMENTED = @DOXYGEN_WARN_IF_UNDOCUMENTED@
|
||||
WARN_IF_DOC_ERROR = @DOXYGEN_WARN_IF_DOC_ERROR@
|
||||
WARN_NO_PARAMDOC = @DOXYGEN_WARN_NO_PARAMDOC@
|
||||
WARN_AS_ERROR = @DOXYGEN_WARN_AS_ERROR@
|
||||
WARN_FORMAT = @DOXYGEN_WARN_FORMAT@
|
||||
WARN_LOGFILE = @DOXYGEN_WARN_LOGFILE@
|
||||
INPUT = @DOXYGEN_INPUT@
|
||||
INPUT_ENCODING = @DOXYGEN_INPUT_ENCODING@
|
||||
FILE_PATTERNS = @DOXYGEN_FILE_PATTERNS@
|
||||
RECURSIVE = @DOXYGEN_RECURSIVE@
|
||||
EXCLUDE = @DOXYGEN_EXCLUDE@
|
||||
EXCLUDE_SYMLINKS = @DOXYGEN_EXCLUDE_SYMLINKS@
|
||||
EXCLUDE_PATTERNS = @DOXYGEN_EXCLUDE_PATTERNS@
|
||||
EXCLUDE_SYMBOLS = @DOXYGEN_EXCLUDE_SYMBOLS@
|
||||
EXAMPLE_PATH = @DOXYGEN_EXAMPLE_PATH@
|
||||
EXAMPLE_PATTERNS = @DOXYGEN_EXAMPLE_PATTERNS@
|
||||
EXAMPLE_RECURSIVE = @DOXYGEN_EXAMPLE_RECURSIVE@
|
||||
IMAGE_PATH = @DOXYGEN_IMAGE_PATH@
|
||||
INPUT_FILTER = @DOXYGEN_INPUT_FILTER@
|
||||
FILTER_PATTERNS = @DOXYGEN_FILTER_PATTERNS@
|
||||
FILTER_SOURCE_FILES = @DOXYGEN_FILTER_SOURCE_FILES@
|
||||
FILTER_SOURCE_PATTERNS = @DOXYGEN_FILTER_SOURCE_PATTERNS@
|
||||
USE_MDFILE_AS_MAINPAGE = @DOXYGEN_USE_MDFILE_AS_MAINPAGE@
|
||||
SOURCE_BROWSER = @DOXYGEN_SOURCE_BROWSER@
|
||||
INLINE_SOURCES = @DOXYGEN_INLINE_SOURCES@
|
||||
STRIP_CODE_COMMENTS = @DOXYGEN_STRIP_CODE_COMMENTS@
|
||||
REFERENCED_BY_RELATION = @DOXYGEN_REFERENCED_BY_RELATION@
|
||||
REFERENCES_RELATION = @DOXYGEN_REFERENCES_RELATION@
|
||||
REFERENCES_LINK_SOURCE = @DOXYGEN_REFERENCES_LINK_SOURCE@
|
||||
SOURCE_TOOLTIPS = @DOXYGEN_SOURCE_TOOLTIPS@
|
||||
USE_HTAGS = @DOXYGEN_USE_HTAGS@
|
||||
VERBATIM_HEADERS = @DOXYGEN_VERBATIM_HEADERS@
|
||||
ALPHABETICAL_INDEX = @DOXYGEN_ALPHABETICAL_INDEX@
|
||||
COLS_IN_ALPHA_INDEX = @DOXYGEN_COLS_IN_ALPHA_INDEX@
|
||||
IGNORE_PREFIX = @DOXYGEN_IGNORE_PREFIX@
|
||||
GENERATE_HTML = @DOXYGEN_GENERATE_HTML@
|
||||
HTML_OUTPUT = @DOXYGEN_HTML_OUTPUT@
|
||||
HTML_FILE_EXTENSION = @DOXYGEN_HTML_FILE_EXTENSION@
|
||||
HTML_HEADER = @DOXYGEN_HTML_HEADER@
|
||||
HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
|
||||
HTML_STYLESHEET = @DOXYGEN_HTML_STYLESHEET@
|
||||
HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
|
||||
HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
|
||||
HTML_COLORSTYLE_HUE = @DOXYGEN_HTML_COLORSTYLE_HUE@
|
||||
HTML_COLORSTYLE_SAT = @DOXYGEN_HTML_COLORSTYLE_SAT@
|
||||
HTML_COLORSTYLE_GAMMA = @DOXYGEN_HTML_COLORSTYLE_GAMMA@
|
||||
HTML_TIMESTAMP = @DOXYGEN_HTML_TIMESTAMP@
|
||||
HTML_DYNAMIC_MENUS = @DOXYGEN_HTML_DYNAMIC_MENUS@
|
||||
HTML_DYNAMIC_SECTIONS = @DOXYGEN_HTML_DYNAMIC_SECTIONS@
|
||||
HTML_INDEX_NUM_ENTRIES = @DOXYGEN_HTML_INDEX_NUM_ENTRIES@
|
||||
GENERATE_DOCSET = @DOXYGEN_GENERATE_DOCSET@
|
||||
DOCSET_FEEDNAME = @DOXYGEN_DOCSET_FEEDNAME@
|
||||
DOCSET_BUNDLE_ID = @DOXYGEN_DOCSET_BUNDLE_ID@
|
||||
DOCSET_PUBLISHER_ID = @DOXYGEN_DOCSET_PUBLISHER_ID@
|
||||
DOCSET_PUBLISHER_NAME = @DOXYGEN_DOCSET_PUBLISHER_NAME@
|
||||
GENERATE_HTMLHELP = @DOXYGEN_GENERATE_HTMLHELP@
|
||||
CHM_FILE = @DOXYGEN_CHM_FILE@
|
||||
HHC_LOCATION = @DOXYGEN_HHC_LOCATION@
|
||||
GENERATE_CHI = @DOXYGEN_GENERATE_CHI@
|
||||
CHM_INDEX_ENCODING = @DOXYGEN_CHM_INDEX_ENCODING@
|
||||
BINARY_TOC = @DOXYGEN_BINARY_TOC@
|
||||
TOC_EXPAND = @DOXYGEN_TOC_EXPAND@
|
||||
GENERATE_QHP = @DOXYGEN_GENERATE_QHP@
|
||||
QCH_FILE = @DOXYGEN_QCH_FILE@
|
||||
QHP_NAMESPACE = @DOXYGEN_QHP_NAMESPACE@
|
||||
QHP_VIRTUAL_FOLDER = @DOXYGEN_QHP_VIRTUAL_FOLDER@
|
||||
QHP_CUST_FILTER_NAME = @DOXYGEN_QHP_CUST_FILTER_NAME@
|
||||
QHP_CUST_FILTER_ATTRS = @DOXYGEN_QHP_CUST_FILTER_ATTRS@
|
||||
QHP_SECT_FILTER_ATTRS = @DOXYGEN_QHP_SECT_FILTER_ATTRS@
|
||||
QHG_LOCATION = @DOXYGEN_QHG_LOCATION@
|
||||
GENERATE_ECLIPSEHELP = @DOXYGEN_GENERATE_ECLIPSEHELP@
|
||||
ECLIPSE_DOC_ID = @DOXYGEN_ECLIPSE_DOC_ID@
|
||||
DISABLE_INDEX = @DOXYGEN_DISABLE_INDEX@
|
||||
GENERATE_TREEVIEW = @DOXYGEN_GENERATE_TREEVIEW@
|
||||
ENUM_VALUES_PER_LINE = @DOXYGEN_ENUM_VALUES_PER_LINE@
|
||||
TREEVIEW_WIDTH = @DOXYGEN_TREEVIEW_WIDTH@
|
||||
EXT_LINKS_IN_WINDOW = @DOXYGEN_EXT_LINKS_IN_WINDOW@
|
||||
HTML_FORMULA_FORMAT = @DOXYGEN_HTML_FORMULA_FORMAT@
|
||||
FORMULA_FONTSIZE = @DOXYGEN_FORMULA_FONTSIZE@
|
||||
FORMULA_TRANSPARENT = @DOXYGEN_FORMULA_TRANSPARENT@
|
||||
FORMULA_MACROFILE = @DOXYGEN_FORMULA_MACROFILE@
|
||||
USE_MATHJAX = @DOXYGEN_USE_MATHJAX@
|
||||
MATHJAX_FORMAT = @DOXYGEN_MATHJAX_FORMAT@
|
||||
MATHJAX_RELPATH = @DOXYGEN_MATHJAX_RELPATH@
|
||||
MATHJAX_EXTENSIONS = @DOXYGEN_MATHJAX_EXTENSIONS@
|
||||
MATHJAX_CODEFILE = @DOXYGEN_MATHJAX_CODEFILE@
|
||||
SEARCHENGINE = @DOXYGEN_SEARCHENGINE@
|
||||
SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
|
||||
EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
|
||||
SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
|
||||
SEARCHDATA_FILE = @DOXYGEN_SEARCHDATA_FILE@
|
||||
EXTERNAL_SEARCH_ID = @DOXYGEN_EXTERNAL_SEARCH_ID@
|
||||
EXTRA_SEARCH_MAPPINGS = @DOXYGEN_EXTRA_SEARCH_MAPPINGS@
|
||||
GENERATE_LATEX = @DOXYGEN_GENERATE_LATEX@
|
||||
LATEX_OUTPUT = @DOXYGEN_LATEX_OUTPUT@
|
||||
LATEX_CMD_NAME = @DOXYGEN_LATEX_CMD_NAME@
|
||||
MAKEINDEX_CMD_NAME = @DOXYGEN_MAKEINDEX_CMD_NAME@
|
||||
LATEX_MAKEINDEX_CMD = @DOXYGEN_LATEX_MAKEINDEX_CMD@
|
||||
COMPACT_LATEX = @DOXYGEN_COMPACT_LATEX@
|
||||
PAPER_TYPE = @DOXYGEN_PAPER_TYPE@
|
||||
EXTRA_PACKAGES = @DOXYGEN_EXTRA_PACKAGES@
|
||||
LATEX_HEADER = @DOXYGEN_LATEX_HEADER@
|
||||
LATEX_FOOTER = @DOXYGEN_LATEX_FOOTER@
|
||||
LATEX_EXTRA_STYLESHEET = @DOXYGEN_LATEX_EXTRA_STYLESHEET@
|
||||
LATEX_EXTRA_FILES = @DOXYGEN_LATEX_EXTRA_FILES@
|
||||
PDF_HYPERLINKS = @DOXYGEN_PDF_HYPERLINKS@
|
||||
USE_PDFLATEX = @DOXYGEN_USE_PDFLATEX@
|
||||
LATEX_BATCHMODE = @DOXYGEN_LATEX_BATCHMODE@
|
||||
LATEX_HIDE_INDICES = @DOXYGEN_LATEX_HIDE_INDICES@
|
||||
LATEX_SOURCE_CODE = @DOXYGEN_LATEX_SOURCE_CODE@
|
||||
LATEX_BIB_STYLE = @DOXYGEN_LATEX_BIB_STYLE@
|
||||
LATEX_TIMESTAMP = @DOXYGEN_LATEX_TIMESTAMP@
|
||||
LATEX_EMOJI_DIRECTORY = @DOXYGEN_LATEX_EMOJI_DIRECTORY@
|
||||
GENERATE_RTF = @DOXYGEN_GENERATE_RTF@
|
||||
RTF_OUTPUT = @DOXYGEN_RTF_OUTPUT@
|
||||
COMPACT_RTF = @DOXYGEN_COMPACT_RTF@
|
||||
RTF_HYPERLINKS = @DOXYGEN_RTF_HYPERLINKS@
|
||||
RTF_STYLESHEET_FILE = @DOXYGEN_RTF_STYLESHEET_FILE@
|
||||
RTF_EXTENSIONS_FILE = @DOXYGEN_RTF_EXTENSIONS_FILE@
|
||||
RTF_SOURCE_CODE = @DOXYGEN_RTF_SOURCE_CODE@
|
||||
GENERATE_MAN = @DOXYGEN_GENERATE_MAN@
|
||||
MAN_OUTPUT = @DOXYGEN_MAN_OUTPUT@
|
||||
MAN_EXTENSION = @DOXYGEN_MAN_EXTENSION@
|
||||
MAN_SUBDIR = @DOXYGEN_MAN_SUBDIR@
|
||||
MAN_LINKS = @DOXYGEN_MAN_LINKS@
|
||||
GENERATE_XML = @DOXYGEN_GENERATE_XML@
|
||||
XML_OUTPUT = @DOXYGEN_XML_OUTPUT@
|
||||
XML_PROGRAMLISTING = @DOXYGEN_XML_PROGRAMLISTING@
|
||||
XML_NS_MEMB_FILE_SCOPE = @DOXYGEN_XML_NS_MEMB_FILE_SCOPE@
|
||||
GENERATE_DOCBOOK = @DOXYGEN_GENERATE_DOCBOOK@
|
||||
DOCBOOK_OUTPUT = @DOXYGEN_DOCBOOK_OUTPUT@
|
||||
DOCBOOK_PROGRAMLISTING = @DOXYGEN_DOCBOOK_PROGRAMLISTING@
|
||||
GENERATE_AUTOGEN_DEF = @DOXYGEN_GENERATE_AUTOGEN_DEF@
|
||||
GENERATE_PERLMOD = @DOXYGEN_GENERATE_PERLMOD@
|
||||
PERLMOD_LATEX = @DOXYGEN_PERLMOD_LATEX@
|
||||
PERLMOD_PRETTY = @DOXYGEN_PERLMOD_PRETTY@
|
||||
PERLMOD_MAKEVAR_PREFIX = @DOXYGEN_PERLMOD_MAKEVAR_PREFIX@
|
||||
ENABLE_PREPROCESSING = @DOXYGEN_ENABLE_PREPROCESSING@
|
||||
MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
|
||||
EXPAND_ONLY_PREDEF = @DOXYGEN_EXPAND_ONLY_PREDEF@
|
||||
SEARCH_INCLUDES = @DOXYGEN_SEARCH_INCLUDES@
|
||||
INCLUDE_PATH = @DOXYGEN_INCLUDE_PATH@
|
||||
INCLUDE_FILE_PATTERNS = @DOXYGEN_INCLUDE_FILE_PATTERNS@
|
||||
PREDEFINED = @DOXYGEN_PREDEFINED@
|
||||
EXPAND_AS_DEFINED = @DOXYGEN_EXPAND_AS_DEFINED@
|
||||
SKIP_FUNCTION_MACROS = @DOXYGEN_SKIP_FUNCTION_MACROS@
|
||||
TAGFILES = @DOXYGEN_TAGFILES@
|
||||
GENERATE_TAGFILE = @DOXYGEN_GENERATE_TAGFILE@
|
||||
ALLEXTERNALS = @DOXYGEN_ALLEXTERNALS@
|
||||
EXTERNAL_GROUPS = @DOXYGEN_EXTERNAL_GROUPS@
|
||||
EXTERNAL_PAGES = @DOXYGEN_EXTERNAL_PAGES@
|
||||
CLASS_DIAGRAMS = @DOXYGEN_CLASS_DIAGRAMS@
|
||||
DIA_PATH = @DOXYGEN_DIA_PATH@
|
||||
HIDE_UNDOC_RELATIONS = @DOXYGEN_HIDE_UNDOC_RELATIONS@
|
||||
HAVE_DOT = @DOXYGEN_HAVE_DOT@
|
||||
DOT_NUM_THREADS = @DOXYGEN_DOT_NUM_THREADS@
|
||||
DOT_FONTNAME = @DOXYGEN_DOT_FONTNAME@
|
||||
DOT_FONTSIZE = @DOXYGEN_DOT_FONTSIZE@
|
||||
DOT_FONTPATH = @DOXYGEN_DOT_FONTPATH@
|
||||
CLASS_GRAPH = @DOXYGEN_CLASS_GRAPH@
|
||||
COLLABORATION_GRAPH = @DOXYGEN_COLLABORATION_GRAPH@
|
||||
GROUP_GRAPHS = @DOXYGEN_GROUP_GRAPHS@
|
||||
UML_LOOK = @DOXYGEN_UML_LOOK@
|
||||
UML_LIMIT_NUM_FIELDS = @DOXYGEN_UML_LIMIT_NUM_FIELDS@
|
||||
TEMPLATE_RELATIONS = @DOXYGEN_TEMPLATE_RELATIONS@
|
||||
INCLUDE_GRAPH = @DOXYGEN_INCLUDE_GRAPH@
|
||||
INCLUDED_BY_GRAPH = @DOXYGEN_INCLUDED_BY_GRAPH@
|
||||
CALL_GRAPH = @DOXYGEN_CALL_GRAPH@
|
||||
CALLER_GRAPH = @DOXYGEN_CALLER_GRAPH@
|
||||
GRAPHICAL_HIERARCHY = @DOXYGEN_GRAPHICAL_HIERARCHY@
|
||||
DIRECTORY_GRAPH = @DOXYGEN_DIRECTORY_GRAPH@
|
||||
DOT_IMAGE_FORMAT = @DOXYGEN_DOT_IMAGE_FORMAT@
|
||||
INTERACTIVE_SVG = @DOXYGEN_INTERACTIVE_SVG@
|
||||
DOT_PATH = @DOXYGEN_DOT_PATH@
|
||||
DOTFILE_DIRS = @DOXYGEN_DOTFILE_DIRS@
|
||||
MSCFILE_DIRS = @DOXYGEN_MSCFILE_DIRS@
|
||||
DIAFILE_DIRS = @DOXYGEN_DIAFILE_DIRS@
|
||||
PLANTUML_JAR_PATH = @DOXYGEN_PLANTUML_JAR_PATH@
|
||||
PLANTUML_CFG_FILE = @DOXYGEN_PLANTUML_CFG_FILE@
|
||||
PLANTUML_INCLUDE_PATH = @DOXYGEN_PLANTUML_INCLUDE_PATH@
|
||||
DOT_GRAPH_MAX_NODES = @DOXYGEN_DOT_GRAPH_MAX_NODES@
|
||||
MAX_DOT_GRAPH_DEPTH = @DOXYGEN_MAX_DOT_GRAPH_DEPTH@
|
||||
DOT_TRANSPARENT = @DOXYGEN_DOT_TRANSPARENT@
|
||||
DOT_MULTI_TARGETS = @DOXYGEN_DOT_MULTI_TARGETS@
|
||||
GENERATE_LEGEND = @DOXYGEN_GENERATE_LEGEND@
|
||||
DOT_CLEANUP = @DOXYGEN_DOT_CLEANUP@
|
||||
678
src/CMakeDoxygenDefaults.cmake
Normal file
678
src/CMakeDoxygenDefaults.cmake
Normal file
@ -0,0 +1,678 @@
|
||||
#
|
||||
# DO NOT EDIT! THIS FILE WAS GENERATED BY CMAKE!
|
||||
#
|
||||
|
||||
if(NOT DEFINED DOXYGEN_DOXYFILE_ENCODING)
|
||||
set(DOXYGEN_DOXYFILE_ENCODING UTF-8)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_PROJECT_NAME)
|
||||
set(DOXYGEN_PROJECT_NAME "My Project")
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_CREATE_SUBDIRS)
|
||||
set(DOXYGEN_CREATE_SUBDIRS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_ALLOW_UNICODE_NAMES)
|
||||
set(DOXYGEN_ALLOW_UNICODE_NAMES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_OUTPUT_LANGUAGE)
|
||||
set(DOXYGEN_OUTPUT_LANGUAGE English)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_OUTPUT_TEXT_DIRECTION)
|
||||
set(DOXYGEN_OUTPUT_TEXT_DIRECTION None)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_BRIEF_MEMBER_DESC)
|
||||
set(DOXYGEN_BRIEF_MEMBER_DESC YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_REPEAT_BRIEF)
|
||||
set(DOXYGEN_REPEAT_BRIEF YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_ABBREVIATE_BRIEF)
|
||||
set(DOXYGEN_ABBREVIATE_BRIEF "The $name class"
|
||||
"The $name widget"
|
||||
"The $name file"
|
||||
is
|
||||
provides
|
||||
specifies
|
||||
contains
|
||||
represents
|
||||
a
|
||||
an
|
||||
the)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_ALWAYS_DETAILED_SEC)
|
||||
set(DOXYGEN_ALWAYS_DETAILED_SEC NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INLINE_INHERITED_MEMB)
|
||||
set(DOXYGEN_INLINE_INHERITED_MEMB NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_FULL_PATH_NAMES)
|
||||
set(DOXYGEN_FULL_PATH_NAMES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SHORT_NAMES)
|
||||
set(DOXYGEN_SHORT_NAMES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_JAVADOC_AUTOBRIEF)
|
||||
set(DOXYGEN_JAVADOC_AUTOBRIEF NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_JAVADOC_BANNER)
|
||||
set(DOXYGEN_JAVADOC_BANNER NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_QT_AUTOBRIEF)
|
||||
set(DOXYGEN_QT_AUTOBRIEF NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MULTILINE_CPP_IS_BRIEF)
|
||||
set(DOXYGEN_MULTILINE_CPP_IS_BRIEF NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_PYTHON_DOCSTRING)
|
||||
set(DOXYGEN_PYTHON_DOCSTRING YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INHERIT_DOCS)
|
||||
set(DOXYGEN_INHERIT_DOCS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SEPARATE_MEMBER_PAGES)
|
||||
set(DOXYGEN_SEPARATE_MEMBER_PAGES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_TAB_SIZE)
|
||||
set(DOXYGEN_TAB_SIZE 4)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_OPTIMIZE_OUTPUT_FOR_C)
|
||||
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_OPTIMIZE_OUTPUT_JAVA)
|
||||
set(DOXYGEN_OPTIMIZE_OUTPUT_JAVA NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_OPTIMIZE_FOR_FORTRAN)
|
||||
set(DOXYGEN_OPTIMIZE_FOR_FORTRAN NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_OPTIMIZE_OUTPUT_VHDL)
|
||||
set(DOXYGEN_OPTIMIZE_OUTPUT_VHDL NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_OPTIMIZE_OUTPUT_SLICE)
|
||||
set(DOXYGEN_OPTIMIZE_OUTPUT_SLICE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MARKDOWN_SUPPORT)
|
||||
set(DOXYGEN_MARKDOWN_SUPPORT YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_TOC_INCLUDE_HEADINGS)
|
||||
set(DOXYGEN_TOC_INCLUDE_HEADINGS 5)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_AUTOLINK_SUPPORT)
|
||||
set(DOXYGEN_AUTOLINK_SUPPORT YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_BUILTIN_STL_SUPPORT)
|
||||
set(DOXYGEN_BUILTIN_STL_SUPPORT NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_CPP_CLI_SUPPORT)
|
||||
set(DOXYGEN_CPP_CLI_SUPPORT NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SIP_SUPPORT)
|
||||
set(DOXYGEN_SIP_SUPPORT NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_IDL_PROPERTY_SUPPORT)
|
||||
set(DOXYGEN_IDL_PROPERTY_SUPPORT YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DISTRIBUTE_GROUP_DOC)
|
||||
set(DOXYGEN_DISTRIBUTE_GROUP_DOC NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GROUP_NESTED_COMPOUNDS)
|
||||
set(DOXYGEN_GROUP_NESTED_COMPOUNDS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SUBGROUPING)
|
||||
set(DOXYGEN_SUBGROUPING YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INLINE_GROUPED_CLASSES)
|
||||
set(DOXYGEN_INLINE_GROUPED_CLASSES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INLINE_SIMPLE_STRUCTS)
|
||||
set(DOXYGEN_INLINE_SIMPLE_STRUCTS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_TYPEDEF_HIDES_STRUCT)
|
||||
set(DOXYGEN_TYPEDEF_HIDES_STRUCT NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_LOOKUP_CACHE_SIZE)
|
||||
set(DOXYGEN_LOOKUP_CACHE_SIZE 0)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_NUM_PROC_THREADS)
|
||||
set(DOXYGEN_NUM_PROC_THREADS 1)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTRACT_ALL)
|
||||
set(DOXYGEN_EXTRACT_ALL NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTRACT_PRIVATE)
|
||||
set(DOXYGEN_EXTRACT_PRIVATE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTRACT_PRIV_VIRTUAL)
|
||||
set(DOXYGEN_EXTRACT_PRIV_VIRTUAL NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTRACT_PACKAGE)
|
||||
set(DOXYGEN_EXTRACT_PACKAGE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTRACT_STATIC)
|
||||
set(DOXYGEN_EXTRACT_STATIC NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTRACT_LOCAL_CLASSES)
|
||||
set(DOXYGEN_EXTRACT_LOCAL_CLASSES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTRACT_LOCAL_METHODS)
|
||||
set(DOXYGEN_EXTRACT_LOCAL_METHODS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTRACT_ANON_NSPACES)
|
||||
set(DOXYGEN_EXTRACT_ANON_NSPACES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HIDE_UNDOC_MEMBERS)
|
||||
set(DOXYGEN_HIDE_UNDOC_MEMBERS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HIDE_UNDOC_CLASSES)
|
||||
set(DOXYGEN_HIDE_UNDOC_CLASSES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HIDE_FRIEND_COMPOUNDS)
|
||||
set(DOXYGEN_HIDE_FRIEND_COMPOUNDS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HIDE_IN_BODY_DOCS)
|
||||
set(DOXYGEN_HIDE_IN_BODY_DOCS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INTERNAL_DOCS)
|
||||
set(DOXYGEN_INTERNAL_DOCS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_CASE_SENSE_NAMES)
|
||||
set(DOXYGEN_CASE_SENSE_NAMES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HIDE_SCOPE_NAMES)
|
||||
set(DOXYGEN_HIDE_SCOPE_NAMES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HIDE_COMPOUND_REFERENCE)
|
||||
set(DOXYGEN_HIDE_COMPOUND_REFERENCE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SHOW_INCLUDE_FILES)
|
||||
set(DOXYGEN_SHOW_INCLUDE_FILES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SHOW_GROUPED_MEMB_INC)
|
||||
set(DOXYGEN_SHOW_GROUPED_MEMB_INC NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_FORCE_LOCAL_INCLUDES)
|
||||
set(DOXYGEN_FORCE_LOCAL_INCLUDES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INLINE_INFO)
|
||||
set(DOXYGEN_INLINE_INFO YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SORT_MEMBER_DOCS)
|
||||
set(DOXYGEN_SORT_MEMBER_DOCS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SORT_BRIEF_DOCS)
|
||||
set(DOXYGEN_SORT_BRIEF_DOCS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SORT_MEMBERS_CTORS_1ST)
|
||||
set(DOXYGEN_SORT_MEMBERS_CTORS_1ST NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SORT_GROUP_NAMES)
|
||||
set(DOXYGEN_SORT_GROUP_NAMES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SORT_BY_SCOPE_NAME)
|
||||
set(DOXYGEN_SORT_BY_SCOPE_NAME NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_STRICT_PROTO_MATCHING)
|
||||
set(DOXYGEN_STRICT_PROTO_MATCHING NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_TODOLIST)
|
||||
set(DOXYGEN_GENERATE_TODOLIST YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_TESTLIST)
|
||||
set(DOXYGEN_GENERATE_TESTLIST YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_BUGLIST)
|
||||
set(DOXYGEN_GENERATE_BUGLIST YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_DEPRECATEDLIST)
|
||||
set(DOXYGEN_GENERATE_DEPRECATEDLIST YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MAX_INITIALIZER_LINES)
|
||||
set(DOXYGEN_MAX_INITIALIZER_LINES 30)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SHOW_USED_FILES)
|
||||
set(DOXYGEN_SHOW_USED_FILES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SHOW_FILES)
|
||||
set(DOXYGEN_SHOW_FILES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SHOW_NAMESPACES)
|
||||
set(DOXYGEN_SHOW_NAMESPACES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_QUIET)
|
||||
set(DOXYGEN_QUIET NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_WARNINGS)
|
||||
set(DOXYGEN_WARNINGS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_WARN_IF_UNDOCUMENTED)
|
||||
set(DOXYGEN_WARN_IF_UNDOCUMENTED YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_WARN_IF_DOC_ERROR)
|
||||
set(DOXYGEN_WARN_IF_DOC_ERROR YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_WARN_NO_PARAMDOC)
|
||||
set(DOXYGEN_WARN_NO_PARAMDOC NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_WARN_AS_ERROR)
|
||||
set(DOXYGEN_WARN_AS_ERROR NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_WARN_FORMAT)
|
||||
set(DOXYGEN_WARN_FORMAT "$file:$line: $text")
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INPUT_ENCODING)
|
||||
set(DOXYGEN_INPUT_ENCODING UTF-8)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_FILE_PATTERNS)
|
||||
set(DOXYGEN_FILE_PATTERNS *.c
|
||||
*.cc
|
||||
*.cxx
|
||||
*.cpp
|
||||
*.c++
|
||||
*.java
|
||||
*.ii
|
||||
*.ixx
|
||||
*.ipp
|
||||
*.i++
|
||||
*.inl
|
||||
*.idl
|
||||
*.ddl
|
||||
*.odl
|
||||
*.h
|
||||
*.hh
|
||||
*.hxx
|
||||
*.hpp
|
||||
*.h++
|
||||
*.cs
|
||||
*.d
|
||||
*.php
|
||||
*.php4
|
||||
*.php5
|
||||
*.phtml
|
||||
*.inc
|
||||
*.m
|
||||
*.markdown
|
||||
*.md
|
||||
*.mm
|
||||
*.dox
|
||||
*.doc
|
||||
*.txt
|
||||
*.py
|
||||
*.pyw
|
||||
*.f90
|
||||
*.f95
|
||||
*.f03
|
||||
*.f08
|
||||
*.f18
|
||||
*.f
|
||||
*.for
|
||||
*.vhd
|
||||
*.vhdl
|
||||
*.ucf
|
||||
*.qsf
|
||||
*.ice)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_RECURSIVE)
|
||||
set(DOXYGEN_RECURSIVE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXCLUDE_SYMLINKS)
|
||||
set(DOXYGEN_EXCLUDE_SYMLINKS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXAMPLE_PATTERNS)
|
||||
set(DOXYGEN_EXAMPLE_PATTERNS *)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXAMPLE_RECURSIVE)
|
||||
set(DOXYGEN_EXAMPLE_RECURSIVE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_FILTER_SOURCE_FILES)
|
||||
set(DOXYGEN_FILTER_SOURCE_FILES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SOURCE_BROWSER)
|
||||
set(DOXYGEN_SOURCE_BROWSER NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INLINE_SOURCES)
|
||||
set(DOXYGEN_INLINE_SOURCES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_STRIP_CODE_COMMENTS)
|
||||
set(DOXYGEN_STRIP_CODE_COMMENTS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_REFERENCED_BY_RELATION)
|
||||
set(DOXYGEN_REFERENCED_BY_RELATION NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_REFERENCES_RELATION)
|
||||
set(DOXYGEN_REFERENCES_RELATION NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_REFERENCES_LINK_SOURCE)
|
||||
set(DOXYGEN_REFERENCES_LINK_SOURCE YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SOURCE_TOOLTIPS)
|
||||
set(DOXYGEN_SOURCE_TOOLTIPS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_USE_HTAGS)
|
||||
set(DOXYGEN_USE_HTAGS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_VERBATIM_HEADERS)
|
||||
set(DOXYGEN_VERBATIM_HEADERS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_ALPHABETICAL_INDEX)
|
||||
set(DOXYGEN_ALPHABETICAL_INDEX YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_COLS_IN_ALPHA_INDEX)
|
||||
set(DOXYGEN_COLS_IN_ALPHA_INDEX 5)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_HTML)
|
||||
set(DOXYGEN_GENERATE_HTML YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_OUTPUT)
|
||||
set(DOXYGEN_HTML_OUTPUT html)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_FILE_EXTENSION)
|
||||
set(DOXYGEN_HTML_FILE_EXTENSION .html)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_COLORSTYLE_HUE)
|
||||
set(DOXYGEN_HTML_COLORSTYLE_HUE 220)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_COLORSTYLE_SAT)
|
||||
set(DOXYGEN_HTML_COLORSTYLE_SAT 100)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_COLORSTYLE_GAMMA)
|
||||
set(DOXYGEN_HTML_COLORSTYLE_GAMMA 80)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_TIMESTAMP)
|
||||
set(DOXYGEN_HTML_TIMESTAMP NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_DYNAMIC_MENUS)
|
||||
set(DOXYGEN_HTML_DYNAMIC_MENUS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_DYNAMIC_SECTIONS)
|
||||
set(DOXYGEN_HTML_DYNAMIC_SECTIONS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_INDEX_NUM_ENTRIES)
|
||||
set(DOXYGEN_HTML_INDEX_NUM_ENTRIES 100)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_DOCSET)
|
||||
set(DOXYGEN_GENERATE_DOCSET NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOCSET_FEEDNAME)
|
||||
set(DOXYGEN_DOCSET_FEEDNAME "Doxygen generated docs")
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOCSET_BUNDLE_ID)
|
||||
set(DOXYGEN_DOCSET_BUNDLE_ID org.doxygen.Project)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOCSET_PUBLISHER_ID)
|
||||
set(DOXYGEN_DOCSET_PUBLISHER_ID org.doxygen.Publisher)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOCSET_PUBLISHER_NAME)
|
||||
set(DOXYGEN_DOCSET_PUBLISHER_NAME Publisher)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_HTMLHELP)
|
||||
set(DOXYGEN_GENERATE_HTMLHELP NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_CHI)
|
||||
set(DOXYGEN_GENERATE_CHI NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_BINARY_TOC)
|
||||
set(DOXYGEN_BINARY_TOC NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_TOC_EXPAND)
|
||||
set(DOXYGEN_TOC_EXPAND NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_QHP)
|
||||
set(DOXYGEN_GENERATE_QHP NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_QHP_NAMESPACE)
|
||||
set(DOXYGEN_QHP_NAMESPACE org.doxygen.Project)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_QHP_VIRTUAL_FOLDER)
|
||||
set(DOXYGEN_QHP_VIRTUAL_FOLDER doc)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_ECLIPSEHELP)
|
||||
set(DOXYGEN_GENERATE_ECLIPSEHELP NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_ECLIPSE_DOC_ID)
|
||||
set(DOXYGEN_ECLIPSE_DOC_ID org.doxygen.Project)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DISABLE_INDEX)
|
||||
set(DOXYGEN_DISABLE_INDEX NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_TREEVIEW)
|
||||
set(DOXYGEN_GENERATE_TREEVIEW NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_ENUM_VALUES_PER_LINE)
|
||||
set(DOXYGEN_ENUM_VALUES_PER_LINE 4)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_TREEVIEW_WIDTH)
|
||||
set(DOXYGEN_TREEVIEW_WIDTH 250)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXT_LINKS_IN_WINDOW)
|
||||
set(DOXYGEN_EXT_LINKS_IN_WINDOW NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HTML_FORMULA_FORMAT)
|
||||
set(DOXYGEN_HTML_FORMULA_FORMAT png)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_FORMULA_FONTSIZE)
|
||||
set(DOXYGEN_FORMULA_FONTSIZE 10)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_FORMULA_TRANSPARENT)
|
||||
set(DOXYGEN_FORMULA_TRANSPARENT YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_USE_MATHJAX)
|
||||
set(DOXYGEN_USE_MATHJAX NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MATHJAX_FORMAT)
|
||||
set(DOXYGEN_MATHJAX_FORMAT HTML-CSS)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MATHJAX_RELPATH)
|
||||
set(DOXYGEN_MATHJAX_RELPATH https://cdn.jsdelivr.net/npm/mathjax@2)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SEARCHENGINE)
|
||||
set(DOXYGEN_SEARCHENGINE YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SERVER_BASED_SEARCH)
|
||||
set(DOXYGEN_SERVER_BASED_SEARCH NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTERNAL_SEARCH)
|
||||
set(DOXYGEN_EXTERNAL_SEARCH NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SEARCHDATA_FILE)
|
||||
set(DOXYGEN_SEARCHDATA_FILE searchdata.xml)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_LATEX)
|
||||
set(DOXYGEN_GENERATE_LATEX YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_LATEX_OUTPUT)
|
||||
set(DOXYGEN_LATEX_OUTPUT latex)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MAKEINDEX_CMD_NAME)
|
||||
set(DOXYGEN_MAKEINDEX_CMD_NAME makeindex)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_LATEX_MAKEINDEX_CMD)
|
||||
set(DOXYGEN_LATEX_MAKEINDEX_CMD makeindex)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_COMPACT_LATEX)
|
||||
set(DOXYGEN_COMPACT_LATEX NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_PAPER_TYPE)
|
||||
set(DOXYGEN_PAPER_TYPE a4)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_PDF_HYPERLINKS)
|
||||
set(DOXYGEN_PDF_HYPERLINKS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_USE_PDFLATEX)
|
||||
set(DOXYGEN_USE_PDFLATEX YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_LATEX_BATCHMODE)
|
||||
set(DOXYGEN_LATEX_BATCHMODE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_LATEX_HIDE_INDICES)
|
||||
set(DOXYGEN_LATEX_HIDE_INDICES NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_LATEX_SOURCE_CODE)
|
||||
set(DOXYGEN_LATEX_SOURCE_CODE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_LATEX_BIB_STYLE)
|
||||
set(DOXYGEN_LATEX_BIB_STYLE plain)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_LATEX_TIMESTAMP)
|
||||
set(DOXYGEN_LATEX_TIMESTAMP NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_RTF)
|
||||
set(DOXYGEN_GENERATE_RTF NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_RTF_OUTPUT)
|
||||
set(DOXYGEN_RTF_OUTPUT rtf)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_COMPACT_RTF)
|
||||
set(DOXYGEN_COMPACT_RTF NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_RTF_HYPERLINKS)
|
||||
set(DOXYGEN_RTF_HYPERLINKS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_RTF_SOURCE_CODE)
|
||||
set(DOXYGEN_RTF_SOURCE_CODE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_MAN)
|
||||
set(DOXYGEN_GENERATE_MAN NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MAN_OUTPUT)
|
||||
set(DOXYGEN_MAN_OUTPUT man)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MAN_EXTENSION)
|
||||
set(DOXYGEN_MAN_EXTENSION .3)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MAN_LINKS)
|
||||
set(DOXYGEN_MAN_LINKS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_XML)
|
||||
set(DOXYGEN_GENERATE_XML NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_XML_OUTPUT)
|
||||
set(DOXYGEN_XML_OUTPUT xml)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_XML_PROGRAMLISTING)
|
||||
set(DOXYGEN_XML_PROGRAMLISTING YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_XML_NS_MEMB_FILE_SCOPE)
|
||||
set(DOXYGEN_XML_NS_MEMB_FILE_SCOPE NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_DOCBOOK)
|
||||
set(DOXYGEN_GENERATE_DOCBOOK NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOCBOOK_OUTPUT)
|
||||
set(DOXYGEN_DOCBOOK_OUTPUT docbook)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOCBOOK_PROGRAMLISTING)
|
||||
set(DOXYGEN_DOCBOOK_PROGRAMLISTING NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_AUTOGEN_DEF)
|
||||
set(DOXYGEN_GENERATE_AUTOGEN_DEF NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_PERLMOD)
|
||||
set(DOXYGEN_GENERATE_PERLMOD NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_PERLMOD_LATEX)
|
||||
set(DOXYGEN_PERLMOD_LATEX NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_PERLMOD_PRETTY)
|
||||
set(DOXYGEN_PERLMOD_PRETTY YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_ENABLE_PREPROCESSING)
|
||||
set(DOXYGEN_ENABLE_PREPROCESSING YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MACRO_EXPANSION)
|
||||
set(DOXYGEN_MACRO_EXPANSION NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXPAND_ONLY_PREDEF)
|
||||
set(DOXYGEN_EXPAND_ONLY_PREDEF NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SEARCH_INCLUDES)
|
||||
set(DOXYGEN_SEARCH_INCLUDES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_SKIP_FUNCTION_MACROS)
|
||||
set(DOXYGEN_SKIP_FUNCTION_MACROS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_ALLEXTERNALS)
|
||||
set(DOXYGEN_ALLEXTERNALS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTERNAL_GROUPS)
|
||||
set(DOXYGEN_EXTERNAL_GROUPS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_EXTERNAL_PAGES)
|
||||
set(DOXYGEN_EXTERNAL_PAGES YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_CLASS_DIAGRAMS)
|
||||
set(DOXYGEN_CLASS_DIAGRAMS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HIDE_UNDOC_RELATIONS)
|
||||
set(DOXYGEN_HIDE_UNDOC_RELATIONS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_HAVE_DOT)
|
||||
set(DOXYGEN_HAVE_DOT NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOT_NUM_THREADS)
|
||||
set(DOXYGEN_DOT_NUM_THREADS 0)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOT_FONTNAME)
|
||||
set(DOXYGEN_DOT_FONTNAME Helvetica)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOT_FONTSIZE)
|
||||
set(DOXYGEN_DOT_FONTSIZE 10)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_CLASS_GRAPH)
|
||||
set(DOXYGEN_CLASS_GRAPH YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_COLLABORATION_GRAPH)
|
||||
set(DOXYGEN_COLLABORATION_GRAPH YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GROUP_GRAPHS)
|
||||
set(DOXYGEN_GROUP_GRAPHS YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_UML_LOOK)
|
||||
set(DOXYGEN_UML_LOOK NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_UML_LIMIT_NUM_FIELDS)
|
||||
set(DOXYGEN_UML_LIMIT_NUM_FIELDS 10)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_TEMPLATE_RELATIONS)
|
||||
set(DOXYGEN_TEMPLATE_RELATIONS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INCLUDE_GRAPH)
|
||||
set(DOXYGEN_INCLUDE_GRAPH YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INCLUDED_BY_GRAPH)
|
||||
set(DOXYGEN_INCLUDED_BY_GRAPH YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_CALL_GRAPH)
|
||||
set(DOXYGEN_CALL_GRAPH NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_CALLER_GRAPH)
|
||||
set(DOXYGEN_CALLER_GRAPH NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GRAPHICAL_HIERARCHY)
|
||||
set(DOXYGEN_GRAPHICAL_HIERARCHY YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DIRECTORY_GRAPH)
|
||||
set(DOXYGEN_DIRECTORY_GRAPH YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOT_IMAGE_FORMAT)
|
||||
set(DOXYGEN_DOT_IMAGE_FORMAT png)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_INTERACTIVE_SVG)
|
||||
set(DOXYGEN_INTERACTIVE_SVG NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOT_GRAPH_MAX_NODES)
|
||||
set(DOXYGEN_DOT_GRAPH_MAX_NODES 50)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_MAX_DOT_GRAPH_DEPTH)
|
||||
set(DOXYGEN_MAX_DOT_GRAPH_DEPTH 0)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOT_TRANSPARENT)
|
||||
set(DOXYGEN_DOT_TRANSPARENT NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOT_MULTI_TARGETS)
|
||||
set(DOXYGEN_DOT_MULTI_TARGETS NO)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_GENERATE_LEGEND)
|
||||
set(DOXYGEN_GENERATE_LEGEND YES)
|
||||
endif()
|
||||
if(NOT DEFINED DOXYGEN_DOT_CLEANUP)
|
||||
set(DOXYGEN_DOT_CLEANUP YES)
|
||||
endif()
|
||||
2482
src/Doxyfile
Executable file
2482
src/Doxyfile
Executable file
File diff suppressed because it is too large
Load Diff
1016
src/Makefile
Normal file
1016
src/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
579
src/ag_gen/ag_gen.cpp
Executable file
579
src/ag_gen/ag_gen.cpp
Executable file
@ -0,0 +1,579 @@
|
||||
// ag_gen.cpp contains the methods for building an attack graph and generating
|
||||
// an attack graph's exploits and printing them
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
#include <omp.h>
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ag_gen.h"
|
||||
|
||||
#include "../util/odometer.h"
|
||||
#include "../util/db_functions.h"
|
||||
|
||||
#ifdef REDIS
|
||||
|
||||
/**
|
||||
* @brief Constructor for generator
|
||||
* @details Builds a generator for creating attack graphs.
|
||||
*
|
||||
* @param _instance The initial information for generating the graph
|
||||
*/
|
||||
AGGen::AGGen(AGGenInstance &_instance, RedisManager &_rman) : instance(_instance), rman(&_rman) {
|
||||
rman->clear();
|
||||
auto init_quals = instance.initial_qualities;
|
||||
auto init_topos = instance.initial_topologies;
|
||||
NetworkState init_state(init_quals, init_topos);
|
||||
init_state.set_id();
|
||||
int init_id = init_state.get_id();
|
||||
FactbaseItems init_items =
|
||||
make_tuple(make_tuple(init_quals, init_topos), init_id);
|
||||
instance.factbases.push_back(init_state.get_factbase());
|
||||
instance.factbase_items.push_back(init_items);
|
||||
std::string hash = std::to_string(init_state.get_hash(instance.facts));
|
||||
// std::cout << "before init insertion" << std::endl;
|
||||
rman->insert_factbase(hash, init_id);
|
||||
// rman->insert_facts(hash, init_quals, init_topos);
|
||||
rman->commit();
|
||||
// std::cout << "after init insertion" << std::endl;
|
||||
// hash_map.insert(std::make_pair(init_state.get_hash(instance.facts), init_id));
|
||||
frontier.push_back(init_state);
|
||||
use_redis = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
AGGen::AGGen(AGGenInstance &_instance) : instance(_instance) {
|
||||
auto init_quals = instance.initial_qualities;
|
||||
auto init_topos = instance.initial_topologies;
|
||||
NetworkState init_state(init_quals, init_topos);//instantiate an obj init_state with initial input
|
||||
init_state.set_id();
|
||||
int init_id = init_state.get_id();
|
||||
FactbaseItems init_items =
|
||||
make_tuple(make_tuple(init_quals, init_topos), init_id);
|
||||
instance.factbases.push_back(init_state.get_factbase());
|
||||
instance.factbase_items.push_back(init_items);
|
||||
std::string hash = std::to_string(init_state.get_hash(instance.facts));
|
||||
hash_map.insert(std::make_pair(init_state.get_hash(instance.facts), init_id));
|
||||
frontier.push_back(init_state);
|
||||
use_redis = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generates exploit postconditions
|
||||
* @details When an exploit is known to apply to a set of assets,
|
||||
* the postconditions must be generated. This is done by iterating
|
||||
* through each parameterized fact and inserting the applicable
|
||||
* assets.
|
||||
*
|
||||
* @param group A tuple containing the exploit and applicable assets
|
||||
* @return A tuple containing the "real" qualities and "real" topologies
|
||||
*/
|
||||
static std::tuple<std::vector<std::tuple<ACTION_T, Quality>>, std::vector<std::tuple<ACTION_T, Topology>>>
|
||||
createPostConditions(std::tuple<Exploit, AssetGroup> &group, Keyvalue &facts) {
|
||||
auto ex = std::get<0>(group);
|
||||
auto ag = std::get<1>(group);
|
||||
|
||||
auto perm = ag.get_perm();
|
||||
|
||||
auto param_postconds_q = ex.postcond_list_q();
|
||||
auto param_postconds_t = ex.postcond_list_t();
|
||||
|
||||
std::vector<std::tuple<ACTION_T, Quality>> postconds_q;
|
||||
std::vector<std::tuple<ACTION_T, Topology>> postconds_t;
|
||||
|
||||
for (auto &postcond : param_postconds_q) {
|
||||
auto action = std::get<0>(postcond);
|
||||
auto fact = std::get<1>(postcond);
|
||||
|
||||
Quality q(perm[fact.get_param_num()], fact.name, fact.op,
|
||||
fact.value, facts);
|
||||
postconds_q.emplace_back(action, q);
|
||||
}
|
||||
|
||||
for (auto &postcond : param_postconds_t) {
|
||||
auto action = std::get<0>(postcond);
|
||||
auto fact = std::get<1>(postcond);
|
||||
|
||||
auto dir = fact.get_dir();
|
||||
auto prop = fact.get_property();
|
||||
auto op = fact.get_operation();
|
||||
auto val = fact.get_value();
|
||||
|
||||
Topology t(perm[fact.get_from_param()],
|
||||
perm[fact.get_to_param()], dir, prop, op, val, facts);
|
||||
postconds_t.emplace_back(action, t);
|
||||
}
|
||||
return make_tuple(postconds_q, postconds_t);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generate attack graph
|
||||
* @details Begin the generation of the attack graph. The algorithm is as
|
||||
* follows:
|
||||
*
|
||||
* 1. Fetch next factbase to expand from the frontier
|
||||
* 2. Fetch all exploits
|
||||
* 3. Loop over each exploit to determine if it is applicable.
|
||||
* a. Fetch preconditions of the exploit
|
||||
* b. Generate all permutations of assets using the Odometer utility
|
||||
* c. Apply each permutation of the assets to the preconditions.
|
||||
* d. Check if ALL generated preconditions are present in the current
|
||||
* factbase. 4a. If all preconditions are found, apply the matching asset group
|
||||
* to the postconditions of the exploit. 4b. If not all preconditions are found,
|
||||
* break and continue checking with the next exploit.
|
||||
* 5. Push the new network state onto the frontier to be expanded later.
|
||||
*/
|
||||
AGGenInstance &AGGen::generate(bool batch_process, int batch_size, int numThrd, int initQSize ) {
|
||||
std::vector<Exploit> exploit_list = instance.exploits;
|
||||
|
||||
//Create a vector that contains all the groups of exploits to be fired synchonously
|
||||
std::vector<std::string> ex_groups;
|
||||
for (const auto &ex : exploit_list) {
|
||||
//If the group isn't already in the vector
|
||||
if(!(std::find(ex_groups.begin(), ex_groups.end(), ex.get_group()) !=ex_groups.end())) {
|
||||
//Don't include the "no" group
|
||||
if(ex.get_group()!="null")
|
||||
ex_groups.emplace_back(ex.get_group());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Print out the groups if desired
|
||||
std::cout <<"\nThere are "<<ex_groups.size()<<" groups: ";
|
||||
for(int i=0; i<ex_groups.size(); i++){
|
||||
std::cout<<ex_groups[i] << ". ";
|
||||
}
|
||||
std::cout<<"\n";
|
||||
|
||||
auto counter = 0;
|
||||
auto start = std::chrono::system_clock::now();
|
||||
|
||||
unsigned long esize = exploit_list.size();
|
||||
printf("esize: %lu\n", esize);
|
||||
bool save_queued = false;
|
||||
|
||||
std::cout << "Generating Attack Graph" << std::endl;
|
||||
|
||||
std::unordered_map<size_t, PermSet<size_t>> od_map;
|
||||
size_t assets_size = instance.assets.size();
|
||||
for (const auto &ex : exploit_list) {
|
||||
size_t num_params = ex.get_num_params();
|
||||
if (od_map.find(num_params) == od_map.end()) {
|
||||
Odometer<size_t> od(num_params, assets_size);
|
||||
od_map[num_params] = od.get_all();
|
||||
}
|
||||
}
|
||||
//might be where to apply parallelization.
|
||||
while (frontier.size()<initQSize){//while starts, test multiple thread case THIS WAS THE ONE MING USED
|
||||
//while (frontier.size()!=0){//while starts, test single thread case
|
||||
// while(!frontier.empty()) {
|
||||
auto current_state = frontier.back();
|
||||
auto current_hash = current_state.get_hash(instance.facts);
|
||||
frontier.pop_back();
|
||||
std::vector<std::tuple<Exploit, AssetGroup>> appl_exploits;
|
||||
for (size_t i = 0; i < esize; i++) {//for loop for applicable exploits starts
|
||||
auto e = exploit_list.at(i);
|
||||
size_t num_params = e.get_num_params();
|
||||
auto preconds_q = e.precond_list_q();
|
||||
auto preconds_t = e.precond_list_t();
|
||||
auto perms = od_map[num_params];
|
||||
std::vector<AssetGroup> asset_groups;
|
||||
for (auto perm : perms) {
|
||||
std::vector<Quality> asset_group_quals;
|
||||
std::vector<Topology> asset_group_topos;
|
||||
asset_group_quals.reserve(preconds_q.size());
|
||||
asset_group_topos.reserve(preconds_t.size());
|
||||
for (auto &precond : preconds_q) {
|
||||
asset_group_quals.emplace_back(
|
||||
perm[precond.get_param_num()], precond.name, precond.op,
|
||||
precond.value, instance.facts);
|
||||
}
|
||||
for (auto &precond : preconds_t) {
|
||||
auto dir = precond.get_dir();
|
||||
auto prop = precond.get_property();
|
||||
auto op = precond.get_operation();
|
||||
auto val = precond.get_value();
|
||||
|
||||
asset_group_topos.emplace_back(
|
||||
perm[precond.get_from_param()],
|
||||
perm[precond.get_to_param()], dir, prop, op, val, instance.facts);
|
||||
}
|
||||
|
||||
asset_groups.emplace_back(asset_group_quals, asset_group_topos,
|
||||
perm);
|
||||
}
|
||||
auto assetgroup_size = asset_groups.size();
|
||||
for (size_t j = 0; j < assetgroup_size; j++) {
|
||||
auto asset_group = asset_groups.at(j);
|
||||
for (auto &quality : asset_group.get_hypo_quals()) {
|
||||
if (!current_state.get_factbase().find_quality(quality)) {
|
||||
goto LOOPCONTINUE;
|
||||
}
|
||||
}
|
||||
for (auto &topology : asset_group.get_hypo_topos()) {
|
||||
if (!current_state.get_factbase().find_topology(topology)) {
|
||||
goto LOOPCONTINUE;
|
||||
}
|
||||
}
|
||||
//MING DID NOT HAVE THIS CRITICAL, BUT KYLE DID
|
||||
// #pragma omp critical
|
||||
{
|
||||
auto new_appl_exploit = std::make_tuple(e, asset_group);
|
||||
appl_exploits.push_back(new_appl_exploit);
|
||||
}
|
||||
LOOPCONTINUE:;
|
||||
}
|
||||
} //for loop for applicable exploits ends
|
||||
|
||||
auto appl_expl_size = appl_exploits.size();
|
||||
for (size_t j = 0; j < appl_expl_size; j++) { //for loop for new states starts
|
||||
auto e = appl_exploits.at(j);
|
||||
auto exploit = std::get<0>(e);
|
||||
auto assetGroup = std::get<1>(e);
|
||||
auto postconditions = createPostConditions(e, instance.facts);
|
||||
auto qualities = std::get<0>(postconditions);
|
||||
auto topologies = std::get<1>(postconditions);
|
||||
NetworkState new_state{current_state};
|
||||
for(auto &qual : qualities) {
|
||||
auto action = std::get<0>(qual);
|
||||
auto fact = std::get<1>(qual);
|
||||
switch(action) {
|
||||
case ADD_T:
|
||||
new_state.add_quality(fact);
|
||||
break;
|
||||
case UPDATE_T:
|
||||
new_state.update_quality(fact);
|
||||
break;
|
||||
case DELETE_T:
|
||||
new_state.delete_quality(fact);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(auto &topo : topologies) {
|
||||
auto action = std::get<0>(topo);
|
||||
auto fact = std::get<1>(topo);
|
||||
switch(action) {
|
||||
case ADD_T:
|
||||
new_state.add_topology(fact);
|
||||
break;
|
||||
case UPDATE_T:
|
||||
new_state.update_topology(fact);
|
||||
break;
|
||||
case DELETE_T:
|
||||
new_state.delete_topology(fact);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto hash_num = new_state.get_hash(instance.facts);
|
||||
if (hash_num == current_hash)
|
||||
continue;
|
||||
if (hash_map.find(hash_num) == hash_map.end()) {
|
||||
new_state.set_id();
|
||||
auto facts_tuple = new_state.get_factbase().get_facts_tuple();
|
||||
FactbaseItems new_items =
|
||||
std::make_tuple(facts_tuple, new_state.get_id());
|
||||
instance.factbase_items.push_back(new_items);
|
||||
instance.factbases.push_back(new_state.get_factbase());
|
||||
hash_map.insert(std::make_pair(new_state.get_hash(instance.facts), new_state.get_id()));
|
||||
frontier.emplace_front(new_state);
|
||||
Edge ed(current_state.get_id(), new_state.get_id(), exploit, assetGroup);
|
||||
ed.set_id();
|
||||
instance.edges.push_back(ed);
|
||||
counter++;
|
||||
}
|
||||
else {
|
||||
int id = hash_map[hash_num];
|
||||
Edge ed(current_state.get_id(), id, exploit, assetGroup);
|
||||
ed.set_id();
|
||||
instance.edges.push_back(ed);
|
||||
}
|
||||
} //for loop for new states ends
|
||||
} //while ends
|
||||
|
||||
//int numThrd=32;
|
||||
printf("The number of threads used is %d\n",numThrd);
|
||||
printf("The initial QSize is %d\n",initQSize);
|
||||
int frt_size=frontier.size();
|
||||
printf("The actual QSize to start using multiple threads is %d\n",frt_size);
|
||||
|
||||
|
||||
double total_t=0.0;
|
||||
struct timeval t1,t2;
|
||||
gettimeofday(&t1,NULL);
|
||||
//#pragma omp parallel for num_threads(numThrd) default(none) shared(esize,counter,exploit_list,od_map,frt_size,total_t,t1,t2) schedule(dynamic,1)
|
||||
#pragma omp parallel for num_threads(numThrd) default(none) shared(esize,counter,exploit_list,od_map,frt_size,total_t,t1,t2,std::cout) schedule(dynamic,1)
|
||||
//auto ag_start = std::chrono::system_clock::now();
|
||||
for(int k=0;k<frt_size;k++){
|
||||
|
||||
|
||||
//printf("State %d in Frontier\n",k);
|
||||
std::deque<NetworkState> localFrontier;
|
||||
localFrontier.emplace_front(frontier[k]);
|
||||
while (!localFrontier.empty()){//while starts
|
||||
//std::cout<<"SIZE: "<<localFrontier.size()<<std::endl;
|
||||
auto current_state = localFrontier.back();
|
||||
auto current_hash = current_state.get_hash(instance.facts);
|
||||
localFrontier.pop_back();
|
||||
std::vector<std::tuple<Exploit, AssetGroup>> appl_exploits;
|
||||
for (size_t i = 0; i < esize; i++) {//for loop for applicable exploits starts
|
||||
auto e = exploit_list.at(i);
|
||||
size_t num_params = e.get_num_params();
|
||||
auto preconds_q = e.precond_list_q();
|
||||
auto preconds_t = e.precond_list_t();
|
||||
auto perms = od_map[num_params];
|
||||
std::vector<AssetGroup> asset_groups;
|
||||
for (auto perm : perms) {
|
||||
std::vector<Quality> asset_group_quals;
|
||||
std::vector<Topology> asset_group_topos;
|
||||
asset_group_quals.reserve(preconds_q.size());
|
||||
asset_group_topos.reserve(preconds_t.size());
|
||||
|
||||
|
||||
//std::vector<int>::size_type sz;
|
||||
//sz=asset_group_quals.capacity();
|
||||
for (auto &precond : preconds_q) {
|
||||
|
||||
//Old quality encode caused this to crash
|
||||
asset_group_quals.emplace_back(
|
||||
perm[precond.get_param_num()], precond.name, precond.op,
|
||||
precond.value, instance.facts);
|
||||
}
|
||||
for (auto &precond : preconds_t) {
|
||||
auto dir = precond.get_dir();
|
||||
auto prop = precond.get_property();
|
||||
auto op = precond.get_operation();
|
||||
auto val = precond.get_value();
|
||||
asset_group_topos.emplace_back(
|
||||
perm[precond.get_from_param()],
|
||||
perm[precond.get_to_param()], dir, prop, op, val, instance.facts);
|
||||
}
|
||||
asset_groups.emplace_back(asset_group_quals, asset_group_topos,
|
||||
perm);
|
||||
}
|
||||
auto assetgroup_size = asset_groups.size();
|
||||
for (size_t j = 0; j < assetgroup_size; j++) {
|
||||
auto asset_group = asset_groups.at(j);
|
||||
for (auto &quality : asset_group.get_hypo_quals()) {
|
||||
if (!current_state.get_factbase().find_quality(quality)) {
|
||||
goto LOOPCONTINUE1;
|
||||
}
|
||||
}
|
||||
for (auto &topology : asset_group.get_hypo_topos()) {
|
||||
if (!current_state.get_factbase().find_topology(topology)) {
|
||||
goto LOOPCONTINUE1;
|
||||
}
|
||||
}
|
||||
{
|
||||
auto new_appl_exploit = std::make_tuple(e, asset_group);
|
||||
appl_exploits.push_back(new_appl_exploit);
|
||||
}
|
||||
LOOPCONTINUE1:;
|
||||
}
|
||||
} //for loop for applicable exploits ends
|
||||
|
||||
|
||||
auto appl_expl_size = appl_exploits.size();
|
||||
|
||||
//skip flag is used to ensure that the egroup loop is not repeatedly run more than necessary
|
||||
int skip_flag=0;
|
||||
|
||||
//for (size_t j = 0; j < appl_expl_size; j++) { //(OLD) for loop for new states starts
|
||||
|
||||
//vector for holding the appl_exploits indices at which groups exist
|
||||
std::vector<int> idr_idx;
|
||||
|
||||
//vector for holding indices that have already fired
|
||||
std::vector<int> fired_idx;
|
||||
|
||||
//iterator for the applicable exploits vector
|
||||
auto itr=appl_exploits.begin();
|
||||
|
||||
int break_flag=0;
|
||||
int testing_flag=0;
|
||||
//loop through the vector
|
||||
for(auto itr=appl_exploits.begin(); itr!=appl_exploits.end(); itr++){
|
||||
//keep track of index for later use
|
||||
auto index=std::distance(appl_exploits.begin(), itr);
|
||||
//reset break flag
|
||||
break_flag=0;
|
||||
|
||||
//To avoid double-fire, check if an index has already been run.
|
||||
//If it has, then there is no need to run through this loop again.
|
||||
for(auto itr_f=fired_idx.begin(); itr_f!=fired_idx.end(); itr_f++){
|
||||
auto index_f=std::distance(fired_idx.begin(),itr_f);
|
||||
if(index==index_f)
|
||||
break_flag=1;
|
||||
}
|
||||
|
||||
if (break_flag==1)
|
||||
break;
|
||||
|
||||
//empty the appl_exploits index vector at the start of each loop so that
|
||||
//it doesn't contain stale data from a previous loop
|
||||
idr_idx.clear();
|
||||
|
||||
NetworkState new_state{current_state};
|
||||
//auto e = appl_exploits.at(j);
|
||||
|
||||
/* Synchronous fire function
|
||||
|
||||
First: double/sanity checks to see if there are other exploits that need to be fired
|
||||
This also prevents the firing from occurring when it shouldn't via a regular passthrough
|
||||
After popping, it checks if the vector is empty. If it is, then we no longer need to
|
||||
re-fill the vector since we've gone through all possibilities
|
||||
*/
|
||||
SYNCH_FIRE:;
|
||||
if(!idr_idx.empty()){
|
||||
//std::cout<<"IDR Size " << idr_idx.size()<<std::endl;
|
||||
index=idr_idx.back();
|
||||
idr_idx.pop_back();
|
||||
if(idr_idx.empty())
|
||||
skip_flag=1;
|
||||
fired_idx.push_back(index);
|
||||
}
|
||||
|
||||
|
||||
auto e = appl_exploits.at(index);
|
||||
auto exploit = std::get<0>(e);
|
||||
//std::cout<<exploit.get_name()<<std::endl;
|
||||
|
||||
//For synchronous firing: get indices of all exploits in the same group and
|
||||
//push them onto the index vector for later use
|
||||
auto egroup=exploit.get_group();
|
||||
|
||||
if (egroup!="null" && idr_idx.empty() && skip_flag==0){
|
||||
for(int i=0; i!=appl_exploits.size(); i++){
|
||||
if((std::get<0>(appl_exploits.at(i))).get_group()==egroup && i!=index){
|
||||
idr_idx.emplace_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Comment/think more. If there are other assets in group,
|
||||
//but you check idr_idx after filling and it's still empty
|
||||
//you know that the other asset isn't ready to be fired yet, so wait.
|
||||
//CORRECT: THIS BREAKS CODE IF ONLY 1 ASSET IN GROUP EXPLOIT. NEED TO FIGURE OUT HOW TO SEE HOW MANY ASSETS ARE IN GROUP
|
||||
//std::cout<<std::get<1>(e).size()<<std::endl;
|
||||
//if(std::get<1>(e).size()>1){
|
||||
if(idr_idx.empty()){
|
||||
testing_flag=1;
|
||||
}
|
||||
// }
|
||||
}
|
||||
if(testing_flag==1)
|
||||
break;
|
||||
skip_flag=0;
|
||||
auto assetGroup = std::get<1>(e);
|
||||
//assetGroup.print_group();
|
||||
//std::cout<<std::endl;
|
||||
auto postconditions = createPostConditions(e, instance.facts);
|
||||
auto qualities = std::get<0>(postconditions);
|
||||
auto topologies = std::get<1>(postconditions);
|
||||
|
||||
for(auto &qual : qualities) {
|
||||
auto action = std::get<0>(qual);
|
||||
auto fact = std::get<1>(qual);
|
||||
switch(action) {
|
||||
case ADD_T:
|
||||
new_state.add_quality(fact);
|
||||
break;
|
||||
case UPDATE_T:
|
||||
new_state.update_quality(fact);
|
||||
|
||||
//TODO: if fact!= "="" call new_state function, passing fact and instance.facts. Update the quality, and insert it into the hash_table instead of this convoluted mess
|
||||
if(fact.get_op()=="+="){
|
||||
|
||||
//std::cout<<" AFTER UPDATE "<<new_state.compound_assign(fact)<<std::endl;
|
||||
std::unordered_map<std::string,int>::const_iterator got = instance.facts.hash_table.find(new_state.compound_assign(fact));
|
||||
|
||||
//If the value is not already in the hash_table, insert it.
|
||||
//Since the compound operators include a value that is not in the original Keyvalue object, the unordered map does not include it
|
||||
//As a result, you have to manually add it.
|
||||
if(got==instance.facts.hash_table.end()){
|
||||
instance.facts.hash_table[new_state.compound_assign(fact)]=instance.facts.size();
|
||||
instance.facts.length++;
|
||||
instance.facts.str_vector.push_back(new_state.compound_assign(fact));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DELETE_T:
|
||||
new_state.delete_quality(fact);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(auto &topo : topologies) {
|
||||
auto action = std::get<0>(topo);
|
||||
auto fact = std::get<1>(topo);
|
||||
switch(action) {
|
||||
case ADD_T:
|
||||
new_state.add_topology(fact);
|
||||
break;
|
||||
case UPDATE_T:
|
||||
new_state.update_topology(fact);
|
||||
break;
|
||||
case DELETE_T:
|
||||
new_state.delete_topology(fact);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//appl_exploits.erase(appl_exploits.begin()+index);
|
||||
|
||||
if(!idr_idx.empty())
|
||||
goto SYNCH_FIRE;
|
||||
|
||||
|
||||
//THIS ALSO CRASHES
|
||||
auto hash_num = new_state.get_hash(instance.facts);
|
||||
|
||||
if (hash_num == current_hash)
|
||||
continue;
|
||||
//gettimeofday(&t1,NULL);
|
||||
#pragma omp critical
|
||||
if (hash_map.find(hash_num) == hash_map.end()) {//although local frontier is updated, the global hash is also updated to avoid testing on explored states.
|
||||
new_state.set_id();
|
||||
auto facts_tuple = new_state.get_factbase().get_facts_tuple();
|
||||
FactbaseItems new_items =
|
||||
std::make_tuple(facts_tuple, new_state.get_id());
|
||||
instance.factbase_items.push_back(new_items);
|
||||
instance.factbases.push_back(new_state.get_factbase());
|
||||
hash_map.insert(std::make_pair(new_state.get_hash(instance.facts), new_state.get_id()));
|
||||
localFrontier.emplace_front(new_state);
|
||||
Edge ed(current_state.get_id(), new_state.get_id(), exploit, assetGroup);
|
||||
ed.set_id();
|
||||
instance.edges.push_back(ed);
|
||||
counter++;
|
||||
}
|
||||
else {
|
||||
int id = hash_map[hash_num];
|
||||
Edge ed(current_state.get_id(), id, exploit, assetGroup);
|
||||
ed.set_id();
|
||||
instance.edges.push_back(ed);
|
||||
}
|
||||
//gettimeofday(&t2,NULL);
|
||||
//total_t+=(t2.tv_sec-t1.tv_sec)*1000.0+(t2.tv_usec-t1.tv_usec)/1000.0;
|
||||
} //for loop for new states ends
|
||||
} //while ends
|
||||
auto ag_end= std::chrono::system_clock::now();
|
||||
// std::chrono::duration<double> ag_elapsed = ag_end - ag_start;
|
||||
//std::cout << "AG TOOK" << ag_elapsed.count() << std::endl;
|
||||
|
||||
}//OpenMP block ends
|
||||
//printf("The critical took %lf s.\n",total_t);
|
||||
gettimeofday(&t2,NULL);
|
||||
total_t+=(t2.tv_sec-t1.tv_sec)*1000.0+(t2.tv_usec-t1.tv_usec)/1000.0;
|
||||
printf("AG TOOK %lf s.\n", total_t);
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
instance.elapsed_seconds = elapsed_seconds;
|
||||
|
||||
return instance;
|
||||
}
|
||||
74
src/ag_gen/ag_gen.h
Executable file
74
src/ag_gen/ag_gen.h
Executable file
@ -0,0 +1,74 @@
|
||||
#ifndef AG_GEN_HPP
|
||||
#define AG_GEN_HPP
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
|
||||
#include "asset.h"
|
||||
#include "assetgroup.h"
|
||||
#include "edge.h"
|
||||
#include "exploit.h"
|
||||
#include "factbase.h"
|
||||
#include "network_state.h"
|
||||
|
||||
#include "../util/keyvalue.h"
|
||||
|
||||
#ifdef REDIS
|
||||
#include "../util/redis_manager.h"
|
||||
#endif
|
||||
|
||||
using FactbaseItems =
|
||||
std::tuple<std::tuple<std::vector<Quality>, std::vector<Topology>>, int>;
|
||||
|
||||
typedef enum OPERATION_T {
|
||||
EQ_T,
|
||||
GEQ_T,
|
||||
LEQ_T,
|
||||
GT_T,
|
||||
LT_T
|
||||
} OPERATION_T;
|
||||
|
||||
struct AGGenInstance {
|
||||
std::string opt_network;
|
||||
std::vector<Asset> assets; //init
|
||||
std::vector<Factbase> factbases;
|
||||
std::vector<Quality> initial_qualities; //init
|
||||
std::vector<Topology> initial_topologies; //init
|
||||
std::vector<FactbaseItems> factbase_items;
|
||||
std::vector<Exploit> exploits; //init
|
||||
std::vector<Edge> edges;
|
||||
Keyvalue facts; //init
|
||||
|
||||
std::chrono::duration<double> elapsed_seconds;
|
||||
};
|
||||
|
||||
/** AGGen class
|
||||
* @brief Generate attack graph
|
||||
* @details Main generator class that stores state for the entire graph
|
||||
* generation process.
|
||||
*/
|
||||
class AGGen {
|
||||
AGGenInstance instance;
|
||||
std::deque<NetworkState> frontier; //!< Unexplored states
|
||||
std::unordered_map<size_t, int> hash_map{}; //!< Map of hashes to Factbase ID
|
||||
|
||||
bool use_redis;
|
||||
#ifdef REDIS
|
||||
RedisManager *rman;
|
||||
#endif
|
||||
|
||||
public:
|
||||
explicit AGGen(AGGenInstance &_instance);
|
||||
|
||||
#ifdef REDIS
|
||||
AGGen(AGGenInstance &_instance, RedisManager &_rman);
|
||||
#endif
|
||||
|
||||
AGGenInstance &generate(bool batch_process, int batch_num, int numThrd, int initQSize);
|
||||
};
|
||||
|
||||
#endif // AG_GEN_HPP
|
||||
30
src/ag_gen/asset.cpp
Executable file
30
src/ag_gen/asset.cpp
Executable file
@ -0,0 +1,30 @@
|
||||
// asset.cpp is used to represent an asset on the network and contains functions
|
||||
// to access and manipulate the properties (id, name, network, qualities) of an
|
||||
// asset
|
||||
|
||||
#include <libpq-fe.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ag_gen.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* @brief Constructor for Asset
|
||||
* @details Fetches the qualities of an asset with given parameters
|
||||
*
|
||||
* @param iid The id of the asset to fetch
|
||||
* @param netid The id of the network to fetch from
|
||||
* @param nname The name of the Asset
|
||||
* @param q The vector of qualities to associate with the Asset
|
||||
*/
|
||||
Asset::Asset(std::string nname, std::vector<Quality> q)
|
||||
: name(move(nname)), qualities(std::move(q)) {}
|
||||
|
||||
std::string Asset::get_name()
|
||||
{
|
||||
|
||||
return name;
|
||||
|
||||
}
|
||||
25
src/ag_gen/asset.h
Executable file
25
src/ag_gen/asset.h
Executable file
@ -0,0 +1,25 @@
|
||||
#ifndef ASSET_HPP
|
||||
#define ASSET_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "quality.h"
|
||||
|
||||
/** Asset class
|
||||
* @brief Fetches and saves assets
|
||||
* @details Fetches the qualities of the assets from the database and stores
|
||||
* them in a vector.
|
||||
*/
|
||||
class Asset {
|
||||
std::string name;
|
||||
std::vector<Quality> qualities;
|
||||
|
||||
public:
|
||||
Asset(std::string nname, std::vector<Quality> q);
|
||||
|
||||
std::string get_name();
|
||||
};
|
||||
|
||||
#endif // ASSET_HPP
|
||||
50
src/ag_gen/assetgroup.cpp
Executable file
50
src/ag_gen/assetgroup.cpp
Executable file
@ -0,0 +1,50 @@
|
||||
//
|
||||
// Created by Kyle Cook on 4/9/17.
|
||||
//
|
||||
// assetgroup.cpp is used to hold the hypothetical qualities and topologies of
|
||||
// multiple assets as well as a vector of the number IDs of the assets. It also
|
||||
// implements a print method for the qualities and topologies and for the
|
||||
// assets.
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "assetgroup.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* @brief Prints information about the Asset Group
|
||||
* @details prints all of the hypothetical qualities of an Asset Group, then
|
||||
* prints all of the hypothetical topologies
|
||||
*/
|
||||
void AssetGroup::print_facts() {
|
||||
for (auto &quality : this->get_hypo_quals()) {
|
||||
quality.print();
|
||||
}
|
||||
|
||||
for (auto &topology : this->get_hypo_topos()) {
|
||||
topology.print();
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prints every Asset
|
||||
* @details Prints each Asset to stdout on a single line in a comma separated
|
||||
* list
|
||||
*/
|
||||
void AssetGroup::print_group() {
|
||||
if (perm.size() == 1) {
|
||||
cout << "Asset " + to_string(perm[0]);
|
||||
} else {
|
||||
cout << "Assets " + to_string(perm[0]);
|
||||
for (size_t i : perm) {
|
||||
cout << ", " + to_string(i);
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
int AssetGroup::size() {
|
||||
return perm.size();
|
||||
}
|
||||
55
src/ag_gen/assetgroup.h
Executable file
55
src/ag_gen/assetgroup.h
Executable file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// Created by Kyle Cook on 4/9/17.
|
||||
//
|
||||
|
||||
#ifndef AG_GEN_ASSET_GROUP_H
|
||||
#define AG_GEN_ASSET_GROUP_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "quality.h"
|
||||
#include "topology.h"
|
||||
|
||||
/** AssetGroup class
|
||||
* @brief Holds information about multiple Assets
|
||||
* @details Holds the hypothetical qualities and topologies of
|
||||
* multiple Assets as well as a vector of the number IDs of the Assets.
|
||||
* It also implements a print method for the qualities and topologies
|
||||
* and for the Assets.
|
||||
*/
|
||||
class AssetGroup {
|
||||
std::vector<Quality> hypothetical_qualities;
|
||||
std::vector<Topology> hypothetical_topologies;
|
||||
|
||||
std::vector<size_t> perm;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor for AssetGroup
|
||||
* @details Initializes values of AssetGroup
|
||||
*
|
||||
* @param hypo_quals The hypothetical qualities of Assets
|
||||
* @param hypo_topos The hyptothetcial topologies of Assets
|
||||
* @param pperm IDs of the Assets
|
||||
*/
|
||||
AssetGroup(std::vector<Quality> hypo_quals,
|
||||
std::vector<Topology> hypo_topos, std::vector<size_t> pperm)
|
||||
: hypothetical_qualities(move(hypo_quals)),
|
||||
hypothetical_topologies(move(hypo_topos)), perm(move(pperm)) {}
|
||||
|
||||
std::vector<size_t> get_perm() const { return perm; }
|
||||
|
||||
std::vector<Quality> get_hypo_quals() const {
|
||||
return hypothetical_qualities;
|
||||
}
|
||||
|
||||
std::vector<Topology> get_hypo_topos() const {
|
||||
return hypothetical_topologies;
|
||||
}
|
||||
|
||||
void print_facts();
|
||||
void print_group();
|
||||
int size();
|
||||
};
|
||||
|
||||
#endif // AG_GEN_ASSET_GROUP_H
|
||||
90
src/ag_gen/edge.cpp
Executable file
90
src/ag_gen/edge.cpp
Executable file
@ -0,0 +1,90 @@
|
||||
//
|
||||
// Created by Kyle Cook on 6/24/17.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "edge.h"
|
||||
#include "../util/db.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor for Edge
|
||||
* @details Initializes information with given parameters and initializes id to
|
||||
* 0.
|
||||
*
|
||||
* @param iFrom The From Node
|
||||
* @param iTo The To Node
|
||||
* @param ex Exploit associated with the Edge
|
||||
* @param ag AssetGroup associated with the Edge
|
||||
*/
|
||||
Edge::Edge(int iFrom, int iTo, Exploit &ex, AssetGroup &ag)
|
||||
: from_node(iFrom), to_node(iTo), exploit(ex), assetGroup(ag), deleted(false) {}
|
||||
|
||||
/**
|
||||
* @return The Edge ID
|
||||
*/
|
||||
int Edge::get_id() { return id; }
|
||||
|
||||
void Edge::set_deleted() { deleted = true; }
|
||||
|
||||
bool Edge::is_deleted() { return deleted; }
|
||||
|
||||
int Edge::get_from_id()
|
||||
{
|
||||
|
||||
return from_node;
|
||||
|
||||
}
|
||||
|
||||
int Edge::get_to_id()
|
||||
{
|
||||
|
||||
return to_node;
|
||||
|
||||
}
|
||||
|
||||
int Edge::get_exploit_id()
|
||||
{
|
||||
|
||||
return exploit.get_id();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The Edge information as a string for SQL
|
||||
*/
|
||||
std::string Edge::get_query() {
|
||||
return std::to_string(from_node) + "," + std::to_string(to_node) + "," +
|
||||
std::to_string(exploit.get_id()) + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the Edge id to the current id and increments edge_current_id.
|
||||
*
|
||||
* @return The new id
|
||||
*/
|
||||
int Edge::set_id() {
|
||||
id = edge_current_id++;
|
||||
return id;
|
||||
}
|
||||
|
||||
int Edge::edge_current_id = 0;
|
||||
|
||||
/**
|
||||
* @return The Assets as a string for SQL
|
||||
*/
|
||||
std::string Edge::get_asset_query() {
|
||||
auto current_perm = assetGroup.get_perm();
|
||||
std::string sql;
|
||||
for (size_t i = 0; i < current_perm.size(); ++i) {
|
||||
|
||||
if (i == 0)
|
||||
sql += "(" + std::to_string(id) + "," + std::to_string(i) + "," +
|
||||
std::to_string(current_perm[i]) + ")";
|
||||
|
||||
else
|
||||
sql += ",(" + std::to_string(id) + "," + std::to_string(i) + "," +
|
||||
std::to_string(current_perm[i]) + ")";
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
38
src/ag_gen/edge.h
Executable file
38
src/ag_gen/edge.h
Executable file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// Created by Kyle Cook on 6/24/17.
|
||||
//
|
||||
|
||||
#ifndef AG_GEN_EDGE_H
|
||||
#define AG_GEN_EDGE_H
|
||||
|
||||
#include "assetgroup.h"
|
||||
#include "exploit.h"
|
||||
|
||||
/** Edge class
|
||||
* @brief Edge of the graph.
|
||||
*/
|
||||
class Edge {
|
||||
static int edge_current_id;
|
||||
int id;
|
||||
int from_node;
|
||||
int to_node;
|
||||
Exploit exploit;
|
||||
AssetGroup assetGroup;
|
||||
bool deleted;
|
||||
|
||||
public:
|
||||
Edge(int, int, Exploit &, AssetGroup &);
|
||||
|
||||
std::string get_query();
|
||||
std::string get_asset_query();
|
||||
|
||||
int get_id();
|
||||
int set_id();
|
||||
int get_from_id();
|
||||
int get_to_id();
|
||||
int get_exploit_id();
|
||||
void set_deleted();
|
||||
bool is_deleted();
|
||||
};
|
||||
|
||||
#endif // AG_GEN_EDGE_H
|
||||
92
src/ag_gen/exploit.cpp
Executable file
92
src/ag_gen/exploit.cpp
Executable file
@ -0,0 +1,92 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "exploit.h"
|
||||
#include "../util/db.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* @brief Prints the ParameterizedQuality preconditions.
|
||||
*/
|
||||
void Exploit::print_preconds_q() {
|
||||
for_each(preconds_q.begin(), preconds_q.end(),
|
||||
[](ParameterizedQuality &q) { q.print(); });
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prints the ParameterizedTopology preconditions.
|
||||
*/
|
||||
void Exploit::print_preconds_t() {
|
||||
for_each(preconds_t.begin(), preconds_t.end(),
|
||||
[](ParameterizedTopology &t) { t.print(); });
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prints the ParameterizedQuality postconditions.
|
||||
*/
|
||||
void Exploit::print_postconds_q() {
|
||||
for_each(postconds_q.begin(), postconds_q.end(),
|
||||
[](PostconditionQ &q) {
|
||||
auto fact = std::get<1>(q);
|
||||
fact.print();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prints the ParameterizedTopology postconditions.
|
||||
*/
|
||||
void Exploit::print_postconds_t() {
|
||||
for_each(postconds_t.begin(), postconds_t.end(),
|
||||
[](PostconditionT &q) {
|
||||
auto fact = std::get<1>(q);
|
||||
fact.print();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor for Exploit
|
||||
* @details Initializes Exploit information with given pre- and postconditions.
|
||||
*
|
||||
* @param preId Exploit ID
|
||||
* @param preName Name of the Exploit
|
||||
* @param preNumParams Number of parameters for the Exploit
|
||||
* @param preconds A tuple of preconditions
|
||||
* @param postconds A tuple of postconditions
|
||||
*/
|
||||
Exploit::Exploit(int preId, string &preName, int preNumParams,
|
||||
std::string &groupName,
|
||||
std::tuple<std::vector<ParameterizedQuality>,
|
||||
std::vector<ParameterizedTopology>>
|
||||
preconds,
|
||||
std::tuple<std::vector<PostconditionQ>,
|
||||
std::vector<PostconditionT>>
|
||||
postconds)
|
||||
: id(preId), name(preName), num_params(preNumParams), group(groupName),
|
||||
preconds_q(std::get<0>(preconds)), preconds_t(std::get<1>(preconds)),
|
||||
postconds_q(std::get<0>(postconds)), postconds_t(std::get<1>(postconds)) {}
|
||||
|
||||
/**
|
||||
* @brief Prints the Exploit ID
|
||||
*/
|
||||
void Exploit::print_id() { cout << "Exploit " + to_string(this->id) << endl; }
|
||||
|
||||
/**
|
||||
* @brief Gets the ParameterizedQuality preconditions.
|
||||
*/
|
||||
vector<ParameterizedQuality> Exploit::precond_list_q() { return preconds_q; }
|
||||
|
||||
/**
|
||||
* @brief Gets the ParameterizedTopology preconditions.
|
||||
*/
|
||||
vector<ParameterizedTopology> Exploit::precond_list_t() { return preconds_t; }
|
||||
|
||||
/**
|
||||
* @brief Gets the ParameterizedQuality postconditions.
|
||||
*/
|
||||
vector<PostconditionQ> Exploit::postcond_list_q() { return postconds_q; }
|
||||
|
||||
/**
|
||||
* @brief Gets the ParameterizedTopology postconditions.
|
||||
*/
|
||||
vector<PostconditionT> Exploit::postcond_list_t() { return postconds_t; }
|
||||
70
src/ag_gen/exploit.h
Executable file
70
src/ag_gen/exploit.h
Executable file
@ -0,0 +1,70 @@
|
||||
#ifndef EXPLOIT_HPP
|
||||
#define EXPLOIT_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "quality.h"
|
||||
#include "topology.h"
|
||||
#include "../util/build_sql.h"
|
||||
|
||||
typedef std::tuple<ACTION_T, ParameterizedQuality> PostconditionQ;
|
||||
typedef std::tuple<ACTION_T, ParameterizedTopology> PostconditionT;
|
||||
|
||||
/** Exploit class
|
||||
* @brief Holds information about an exploit.
|
||||
* @details Holds information about an exploit including:
|
||||
*
|
||||
* - id
|
||||
* - name
|
||||
* - preconditions
|
||||
* - postconditions
|
||||
*/
|
||||
class Exploit {
|
||||
int id;
|
||||
std::string name;
|
||||
size_t num_params;
|
||||
std::string group;
|
||||
|
||||
std::vector<ParameterizedQuality> preconds_q;
|
||||
std::vector<ParameterizedTopology> preconds_t;
|
||||
|
||||
std::vector<PostconditionQ> postconds_q;
|
||||
std::vector<PostconditionT> postconds_t;
|
||||
|
||||
public:
|
||||
Exploit(int preId, std::string &preName, int preNumParams,
|
||||
std::string &groupName,
|
||||
std::tuple<std::vector<ParameterizedQuality>,
|
||||
std::vector<ParameterizedTopology>>
|
||||
preconds,
|
||||
std::tuple<std::vector<PostconditionQ>,
|
||||
std::vector<PostconditionT>>
|
||||
postconds);
|
||||
|
||||
int get_id() const { return id; }
|
||||
|
||||
std::string get_name() const { return name; }
|
||||
std::string get_group() const { return group; }
|
||||
|
||||
size_t get_num_params() const { return num_params; }
|
||||
|
||||
void print_preconds_q();
|
||||
void print_preconds_t();
|
||||
void print_postconds_q();
|
||||
void print_postconds_t();
|
||||
void print_id();
|
||||
|
||||
std::vector<ParameterizedQuality> precond_list_q();
|
||||
std::vector<ParameterizedTopology> precond_list_t();
|
||||
|
||||
std::vector<PostconditionQ> postcond_list_q();
|
||||
std::vector<PostconditionT> postcond_list_t();
|
||||
|
||||
// static std::vector<Exploit> fetch_all();
|
||||
|
||||
// static void print_all();
|
||||
};
|
||||
|
||||
#endif // EXPLOIT_HPP
|
||||
194
src/ag_gen/factbase.cpp
Executable file
194
src/ag_gen/factbase.cpp
Executable file
@ -0,0 +1,194 @@
|
||||
// factbase.cpp implements the Factbase class which contains the known facts
|
||||
// that are completely true in a particular Network State
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include "ag_gen.h"
|
||||
#include "quality.h" //NOAH
|
||||
|
||||
using namespace std;
|
||||
|
||||
int Factbase::current_id = 0;
|
||||
|
||||
/**
|
||||
* @brief Constructor for Factbase
|
||||
*
|
||||
* @param q A vector of Qualities
|
||||
* @param t A vector of Topologies
|
||||
*/
|
||||
Factbase::Factbase(std::vector<Quality> q, std::vector<Topology> t)
|
||||
: qualities(q), topologies(t) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Increments the current ID.
|
||||
*/
|
||||
void Factbase::set_id() {
|
||||
id = current_id++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current Factbase ID.
|
||||
*/
|
||||
int Factbase::get_id() const { return id; }
|
||||
|
||||
std::tuple<std::vector<Quality>, std::vector<Topology>> Factbase::get_facts_tuple() const {
|
||||
return std::make_tuple(qualities, topologies);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Searches for a Quality in the Factbase.
|
||||
* @details Returns true if the Quality is found and false otherwise.
|
||||
*
|
||||
* @param q Quality for which to search.
|
||||
*/
|
||||
bool Factbase::find_quality(Quality &q) const {
|
||||
|
||||
int id=q.get_asset_id();
|
||||
std::string name=q.get_name();
|
||||
std::string op=q.get_op();
|
||||
std::string value=q.get_value();
|
||||
// std::cout<<"Name " <<name<< " has an operator of " <<op<<std::endl;
|
||||
for(auto qual : qualities) {
|
||||
if(qual.get_asset_id() == id &&
|
||||
qual.get_name() == name) {
|
||||
|
||||
if(op=="=") {
|
||||
if(qual.operator==(q) ==true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(op=="<") {
|
||||
if(qual.operator<(q) ==true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(op==">") {
|
||||
if(qual.operator>(q) ==true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(op==">=") {
|
||||
if(qual.operator>=(q) ==true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(op=="<=") {
|
||||
if(qual.operator<=(q) ==true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
//Original - all above was not present
|
||||
// return std::find(qualities.begin(), qualities.end(), q) != qualities.end();
|
||||
}
|
||||
|
||||
std::vector<Quality>::iterator Factbase::get_quality(Quality &q) {
|
||||
return std::find(qualities.begin(), qualities.end(), q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Searches for a Topology in the Factbase.
|
||||
* @details Returns true if the Topology is found and false otherwise.
|
||||
*
|
||||
* @param t Topology for which to search.
|
||||
*/
|
||||
bool Factbase::find_topology(Topology &t) const {
|
||||
return std::find(topologies.begin(), topologies.end(), t) != topologies.end();
|
||||
}
|
||||
|
||||
std::vector<Topology>::iterator Factbase::get_topology(Topology &t) {
|
||||
return std::find(topologies.begin(), topologies.end(), t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds a given Quality to the factbase's vector of Qualities.
|
||||
*
|
||||
* @param q Quality to add
|
||||
*/
|
||||
void Factbase::add_quality(Quality &q) {
|
||||
qualities.push_back(q);
|
||||
}
|
||||
|
||||
void Factbase::delete_quality(Quality &q) {
|
||||
auto qual = get_quality(q);
|
||||
if(qual != qualities.end()) {
|
||||
qualities.erase(qual);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds a given Topology to the factbase's vector of Topologies.
|
||||
*
|
||||
* @param t Topology to add
|
||||
*/
|
||||
void Factbase::add_topology(Topology &t) {
|
||||
topologies.push_back(t);
|
||||
}
|
||||
|
||||
void Factbase::delete_topology(Topology &t) {
|
||||
auto topo = get_topology(t);
|
||||
if(topo != topologies.end()) {
|
||||
topologies.erase(topo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Shamelessly copied from Boost::hash_combine
|
||||
*/
|
||||
// void combine(size_t *seed) {
|
||||
// *seed ^= std::hash<size_t>{}(seed) + 0x9e3779b97f4a7c15 + (seed << 6) +
|
||||
// (seed >> 2);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief Hashes the Factbase
|
||||
*
|
||||
* @param factlist The current Keyvalue
|
||||
* @return The hash of the Factbase
|
||||
*/
|
||||
size_t Factbase::hash(Keyvalue &factlist) const {
|
||||
// size_t hash = 0xf848b64e; // Random seed value
|
||||
// size_t seed = 0x0c32a12fe19d2119;
|
||||
size_t seed = 0;
|
||||
std::set<size_t> factset_q;
|
||||
std::transform(qualities.begin(), qualities.end(), std::inserter(factset_q, factset_q.end()),
|
||||
[&](const Quality &q) -> size_t {
|
||||
//THIS WAS THE ORIGINAL ONE THAT WAS ERRORING:
|
||||
return q.encode(factlist).enc;});
|
||||
|
||||
std::for_each(factset_q.begin(), factset_q.end(),
|
||||
[&](size_t t) { boost::hash_combine(seed, t); });
|
||||
|
||||
std::set<size_t> factset_t;
|
||||
std::transform(topologies.begin(), topologies.end(), std::inserter(factset_t, factset_t.end()),
|
||||
[&](const Topology &t) -> size_t { return t.encode(factlist).enc;});
|
||||
std::for_each(factset_t.begin(), factset_t.end(),
|
||||
[&](size_t t) { boost::hash_combine(seed, t); });
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prints out the Factbase information.
|
||||
*/
|
||||
void Factbase::print() const {
|
||||
cout << "ID: " << id << endl;
|
||||
// cout << "HASH: " << hash() << endl;
|
||||
cout << "Qualities: " << qualities.size() << endl;
|
||||
cout << "Topologies: " << topologies.size() << endl << endl;
|
||||
for (auto &qual : qualities) {
|
||||
qual.print();
|
||||
}
|
||||
for (auto &topo : topologies) {
|
||||
topo.print();
|
||||
}
|
||||
}
|
||||
51
src/ag_gen/factbase.h
Executable file
51
src/ag_gen/factbase.h
Executable file
@ -0,0 +1,51 @@
|
||||
#ifndef FACTBASE_HPP
|
||||
#define FACTBASE_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "quality.h"
|
||||
#include "topology.h"
|
||||
|
||||
class NetworkState;
|
||||
|
||||
/** Factbase class
|
||||
* @brief Contains known facts in a NetworkState.
|
||||
* @details Contains known facts that are completely true in the
|
||||
* NetworkState such as Qualities and Topologies.
|
||||
*/
|
||||
class Factbase {
|
||||
static int current_id;
|
||||
|
||||
int id;
|
||||
std::vector<Quality> qualities;
|
||||
std::vector<Topology> topologies;
|
||||
|
||||
Factbase(std::vector<Quality> q, std::vector<Topology> t);
|
||||
|
||||
friend class NetworkState;
|
||||
|
||||
public:
|
||||
|
||||
std::tuple<std::vector<Quality>, std::vector<Topology>> get_facts_tuple() const;
|
||||
|
||||
bool find_quality(Quality &q) const;
|
||||
bool find_topology(Topology &t) const;
|
||||
|
||||
std::vector<Quality>::iterator get_quality(Quality &q);
|
||||
std::vector<Topology>::iterator get_topology(Topology &t);
|
||||
|
||||
void add_quality(Quality &q);
|
||||
void add_topology(Topology &t);
|
||||
|
||||
void delete_quality(Quality &q);
|
||||
void delete_topology(Topology &t);
|
||||
|
||||
void print() const;
|
||||
void set_id();
|
||||
int get_id() const;
|
||||
size_t hash(Keyvalue &factlist) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
251
src/ag_gen/network_state.cpp
Executable file
251
src/ag_gen/network_state.cpp
Executable file
@ -0,0 +1,251 @@
|
||||
//
|
||||
// Created by Kyle Cook on 6/26/17.
|
||||
//
|
||||
|
||||
#include <algorithm>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "network_state.h"
|
||||
|
||||
/**
|
||||
* @brief Normal Constructor for NetworkState
|
||||
* @details Creates a Factbase for a given Network
|
||||
* and sets this as its parent.
|
||||
*
|
||||
* @param q A vector of Qualities
|
||||
* @param t A vector of Topologies
|
||||
*/
|
||||
NetworkState::NetworkState(std::vector<Quality> q, std::vector<Topology> t)
|
||||
: factbase(Factbase(std::move(q), std::move(t))) {}
|
||||
|
||||
/**
|
||||
* @brief Copy Constructor for NetworkState
|
||||
* @details Creates a new Factbase and sets Network
|
||||
* based on an incoming NetworkState
|
||||
*
|
||||
* @param ns The NetworkState from which to copy
|
||||
*/
|
||||
NetworkState::NetworkState(const NetworkState &ns) = default;
|
||||
|
||||
/**
|
||||
* @brief Sets the ID of the Factbase
|
||||
*/
|
||||
void NetworkState::set_id() { factbase.set_id(); }
|
||||
|
||||
/**
|
||||
* @return The ID of the NetworkState
|
||||
*/
|
||||
int NetworkState::get_id() { return factbase.get_id(); }
|
||||
|
||||
/**
|
||||
* @return The Factbase for the NetworkState
|
||||
*/
|
||||
const Factbase &NetworkState::get_factbase() const { return factbase; }
|
||||
|
||||
/**
|
||||
* @brief Returns the hash of the Factbase
|
||||
*
|
||||
* @param factlist The current Keyvalue
|
||||
* @return The hash of the Factbase
|
||||
*/
|
||||
size_t NetworkState::get_hash(Keyvalue &factlist) const {
|
||||
return factbase.hash(factlist);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds all unique Quality elements of a vector to the Factbase
|
||||
*
|
||||
* @param q A vector of Qualities
|
||||
*/
|
||||
void NetworkState::add_qualities(std::vector<Quality> q) {
|
||||
// For each quality, check if it already exists in the factbase. If it does
|
||||
// not already exist, we add it.
|
||||
for (auto &qual : q) {
|
||||
add_quality(qual);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds all unique Topology elements of a vector to the Factbase
|
||||
*
|
||||
* @param t A vector of Topologies
|
||||
*/
|
||||
void NetworkState::add_topologies(std::vector<Topology> t) {
|
||||
// For each topology, check if it already exists in the factbase. If it does
|
||||
// not already exist, we add it.
|
||||
for (auto &topo : t) {
|
||||
add_topology(topo);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkState::add_quality(Quality &q) {
|
||||
if (!factbase.find_quality(q)) {
|
||||
factbase.add_quality(q);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkState::add_topology(Topology &t) {
|
||||
if (!factbase.find_topology(t)) {
|
||||
factbase.add_topology(t);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkState::update_quality(Quality &q) {
|
||||
auto asset_id = q.get_asset_id();
|
||||
auto attr = q.get_name();
|
||||
auto val = q.get_value();
|
||||
auto op = q.get_op();
|
||||
//std::cout<<"OP" << op<<std::endl;
|
||||
|
||||
for(auto &qual : factbase.qualities) {
|
||||
if(qual.get_asset_id() == asset_id &&
|
||||
qual.get_name() == attr) {
|
||||
if(op=="+=")
|
||||
{
|
||||
|
||||
//std::cout<<"Old value " << qual.get_value()<<std::endl;
|
||||
int curr_val=stoi(qual.get_value());
|
||||
val= std::to_string(curr_val+stoi(val));
|
||||
//std::cout<<"+= VAL IS " <<val<<std::endl;
|
||||
qual.set_value(val);
|
||||
}
|
||||
// else if(op=="-=")
|
||||
// qual.set_value_minp(val);
|
||||
else
|
||||
qual.set_value(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string NetworkState::compound_assign(Quality &q) {
|
||||
auto asset_id = q.get_asset_id();
|
||||
auto attr = q.get_name();
|
||||
auto val = q.get_value();
|
||||
auto op = q.get_op();
|
||||
|
||||
for(auto &qual : factbase.qualities) {
|
||||
if(qual.get_asset_id() == asset_id &&
|
||||
qual.get_name() == attr) {
|
||||
//if(op=="+=")
|
||||
//{
|
||||
//std::cout<<"TRUE"<<std::endl;
|
||||
// int curr_val=stoi(qual.get_value());
|
||||
val=qual.get_value();
|
||||
// val= std::to_string(curr_val+stoi(val));
|
||||
//int int_val=stoi(curr_val);
|
||||
//int new_val=stoi(val);
|
||||
//val=(int_val+new_val);
|
||||
// std::cout<<"+= VAL IS " <<val<<std::endl;
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkState::update_topology(Topology &t) {
|
||||
auto from_asset = t.get_from_asset_id();
|
||||
auto to_asset = t.get_to_asset_id();
|
||||
auto attr = t.get_property();
|
||||
auto val = t.get_value();
|
||||
|
||||
for(auto &topo : factbase.topologies) {
|
||||
if(topo.get_from_asset_id() == from_asset &&
|
||||
topo.get_to_asset_id() == to_asset &&
|
||||
topo.get_property() == attr) {
|
||||
topo.set_value(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkState::delete_quality(Quality &q) {
|
||||
auto qual = factbase.get_quality(q);
|
||||
if(qual != factbase.qualities.end()) {
|
||||
factbase.qualities.erase(qual);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkState::delete_topology(Topology &t) {
|
||||
auto topo = factbase.get_topology(t);
|
||||
if(topo != factbase.topologies.end()) {
|
||||
factbase.topologies.erase(topo);
|
||||
}
|
||||
}
|
||||
|
||||
// int NetworkState::compare(std::string &hash, RedisManager* rman) const {
|
||||
// if (!rman->check_collision(hash)) {
|
||||
// if (!rman->check_facts(hash, factbase.qualities, factbase.topologies))
|
||||
// return -1;
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// if (rman->check_facts(hash, factbase.qualities, factbase.topologies))
|
||||
// return 0;
|
||||
|
||||
// int amt = rman->get_collision_count(hash);
|
||||
|
||||
// for (int i = 0; i <= amt; ++i) {
|
||||
// std::string new_string = hash + "_" + std::to_string(i);
|
||||
// if (!rman->check_facts(new_string, factbase.qualities, factbase.topologies))
|
||||
// continue;
|
||||
|
||||
// return i;
|
||||
// }
|
||||
|
||||
// return -1;
|
||||
// // if (!rman->check_collision(hash)) {
|
||||
// // if (!rman->check_qualities(hash, factbase.qualities))
|
||||
// // return -1;
|
||||
|
||||
// // if (!rman->check_topologies(hash, factbase.topologies))
|
||||
// // return -1;
|
||||
|
||||
// // return 0;
|
||||
// // }
|
||||
|
||||
// // if (rman->check_qualities(hash, factbase.qualities) && rman->check_topologies(hash, factbase.topologies))
|
||||
// // return 0;
|
||||
|
||||
// // int amt = rman->get_collision_count(hash);
|
||||
|
||||
// // for (int i = 1; i <= amt; ++i) {
|
||||
// // std::string new_string = hash + "_" + std::to_string(i);
|
||||
// // if (!rman->check_qualities(new_string, factbase.qualities))
|
||||
// // continue;
|
||||
|
||||
// // if (!rman->check_topologies(new_string, factbase.topologies))
|
||||
// // continue;
|
||||
|
||||
// // return i;
|
||||
// // }
|
||||
|
||||
// // return -1;
|
||||
// }
|
||||
|
||||
// bool NetworkState::operator==(const Factbase &rhs) const {
|
||||
// auto right_tuple = rhs.get_facts_tuple();
|
||||
// auto rq = std::get<0>(right_tuple);
|
||||
// auto rt = std::get<1>(right_tuple);
|
||||
|
||||
// auto left_tuple = factbase.get_facts_tuple();
|
||||
// auto lq = std::get<0>(left_tuple);
|
||||
// auto lt = std::get<1>(left_tuple);
|
||||
|
||||
// // Right quality set
|
||||
// std::unordered_set<size_t> rqs;
|
||||
// std::for_each(rq.begin(), rq.end(), [&rqs](Quality q){rqs.insert(q.get_encoding());});
|
||||
|
||||
// // Right topology set
|
||||
// std::unordered_set<size_t> rts;
|
||||
// std::for_each(rt.begin(), rt.end(), [&rts](Topology t){rts.insert(t.get_encoding());});
|
||||
|
||||
// for (auto q : lq) {
|
||||
// if (rqs.find(q.get_encoding()) == rqs.end())
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// for (auto t : lt) {
|
||||
// if (rts.find(t.get_encoding()) == rts.end())
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
52
src/ag_gen/network_state.h
Executable file
52
src/ag_gen/network_state.h
Executable file
@ -0,0 +1,52 @@
|
||||
// network_state.h implements the Network State class which represents a single
|
||||
// state of a network and cotains a factbase of known truths for the Network
|
||||
// State
|
||||
|
||||
#ifndef NETWORK_STATE_H
|
||||
#define NETWORK_STATE_H
|
||||
|
||||
#include "asset.h"
|
||||
#include "factbase.h"
|
||||
#include "quality.h"
|
||||
#include "topology.h"
|
||||
|
||||
#include "../util/keyvalue.h"
|
||||
#include "../util/redis_manager.h"
|
||||
|
||||
class Network;
|
||||
|
||||
/** NetworkState class
|
||||
* @brief Manages the current state of the network
|
||||
* @details The current network state is dependent on the Qualities
|
||||
* and Topologies in the Factbase. NetworkState allows
|
||||
* for the addition of Qualities and Topologies to the Factbase.
|
||||
*/
|
||||
class NetworkState {
|
||||
Factbase factbase;
|
||||
friend class Factbase;
|
||||
|
||||
public:
|
||||
NetworkState(std::vector<Quality> q, std::vector<Topology> t);
|
||||
NetworkState(const NetworkState &ns);
|
||||
|
||||
const Factbase &get_factbase() const;
|
||||
size_t get_hash(Keyvalue &factlist) const;
|
||||
|
||||
void set_id();
|
||||
int get_id();
|
||||
|
||||
void add_qualities(std::vector<Quality> q);
|
||||
void add_topologies(std::vector<Topology> t);
|
||||
|
||||
void add_quality(Quality &q);
|
||||
void add_topology(Topology &t);
|
||||
|
||||
void update_quality(Quality &q);
|
||||
void update_topology(Topology &t);
|
||||
std::string compound_assign(Quality &q);
|
||||
|
||||
void delete_quality(Quality &q);
|
||||
void delete_topology(Topology &t);
|
||||
};
|
||||
|
||||
#endif
|
||||
130
src/ag_gen/quality.cpp
Executable file
130
src/ag_gen/quality.cpp
Executable file
@ -0,0 +1,130 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string> //NOAH
|
||||
#include "../util/db_functions.h" //NOAH
|
||||
#include "ag_gen.h"
|
||||
#include "unistd.h" //Included for sleep function for debugging purposes only
|
||||
|
||||
/**
|
||||
* @brief Constructor for Quality
|
||||
*
|
||||
* @param asset The id of the asset with which the Quality is associated
|
||||
* @param qualName The name of the Quality
|
||||
* @param o The operation
|
||||
* @param qualValue The value of the Quality
|
||||
*/
|
||||
|
||||
|
||||
//ORIGINAL QUALITY
|
||||
//Quality::Quality(int asset, std::string qualName, std::string o, std::string qualValue, Keyvalue &facts)
|
||||
// : asset_id(asset), name(std::move(qualName)), op(std::move(o)), value(std::move(qualValue)), encoded(encode(facts).enc) {}
|
||||
|
||||
|
||||
//TESTING ENCODING ERROR
|
||||
Quality::Quality(int asset, std::string qualName, std::string o, std::string qualValue, Keyvalue &facts)
|
||||
: asset_id(asset), name(std::move(qualName)), op(std::move(o)), value(std::move(qualValue)), encoded((size_t)facts.size()) {}
|
||||
|
||||
int Quality::get_asset_id() const { return asset_id; }
|
||||
|
||||
/**
|
||||
* @return The name of the Quality
|
||||
*/
|
||||
std::string Quality::get_name() const { return name; }
|
||||
|
||||
/**
|
||||
* @return The operation
|
||||
*/
|
||||
std::string Quality::get_op() const { return op; }
|
||||
|
||||
std::string Quality::get_value() const { return value; }
|
||||
|
||||
const size_t Quality::get_encoding() const {
|
||||
return encoded;
|
||||
}
|
||||
|
||||
void Quality::set_value(std::string &val) {
|
||||
value = val;
|
||||
}
|
||||
void Quality::set_value_addp(std::string &val) {
|
||||
//value=stoi(value)+stoi(val);
|
||||
//std::string old_val=
|
||||
//int intval=stoi(val);
|
||||
//int fin=intvalue+intval;
|
||||
|
||||
value=val;
|
||||
}
|
||||
void Quality::set_value_minp(std::string &val) {
|
||||
int intvalue=stoi(value);
|
||||
int intval=stoi(val);
|
||||
int fin=intvalue-intval;
|
||||
|
||||
value=std::to_string((fin));
|
||||
}
|
||||
/**
|
||||
* @brief Prints the Quality
|
||||
*/
|
||||
void Quality::print() const {
|
||||
std::cout << std::to_string(asset_id) << ": " << name << op << value
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encodes the Quality
|
||||
*
|
||||
* @param kv_facts The Keyvalue of the facts
|
||||
*
|
||||
* @return The EncodedQuality
|
||||
*/
|
||||
EncodedQuality Quality::encode(const Keyvalue &kv_facts) const {
|
||||
EncodedQuality qual{};
|
||||
qual.dec.asset_id = asset_id;
|
||||
qual.dec.attr = kv_facts[name];
|
||||
//std::cout<<"DONE PART 2"<<std::endl;
|
||||
//std::cout<<"ASSET ID " <<asset_id<<std::endl;
|
||||
//std::cout<<" NAME" <<kv_facts[name]<<std::endl;
|
||||
//std::cout<<"VALUE " <<value<<std::endl;
|
||||
|
||||
//THIS IS THE ONE THAT THROWS THE OUT OF RANGE FOR THE UNORDERED MAP
|
||||
// std::cout<<"Break"<<std::endl;
|
||||
//std::cout<<"ATTEMPTING TO FIND " <<value<<std::endl;
|
||||
//std::cout<<"SIZE FROM ENCODE " <<kv_facts.size() << std::endl;
|
||||
//std::unordered_map<std::string,int>::const_iterator got = kv_facts.hash_table.find(value);
|
||||
//if(got==kv_facts.hash_table.end())
|
||||
// std::cout<< " NOT FOUND"<<std::endl;
|
||||
//else
|
||||
// std::cout<<" YES FOUND " <<std::endl;
|
||||
|
||||
//std::cout<<"NAME "<<name<<"VALUE " <<value<< "KEY OR W/E "<< kv_facts[value]<<std::endl;
|
||||
// std::cout<<"SIZE FROM ENCODE "<<kv_facts.size()<<std::endl;
|
||||
//try {
|
||||
|
||||
qual.dec.val = kv_facts[value];
|
||||
//}
|
||||
//catch (std::out_of_range outofrange)
|
||||
// kv_facts.hash_table.insert(value, kv_facts.size()+1);
|
||||
//kv_facts.length+=1;
|
||||
//std::cout<<"YES" << std::endl;
|
||||
//qual.dec.val=kv_facts[value];
|
||||
//std::cout<<"DONE PART 3"<<std::endl;
|
||||
return qual;
|
||||
}
|
||||
|
||||
bool Quality::operator==(const Quality &rhs) const {
|
||||
return this->asset_id == rhs.asset_id && this->name == rhs.name && this->value == rhs.value;
|
||||
}
|
||||
|
||||
bool Quality::operator<(const Quality &rhs) const {
|
||||
return this->asset_id == rhs.asset_id && this->name == rhs.name && stoi(this->value) < stoi(rhs.value);
|
||||
}
|
||||
|
||||
bool Quality::operator>(const Quality &rhs) const {
|
||||
return this->asset_id == rhs.asset_id && this->name == rhs.name && stoi(this->value) > stoi(rhs.value);
|
||||
}
|
||||
|
||||
bool Quality::operator>=(const Quality &rhs) const {
|
||||
return this->asset_id == rhs.asset_id && this->name == rhs.name && stoi(this->value) >= stoi(rhs.value);
|
||||
}
|
||||
|
||||
bool Quality::operator<=(const Quality &rhs) const {
|
||||
return this->asset_id == rhs.asset_id && this->name == rhs.name && stoi(this->value) <= stoi(rhs.value);
|
||||
}
|
||||
82
src/ag_gen/quality.h
Executable file
82
src/ag_gen/quality.h
Executable file
@ -0,0 +1,82 @@
|
||||
//
|
||||
// Created by Kyle Cook on 4/9/17.
|
||||
//
|
||||
|
||||
#ifndef AG_GEN_QUALITY_H
|
||||
#define AG_GEN_QUALITY_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../util/keyvalue.h"
|
||||
|
||||
union EncodedQuality {
|
||||
struct {
|
||||
int asset_id : 16;
|
||||
int attr : 12;
|
||||
int op : 4;
|
||||
int val : 16;
|
||||
} dec;
|
||||
size_t enc;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Holds information about a Quality and a parameter number.
|
||||
*/
|
||||
struct ParameterizedQuality {
|
||||
int param;
|
||||
std::string name;
|
||||
std::string value;
|
||||
std::string op;
|
||||
|
||||
int get_param_num() { return param; }
|
||||
|
||||
void print() {
|
||||
std::cout << "Param: " + std::to_string(param) << std::endl;
|
||||
std::cout << "Attribute: " + name << std::endl;
|
||||
std::cout << "Operation: " << op << std::endl;
|
||||
std::cout << "Value: " + value << std::endl << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
using PostconditionQuality = std::tuple<ParameterizedQuality, std::string>;
|
||||
|
||||
/** Quality class
|
||||
* @brief Holds information for the Quality
|
||||
*/
|
||||
class Quality {
|
||||
int asset_id;
|
||||
std::string name;
|
||||
std::string op;
|
||||
std::string value;
|
||||
|
||||
size_t encoded;
|
||||
|
||||
EncodedQuality encode(const Keyvalue &kv_facts) const;
|
||||
|
||||
friend class Factbase;
|
||||
|
||||
public:
|
||||
Quality(int assetId, std::string qualName, std::string op,
|
||||
std::string qualValue, Keyvalue &facts);
|
||||
|
||||
int get_asset_id() const;
|
||||
std::string get_name() const;
|
||||
std::string get_op() const;
|
||||
std::string get_value() const;
|
||||
|
||||
const size_t get_encoding() const;
|
||||
|
||||
void set_value(std::string &val);
|
||||
void set_value_addp(std::string &val);
|
||||
void set_value_minp(std::string &val);
|
||||
|
||||
void print() const;
|
||||
|
||||
bool operator==(const Quality &rhs) const;
|
||||
bool operator<(const Quality &rhs) const;
|
||||
bool operator>(const Quality &rhs) const;
|
||||
bool operator>=(const Quality &rhs) const;
|
||||
bool operator<=(const Quality &rhs) const;
|
||||
};
|
||||
|
||||
#endif // AG_GEN_QUALITY_H
|
||||
113
src/ag_gen/topology.cpp
Executable file
113
src/ag_gen/topology.cpp
Executable file
@ -0,0 +1,113 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "ag_gen.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor for Topology
|
||||
*
|
||||
* @param f_asset The ID of the from asset
|
||||
* @param t_asset The ID of the to asset
|
||||
* @param dir The direction
|
||||
* @param property The property of the Topology
|
||||
* @param op The operation
|
||||
* @param val The value of the Topology
|
||||
*/
|
||||
Topology::Topology(int f_asset, int t_asset, DIRECTION_T dir, std::string property,
|
||||
std::string op, std::string val, Keyvalue &facts)
|
||||
: from_asset_id(f_asset), to_asset_id(t_asset), property(move(property)),
|
||||
op(move(op)), value(move(val)), dir(std::move(dir)), encoded(encode(facts).enc) {}
|
||||
|
||||
/**
|
||||
* @return The From Asset ID
|
||||
*/
|
||||
int Topology::get_from_asset_id() const { return from_asset_id; }
|
||||
|
||||
/**
|
||||
* @return The To Asset ID
|
||||
*/
|
||||
int Topology::get_to_asset_id() const { return to_asset_id; }
|
||||
|
||||
/**
|
||||
* @return The property of the Topology
|
||||
*/
|
||||
std::string Topology::get_property() const { return property; }
|
||||
|
||||
/**
|
||||
* @return The operation of the Topology
|
||||
*/
|
||||
std::string Topology::get_op() const { return op; }
|
||||
|
||||
const size_t Topology::get_encoding() const {
|
||||
return encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The value of the Topology
|
||||
*/
|
||||
std::string Topology::get_value() const { return value; }
|
||||
|
||||
void Topology::set_value(std::string &val) { value = val; }
|
||||
|
||||
/**
|
||||
* @return The direction of the Topology
|
||||
*/
|
||||
DIRECTION_T Topology::get_dir() const { return dir; }
|
||||
|
||||
/**
|
||||
* @brief Prints the Topology
|
||||
*/
|
||||
void Topology::print() const {
|
||||
std::cout << std::to_string(from_asset_id) + " " + std::to_string(dir) + " " +
|
||||
std::to_string(to_asset_id) + ": " + property + " " + op + " " +
|
||||
value
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encodes the Topology
|
||||
*
|
||||
* @param kv_facts The Keyvalue of the facts
|
||||
*
|
||||
* @return The EncodedTopology
|
||||
*/
|
||||
const EncodedTopology Topology::encode(const Keyvalue &kv_facts) const {
|
||||
EncodedTopology topo{};
|
||||
|
||||
topo.dec.from_asset = from_asset_id;
|
||||
topo.dec.to_asset = to_asset_id;
|
||||
topo.dec.dir = dir;
|
||||
topo.dec.property = kv_facts[property];
|
||||
topo.dec.op = 0; // Assuming only one operation for now
|
||||
topo.dec.value = kv_facts[value];
|
||||
|
||||
return topo;
|
||||
}
|
||||
|
||||
bool Topology::operator==(const Topology &rhs) const {
|
||||
if(this->dir != BIDIRECTION_T) {
|
||||
return (this->from_asset_id == rhs.from_asset_id) || (this->to_asset_id == rhs.to_asset_id);
|
||||
} else {
|
||||
if(this->from_asset_id != rhs.from_asset_id && this->from_asset_id != rhs.to_asset_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(this->to_asset_id != rhs.to_asset_id && this->to_asset_id != rhs.from_asset_id) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->property != rhs.property) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->op != rhs.op) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (this->value == rhs.value);
|
||||
}
|
||||
|
||||
bool Topology::operator<(const Topology &rhs) const {
|
||||
return (this->from_asset_id < rhs.from_asset_id);
|
||||
}
|
||||
93
src/ag_gen/topology.h
Executable file
93
src/ag_gen/topology.h
Executable file
@ -0,0 +1,93 @@
|
||||
#ifndef AG_GEN_TOPOLOGY_H
|
||||
#define AG_GEN_TOPOLOGY_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../util/keyvalue.h"
|
||||
|
||||
typedef enum {
|
||||
FORWARD_T = 0,
|
||||
BACKWARD_T = 1,
|
||||
BIDIRECTION_T = 2,
|
||||
} DIRECTION_T;
|
||||
|
||||
union EncodedTopology {
|
||||
struct {
|
||||
int from_asset : 16;
|
||||
int to_asset : 16;
|
||||
int dir : 2;
|
||||
int property : 10;
|
||||
int op : 4;
|
||||
int value : 16;
|
||||
|
||||
} dec;
|
||||
size_t enc;
|
||||
};
|
||||
|
||||
struct ParameterizedTopology {
|
||||
int from_param;
|
||||
int to_param;
|
||||
DIRECTION_T dir;
|
||||
std::string prop;
|
||||
std::string op;
|
||||
std::string val;
|
||||
|
||||
int get_from_param() { return from_param; }
|
||||
int get_to_param() { return to_param; }
|
||||
DIRECTION_T get_dir() { return dir; }
|
||||
std::string get_property() { return prop; }
|
||||
std::string get_operation() { return op; }
|
||||
std::string get_value() { return val; }
|
||||
|
||||
void print() {
|
||||
std::cout << "From Param: " << std::to_string(from_param) << std::endl;
|
||||
std::cout << "To Param: " << std::to_string(to_param) << std::endl;
|
||||
std::cout << "Direction: " << dir << std::endl << std::endl;
|
||||
std::cout << "Property: " << prop << std::endl << std::endl;
|
||||
std::cout << "Operation: " << op << std::endl << std::endl;
|
||||
std::cout << "Value: " << val << std::endl << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
using PostconditionTopology = std::tuple<ParameterizedTopology, std::string>;
|
||||
|
||||
/** Topology class
|
||||
* @brief Holds information for the Topology
|
||||
*/
|
||||
class Topology {
|
||||
int from_asset_id;
|
||||
int to_asset_id;
|
||||
std::string property;
|
||||
std::string op;
|
||||
std::string value;
|
||||
DIRECTION_T dir;
|
||||
|
||||
size_t encoded;
|
||||
|
||||
const EncodedTopology encode(const Keyvalue &kv_facts) const;
|
||||
|
||||
friend class Factbase;
|
||||
|
||||
public:
|
||||
Topology(int f_asset, int t_asset, DIRECTION_T dir, std::string property,
|
||||
std::string op, std::string val, Keyvalue &facts);
|
||||
|
||||
int get_from_asset_id() const;
|
||||
int get_to_asset_id() const;
|
||||
std::string get_property() const;
|
||||
std::string get_op() const;
|
||||
std::string get_value() const;
|
||||
DIRECTION_T get_dir() const;
|
||||
|
||||
const size_t get_encoding() const;
|
||||
|
||||
void print() const;
|
||||
|
||||
bool operator==(const Topology &rhs) const;
|
||||
bool operator<(const Topology &rhs) const;
|
||||
|
||||
void set_value(std::string &val);
|
||||
};
|
||||
|
||||
#endif // AG_GEN_TOPOLOGY_H
|
||||
6
src/config.ini
Executable file
6
src/config.ini
Executable file
@ -0,0 +1,6 @@
|
||||
[database]
|
||||
name = ag_gen
|
||||
host = 127.0.0.1
|
||||
port = 5432
|
||||
username = ag_gen
|
||||
password = 8PZQc79NUZ3FjqSB
|
||||
646
src/main.cpp
Executable file
646
src/main.cpp
Executable file
@ -0,0 +1,646 @@
|
||||
//! main.cpp contains the main fuction that runs the program including flag
|
||||
//! handling and calls to functions that access the database and generate the
|
||||
//! attack graph.
|
||||
//!
|
||||
|
||||
#include <algorithm>
|
||||
#include <getopt.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
#include <cstdlib>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <omp.h>
|
||||
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/graph/graphviz.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <boost/graph/visitors.hpp>
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
|
||||
#include "ag_gen/ag_gen.h"
|
||||
#include "util/db_functions.h"
|
||||
#include "util/build_sql.h"
|
||||
#include "util/db.h"
|
||||
#include "util/hash.h"
|
||||
#include "util/list.h"
|
||||
#include "util/mem.h"
|
||||
|
||||
#ifdef REDIS
|
||||
#include "util/redis_manager.h"
|
||||
#endif // REDIS
|
||||
|
||||
template<typename GraphEdge>
|
||||
class ag_visitor : public boost::default_dfs_visitor {
|
||||
std::vector<std::pair<GraphEdge, int>> &to_delete;
|
||||
public:
|
||||
explicit ag_visitor(std::vector<std::pair<GraphEdge, int>> &_to_delete) : to_delete(_to_delete) {}
|
||||
|
||||
template <typename Graph>
|
||||
void back_edge(GraphEdge e, Graph g) {
|
||||
typename boost::property_map<Graph, boost::edge_index_t>::type Edge_Index =
|
||||
boost::get(boost::edge_index, g);
|
||||
|
||||
int index = Edge_Index[e];
|
||||
// edges[index].set_deleted();
|
||||
to_delete.push_back(std::make_pair(e, index));
|
||||
}
|
||||
};
|
||||
|
||||
typedef boost::property<boost::edge_name_t, std::string,
|
||||
boost::property<boost::edge_index_t, int>> EdgeProperties;
|
||||
typedef boost::property<boost::vertex_name_t, int> VertexNameProperty;
|
||||
|
||||
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
|
||||
VertexNameProperty, EdgeProperties> Graph;
|
||||
|
||||
typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
typedef boost::graph_traits<Graph>::edge_descriptor GraphEdge;
|
||||
|
||||
Graph graph_init() {
|
||||
GraphInfo info = fetch_graph_info();
|
||||
|
||||
auto factbase_ids = info.first;
|
||||
auto edges = info.second;
|
||||
Graph g;
|
||||
|
||||
boost::property_map<Graph, boost::vertex_name_t>::type Factbase_ID = boost::get(boost::vertex_name, g);
|
||||
boost::property_map<Graph, boost::edge_name_t>::type Exploit_ID = boost::get(boost::edge_name, g);
|
||||
boost::property_map<Graph, boost::edge_index_t>::type Edge_Index = boost::get(boost::edge_index, g);
|
||||
|
||||
std::unordered_map<int, Vertex> vertex_map;
|
||||
|
||||
for (int fid : factbase_ids) {
|
||||
Vertex v = boost::add_vertex(g);
|
||||
Factbase_ID[v] = fid;
|
||||
vertex_map[fid] = v;
|
||||
}
|
||||
|
||||
for (auto ei : edges) {
|
||||
|
||||
int eid = ei[0];
|
||||
int from_id = ei[1];
|
||||
int to_id = ei[2];
|
||||
int exid = ei[3];
|
||||
|
||||
Vertex from_v = vertex_map[from_id];
|
||||
Vertex to_v = vertex_map[to_id];
|
||||
|
||||
GraphEdge e = boost::add_edge(from_v, to_v, g).first;
|
||||
Exploit_ID[e] = std::to_string(exid);
|
||||
Edge_Index[e] = eid;
|
||||
}
|
||||
|
||||
return g;
|
||||
}
|
||||
|
||||
void remove_cycles(Graph &g) {
|
||||
std::vector<std::pair<GraphEdge, int>> to_delete;
|
||||
|
||||
// ag_visitor<GraphEdge> vis(edges, to_delete);
|
||||
ag_visitor<GraphEdge> vis(to_delete);
|
||||
boost::depth_first_search(g, boost::visitor(vis));
|
||||
|
||||
std::vector<int> delete_edge_ids;
|
||||
delete_edge_ids.resize(to_delete.size());
|
||||
|
||||
for (int i = 0; i < to_delete.size(); ++i) {
|
||||
boost::remove_edge(to_delete[i].first, g);
|
||||
delete_edge_ids[i] = to_delete[i].second;
|
||||
}
|
||||
|
||||
delete_edges(delete_edge_ids);
|
||||
}
|
||||
|
||||
void graph_ag(Graph &g, std::string &filename) {
|
||||
std::ofstream gout;
|
||||
std::cout << filename << std::endl;
|
||||
gout.open(filename);
|
||||
boost::write_graphviz(gout, g, boost::default_writer(), boost::make_label_writer(boost::get(boost::edge_name, g)));
|
||||
}
|
||||
|
||||
/* Try and color code the severe violations
|
||||
void color_code(Graph &g) {
|
||||
if
|
||||
}
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
extern FILE *nmin;
|
||||
extern int nmparse(networkmodel *nm);
|
||||
}
|
||||
|
||||
std::string parse_nm(std::string &filename) {
|
||||
FILE *file = fopen(filename.c_str(), "r");
|
||||
|
||||
if(!file) {
|
||||
fprintf(stderr, "Cannot open file.\n");
|
||||
}
|
||||
|
||||
networkmodel nm;
|
||||
nm.assets = list_new();
|
||||
|
||||
//yydebug = 1;
|
||||
nmin = file;
|
||||
do {
|
||||
nmparse(&nm);
|
||||
} while(!feof(nmin));
|
||||
|
||||
// FILE *out = stdout;
|
||||
std::string output;
|
||||
|
||||
//print_xp_list(xplist);
|
||||
|
||||
/////////////////////////
|
||||
// ASSETS
|
||||
/////////////////////////
|
||||
|
||||
hashtable *asset_ids = new_hashtable(101);
|
||||
|
||||
// Preload buffer with SQL prelude
|
||||
size_t bufsize = INITIALBUFSIZE;
|
||||
auto buf = static_cast<char *>(getcmem(bufsize));
|
||||
strcat(buf, "INSERT INTO asset VALUES\n");
|
||||
|
||||
// Iterate over each exploit in the list
|
||||
// Generate an "exploit_instance" which contains
|
||||
// the generated exploit id and the sql for
|
||||
// for the exploit.
|
||||
for(size_t i=0; i<nm.assets->size; i++) {
|
||||
auto asset = static_cast<char *>(list_get_idx(nm.assets, i));
|
||||
add_hashtable(asset_ids, asset, i);
|
||||
asset_instance *ai = make_asset(asset);
|
||||
while(bufsize < strlen(buf) + strlen(ai->sql)) {
|
||||
buf = static_cast<char *>(realloc(buf, (bufsize *= 2)));
|
||||
}
|
||||
strcat(buf, ai->sql);
|
||||
}
|
||||
|
||||
// Replace the last comma with a semicolon
|
||||
char *last = strrchr(buf, ',');
|
||||
*last = ';';
|
||||
// fprintf(out, "%s\n", buf);
|
||||
output += std::string(buf);
|
||||
|
||||
/////////////////////////
|
||||
// FACTS
|
||||
/////////////////////////
|
||||
|
||||
// Preload buffer with SQL prelude
|
||||
bufsize = INITIALBUFSIZE;
|
||||
buf = static_cast<char *>(getcmem(bufsize));
|
||||
strcat(buf, "INSERT INTO quality VALUES\n");
|
||||
|
||||
size_t buf2size = INITIALBUFSIZE;
|
||||
auto buf2 = static_cast<char *>(getcmem(buf2size));
|
||||
strcat(buf2, "INSERT INTO topology VALUES\n");
|
||||
|
||||
// Iterate over each exploit. We then iterate
|
||||
// over each f in the exploit and generate
|
||||
// the sql for it.
|
||||
for(size_t i=0; i<nm.facts->size; i++) {
|
||||
auto fct = static_cast<fact *>(list_get_idx(nm.facts, i));
|
||||
char *sqlqual,*sqltopo;
|
||||
|
||||
auto assetFrom = static_cast<size_t>(get_hashtable(asset_ids, fct->from));
|
||||
|
||||
switch(fct->type) {
|
||||
case QUALITY_T:
|
||||
sqlqual = make_quality(assetFrom, fct->st);
|
||||
while(bufsize < (strlen(buf) + strlen(sqlqual))) {
|
||||
buf = static_cast<char *>(realloc(buf, (bufsize*=2)));
|
||||
}
|
||||
strcat(buf, sqlqual);
|
||||
break;
|
||||
case TOPOLOGY_T:
|
||||
auto assetTo = static_cast<size_t>(get_hashtable(asset_ids, fct->to));
|
||||
sqltopo = make_topology(assetFrom, assetTo, fct->dir, fct->st);
|
||||
while(buf2size < (strlen(buf2) + strlen(sqltopo))) {
|
||||
buf2 = static_cast<char *>(realloc(buf2, (buf2size*=2)));
|
||||
}
|
||||
strcat(buf2, sqltopo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
last = strrchr(buf, ',');
|
||||
*last = ';';
|
||||
|
||||
char *last2 = strrchr(buf2, ',');
|
||||
*last2 = ';';
|
||||
|
||||
output += std::string(buf);
|
||||
output += std::string(buf2);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
extern FILE *xpin;
|
||||
extern int xpparse(list *xpplist);
|
||||
}
|
||||
|
||||
std::string parse_xp(std::string &filename) {
|
||||
FILE *file = fopen(filename.c_str(), "r");
|
||||
|
||||
if(!file) {
|
||||
fprintf(stderr, "Cannot open file.\n");
|
||||
}
|
||||
|
||||
struct list *xplist = list_new();
|
||||
|
||||
//yydebug = 1;
|
||||
xpin = file;
|
||||
do {
|
||||
xpparse(xplist);
|
||||
} while(!feof(xpin));
|
||||
|
||||
// FILE *out = stdout;
|
||||
std::string output;
|
||||
|
||||
//print_xp_list(xplist);
|
||||
|
||||
/////////////////////////
|
||||
// EXPLOITS
|
||||
/////////////////////////
|
||||
|
||||
hashtable *exploit_ids = new_hashtable(101);
|
||||
|
||||
// Preload buffer with SQL prelude
|
||||
size_t bufsize = INITIALBUFSIZE;
|
||||
auto buf = static_cast<char *>(getcmem(bufsize));
|
||||
strcat(buf, "INSERT INTO exploit VALUES\n");
|
||||
|
||||
// Iterate over each exploit in the list
|
||||
// Generate an "exploit_instance" which contains
|
||||
// the generated exploit id and the sql for
|
||||
// for the exploit.
|
||||
for(size_t i=0; i<xplist->size; i++) {
|
||||
auto xp = static_cast<exploitpattern *>(list_get_idx(xplist, i));
|
||||
|
||||
exploit_instance *ei = make_exploit(xp);
|
||||
add_hashtable(exploit_ids, xp->name, ei->id);
|
||||
printf("%s - %d\n", xp->name, get_hashtable(exploit_ids, xp->name));
|
||||
while(bufsize < strlen(buf) + strlen(ei->sql)) {
|
||||
buf = static_cast<char *>(realloc(buf, (bufsize *= 2)));
|
||||
}
|
||||
strcat(buf, ei->sql);
|
||||
}
|
||||
|
||||
// Replace the last comma with a semicolon
|
||||
char *last = strrchr(buf, ',');
|
||||
*last = ';';
|
||||
// fprintf(out, "%s\n", buf);
|
||||
output += std::string(buf);
|
||||
|
||||
/////////////////////////
|
||||
// PRECONDITIONS
|
||||
/////////////////////////
|
||||
|
||||
// Preload buffer with SQL prelude
|
||||
bufsize = INITIALBUFSIZE;
|
||||
buf = static_cast<char *>(getcmem(bufsize));
|
||||
strcat(buf, "INSERT INTO exploit_precondition VALUES\n");
|
||||
|
||||
// Iterate over each exploit. We then iterate
|
||||
// over each f in the exploit and generate
|
||||
// the sql for it.
|
||||
for(size_t i=0; i<xplist->size; i++) {
|
||||
auto xp = static_cast<exploitpattern *>(list_get_idx(xplist, i));
|
||||
for(size_t j=0; j<xp->preconditions->size; j++) {
|
||||
auto fct = static_cast<fact *>(list_get_idx(xp->preconditions, j));
|
||||
// printf("%s: %d\n", fct->from, get_hashtable(exploit_ids, fct->from));
|
||||
char *sqladd = make_precondition(exploit_ids, xp, fct);
|
||||
while(bufsize < strlen(buf) + strlen(sqladd)) {
|
||||
buf = static_cast<char *>(realloc(buf, (bufsize*=2)));
|
||||
}
|
||||
strcat(buf, sqladd);
|
||||
}
|
||||
}
|
||||
|
||||
last = strrchr(buf, ',');
|
||||
*last = ';';
|
||||
// fprintf(out, "%s\n", buf);
|
||||
output += std::string(buf);
|
||||
|
||||
/////////////////////////
|
||||
// POSTCONDITIONS
|
||||
/////////////////////////
|
||||
|
||||
// Preload buffer with SQL prelude
|
||||
bufsize = INITIALBUFSIZE;
|
||||
buf = (char *)getcmem(bufsize);
|
||||
strcat(buf, "INSERT INTO exploit_postcondition VALUES\n");
|
||||
|
||||
// Iterate over each exploit. We then iterate
|
||||
// over each f in the exploit and generate
|
||||
// the sql for it.
|
||||
for(size_t i=0; i<xplist->size; i++) {
|
||||
auto xp = static_cast<exploitpattern *>(list_get_idx(xplist, i));
|
||||
for(size_t j=0; j<xp->postconditions->size; j++) {
|
||||
auto pc = static_cast<postcondition *>(list_get_idx(xp->postconditions, j));
|
||||
char *sqladd = make_postcondition(exploit_ids, xp, pc);
|
||||
while(bufsize < strlen(buf) + strlen(sqladd)) {
|
||||
buf = static_cast<char *>(realloc(buf, (bufsize*=2)));
|
||||
}
|
||||
strcat(buf, sqladd);
|
||||
}
|
||||
}
|
||||
|
||||
last = strrchr(buf, ',');
|
||||
*last = ';';
|
||||
// fprintf(out, "%s\n", buf);
|
||||
output += std::string(buf);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prints command line usage information.
|
||||
*/
|
||||
void print_usage() {
|
||||
std::cout << "Usage: ag_gen [OPTION...]" << std::endl << std::endl;
|
||||
std::cout << "Flags:" << std::endl;
|
||||
std::cout << "\t-c\tConfig section in config.ini" << std::endl;
|
||||
std::cout << "\t-b\tEnables batch processing. The argument is the size of batches." << std::endl;
|
||||
std::cout << "\t-g\tGenerate visual graph using graphviz, dot file for saving" << std::endl;
|
||||
std::cout << "\t-d\tPerform a depth first search to remove cycles" << std::endl;
|
||||
std::cout << "\t-n\tNetwork model file used for generation" << std::endl;
|
||||
std::cout << "\t-x\tExploit pattern file used for generation" << std::endl;
|
||||
std::cout << "\t-r\tUse redis for generation" << std::endl;
|
||||
std::cout << "\t-h\tThis help menu." << std::endl;
|
||||
}
|
||||
|
||||
inline bool file_exists(const std::string &name) {
|
||||
struct stat buffer {};
|
||||
return (stat(name.c_str(), &buffer) == 0);
|
||||
}
|
||||
|
||||
const std::string read_file(const std::string &fn) {
|
||||
std::ifstream f(fn);
|
||||
std::stringstream buffer;
|
||||
buffer << f.rdbuf();
|
||||
return buffer.str();
|
||||
}
|
||||
|
||||
// the main function executes the command according to the given flag and throws
|
||||
// and error if an unknown flag is provided. It then uses the database given in
|
||||
// the "config.txt" file to generate an attack graph.
|
||||
int main(int argc, char *argv[]) {
|
||||
//------------------------------
|
||||
//Program block 1: initialization and database connection
|
||||
//------------------------------
|
||||
//int thread_count=strtol(argv[5],NULL,10);
|
||||
//int init_qsize=strtol(argv[6],NULL,10);
|
||||
struct timeval ts1,tf1,ts2,tf2,ts3,tf3;
|
||||
gettimeofday(&ts1,NULL);
|
||||
if (argc < 2) {
|
||||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
printf("Start init\n");
|
||||
std::string opt_nm;
|
||||
std::string opt_xp;
|
||||
std::string opt_config;
|
||||
std::string opt_graph;
|
||||
std::string opt_batch;
|
||||
int thread_count;
|
||||
int init_qsize;
|
||||
|
||||
bool should_graph = false;
|
||||
bool no_cycles = false;
|
||||
bool batch_process = false;
|
||||
bool use_redis = false;
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt(argc, argv, "rb:g:dhc:n:x:t:q:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'g':
|
||||
should_graph = true;
|
||||
opt_graph = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
print_usage();
|
||||
return 0;
|
||||
case 'n':
|
||||
opt_nm = optarg; //read in the path of the .nm file from the command line arguments
|
||||
break;
|
||||
case 'x':
|
||||
opt_xp = optarg; //read in the path of the .xp file from the command line arguments
|
||||
break;
|
||||
case 'c':
|
||||
opt_config = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
no_cycles = true;
|
||||
break;
|
||||
case 'r':
|
||||
use_redis = true;
|
||||
break;
|
||||
case 'b':
|
||||
batch_process = true;
|
||||
opt_batch = optarg;
|
||||
break;
|
||||
case 't':
|
||||
thread_count =atoi(optarg);
|
||||
break;
|
||||
case 'q':
|
||||
init_qsize = atoi(optarg);
|
||||
break;
|
||||
case '?':
|
||||
if (optopt == 'c')
|
||||
fprintf(stderr, "Option -%c requires an argument.\n", optopt);
|
||||
exit(EXIT_FAILURE);
|
||||
case ':':
|
||||
fprintf(stderr, "wtf\n");
|
||||
exit(EXIT_FAILURE);
|
||||
default:
|
||||
fprintf(stderr, "Unknown option -%c.\n", optopt);
|
||||
print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
printf("Finished init\n");
|
||||
|
||||
std::string config_section = (opt_config.empty()) ? "default" : opt_config;
|
||||
|
||||
boost::property_tree::ptree pt;
|
||||
boost::property_tree::ini_parser::read_ini("config.ini", pt);
|
||||
|
||||
/*
|
||||
std::string dbName = pt.get<std::string>("database.name");
|
||||
std::string host = pt.get<std::string>("database.host");
|
||||
std::string port = pt.get<std::string>("database.port");
|
||||
std::string username = pt.get<std::string>("database.username");
|
||||
std::string password = pt.get<std::string>("database.password");
|
||||
std::cout<<dbName<<std::endl;
|
||||
std::cout<<host<<std::endl;
|
||||
std::cout<<port<<std::endl;
|
||||
std::cout<<username<<std::endl;
|
||||
std::cout<<password<<std::endl;
|
||||
//init_db("postgresql://" + username + ":" + password + "@" + host + ":" + port + "/" + dbName); //only to connect to the db, not query or update yet!!!
|
||||
init_db("dbname="+dbName+" user="+username+" host="+host+" port="+port+" password="+password);
|
||||
gettimeofday(&tf2,NULL);
|
||||
double tdiff2=(tf2.tv_sec-ts1.tv_sec)*1000.0+(tf2.tv_usec-ts1.tv_usec)/1000.0;
|
||||
printf("Finished db connection\n");
|
||||
printf("---------->Initialization and Connecting to DB took %lf ms.<----------- \n",tdiff2);
|
||||
printf("\n");
|
||||
*/
|
||||
//int a2=1;
|
||||
//a2=a2+1;
|
||||
//while(a2);
|
||||
|
||||
|
||||
//--------------------------------------------
|
||||
//program block 2: read in network model and exploit pattern and store them in local database
|
||||
//--------------------------------------------
|
||||
|
||||
gettimeofday(&ts3,NULL);
|
||||
//load network model,convert into strings that are SQL insert commands
|
||||
//directly read data and put them inside the ag_gen database tables: asset, quality and topology
|
||||
//-------This is the program block that can be used to test Alex's output file-------
|
||||
std::string parsednm;
|
||||
if(!opt_nm.empty()) {
|
||||
if (!file_exists(opt_nm)) {
|
||||
fprintf(stderr, "File %s doesn't exist.\n", opt_nm.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
parsednm = parse_nm(opt_nm);
|
||||
}
|
||||
//load exploit pattern,convert into strings that are SQL insert commands
|
||||
//directly read data and put them inside the ag_gen database tables: exploit,exploit_precondition and exploit_postcondition
|
||||
//-------This is the program block that can be used to test Jacob's output file-------
|
||||
std::string parsedxp;
|
||||
if(!opt_xp.empty()) {
|
||||
if (!file_exists(opt_xp)) {
|
||||
fprintf(stderr, "File %s doesn't exist.\n", opt_xp.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
parsedxp = parse_xp(opt_xp);
|
||||
}
|
||||
printf("\n");
|
||||
printf("=====parsed nm=====\n");
|
||||
std::cout << parsednm <<"\n";
|
||||
printf("=====parsed xp=====\n");
|
||||
std::cout << parsedxp <<"\n";
|
||||
printf("\n");
|
||||
int batch_size = 0;
|
||||
if (batch_process)
|
||||
batch_size = std::stoi(opt_batch);
|
||||
/*
|
||||
std::cout << "Importing Models and Exploits into Database: ";
|
||||
import_models(parsednm, parsedxp); //directly use the strings parsednm and parsedxp as SQL commands
|
||||
gettimeofday(&tf3,NULL);
|
||||
double tdiff3=(tf3.tv_sec-ts3.tv_sec)*1000.0+(tf3.tv_usec-ts3.tv_usec)/1000.0;
|
||||
std::cout << "Done\n";
|
||||
printf("------>The time to load .nm and .xp into the database took %lf ms.<------\n",tdiff3);
|
||||
printf("\n");
|
||||
*/
|
||||
//------------------------------------------
|
||||
//program block 3:
|
||||
//------------------------------------------
|
||||
|
||||
AGGenInstance _instance;
|
||||
//the following five assignments to _instance's members are all from db_function.cpp
|
||||
_instance.facts = fetch_facts();
|
||||
//The above function call returned an Keyvalue object and assigned the object to facts. The object mainly contains hash table and string vector based on all initial property and value.
|
||||
//the following 4 lines can be used to check the content of the facts. It is based on the initial property and value from table quality, postcondition and topology.
|
||||
//for(std::string abc: _instance.facts.get_str_vector()){
|
||||
// std::cout<<"Fact: "<<abc<<"\n";
|
||||
//std::cout<<"Hash number: "<<_instance.facts[abc]<<"\n";
|
||||
//std::cout<<"Operator: " <<abc[3]<<"\n";
|
||||
//std::cout<<"Operator: " <<fetch_all_qualities(_instance.facts).get_op();
|
||||
//}
|
||||
_instance.initial_qualities = fetch_all_qualities(_instance.facts); //prepare all the initial qualities, return a Quality vector of (quality plus facts)
|
||||
_instance.initial_topologies = fetch_all_topologies(_instance.facts); //prepare all the initial topologies, return a Topology vector of (topology plus facts)
|
||||
_instance.assets = fetch_all_assets(_instance.facts); //fetch each asset name and its related qualities.
|
||||
_instance.exploits = fetch_all_exploits(); //fetch each exploit and its precondition and post conditions from initial exploits
|
||||
auto ex = fetch_all_exploits(); //make a copy of initial exploits
|
||||
|
||||
std::cout << "Assets: " << _instance.assets.size() << "\n"; //# of assets, vector size
|
||||
std::cout << "Exploits: " << _instance.exploits.size() << "\n"; //# of exploits, vector size
|
||||
std::cout << "Facts: " << _instance.facts.size() << "\n"; //how many different parameters and values are there? class size() method
|
||||
|
||||
AGGenInstance postinstance;
|
||||
|
||||
std::cout << "Generating Attack Graph: " << std::flush;
|
||||
AGGen gen(_instance);//use AGGen class to instantiate an obj with the name gen! _instance obj as the parameter! constructor defined in ag_gen.cpp
|
||||
postinstance = gen.generate(batch_process, batch_size, thread_count, init_qsize); //The method call to generate the attack graph, defined in ag_gen.cpp.
|
||||
|
||||
std::cout << "Done\n";
|
||||
std::cout << "# of edges " <<postinstance.edges.size()<<std::endl;
|
||||
std::cout << "# of edge_asset_binding" <<postinstance.edges.size()<<std::endl;
|
||||
// std::cout << "# of factbase " <<postinstance.factbases.size()<<std::endl;
|
||||
// std::cout << "# of factbase_item " <<postinstance.factbase_items.size()<<std::endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::cout << "Total Time: " << postinstance.elapsed_seconds.count() << " seconds\n";
|
||||
std::cout << "Total States: " << postinstance.factbases.size() << "\n";
|
||||
std::cout << "Saving Attack Graph to Database: " << std::flush;
|
||||
save_ag_to_db(postinstance, true);
|
||||
std::cout << "Done\n";
|
||||
|
||||
if(should_graph) {
|
||||
Graph g = graph_init();
|
||||
|
||||
|
||||
if(no_cycles) {
|
||||
std::cout << "Removing cycles: " << std::flush;
|
||||
remove_cycles(g);
|
||||
std::cout << "Done\n";
|
||||
}
|
||||
|
||||
std::cout << "Creating graph visualization: " << std::flush;
|
||||
graph_ag(g, opt_graph);
|
||||
std::cout << "Done\n";
|
||||
|
||||
/*if(no_cycles) {
|
||||
std::cout << "Removing cycles: " << std::flush;
|
||||
remove_cycles(g);
|
||||
std::cout << "Done\n";
|
||||
}*/
|
||||
}
|
||||
|
||||
gettimeofday(&tf1,NULL);
|
||||
double tdiff1;
|
||||
tdiff1=(tf1.tv_sec-ts1.tv_sec)*1000.0+(tf1.tv_usec-ts1.tv_usec)/1000.0;
|
||||
printf("-----------> total run time is %lf ms. <-----------\n",tdiff1);
|
||||
return(0);
|
||||
/*
|
||||
struct timeval ts4,tf4;
|
||||
gettimeofday(&ts4,NULL);
|
||||
#pragma omp parallel num_threads(2)
|
||||
{
|
||||
int thread_num=1;
|
||||
#pragma omp for schedule(dynamic,1)
|
||||
for(long a1=0;a1<6;a1++)
|
||||
{
|
||||
int tn=omp_get_thread_num();
|
||||
printf("Thread num:%d and my a1 is %d\n",tn,a1);
|
||||
for(long d1=0;d1<10000;d1++)
|
||||
{
|
||||
double b1;
|
||||
if(a1%3==0) b1=a1*1.1;
|
||||
else if(a1%3==1) b1=a1*1.3;
|
||||
else b1=a1*1.5;
|
||||
}
|
||||
int b1=120000;
|
||||
if(tn==0) {while(b1--);a1=a1+6;}
|
||||
}
|
||||
}
|
||||
gettimeofday(&tf4,NULL);
|
||||
double tdiff4=(tf4.tv_sec-ts4.tv_sec)*1000.0+(tf4.tv_usec-ts4.tv_usec)/1000.0;
|
||||
printf("%lf\n",tdiff4);
|
||||
*/
|
||||
}
|
||||
1965
src/nm_parser.c
Normal file
1965
src/nm_parser.c
Normal file
File diff suppressed because it is too large
Load Diff
112
src/nm_parser.tab.h
Normal file
112
src/nm_parser.tab.h
Normal file
@ -0,0 +1,112 @@
|
||||
/* A Bison parser, made by GNU Bison 3.6.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
||||
especially those whose name start with YY_ or yy_. They are
|
||||
private implementation details that can be changed or removed. */
|
||||
|
||||
#ifndef YY_NM_HOME_NOAH_DOCUMENTS_SCHOOL_THESIS_WORK_AG_PARALLEL_SRC_NM_PARSER_TAB_H_INCLUDED
|
||||
# define YY_NM_HOME_NOAH_DOCUMENTS_SCHOOL_THESIS_WORK_AG_PARALLEL_SRC_NM_PARSER_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int nmdebug;
|
||||
#endif
|
||||
|
||||
/* Token kinds. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
YYEMPTY = -2,
|
||||
YYEOF = 0, /* "end of file" */
|
||||
YYerror = 256, /* error */
|
||||
YYUNDEF = 257, /* "invalid token" */
|
||||
IDENTIFIER = 258, /* IDENTIFIER */
|
||||
INT = 259, /* INT */
|
||||
FLOAT = 260, /* FLOAT */
|
||||
EQ = 261, /* EQ */
|
||||
GT = 262, /* GT */
|
||||
LT = 263, /* LT */
|
||||
GEQ = 264, /* GEQ */
|
||||
LEQ = 265, /* LEQ */
|
||||
ONEDIR = 266, /* ONEDIR */
|
||||
ONEDIRBACK = 267, /* ONEDIRBACK */
|
||||
BIDIR = 268, /* BIDIR */
|
||||
NOTONEDIR = 269, /* NOTONEDIR */
|
||||
NOTBIDIR = 270, /* NOTBIDIR */
|
||||
NETWORK = 271, /* NETWORK */
|
||||
MODEL = 272, /* MODEL */
|
||||
ASSETS = 273, /* ASSETS */
|
||||
COLON = 274, /* COLON */
|
||||
FACTS = 275, /* FACTS */
|
||||
PERIOD = 276, /* PERIOD */
|
||||
SEMI = 277, /* SEMI */
|
||||
QUALITY = 278, /* QUALITY */
|
||||
COMMA = 279, /* COMMA */
|
||||
TOPOLOGY = 280, /* TOPOLOGY */
|
||||
WHITESPACE = 281, /* WHITESPACE */
|
||||
TAGS = 282 /* TAGS */
|
||||
};
|
||||
typedef enum yytokentype yytoken_kind_t;
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 25 "/home/noah/Documents/School/Thesis Work/ag_parallel/src/parser/nm-parser/nm_parser.yy"
|
||||
|
||||
struct str_array* arr;
|
||||
struct list* lst;
|
||||
struct networkmodel* model;
|
||||
struct statement* st;
|
||||
struct fact *fct;
|
||||
char* string;
|
||||
|
||||
#line 100 "/home/noah/Documents/School/Thesis Work/ag_parallel/src/nm_parser.tab.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
extern YYSTYPE nmlval;
|
||||
|
||||
int nmparse (struct networkmodel* nm);
|
||||
|
||||
#endif /* !YY_NM_HOME_NOAH_DOCUMENTS_SCHOOL_THESIS_WORK_AG_PARALLEL_SRC_NM_PARSER_TAB_H_INCLUDED */
|
||||
2225
src/nm_scanner.c
Normal file
2225
src/nm_scanner.c
Normal file
File diff suppressed because it is too large
Load Diff
262
src/parser/nm-parser/nm_parser.yy
Executable file
262
src/parser/nm-parser/nm_parser.yy
Executable file
@ -0,0 +1,262 @@
|
||||
%error-verbose
|
||||
%name-prefix="nm"
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/mem.h"
|
||||
#include "util/str_array.h"
|
||||
#include "util/hash.h"
|
||||
#include "util/build_sql.h"
|
||||
|
||||
#define YYDEBUG 0
|
||||
|
||||
int nmlex();
|
||||
void yyerror(struct networkmodel* nm, char const *s);
|
||||
|
||||
extern FILE* nmin;
|
||||
extern int nmlineno;
|
||||
|
||||
extern int assetcount;
|
||||
extern int factcount;
|
||||
%}
|
||||
|
||||
%union {
|
||||
struct str_array* arr;
|
||||
struct list* lst;
|
||||
struct networkmodel* model;
|
||||
struct statement* st;
|
||||
struct fact *fct;
|
||||
char* string;
|
||||
}
|
||||
|
||||
%parse-param { struct networkmodel* nm }
|
||||
|
||||
%type <lst> factlist
|
||||
%type <fct> f
|
||||
|
||||
%type <string> asset
|
||||
%type <string> relop operator direction number value
|
||||
|
||||
%type <st> statement
|
||||
|
||||
%token <string> IDENTIFIER INT FLOAT
|
||||
%token <string> EQ GT LT GEQ LEQ
|
||||
%token <string> ONEDIR ONEDIRBACK BIDIR NOTONEDIR NOTBIDIR
|
||||
%token NETWORK MODEL ASSETS COLON FACTS PERIOD SEMI QUALITY COMMA TOPOLOGY WHITESPACE;
|
||||
%token TAGS
|
||||
|
||||
%%
|
||||
|
||||
root: NETWORK IDENTIFIER EQ assets facts tags PERIOD {}
|
||||
;
|
||||
|
||||
assets: ASSETS COLON assetlist {}
|
||||
;
|
||||
|
||||
assetlist: {}
|
||||
| assetlist asset {
|
||||
list_add(nm->assets, $2);
|
||||
}
|
||||
;
|
||||
|
||||
asset: IDENTIFIER SEMI { $$ = $1; }
|
||||
;
|
||||
|
||||
tags: {}
|
||||
| TAGS COLON {}
|
||||
;
|
||||
|
||||
facts: FACTS COLON factlist { nm->facts = $3; }
|
||||
;
|
||||
|
||||
factlist: { $$ = NULL; }
|
||||
| factlist f {
|
||||
if($1 == NULL) {
|
||||
$$ = list_new();
|
||||
list_add($$, $2);
|
||||
} else {
|
||||
list_add($$, $2);
|
||||
$$ = $1;
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
f: QUALITY COLON IDENTIFIER COMMA statement SEMI {
|
||||
statement *st = getmem(sizeof(struct statement));
|
||||
st->obj = $5->obj;
|
||||
st->op = $5->op;
|
||||
st->val = $5->val;
|
||||
|
||||
struct fact *fct = getmem(sizeof(struct fact));
|
||||
fct->type = QUALITY_T;
|
||||
fct->from = $3;
|
||||
fct->dir = NULL;
|
||||
fct->to = NULL;
|
||||
fct->st = st;
|
||||
|
||||
$$ = fct;
|
||||
}
|
||||
| TOPOLOGY COLON IDENTIFIER direction IDENTIFIER COMMA statement SEMI {
|
||||
struct statement* st = $7;
|
||||
st->obj = $7->obj;
|
||||
st->op = $7->op;
|
||||
st->val = $7->val;
|
||||
|
||||
struct fact *fct = getmem(sizeof(struct fact));
|
||||
fct->type = TOPOLOGY_T;
|
||||
fct->from = $3;
|
||||
fct->dir = $4;
|
||||
fct->to = $5;
|
||||
fct->st = st;
|
||||
|
||||
$$ = fct;
|
||||
}
|
||||
;
|
||||
|
||||
statement:
|
||||
IDENTIFIER {
|
||||
struct statement* st = getmem(sizeof(struct statement));
|
||||
st->obj = $1;
|
||||
st->op = "";
|
||||
st->val = "";
|
||||
$$ = st;
|
||||
}
|
||||
| IDENTIFIER operator value {
|
||||
struct statement* st = getmem(sizeof(struct statement));
|
||||
st->obj = $1;
|
||||
st->op = $2;
|
||||
st->val = $3;
|
||||
$$ = st;
|
||||
}
|
||||
;
|
||||
|
||||
value:
|
||||
IDENTIFIER
|
||||
| number
|
||||
;
|
||||
|
||||
number:
|
||||
INT
|
||||
| FLOAT
|
||||
;
|
||||
|
||||
operator:
|
||||
relop
|
||||
| EQ
|
||||
;
|
||||
|
||||
relop:
|
||||
GT
|
||||
| LT
|
||||
| GEQ
|
||||
| LEQ
|
||||
;
|
||||
|
||||
direction:
|
||||
BIDIR
|
||||
| ONEDIR
|
||||
| ONEDIRBACK
|
||||
| NOTBIDIR
|
||||
| NOTONEDIR
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
/*
|
||||
int main(int argc, char** argv) {
|
||||
FILE* file;
|
||||
if(argv[1] == 0) {
|
||||
printf("Please pass a file to parse as an argument.\n");
|
||||
exit(1);
|
||||
} else {
|
||||
file = fopen(argv[1], "r");
|
||||
}
|
||||
|
||||
if(!file) {
|
||||
fprintf(stderr, "Cannot open file.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct networkmodel nm;
|
||||
nm.asset_tab = new_hashtable(101);
|
||||
|
||||
//yydebug = 1;
|
||||
yyin = file;
|
||||
do {
|
||||
yyparse(&nm);
|
||||
} while(!feof(yyin));
|
||||
|
||||
print_str_array(nm.assets);
|
||||
|
||||
str_array* qualities = new_str_array();
|
||||
str_array* topologies = new_str_array();
|
||||
|
||||
for(int i=0; i<nm.facts->used; i++) {
|
||||
char* current = nm.facts->arr[i];
|
||||
char* copy = getstr(strlen(current));
|
||||
|
||||
strncpy(copy, current, strlen(current));
|
||||
|
||||
char* type = strsep(©, ":");
|
||||
printf("%s\n", type);
|
||||
if(strncmp(type, "q", 1) == 0) {
|
||||
add_str(qualities, copy);
|
||||
} else {
|
||||
add_str(topologies, copy);
|
||||
}
|
||||
}
|
||||
|
||||
FILE* fp = fopen("test.sql", "w");
|
||||
if(fp == NULL) {
|
||||
printf("Error creating file.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char* assetheader = "INSERT INTO asset VALUES";
|
||||
fprintf(fp, "%s\n", assetheader);
|
||||
for(int i=0; i<nm.assets->used-1; i++) {
|
||||
char* nextstring = nm.assets->arr[i];
|
||||
fprintf(fp, "%s\n", nextstring);
|
||||
}
|
||||
char* stripped = nm.assets->arr[nm.assets->used-1];
|
||||
stripped[strlen(stripped)-1] = '\n';
|
||||
fprintf(fp, "%s\n", stripped);
|
||||
|
||||
fprintf(fp, "%s\n", "ON CONFLICT DO NOTHING;");
|
||||
|
||||
char* qualityheader = "\nINSERT INTO quality VALUES";
|
||||
fprintf(fp, "%s\n", qualityheader);
|
||||
for(int i=0; i<qualities->used-1; i++) {
|
||||
char* nextstring = qualities->arr[i];
|
||||
fprintf(fp, "%s\n", nextstring);
|
||||
}
|
||||
stripped = qualities->arr[qualities->used-1];
|
||||
stripped[strlen(stripped)-1] = '\n';
|
||||
fprintf(fp, "%s\n", stripped);
|
||||
|
||||
fprintf(fp, "%s\n", "ON CONFLICT DO NOTHING;");
|
||||
|
||||
char* topologyheader = "\nINSERT INTO topology VALUES";
|
||||
fprintf(fp, "%s\n", topologyheader);
|
||||
for(int i=0; i<topologies->used-1; i++) {
|
||||
char* nextstring = topologies->arr[i];
|
||||
fprintf(fp, "%s\n", nextstring);
|
||||
}
|
||||
stripped = topologies->arr[topologies->used-1];
|
||||
stripped[strlen(stripped)-1] = '\n';
|
||||
fprintf(fp, "%s\n", stripped);
|
||||
|
||||
fprintf(fp, "%s\n", "ON CONFLICT DO NOTHING;");
|
||||
|
||||
fclose(fp);
|
||||
|
||||
free_hashtable(nm.asset_tab);
|
||||
}
|
||||
*/
|
||||
|
||||
void yyerror(struct networkmodel* nm, char const *s) {
|
||||
fprintf(stderr, "Line %d: %s\n", nmlineno, s);
|
||||
exit(-1);
|
||||
}
|
||||
44
src/parser/nm-parser/nm_scanner.l
Executable file
44
src/parser/nm-parser/nm_scanner.l
Executable file
@ -0,0 +1,44 @@
|
||||
%option noyywrap
|
||||
%option yylineno
|
||||
|
||||
DIGIT [0-9]+
|
||||
ID [a-zA-Z][a-zA-Z0-9_]*
|
||||
|
||||
%{
|
||||
#include "nm_parser.tab.h"
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
#.*\n {}
|
||||
|
||||
network { return NETWORK; }
|
||||
facts { return FACTS; }
|
||||
assets { return ASSETS; }
|
||||
quality { return QUALITY; }
|
||||
topology { return TOPOLOGY; }
|
||||
tags { return TAGS; }
|
||||
|
||||
{DIGIT}+ { nmlval.string = strdup(yytext); return INT; }
|
||||
{DIGIT}*"."{DIGIT}+ { nmlval.string = strdup(yytext); return FLOAT; }
|
||||
{ID} { nmlval.string = strdup(yytext); return IDENTIFIER; }
|
||||
|
||||
"=" { nmlval.string = strdup(yytext); return EQ; }
|
||||
"<" { nmlval.string = strdup(yytext); return LT; }
|
||||
">" { nmlval.string = strdup(yytext); return GT; }
|
||||
">=" { nmlval.string = strdup(yytext); return GEQ; }
|
||||
"<=" { nmlval.string = strdup(yytext); return LEQ; }
|
||||
":=" { nmlval.string = strdup(yytext); return EQ; }
|
||||
":" { nmlval.string = strdup(yytext); return COLON; }
|
||||
";" { nmlval.string = strdup(yytext); return SEMI; }
|
||||
"," { nmlval.string = strdup(yytext); return COMMA; }
|
||||
"." { nmlval.string = strdup(yytext); return PERIOD; }
|
||||
"<->" { nmlval.string = strdup(yytext); return BIDIR; }
|
||||
"<!>" { nmlval.string = strdup(yytext); return NOTBIDIR; }
|
||||
"<-" { nmlval.string = strdup(yytext); return ONEDIRBACK; }
|
||||
"->" { nmlval.string = strdup(yytext); return ONEDIR; }
|
||||
"!>" { nmlval.string = strdup(yytext); return NOTONEDIR; }
|
||||
|
||||
[ \t\r\n]+ {}
|
||||
|
||||
. { return 1; }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user