How to use object method in storybook-root

Best JavaScript code snippet using storybook-root

maec40.py

Source:maec40.py Github

copy

Full Screen

1# Copyright (c) 2013, The MITRE Corporation2# Copyright (c) 2010-2014, Cuckoo Developers3# All rights reserved.4# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org5# See the file "docs/LICENSE" for copying permission.6from modules.processing.behavior import fix_key7api_call_mappings = {8"NtCreateFile" : {"action_name" : "create file",9 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",10 "parameter_associated_objects" : {"FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",11 "associated_object_element" : "ID",12 "association_type" : "output",13 "forced" : {"associated_object_element" : "Type", 14 "value" : "File"}},15 "FileName" : {"associated_object_type" : "FileObjectType",16 "associated_object_element" : "File_Path",17 "association_type" : "output"}}},18"NtOpenFile" : {"action_name" : "open file",19 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",20 "parameter_associated_objects" : {"FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",21 "associated_object_element" : "ID",22 "association_type" : "output",23 "forced" : {"associated_object_element" : "Type", 24 "value" : "File"}},25 "FileName" : {"associated_object_type" : "FileObjectType",26 "associated_object_element" : "File_Path",27 "association_type" : "input"}}},28"NtReadFile" : {"action_name" : "read from file",29 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",30 "parameter_associated_objects" : {"FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",31 "associated_object_element" : "ID",32 "association_type" : "input",33 "forced" : {"associated_object_element" : "Type", 34 "value" : "File"}}}},35"NtWriteFile" : {"action_name" : "write to file",36 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",37 "parameter_associated_objects" : {"FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",38 "associated_object_element" : "ID",39 "association_type" : "input",40 "forced" : {"associated_object_element" : "Type", 41 "value" : "File"}}}},42"NtDeleteFile" : {"action_name" : "delete file",43 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",44 "parameter_associated_objects" : {"FileName" : {"associated_object_type" : "FileObjectType",45 "associated_object_element" : "File_Path",46 "association_type" : "input"}}},47"NtDeviceIoControlFile" : {"action_name" : "send control code to file",48 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",49 "parameter_associated_objects" : {"FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",50 "associated_object_element" : "ID",51 "association_type" : "input",52 "forced" : {"associated_object_element" : "Type", 53 "value" : "File"}}}},54"NtQueryDirectoryFile" : {"action_name" : "find file",55 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",56 "parameter_associated_objects" : {"FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",57 "associated_object_element" : "ID",58 "association_type" : "input",59 "forced" : {"associated_object_element" : "Type", 60 "value" : "File"}},61 "FileName" : {"associated_object_type" : "FileObjectType",62 "associated_object_element" : "File_Path",63 "association_type" : "input"}}},64"NtQueryInformationFile" : {"action_name" : "get file attributes",65 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",66 "parameter_associated_objects" : {"FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",67 "associated_object_element" : "ID",68 "association_type" : "input",69 "forced" : {"associated_object_element" : "Type", 70 "value" : "File"}}}},71"NtSetInformationFile" : {"action_name" : "set file attributes",72 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",73 "parameter_associated_objects" : {"FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",74 "associated_object_element" : "ID",75 "association_type" : "input",76 "forced" : {"associated_object_element" : "Type", 77 "value" : "File"}}}},78"NtCreateDirectoryObject" : {"action_name" : "create directory",79 "action_vocab" : "maecVocabs:DirectoryActionNameVocab-1.0",80 "parameter_associated_objects" : {"DirectoryHandle" : {"associated_object_type" : "WindowsHandleObjectType",81 "associated_object_element" : "ID",82 "association_type" : "output",83 "forced" : {"associated_object_element" : "Type", 84 "value" : "File"}}}},85"CreateDirectoryW" : {"action_name" : "create directory",86 "action_vocab" : "maecVocabs:DirectoryActionNameVocab-1.0",87 "parameter_associated_objects" : {"DirectoryName" : {"associated_object_type" : "FileObjectType",88 "associated_object_element" : "File_Path",89 "association_type" : "output"}}},90"CreateDirectoryExW" : {"action_name" : "create directory",91 "action_vocab" : "maecVocabs:DirectoryActionNameVocab-1.0",92 "parameter_associated_objects" : {"DirectoryName" : {"associated_object_type" : "FileObjectType",93 "associated_object_element" : "File_Path",94 "association_type" : "output"}}},95"RemoveDirectoryA" : {"action_name" : "delete directory",96 "action_vocab" : "maecVocabs:DirectoryActionNameVocab-1.0",97 "parameter_associated_objects" : {"DirectoryName" : {"associated_object_type" : "FileObjectType",98 "associated_object_element" : "File_Path",99 "association_type" : "input"}}},100"RemoveDirectoryW" : {"action_name" : "delete directory",101 "action_vocab" : "maecVocabs:DirectoryActionNameVocab-1.0",102 "parameter_associated_objects" : {"DirectoryName" : {"associated_object_type" : "FileObjectType",103 "associated_object_element" : "File_Path",104 "association_type" : "input"}}},105"MoveFileWithProgressW" : {"action_name" : "move file",106 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",107 "parameter_associated_objects" : {"ExistingFileName" : {"associated_object_type" : "FileObjectType",108 "associated_object_element" : "File_Path",109 "association_type" : "input"},110 "NewFileName" : {"associated_object_type" : "FileObjectType",111 "associated_object_element" : "File_Path",112 "association_type" : "output"}}},113"FindFirstFileExA" : {"action_name" : "find file",114 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",115 "parameter_associated_objects" : {"FileName" : {"associated_object_type" : "FileObjectType",116 "associated_object_element" : "File_Path",117 "association_type" : "input"}}},118"FindFirstFileExW" : {"action_name" : "find file",119 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",120 "parameter_associated_objects" : {"FileName" : {"associated_object_type" : "FileObjectType",121 "associated_object_element" : "File_Path",122 "association_type" : "input"}}},123"CopyFileA" : {"action_name" : "copy file",124 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",125 "parameter_associated_objects" : {"ExistingFileName" : {"associated_object_type" : "FileObjectType",126 "associated_object_element" : "File_Path",127 "association_type" : "input"},128 "NewFileName" : {"associated_object_type" : "FileObjectType",129 "associated_object_element" : "File_Path",130 "association_type" : "output"}}},131"CopyFileW" : {"action_name" : "copy file",132 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",133 "parameter_associated_objects" : {"ExistingFileName" : {"associated_object_type" : "FileObjectType",134 "associated_object_element" : "File_Path",135 "association_type" : "input"},136 "NewFileName" : {"associated_object_type" : "FileObjectType",137 "associated_object_element" : "File_Path",138 "association_type" : "output"}}},139"CopyFileExW" : {"action_name" : "copy file",140 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",141 "parameter_associated_objects" : {"ExistingFileName" : {"associated_object_type" : "FileObjectType",142 "associated_object_element" : "File_Path",143 "association_type" : "input"},144 "NewFileName" : {"associated_object_type" : "FileObjectType",145 "associated_object_element" : "File_Path",146 "association_type" : "output"}}},147"DeleteFileA" : {"action_name" : "delete file",148 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",149 "parameter_associated_objects" : {"FileName" : {"associated_object_type" : "FileObjectType",150 "associated_object_element" : "File_Path",151 "association_type" : "input"}}},152"DeleteFileW" : {"action_name" : "delete file",153 "action_vocab" : "maecVocabs:FileActionNameVocab-1.0",154 "parameter_associated_objects" : {"FileName" : {"associated_object_type" : "FileObjectType",155 "associated_object_element" : "File_Path",156 "association_type" : "input"}}},157"RegOpenKeyExA" : {"action_name" : "open registry key",158 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",159 "parameter_associated_objects" : {"Registry" : {"associated_object_type" : "WindowsRegistryKeyObjectType",160 "associated_object_element" : "Hive",161 "association_type" : "input",162 "post_processing" : "hiveHexToString"},163 "SubKey" : {"associated_object_type" : "WindowsRegistryKeyObjectType",164 "associated_object_element" : "Key",165 "association_type" : "input",},166 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",167 "associated_object_element" : "ID",168 "association_type" : "output",169 "forced" : {"associated_object_element" : "Type", 170 "value" : "RegistryKey"}},171 "group_together" : ["Registry", "SubKey"]}},172"RegOpenKeyExW" : {"action_name" : "open registry key",173 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",174 "parameter_associated_objects" : {"Registry" : {"associated_object_type" : "WindowsRegistryKeyObjectType",175 "associated_object_element" : "Hive",176 "association_type" : "input",177 "post_processing" : "hiveHexToString"},178 "SubKey" : {"associated_object_type" : "WindowsRegistryKeyObjectType",179 "associated_object_element" : "Key",180 "association_type" : "input",},181 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",182 "associated_object_element" : "ID",183 "association_type" : "output",184 "forced" : {"associated_object_element" : "Type", 185 "value" : "RegistryKey"}},186 "group_together" : ["Registry", "SubKey"]}},187"RegCreateKeyExA" : {"action_name" : "create registry key",188 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",189 "parameter_associated_objects" : {"Registry" : {"associated_object_type" : "WindowsRegistryKeyObjectType",190 "associated_object_element" : "Hive",191 "association_type" : "output",192 "post_processing" : "hiveHexToString"},193 "SubKey" : {"associated_object_type" : "WindowsRegistryKeyObjectType",194 "associated_object_element" : "Key",195 "association_type" : "output"},196 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",197 "associated_object_element" : "ID",198 "association_type" : "output",199 "forced" : {"associated_object_element" : "Type", 200 "value" : "RegistryKey"}},201 "group_together" : ["Registry", "SubKey"]}},202"RegCreateKeyExW" : {"action_name" : "create registry key",203 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",204 "parameter_associated_objects" : {"Registry" : {"associated_object_type" : "WindowsRegistryKeyObjectType",205 "associated_object_element" : "Hive",206 "association_type" : "output",207 "post_processing" : "hiveHexToString"},208 "SubKey" : {"associated_object_type" : "WindowsRegistryKeyObjectType",209 "associated_object_element" : "Key",210 "association_type" : "output"},211 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",212 "associated_object_element" : "ID",213 "association_type" : "output",214 "forced" : {"associated_object_element" : "Type", 215 "value" : "RegistryKey"}},216 "group_together" : ["Registry", "SubKey"]}},217"RegDeleteKeyA" : {"action_name" : "delete registry key",218 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",219 "parameter_associated_objects" : {"SubKey" : {"associated_object_type" : "WindowsRegistryKeyObjectType",220 "associated_object_element" : "Key",221 "association_type" : "input"},222 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",223 "associated_object_element" : "ID",224 "association_type" : "input",225 "forced" : {"associated_object_element" : "Type", 226 "value" : "RegistryKey"}}}},227"RegDeleteKeyW" : {"action_name" : "delete registry key",228 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",229 "parameter_associated_objects" : {"SubKey" : {"associated_object_type" : "WindowsRegistryKeyObjectType",230 "associated_object_element" : "Key",231 "association_type" : "input"},232 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",233 "associated_object_element" : "ID",234 "association_type" : "input",235 "forced" : {"associated_object_element" : "Type", 236 "value" : "RegistryKey"}}}},237"RegEnumKeyW" : {"action_name" : "enumerate registry key subkeys",238 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",239 "parameter_associated_objects" : {"Name" : {"associated_object_type" : "WindowsRegistryKeyObjectType",240 "associated_object_element" : "Key",241 "association_type" : "output"},242 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",243 "associated_object_element" : "ID",244 "association_type" : "input",245 "forced" : {"associated_object_element" : "Type", 246 "value" : "RegistryKey"}}}},247"RegEnumKeyExA" : {"action_name" : "enumerate registry key subkeys",248 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",249 "parameter_associated_objects" : {"Name" : {"associated_object_type" : "WindowsRegistryKeyObjectType",250 "associated_object_element" : "Key",251 "association_type" : "output"},252 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",253 "associated_object_element" : "ID",254 "association_type" : "input",255 "forced" : {"associated_object_element" : "Type", 256 "value" : "RegistryKey"}}}},257"RegEnumKeyExW" : {"action_name" : "enumerate registry key subkeys",258 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",259 "parameter_associated_objects" : {"Name" : {"associated_object_type" : "WindowsRegistryKeyObjectType",260 "associated_object_element" : "Key",261 "association_type" : "output"},262 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",263 "associated_object_element" : "ID",264 "association_type" : "input",265 "forced" : {"associated_object_element" : "Type", 266 "value" : "RegistryKey"}}}},267"RegEnumValueA" : {"action_name" : "enumerate registry key values",268 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",269 "parameter_associated_objects" : {"Handle" : {"associated_object_type" : "WindowsHandleObjectType",270 "associated_object_element" : "ID",271 "association_type" : "input",272 "forced" : {"associated_object_element" : "Type", 273 "value" : "RegistryKey"}},274 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ValueName", "element_name" : "Name"},275 {"parameter_name" : "Type", "element_name" : "Datatype",276 "post_processing":"regDatatypeToString"},277 {"parameter_name" : "Data", "element_name" : "Data"}],278 "associated_object_type" : "WindowsRegistryKeyObjectType",279 "associated_object_element" : "Values/list__",280 "association_type" : "output"}}},281"RegEnumValueW" : {"action_name" : "enumerate registry key values",282 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",283 "parameter_associated_objects" : {"Handle" : {"associated_object_type" : "WindowsHandleObjectType",284 "associated_object_element" : "ID",285 "association_type" : "input",286 "forced" : {"associated_object_element" : "Type", 287 "value" : "RegistryKey"}},288 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ValueName", "element_name" : "Name"},289 {"parameter_name" : "Type", "element_name" : "Datatype",290 "post_processing":"regDatatypeToString"},291 {"parameter_name" : "Data", "element_name" : "Data"}],292 "associated_object_type" : "WindowsRegistryKeyObjectType",293 "associated_object_element" : "Values/list__",294 "association_type" : "output"}}},295"RegSetValueExA" : {"action_name" : "modify registry key value",296 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",297 "parameter_associated_objects" : {"Handle" : {"associated_object_type" : "WindowsHandleObjectType",298 "associated_object_element" : "ID",299 "association_type" : "input",300 "forced" : {"associated_object_element" : "Type", 301 "value" : "RegistryKey"}},302 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ValueName", "element_name" : "Name"},303 {"parameter_name" : "Type", "element_name" : "Datatype",304 "post_processing":"regDatatypeToString"},305 {"parameter_name" : "Buffer", "element_name" : "Data"}],306 "associated_object_type" : "WindowsRegistryKeyObjectType",307 "associated_object_element" : "Values/list__",308 "association_type" : "output"}}},309"RegSetValueExW" : {"action_name" : "modify registry key value",310 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",311 "parameter_associated_objects" : {"Handle" : {"associated_object_type" : "WindowsHandleObjectType",312 "associated_object_element" : "ID",313 "association_type" : "input",314 "forced" : {"associated_object_element" : "Type", 315 "value" : "RegistryKey"}},316 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ValueName", "element_name" : "Name"},317 {"parameter_name" : "Type", "element_name" : "Datatype",318 "post_processing":"regDatatypeToString"},319 {"parameter_name" : "Buffer", "element_name" : "Data"}],320 "associated_object_type" : "WindowsRegistryKeyObjectType",321 "associated_object_element" : "Values/list__",322 "association_type" : "output"}}},323"RegQueryValueExA" : {"action_name" : "read registry key value",324 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",325 "parameter_associated_objects" : {"ValueName" : {"associated_object_type" : "WindowsRegistryKeyObjectType",326 "associated_object_element" : "Values/list__Name",327 "association_type" : "input"},328 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",329 "associated_object_element" : "ID",330 "association_type" : "input",331 "forced" : {"associated_object_element" : "Type", 332 "value" : "RegistryKey"}},333 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "Type", "element_name" : "Datatype",334 "post_processing":"regDatatypeToString"},335 {"parameter_name" : "Data", "element_name" : "Data"}],336 "associated_object_type" : "WindowsRegistryKeyObjectType",337 "associated_object_element" : "Values/list__",338 "association_type" : "output"}}},339"RegQueryValueExW" : {"action_name" : "read registry key value",340 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",341 "parameter_associated_objects" : {"ValueName" : {"associated_object_type" : "WindowsRegistryKeyObjectType",342 "associated_object_element" : "Values/list__Name",343 "association_type" : "input"},344 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",345 "associated_object_element" : "ID",346 "association_type" : "input",347 "forced" : {"associated_object_element" : "Type", 348 "value" : "RegistryKey"}},349 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "Type", "element_name" : "Datatype",350 "post_processing":"regDatatypeToString"},351 {"parameter_name" : "Data", "element_name" : "Data"}],352 "associated_object_type" : "WindowsRegistryKeyObjectType",353 "associated_object_element" : "Values/list__",354 "association_type" : "output"}}},355"RegDeleteValueA" : {"action_name" : "delete registry key value",356 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",357 "parameter_associated_objects" : {"ValueName" : {"associated_object_type" : "WindowsRegistryKeyObjectType",358 "associated_object_element" : "Values/list__Name",359 "association_type" : "input"},360 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",361 "associated_object_element" : "ID",362 "association_type" : "input",363 "forced" : {"associated_object_element" : "Type", 364 "value" : "RegistryKey"}}}},365"RegDeleteValueW" : {"action_name" : "delete registry key value",366 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",367 "parameter_associated_objects" : {"ValueName" : {"associated_object_type" : "WindowsRegistryKeyObjectType",368 "associated_object_element" : "Values/list__Name",369 "association_type" : "input"},370 "Handle" : {"associated_object_type" : "WindowsHandleObjectType",371 "associated_object_element" : "ID",372 "association_type" : "input",373 "forced" : {"associated_object_element" : "Type", 374 "value" : "RegistryKey"}}}},375"RegQueryInfoKeyA" : {"action_name" : "get registry key attributes",376 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",377 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",378 "associated_object_element" : "ID",379 "association_type" : "input",380 "forced" : {"associated_object_element" : "Type", 381 "value" : "RegistryKey"}}}},382"RegQueryInfoKeyW" : {"action_name" : "get registry key attributes",383 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",384 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",385 "associated_object_element" : "ID",386 "association_type" : "input",387 "forced" : {"associated_object_element" : "Type", 388 "value" : "RegistryKey"}}}},389"RegCloseKey" : {"action_name" : "close registry key",390 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",391 "parameter_associated_objects" : {"Handle" : {"associated_object_type" : "WindowsHandleObjectType",392 "associated_object_element" : "ID",393 "association_type" : "input",394 "forced" : {"associated_object_element" : "Type", 395 "value" : "RegistryKey"}}}},396"NtCreateKey" : {"action_name" : "create registry key",397 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",398 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ObjectAttributes", "element_name" : "Hive",399 "post_processing": "regStringToHive"},400 {"parameter_name" : "ObjectAttributes", "element_name" : "Key",401 "post_processing":"regStringToKey"}],402 "associated_object_type" : "WindowsRegistryKeyObjectType",403 "association_type" : "output"},404 "KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",405 "associated_object_element" : "ID",406 "association_type" : "output",407 "forced" : {"associated_object_element" : "Type", 408 "value" : "RegistryKey"}}}},409"NtOpenKey" : {"action_name" : "open registry key",410 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",411 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ObjectAttributes", "element_name" : "Hive",412 "post_processing": "regStringToHive"},413 {"parameter_name" : "ObjectAttributes", "element_name" : "Key",414 "post_processing":"regStringToKey"}],415 "associated_object_type" : "WindowsRegistryKeyObjectType",416 "association_type" : "input"},417 "KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",418 "associated_object_element" : "ID",419 "association_type" : "output",420 "forced" : {"associated_object_element" : "Type", 421 "value" : "RegistryKey"}}}},422"NtOpenKeyEx" : {"action_name" : "open registry key",423 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",424 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ObjectAttributes", "element_name" : "Hive",425 "post_processing": "regStringToHive"},426 {"parameter_name" : "ObjectAttributes", "element_name" : "Key",427 "post_processing":"regStringToKey"}],428 "associated_object_type" : "WindowsRegistryKeyObjectType",429 "association_type" : "input"},430 "KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",431 "associated_object_element" : "ID",432 "association_type" : "output",433 "forced" : {"associated_object_element" : "Type", 434 "value" : "RegistryKey"}}}},435"NtRenameKey" : {"action_name" : "rename registry key",436 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "NewName", "element_name" : "Hive",437 "post_processing": "regStringToHive"},438 {"parameter_name" : "NewName", "element_name" : "Key",439 "post_processing":"regStringToKey"}],440 "associated_object_type" : "WindowsRegistryKeyObjectType",441 "association_type" : "input"},442 "KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",443 "associated_object_element" : "ID",444 "association_type" : "input",445 "forced" : {"associated_object_element" : "Type", 446 "value" : "RegistryKey"}}}},447"NtReplaceKey" : {"action_name" : "save hive key to file",448 "parameter_associated_objects" : {"NewHiveFileName" : {"associated_object_type" : "FileObjectType",449 "associated_object_element" : "File_Path",450 "association_type" : "output"},451 "OldHiveFileName" : {"associated_object_type" : "FileObjectType",452 "associated_object_element" : "File_Path",453 "association_type" : "input"},454 "KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",455 "associated_object_element" : "ID",456 "association_type" : "input",457 "forced" : {"associated_object_element" : "Type", 458 "value" : "RegistryKey"}}}},459"NtEnumerateKey" : {"action_name" : "enumerate registry key subkeys",460 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",461 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",462 "associated_object_element" : "ID",463 "association_type" : "input",464 "forced" : {"associated_object_element" : "Type", 465 "value" : "RegistryKey"}}}},466"NtEnumerateValueKey" : {"action_name" : "enumerate registry key values",467 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",468 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",469 "associated_object_element" : "ID",470 "association_type" : "input",471 "forced" : {"associated_object_element" : "Type", 472 "value" : "RegistryKey"}}}},473"NtSetValueKey" : {"action_name" : "modify registry key value",474 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",475 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",476 "associated_object_element" : "ID",477 "association_type" : "input",478 "forced" : {"associated_object_element" : "Type", 479 "value" : "RegistryKey"}},480 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ValueName", "element_name" : "Name"},481 {"parameter_name" : "Type", "element_name" : "Datatype",482 "post_processing":"regDatatypeToString"},483 {"parameter_name" : "Buffer", "element_name" : "Data"}],484 "associated_object_type" : "WindowsRegistryKeyObjectType",485 "associated_object_element" : "Values/list__",486 "association_type" : "output"}}},487"NtQueryValueKey" : {"action_name" : "read registry key value",488 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",489 "parameter_associated_objects" : {"ValueName" : {"associated_object_type" : "WindowsRegistryKeyObjectType",490 "associated_object_element" : "Values/list__Name",491 "association_type" : "input"},492 "KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",493 "associated_object_element" : "ID",494 "association_type" : "input",495 "forced" : {"associated_object_element" : "Type", 496 "value" : "RegistryKey"}},497 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "Type", "element_name" : "Datatype",498 "post_processing":"regDatatypeToString"},499 {"parameter_name" : "Information", "element_name" : "Data"}],500 "associated_object_type" : "WindowsRegistryKeyObjectType",501 "associated_object_element" : "Values/list__",502 "association_type" : "output"}}},503"NtQueryMultipleValueKey" : {"action_name" : "read registry key value",504 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",505 "parameter_associated_objects" : {"ValueName" : {"associated_object_type" : "WindowsRegistryKeyObjectType",506 "associated_object_element" : "Values/list__Name",507 "association_type" : "input"},508 "ValueBuffer" : {"associated_object_type" : "WindowsRegistryKeyObjectType",509 "associated_object_element" : "Values/list__Data",510 "association_type" : "output"},511 "KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",512 "associated_object_element" : "ID",513 "association_type" : "input",514 "forced" : {"associated_object_element" : "Type", 515 "value" : "RegistryKey"}}}},516"NtDeleteKey" : {"action_name" : "delete registry key",517 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",518 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",519 "associated_object_element" : "ID",520 "association_type" : "input",521 "forced" : {"associated_object_element" : "Type", 522 "value" : "RegistryKey"}}}},523"NtDeleteValueKey" : {"action_name" : "delete registry key value",524 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",525 "parameter_associated_objects" : {"ValueName" : {"associated_object_type" : "WindowsRegistryKeyObjectType",526 "associated_object_element" : "Values/list__Name",527 "association_type" : "input"},528 "KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",529 "associated_object_element" : "ID",530 "association_type" : "input",531 "forced" : {"associated_object_element" : "Type", 532 "value" : "RegistryKey"}}}},533"NtLoadKey" : {"action_name" : "load registry keys from file",534 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "TargetKey", "element_name" : "Hive",535 "post_processing": "regStringToHive"},536 {"parameter_name" : "TargetKey", "element_name" : "Key",537 "post_processing":"regStringToKey"}],538 "associated_object_type" : "WindowsRegistryKeyObjectType",539 "association_type" : "input"},540 "SourceFile" : {"associated_object_type" : "FileObjectType",541 "associated_object_element" : "File_Path",542 "association_type" : "input",543 "forced" : {"associated_object_element" : "Type", 544 "value" : "RegistryKey"}}}},545"NtLoadKey2" : {"action_name" : "load registry keys from file",546 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "TargetKey", "element_name" : "Hive",547 "post_processing": "regStringToHive"},548 {"parameter_name" : "TargetKey", "element_name" : "Key",549 "post_processing":"regStringToKey"}],550 "associated_object_type" : "WindowsRegistryKeyObjectType",551 "association_type" : "input"},552 "SourceFile" : {"associated_object_type" : "FileObjectType",553 "associated_object_element" : "File_Path",554 "association_type" : "input",555 "forced" : {"associated_object_element" : "Type", 556 "value" : "RegistryKey"}}}},557"NtLoadKeyEx" : {"action_name" : "load registry keys from file",558 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "TargetKey", "element_name" : "Hive",559 "post_processing": "regStringToHive"},560 {"parameter_name" : "TargetKey", "element_name" : "Key",561 "post_processing":"regStringToKey"}],562 "associated_object_type" : "WindowsRegistryKeyObjectType",563 "association_type" : "input"},564 "SourceFile" : {"associated_object_type" : "FileObjectType",565 "associated_object_element" : "File_Path",566 "association_type" : "input",567 "forced" : {"associated_object_element" : "Type", 568 "value" : "RegistryKey"}}}},569"NtQueryKey" : {"action_name" : "get registry key attributes",570 "action_vocab" : "maecVocabs:RegistryActionNameVocab-1.0",571 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",572 "associated_object_element" : "ID",573 "association_type" : "input",574 "forced" : {"associated_object_element" : "Type", 575 "value" : "RegistryKey"}}}},576"NtSaveKey" : {"action_name" : "save registry key subtree to file",577 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",578 "associated_object_element" : "ID",579 "association_type" : "input"},580 "FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",581 "associated_object_element" : "ID",582 "association_type" : "input",583 "forced" : {"associated_object_element" : "Type", 584 "value" : "RegistryKey"}}}},585"NtSaveKeyEx" : {"action_name" : "save registry key subtree to file",586 "parameter_associated_objects" : {"KeyHandle" : {"associated_object_type" : "WindowsHandleObjectType",587 "associated_object_element" : "ID",588 "association_type" : "input"},589 "FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",590 "associated_object_element" : "ID",591 "association_type" : "input",592 "forced" : {"associated_object_element" : "Type", 593 "value" : "Process"}}}}, 594"NtCreateProcess" : {"action_name" : "create process",595 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",596 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",597 "associated_object_element" : "ID",598 "association_type" : "output",599 "forced" : {"associated_object_element" : "Type", 600 "value" : "Process"}},601 "FileName" : {"associated_object_type" : "FileObjectType",602 "associated_object_element" : "File_Path",603 "association_type" : "input"}}},604"NtCreateProcessEx" : {"action_name" : "create process",605 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",606 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",607 "associated_object_element" : "ID",608 "association_type" : "output",609 "forced" : {"associated_object_element" : "Type", 610 "value" : "Process"}},611 "FileName" : {"associated_object_type" : "FileObjectType",612 "associated_object_element" : "File_Path",613 "association_type" : "input"}}},614"NtCreateUserProcess" : {"action_name" : "create process",615 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",616 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",617 "associated_object_element" : "ID",618 "association_type" : "output",619 "forced" : {"associated_object_element" : "Type", 620 "value" : "Process"}},621 "ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",622 "associated_object_element" : "ID",623 "association_type" : "output",624 "forced" : {"associated_object_element" : "Type", 625 "value" : "Thread"}},626 "ThreadName" : {"associated_object_type" : "WindowsThreadObjectType",627 "associated_object_element" : "Thread_ID",628 "association_type" : "output"},629 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ProcessFileName", "element_name" : "File_Name",},630 {"parameter_name" : "ImagePathName", "element_name" : "Path"}],631 "associated_object_type" : "ProcessObjectType",632 "associated_object_element" : "Image_Info",633 "association_type" : "output"}}},634"RtlCreateUserProcess" : {"action_name" : "create process",635 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",636 "parameter_associated_objects" : {"ParentProcess" : {"associated_object_type" : "WindowsHandleObjectType",637 "associated_object_element" : "ID",638 "association_type" : "output",639 "forced" : {"associated_object_element" : "Type", 640 "value" : "Process"}},641 "ImagePath" : {"associated_object_type" : "ProcessObjectType",642 "associated_object_element" : "Image_Info/Path",643 "association_type" : "input"}}},644"NtOpenProcess" : {"action_name" : "open process",645 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",646 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",647 "associated_object_element" : "ID",648 "association_type" : "output",649 "forced" : {"associated_object_element" : "Type", 650 "value" : "Process"}},651 "ProcessIdentifier" : {"associated_object_type" : "ProcessObjectType",652 "associated_object_element" : "PID",653 "association_type" : "input"}}},654"NtTerminateProcess" : {"action_name" : "kill process",655 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",656 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",657 "associated_object_element" : "ID",658 "association_type" : "input",659 "forced" : {"associated_object_element" : "Type", 660 "value" : "Process"}}}},661"NtCreateSection" : {"action_name" : "create section",662 "parameter_associated_objects" : {"SectionHandle" : {"associated_object_type" : "WindowsHandleObjectType",663 "associated_object_element" : "ID",664 "association_type" : "output",665 "forced" : {"associated_object_element" : "Type", 666 "value" : "Section"}},667 "FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",668 "associated_object_element" : "ID",669 "association_type" : "input",670 "forced" : {"associated_object_element" : "Type", 671 "value" : "File"}}}}, 672"NtOpenSection" : {"action_name" : "open section",673 "parameter_associated_objects" : {"SectionHandle" : {"associated_object_type" : "WindowsHandleObjectType",674 "associated_object_element" : "ID",675 "association_type" : "output",676 "forced" : {"associated_object_element" : "Type", 677 "value" : "Section"}},678 "ObjectAttributes" : {"associated_object_type" : "MemoryObjectType",679 "associated_object_element" : "Name",680 "association_type" : "input"}}},681"CreateProcessInternalW" : {"action_name" : "create process",682 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",683 "parameter_associated_objects" : {"ProcessId" : {"associated_object_type" : "WindowsProcessObjectType",684 "associated_object_element" : "PID",685 "association_type" : "output"},686 "ThreadId" : {"associated_object_type" : "WindowsThreadObjectType",687 "associated_object_element" : "Thread_ID",688 "association_type" : "output"},689 "ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",690 "associated_object_element" : "ID",691 "association_type" : "output",692 "forced" : {"associated_object_element" : "Type",693 "value" : "Process"}},694 "ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",695 "associated_object_element" : "ID",696 "association_type" : "output",697 "forced" : {"associated_object_element" : "Type", 698 "value" : "Thread"}}},699 "parameter_associated_arguments" : {"ApplicationName" : {"associated_argument_name" : "Application Name"}}},700"ExitProcess" : {"action_name" : "kill process",701 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",702 "parameter_associated_arguments" : {"ExitCode" : {"associated_argument_name" : "Exit Code"}}},703"ShellExecuteExW" : {"action_name" : "create process",704 "action_vocab" : "maecVocabs:ProcessActionNameVocab-1.0",705 "parameter_associated_objects" : {"FilePath" : {"associated_object_type" : "FileObjectType",706 "associated_object_element" : "File_Path",707 "association_type" : "input" }}},708"NtUnmapViewOfSection" : {"action_name" : "unmap view of section",709 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",710 "associated_object_element" : "ID",711 "association_type" : "input",712 "forced" : {"associated_object_element" : "Type",713 "value" : "Process"}}}},714"NtAllocateVirtualMemory" : {"action_name" : "allocate process virtual memory",715 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",716 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",717 "associated_object_element" : "ID",718 "association_type" : "input",719 "forced" : {"associated_object_element" : "Type", 720 "value" : "Process"}}}},721"NtReadVirtualMemory" : {"action_name" : "read from process memory",722 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",723 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",724 "associated_object_element" : "ID",725 "association_type" : "input",726 "forced" : {"associated_object_element" : "Type", 727 "value" : "Process"}}}},728"ReadProcessMemory" : {"action_name" : "read from process memory",729 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",730 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",731 "associated_object_element" : "ID",732 "association_type" : "input",733 "forced" : {"associated_object_element" : "Type", 734 "value" : "Process"}}}},735"NtWriteVirtualMemory" : {"action_name" : "write to process memory",736 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",737 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",738 "associated_object_element" : "ID",739 "association_type" : "input",740 "forced" : {"associated_object_element" : "Type", 741 "value" : "Process"}}}},742"WriteProcessMemory" : {"action_name" : "write to process memory",743 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",744 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",745 "associated_object_element" : "ID",746 "association_type" : "input",747 "forced" : {"associated_object_element" : "Type", 748 "value" : "Process"}}}},749"NtProtectVirtualMemory" : {"action_name" : "modify process virtual memory protection",750 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",751 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",752 "associated_object_element" : "ID",753 "association_type" : "input",754 "forced" : {"associated_object_element" : "Type", 755 "value" : "Process"}}}},756"VirtualProtectEx" : {"action_name" : "modify process virtual memory protection",757 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",758 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",759 "associated_object_element" : "ID",760 "association_type" : "input",761 "forced" : {"associated_object_element" : "Type", 762 "value" : "Process"}}}},763"NtFreeVirtualMemory" : {"action_name" : "free process virtual memory",764 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",765 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",766 "associated_object_element" : "ID",767 "association_type" : "input",768 "forced" : {"associated_object_element" : "Type", 769 "value" : "Process"}}}},770"VirtualFreeEx" : {"action_name" : "free process virtual memory",771 "action_vocab" : "maecVocabs:ProcessMemoryActionNameVocab-1.0",772 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",773 "associated_object_element" : "ID",774 "association_type" : "input",775 "forced" : {"associated_object_element" : "Type", 776 "value" : "Process"}}}},777"FindWindowA" : {"action_name" : "find window",778 "action_vocab" : "maecVocabs:GUIActionNameVocab-1.0",779 "parameter_associated_objects" : {"WindowName" : {"associated_object_type" : "GUIWindowObjectType",780 "associated_object_element" : "Window_Display_Name",781 "association_type" : "input"}}},782"FindWindowW" : {"action_name" : "find window",783 "action_vocab" : "maecVocabs:GUIActionNameVocab-1.0",784 "parameter_associated_objects" : {"WindowName" : {"associated_object_type" : "GUIWindowObjectType",785 "associated_object_element" : "Window_Display_Name",786 "association_type" : "input"}}},787"FindWindowExA" : {"action_name" : "find window",788 "action_vocab" : "maecVocabs:GUIActionNameVocab-1.0",789 "parameter_associated_objects" : {"WindowName" : {"associated_object_type" : "GUIWindowObjectType",790 "associated_object_element" : "Window_Display_Name",791 "association_type" : "input"}}},792"FindWindowExW" : {"action_name" : "find window",793 "action_vocab" : "maecVocabs:GUIActionNameVocab-1.0",794 "parameter_associated_objects" : {"WindowName" : {"associated_object_type" : "GUIWindowObjectType",795 "associated_object_element" : "Window_Display_Name",796 "association_type" : "input"}}},797"SetWindowsHookExA" : {"action_name" : "add windows hook",798 "action_vocab" : "maecVocabs:HookingActionNameVocab-1.0",799 "parameter_associated_objects" : {"HookIdentifier" : {"associated_object_type" : "WindowsKernelHookObjectType",800 "associated_object_element" : "Type",801 "association_type" : "input"},802 "ProcedureAddress" : {"associated_object_type" : "WindowsKernelHookObjectType",803 "associated_object_element" : "Hooking_Address",804 "association_type" : "input"},805 "ThreadId" : {"associated_object_type" : "WindowsThreadObjectType",806 "associated_object_element" : "Thread_ID",807 "association_type" : "input"},808 "group_together" : ["HookIdentifier", "ProcedureAddress"]}},809"SetWindowsHookExW" : {"action_name" : "add windows hook",810 "action_vocab" : "maecVocabs:HookingActionNameVocab-1.0",811 "parameter_associated_objects" : {"HookIdentifier" : {"associated_object_type" : "WindowsKernelHookObjectType",812 "associated_object_element" : "Type",813 "association_type" : "input"},814 "ProcedureAddress" : {"associated_object_type" : "WindowsKernelHookObjectType",815 "associated_object_element" : "Hooking_Address",816 "association_type" : "input"},817 "ThreadId" : {"associated_object_type" : "WindowsThreadObjectType",818 "associated_object_element" : "Thread_ID",819 "association_type" : "input"},820 "group_together" : ["HookIdentifier", "ProcedureAddress"]}},821"UnhookWindowsHookEx" : {"action_name" : "remove windows hook",822 "parameter_associated_objects" : {"HookHandle" : {"associated_object_type" : "WindowsHandleObjectType",823 "associated_object_element" : "ID",824 "association_type" : "input",825 "forced" : {"associated_object_element" : "Type", 826 "value" : "Hook"}}}}, 827"LdrLoadDll" : {"action_name" : "load library",828 "action_vocab" : "maecVocabs:LibraryActionNameVocab-1.0",829 "parameter_associated_objects" : {"FileName" : {"associated_object_type" : "LibraryObjectType",830 "associated_object_element" : "Name",831 "association_type" : "input"},832 "BaseAddress" : {"associated_object_type" : "WindowsHandleObjectType",833 "associated_object_element" : "ID",834 "association_type" : "output",835 "forced" : {"associated_object_element" : "Type", 836 "value" : "Module"}}}},837"LdrGetDllHandle" : {"action_name" : "get dll handle",838 "parameter_associated_objects" : {"FileName" : {"associated_object_type" : "LibraryObjectType",839 "associated_object_element" : "Name",840 "association_type" : "input"},841 "ModuleHandle" : {"associated_object_type" : "WindowsHandleObjectType",842 "associated_object_element" : "ID",843 "association_type" : "output",844 "forced" : {"associated_object_element" : "Type", 845 "value" : "Module"}}}},846"LdrGetProcedureAddress" : {"action_name" : "get function address",847 "action_vocab" : "maecVocabs:LibraryActionNameVocab-1.0",848 "parameter_associated_objects" : {"ModuleHandle" : {"associated_object_type" : "WindowsHandleObjectType",849 "associated_object_element" : "ID",850 "association_type" : "input",851 "forced" : {"associated_object_element" : "Type", 852 "value" : "Module"}},853 "FunctionAddress" : {"associated_object_type" : "APIObjectType",854 "associated_object_element" : "Address",855 "association_type" : "output",856 "post_processing" : "intToHex"},857 "group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "FunctionName", "element_name" : "Function_Name"}, 858 {"parameter_name" : "Ordinal", "element_name" : "Ordinal"}],859 "associated_object_type" : "WindowsExecutableFileObjectType",860 "associated_object_element" : "Exports/Exported_Functions/list__",861 "association_type" : "input"}}},862"DeviceIoControl" : {"action_name" : "send control code to driver",863 "parameter_associated_objects" : {"DeviceHandle" : {"associated_object_type" : "WindowsHandleObjectType",864 "associated_object_element" : "ID",865 "association_type" : "input",866 "forced" : {"associated_object_element" : "Type", 867 "value" : "Device"}}},868 "parameter_associated_arguments" : {"IoControlCode" : {"associated_argument_name" : "Control Code",869 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},870"ExitWindowsEx" : {"action_name" : "shutdown system",871 "action_vocab" : "maecVocabs:SystemActionNameVocab-1.0",872 "parameter_associated_arguments" : {"Flags" : {"associated_argument_name" : "Flags"},873 "Reason" : {"associated_argument_name" : "Reason"}}},874"IsDebuggerPresent" : {"action_name" : "check for remote debugger",875 "action_vocab" : "maecVocabs:DebuggingActionNameVocab-1.0"},876"LookupPrivilegeValueW" : {"action_name" : "find privilege value",877 "parameter_associated_objects" : {"SystemName" : {"associated_object_type" : "SystemObjectType",878 "associated_object_element" : "Hostname",879 "association_type" : "input"}},880 "parameter_associated_arguments" : {"PrivilegeName" : {"associated_argument_name" : "Privilege Name"}}},881"NtClose" : {"action_name" : "close handle",882 "parameter_associated_objects" : {"Handle" : {"associated_object_type" : "WindowsHandleObjectType",883 "associated_object_element" : "ID",884 "association_type" : "input"}}},885"WriteConsoleA" : {"action_name" : "write to console",886 "parameter_associated_objects" : {"ConsoleHandle" : {"associated_object_type" : "WindowsHandleObjectType",887 "associated_object_element" : "ID",888 "association_type" : "input",889 "forced" : {"associated_object_element" : "Type", 890 "value" : "Console"}}}},891"WriteConsoleW" : {"action_name" : "write to console",892 "parameter_associated_objects" : {"ConsoleHandle" : {"associated_object_type" : "WindowsHandleObjectType",893 "associated_object_element" : "ID",894 "association_type" : "input",895 "forced" : {"associated_object_element" : "Type", 896 "value" : "Console"}}}},897"ZwMapViewOfSection" : {"action_name" : "map view of section",898 "parameter_associated_objects" : {"SectionHandle" : {"associated_object_type" : "WindowsHandleObjectType",899 "associated_object_element" : "ID",900 "association_type" : "input",901 "forced" : {"associated_object_element" : "Type", 902 "value" : "Section"}},903 "ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",904 "associated_object_element" : "ID",905 "association_type" : "input",906 "forced" : {"associated_object_element" : "Type", 907 "value" : "Process"}}},908 "parameter_associated_arguments" : {"BaseAddress" : {"associated_argument_name" : "Base Address",909 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},910 "SectionOffset" : {"associated_argument_name" : "Section Offset"}}},911"GetSystemMetrics" : {"action_name" : "get system metrics",912 "parameter_associated_arguments" : {"SystemMetricIndex" : {"associated_argument_name" : "System Metric Index"}}},913"NtDelayExecution" : {"action_name" : "delay execution",914 "parameter_associated_arguments" : {"Milliseconds" : {"associated_argument_name" : "Milliseconds"}}},915"GetLocalTime" : {"action_name" : "get system local time",916 "action_vocab" : "maecVocabs:SystemActionNameVocab-1.0"},917"GetSystemTime" : {"action_name" : "get system time",918 "action_vocab" : "maecVocabs:SystemActionNameVocab-1.0"},919"GetTickCount" : {"action_name" : "get tick count"},920"NtQuerySystemTime" : {"action_name" : "get system time",921 "action_vocab" : "maecVocabs:SystemActionNameVocab-1.0"},922"WSAStartup" : {"action_name" : "initialize winsock",923 "parameter_associated_arguments" : {"VersionRequested" : {"associated_argument_name" : "Version Requested"}}},924"gethostbyname" : {"action_name" : "get host by name",925 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",926 "parameter_associated_arguments" : {"Name" : {"associated_argument_name" : "Hostname", 927 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},928"socket" : {"action_name" : "create socket",929 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",930 "parameter_associated_objects" : {"type" : {"associated_object_type" : "NetworkSocketObjectType",931 "associated_object_element" : "Type",932 "association_type" : "output",933 "post_processing" : "socketTypeToString"},934 "af" : {"associated_object_type" : "NetworkSocketObjectType",935 "associated_object_element" : "Address_Family",936 "association_type" : "output",937 "post_processing" : "socketAFToString"},938 "protocol" : {"associated_object_type" : "NetworkSocketObjectType",939 "associated_object_element" : "Protocol",940 "association_type" : "output",941 "post_processing" : "socketProtoToString"},942 "group_together" : ["type", "protocol", "af"]}},943"connect" : {"action_name" : "connect to socket",944 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",945 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},946"send" : {"action_name" : "send data on socket",947 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",948 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"},949 "buffer" : {"associated_argument_name" : "Data Buffer"}}},950"sendto" : {"action_name" : "send data to address on socket",951 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",952 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"},953 "buffer" : {"associated_argument_name" : "Data Buffer"}}},954"recv" : {"action_name" : "receive data on socket",955 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",956 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"},957 "buffer" : {"associated_argument_name" : "Data Buffer"}}},958"recvfrom" : {"action_name" : "receive data on socket",959 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",960 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"},961 "buffer" : {"associated_argument_name" : "Data Buffer"}}},962"accept" : {"action_name" : "accept socket connection",963 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",964 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},965"bind" : {"action_name" : "bind address to socket",966 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",967 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "ip", "element_name" : "IP_Address/Address_Value"},968 {"parameter_name" : "port", "element_name" : "Port/Port_Value"}],969 "associated_object_type" : "NetworkSocketObjectType",970 "associated_object_element" : "Local_Address",971 "association_type" : "input"}},972 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},973"listen" : {"action_name" : "listen on socket",974 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",975 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},976"select" : {"action_name" : "check for ready sockets",977 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},978"setsockopt" : {"action_name" : "set socket option",979 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},980"ioctlsocket" : {"action_name" : "send command to socket",981 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"},982 "command" : {"associated_argument_name" : "Command"}}},983"closesocket" : {"action_name" : "close socket",984 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",985 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},986"shutdown" : {"action_name" : "disable socket operation",987 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"},988 "how" : {"associated_argument_name" : "Operation"}}},989"WSARecv" : {"action_name" : "receive data on socket",990 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",991 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},992"WSARecvFrom" : {"action_name" : "receive data on socket",993 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",994 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},995"WSASend" : {"action_name" : "send data on socket",996 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",997 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},998"WSASendTo" : {"action_name" : "send data on socket",999 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",1000 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},1001"WSASocketA" : {"action_name" : "create socket",1002 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",1003 "parameter_associated_objects" : {"type" : {"associated_object_type" : "NetworkSocketObjectType",1004 "associated_object_element" : "Type",1005 "association_type" : "output",1006 "post_processing" : "socketTypeToString"},1007 "af" : {"associated_object_type" : "NetworkSocketObjectType",1008 "associated_object_element" : "Address_Family",1009 "association_type" : "output",1010 "post_processing" : "socketAFToString"},1011 "protocol" : {"associated_object_type" : "NetworkSocketObjectType",1012 "associated_object_element" : "Protocol",1013 "association_type" : "output",1014 "post_processing" : "socketProtoToString"},1015 "group_together" : ["type", "protocol", "af"]}},1016"WSASocketW" : {"action_name" : "create socket",1017 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",1018 "parameter_associated_objects" : {"type" : {"associated_object_type" : "NetworkSocketObjectType",1019 "associated_object_element" : "Type",1020 "association_type" : "output",1021 "post_processing" : "socketTypeToString"},1022 "af" : {"associated_object_type" : "NetworkSocketObjectType",1023 "associated_object_element" : "Address_Family",1024 "association_type" : "output",1025 "post_processing" : "socketAFToString"},1026 "protocol" : {"associated_object_type" : "NetworkSocketObjectType",1027 "associated_object_element" : "Protocol",1028 "association_type" : "output",1029 "post_processing" : "socketProtoToString"},1030 "group_together" : ["type", "protocol", "af"]}},1031"ConnectEx" : {"action_name" : "connect to socket",1032 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",1033 "parameter_associated_arguments" : {"socket" : {"associated_argument_name" : "Socket Descriptor"}}},1034"TransmitFile" : {"action_name" : "send file over socket",1035 "parameter_associated_objects" : {"socket" : {"associated_object_type" : "WindowsHandleObjectType",1036 "associated_object_element" : "ID",1037 "association_type" : "input"},1038 "FileHandle" : {"associated_object_type" : "WindowsHandleObjectType",1039 "associated_object_element" : "ID",1040 "association_type" : "input",1041 "forced" : {"associated_object_element" : "Type", 1042 "value" : "File"}},1043 "NumberOfBytesToWrite" : {"associated_object_type" : "FileObjectType",1044 "associated_object_element" : "Size_In_Bytes",1045 "association_type" : "output"}},1046 "parameter_associated_arguments" : {"NumberOfBytesPerSend" : {"associated_argument_name" : "Send Data Block Size"}}},1047"NtCreateMutant" : {"action_name" : "create mutex",1048 "action_vocab" : "maecVocabs:SynchronizationActionNameVocab-1.0",1049 "parameter_associated_objects" : {"Handle" : {"associated_object_type" : "WindowsHandleObjectType",1050 "associated_object_element" : "ID",1051 "association_type" : "output",1052 "forced" : {"associated_object_element" : "Type", 1053 "value" : "Mutex"}},1054 "MutexName" : {"associated_object_type" : "WindowsMutexObjectType",1055 "associated_object_element" : "Name",1056 "association_type" : "output"}},1057 "parameter_associated_arguments" : {"InitialOwner" : {"associated_argument_name" : "Initial Owner"}}},1058"NtOpenMutant" : {"action_name" : "open mutex",1059 "action_vocab" : "maecVocabs:SynchronizationActionNameVocab-1.0",1060 "parameter_associated_objects" : {"Handle" : {"associated_object_type" : "WindowsHandleObjectType",1061 "associated_object_element" : "ID",1062 "association_type" : "output",1063 "forced" : {"associated_object_element" : "Type", 1064 "value" : "Mutex"}},1065 "MutexName" : {"associated_object_type" : "WindowsMutexObjectType",1066 "associated_object_element" : "Name",1067 "association_type" : "input"}}},1068"NtCreateNamedPipeFile" : {"action_name" : "create named pipe",1069 "action_vocab" : "maecVocabs:IPCActionNameVocab-1.0",1070 "parameter_associated_objects" : {"NamedPipeHandle" : {"associated_object_type" : "WindowsHandleObjectType",1071 "associated_object_element" : "ID",1072 "association_type" : "output",1073 "forced" : {"associated_object_element" : "Type", 1074 "value" : "NamedPipe"}},1075 "PipeName" : {"associated_object_type" : "WindowsPipeObjectType",1076 "associated_object_element" : "Name",1077 "association_type" : "output"}},1078 "parameter_associated_arguments" : {"DesiredAccess" : {"associated_argument_name" : "Access Mode", 1079 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1080 "ShareAccess" : {"associated_argument_name" : "Share Access Mode"}}},1081"OpenSCManagerA" : {"action_name" : "open service control manager",1082 "parameter_associated_objects" : {"MachineName" : {"associated_object_type" : "SystemObjectType",1083 "associated_object_element" : "Hostname",1084 "association_type" : "input"}},1085 "parameter_associated_arguments" : {"DesiredAccess" : {"associated_argument_name" : "Access Mode", 1086 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1087 "DatabaseName" : {"associated_argument_name" : "Database Name"}}},1088"OpenSCManagerW" : {"action_name" : "open service control manager",1089 "parameter_associated_objects" : {"MachineName" : {"associated_object_type" : "SystemObjectType",1090 "associated_object_element" : "Hostname",1091 "association_type" : "input"}},1092 "parameter_associated_arguments" : {"DesiredAccess" : {"associated_argument_name" : "Access Mode", 1093 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1094 "DatabaseName" : {"associated_argument_name" : "Database Name"}}},1095"CreateServiceA" : {"action_name" : "create service",1096 "action_vocab" : "maecVocabs:ServiceActionNameVocab-1.0",1097 "parameter_associated_objects" : {"ServiceControlHandle" : {"associated_object_type" : "WindowsHandleObjectType",1098 "associated_object_element" : "ID",1099 "association_type" : "input",1100 "forced" : {"associated_object_element" : "Type", 1101 "value" : "ServiceControlManager"}},1102 "ServiceName" : {"associated_object_type" : "WindowsServiceObjectType",1103 "associated_object_element" : "Service_Name",1104 "association_type" : "output"},1105 "DisplayName" : {"associated_object_type" : "WindowsServiceObjectType",1106 "associated_object_element" : "Display_Name",1107 "association_type" : "output"},1108 "ServiceType" : {"associated_object_type" : "WindowsServiceObjectType",1109 "associated_object_element" : "Service_Type",1110 "association_type" : "output"},1111 "StartType" : {"associated_object_type" : "WindowsServiceObjectType",1112 "associated_object_element" : "Startup_Type",1113 "association_type" : "output"},1114 "ServiceStartName" : {"associated_object_type" : "WindowsServiceObjectType",1115 "associated_object_element" : "Started_As",1116 "association_type" : "output"},1117 "BinaryPathName" : {"associated_object_type" : "WindowsServiceObjectType",1118 "associated_object_element" : "Image_Info/Path",1119 "association_type" : "output"},1120 "group_together" : ["ServiceName", "DisplayName", "ServiceType", 1121 "StartType", "ServiceStartName", "BinaryPathName"]},1122 "parameter_associated_arguments" : {"DesiredAccess" : {"associated_argument_name" : "Access Mode", 1123 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1124 "ErrorControl" : {"associated_argument_name" : "Error Control"}}},1125"CreateServiceW" : {"action_name" : "create service",1126 "action_vocab" : "maecVocabs:ServiceActionNameVocab-1.0",1127 "parameter_associated_objects" : {"ServiceControlHandle" : {"associated_object_type" : "WindowsHandleObjectType",1128 "associated_object_element" : "ID",1129 "association_type" : "input",1130 "forced" : {"associated_object_element" : "Type", 1131 "value" : "ServiceControlManager"}},1132 "ServiceName" : {"associated_object_type" : "WindowsServiceObjectType",1133 "associated_object_element" : "Service_Name",1134 "association_type" : "output"},1135 "DisplayName" : {"associated_object_type" : "WindowsServiceObjectType",1136 "associated_object_element" : "Display_Name",1137 "association_type" : "output"},1138 "ServiceType" : {"associated_object_type" : "WindowsServiceObjectType",1139 "associated_object_element" : "Service_Type",1140 "association_type" : "output"},1141 "StartType" : {"associated_object_type" : "WindowsServiceObjectType",1142 "associated_object_element" : "Startup_Type",1143 "association_type" : "output"},1144 "ServiceStartName" : {"associated_object_type" : "WindowsServiceObjectType",1145 "associated_object_element" : "Started_As",1146 "association_type" : "output"},1147 "BinaryPathName" : {"associated_object_type" : "WindowsServiceObjectType",1148 "associated_object_element" : "Image_Info/Path",1149 "association_type" : "output"},1150 "group_together" : ["ServiceName", "DisplayName", "ServiceType", 1151 "StartType", "ServiceStartName", "BinaryPathName"]},1152 "parameter_associated_arguments" : {"DesiredAccess" : {"associated_argument_name" : "Access Mode", 1153 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1154 "ErrorControl" : {"associated_argument_name" : "Error Control"}}},1155"OpenServiceA" : {"action_name" : "open service",1156 "action_vocab" : "maecVocabs:ServiceActionNameVocab-1.0",1157 "parameter_associated_objects" : {"ServiceControlManager" : {"associated_object_type" : "WindowsHandleObjectType",1158 "associated_object_element" : "ID",1159 "association_type" : "input",1160 "forced" : {"associated_object_element" : "Type", 1161 "value" : "ServiceControlManager"}},1162 "ServiceName" : {"associated_object_type" : "WindowsServiceObjectType",1163 "associated_object_element" : "Service_Name",1164 "association_type" : "input"}},1165 "parameter_associated_arguments" : {"DesiredAccess" : {"associated_argument_name" : "Access Mode", 1166 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},1167"OpenServiceW" : {"action_name" : "open service",1168 "action_vocab" : "maecVocabs:ServiceActionNameVocab-1.0",1169 "parameter_associated_objects" : {"ServiceControlManager" : {"associated_object_type" : "WindowsHandleObjectType",1170 "associated_object_element" : "ID",1171 "association_type" : "input",1172 "forced" : {"associated_object_element" : "Type", 1173 "value" : "ServiceControlManager"}},1174 "ServiceName" : {"associated_object_type" : "WindowsServiceObjectType",1175 "associated_object_element" : "Service_Name",1176 "association_type" : "input"}},1177 "parameter_associated_arguments" : {"DesiredAccess" : {"associated_argument_name" : "Access Mode", 1178 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},1179"StartServiceA" : {"action_name" : "start service",1180 "action_vocab" : "maecVocabs:ServiceActionNameVocab-1.0",1181 "parameter_associated_objects" : {"ServiceHandle" : {"associated_object_type" : "WindowsHandleObjectType",1182 "associated_object_element" : "ID",1183 "association_type" : "input",1184 "forced" : {"associated_object_element" : "Type", 1185 "value" : "Service"}}},1186 "parameter_associated_arguments" : {"Arguments" : {"associated_argument_name" : "Access Mode"}}},1187"StartServiceW" : {"action_name" : "start service",1188 "action_vocab" : "maecVocabs:ServiceActionNameVocab-1.0",1189 "parameter_associated_objects" : {"ServiceHandle" : {"associated_object_type" : "WindowsHandleObjectType",1190 "associated_object_element" : "ID",1191 "association_type" : "input",1192 "forced" : {"associated_object_element" : "Type", 1193 "value" : "Service"}}},1194 "parameter_associated_arguments" : {"Arguments" : {"associated_argument_name" : "Access Mode"}}},1195"ControlService" : {"action_name" : "send control code to service",1196 "action_vocab" : "maecVocabs:ServiceActionNameVocab-1.0",1197 "parameter_associated_objects" : {"ServiceHandle" : {"associated_object_type" : "WindowsHandleObjectType",1198 "associated_object_element" : "ID",1199 "association_type" : "input",1200 "forced" : {"associated_object_element" : "Type", 1201 "value" : "Service"}}},1202 "parameter_associated_arguments" : {"ControlCode" : {"associated_argument_name" : "Control Code",1203 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},1204"DeleteService" : {"action_name" : "delete service",1205 "action_vocab" : "maecVocabs:ServiceActionNameVocab-1.0",1206 "parameter_associated_objects" : {"ServiceHandle" : {"associated_object_type" : "WindowsHandleObjectType",1207 "associated_object_element" : "ID",1208 "association_type" : "input",1209 "forced" : {"associated_object_element" : "Type", 1210 "value" : "Service"}}}},1211"NtCreateThread" : {"action_name" : "create thread",1212 "action_vocab" : "maecVocabs:ProcessThreadActionNameVocab-1.0",1213 "parameter_associated_objects" : {"ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",1214 "associated_object_element" : "ID",1215 "association_type" : "output",1216 "forced" : {"associated_object_element" : "Type", 1217 "value" : "Thread"}},1218 "ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",1219 "associated_object_element" : "ID",1220 "association_type" : "input",1221 "forced" : {"associated_object_element" : "Type", 1222 "value" : "Process"}}},1223 "parameter_associated_arguments" : {"ObjectAttributes" : {"associated_argument_name" : "Options",1224 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},1225"NtOpenThread" : {"action_name" : "open thread",1226 "parameter_associated_objects" : {"ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",1227 "associated_object_element" : "ID",1228 "association_type" : "output",1229 "forced" : {"associated_object_element" : "Type", 1230 "value" : "Thread"}}},1231 "parameter_associated_arguments" : {"DesiredAccess" : {"associated_argument_name" : "Access Mode",1232 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1233 "ObjectAttributes" : {"associated_argument_name" : "Options",1234 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},1235"NtGetContextThread" : {"action_name" : "get thread context",1236 "action_vocab" : "maecVocabs:ProcessThreadActionNameVocab-1.0",1237 "parameter_associated_objects" : {"ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",1238 "associated_object_element" : "ID",1239 "association_type" : "input",1240 "forced" : {"associated_object_element" : "Type", 1241 "value" : "Thread"}}}},1242"NtSetContextThread" : {"action_name" : "set thread context",1243 "action_vocab" : "maecVocabs:ProcessThreadActionNameVocab-1.0",1244 "parameter_associated_objects" : {"ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",1245 "associated_object_element" : "ID",1246 "association_type" : "input",1247 "forced" : {"associated_object_element" : "Type", 1248 "value" : "Thread"}}}},1249"NtSuspendThread" : {"action_name" : "suspend thread",1250 "parameter_associated_objects" : {"ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",1251 "associated_object_element" : "ID",1252 "association_type" : "input",1253 "forced" : {"associated_object_element" : "Type", 1254 "value" : "Thread"}}}},1255"NtResumeThread" : {"action_name" : "resume thread",1256 "parameter_associated_objects" : {"ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",1257 "associated_object_element" : "ID",1258 "association_type" : "input",1259 "forced" : {"associated_object_element" : "Type", 1260 "value" : "Thread"}}}},1261"NtTerminateThread" : {"action_name" : "kill thread",1262 "action_vocab" : "maecVocabs:ProcessThreadActionNameVocab-1.0",1263 "parameter_associated_objects" : {"ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",1264 "associated_object_element" : "ID",1265 "association_type" : "input",1266 "forced" : {"associated_object_element" : "Type", 1267 "value" : "Thread"}}}},1268"CreateThread" : {"action_name" : "create thread",1269 "action_vocab" : "maecVocabs:ProcessThreadActionNameVocab-1.0",1270 "parameter_associated_objects" : {"ThreadId" : {"associated_object_type" : "WindowsThreadObjectType",1271 "associated_object_element" : "Thread_ID",1272 "association_type" : "output"}},1273 "parameter_associated_arguments" : {"StartRoutine" : {"associated_argument_name" : "Code Address",1274 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1275 "Parameter" : {"associated_argument_name" : "Options",1276 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1277 "CreationFlags" : {"associated_argument_name" : "Creation Flags",1278 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},1279"CreateRemoteThread" : {"action_name" : "create remote thread in process",1280 "action_vocab" : "maecVocabs:ProcessThreadActionNameVocab-1.0",1281 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",1282 "associated_object_element" : "ID",1283 "association_type" : "input"},1284 "ThreadId" : {"associated_object_type" : "WindowsThreadObjectType",1285 "associated_object_element" : "Thread_ID",1286 "association_type" : "output"}},1287 "parameter_associated_arguments" : {"StartRoutine" : {"associated_argument_name" : "Code Address",1288 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1289 "Parameter" : {"associated_argument_name" : "Options",1290 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1291 "CreationFlags" : {"associated_argument_name" : "Creation Flags",1292 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},1293"ExitThread" : {"action_name" : "exit thread"}, 1294"RtlCreateUserThread" : {"action_name" : "create thread",1295 "action_vocab" : "maecVocabs:ProcessThreadActionNameVocab-1.0",1296 "parameter_associated_objects" : {"ProcessHandle" : {"associated_object_type" : "WindowsHandleObjectType",1297 "associated_object_element" : "ID",1298 "association_type" : "input"},1299 "ThreadHandle" : {"associated_object_type" : "WindowsHandleObjectType",1300 "associated_object_element" : "ID",1301 "association_type" : "output",1302 "forced" : {"associated_object_element" : "Type", 1303 "value" : "Thread"}},1304 "ThreadId" : {"associated_object_type" : "WindowsThreadObjectType",1305 "associated_object_element" : "Thread_ID",1306 "association_type" : "output"}},1307 "parameter_associated_arguments" : {"CreatedSuspended" : {"associated_argument_name" : "Control Parameter",1308 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1309 "StartAddress" : {"associated_argument_name" : "Code Address",1310 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1311 "StartParameter" : {"associated_argument_name" : "Options",1312 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"}}},1313"URLDownloadToFileW" : {"action_name" : "download file",1314 "action_vocab" : "maecVocabs:NetworkActionNameVocab-1.0",1315 "parameter_associated_objects" : {"URL" : {"associated_object_type" : "URIObjectType",1316 "associated_object_element" : "Value",1317 "association_type" : "input"},1318 "FileName" : {"associated_object_type" : "FileObjectType",1319 "associated_object_element" : "File_Path",1320 "association_type" : "output"}}},1321"InternetOpenA" : {"action_name" : "initialize wininet",1322 "parameter_associated_objects" : {"Agent" : {"associated_object_type" : "HTTPSessionObjectType",1323 "associated_object_element" : "list__HTTP_Request_Response/HTTP_Client_Request/HTTP_Request_Header/Parsed_Header/User_Agent",1324 "association_type" : "input"}},1325 "parameter_associated_arguments" : {"AccessType" : {"associated_argument_name" : "Access Mode",1326 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1327 "ProxyName" : {"associated_argument_name" : "Proxy Name"},1328 "ProxyBypass" : {"associated_argument_name" : "Proxy Bypass"},1329 "Flags" : {"associated_argument_name" : "Flags"}}}, 1330"InternetOpenW" : {"action_name" : "initialize wininet",1331 "parameter_associated_objects" : {"Agent" : {"associated_object_type" : "HTTPSessionObjectType",1332 "associated_object_element" : "list__HTTP_Request_Response/HTTP_Client_Request/HTTP_Request_Header/Parsed_Header/User_Agent",1333 "association_type" : "input"}},1334 "parameter_associated_arguments" : {"AccessType" : {"associated_argument_name" : "Access Mode",1335 "associated_argument_vocab" : "cyboxVocabs:ActionArgumentNameVocab-1.0"},1336 "ProxyName" : {"associated_argument_name" : "Proxy Name"},1337 "ProxyBypass" : {"associated_argument_name" : "Proxy Bypass"},1338 "Flags" : {"associated_argument_name" : "Flags"}}},1339"InternetConnectA" : {"action_name" : "connect to server",1340 "parameter_associated_objects" : {"InternetHandle" : {"associated_object_type" : "WindowsHandleObjectType",1341 "associated_object_element" : "ID",1342 "association_type" : "input",1343 "forced" : {"associated_object_element" : "Type", 1344 "value" : "Internet Resource"}},1345 "ServerName" : {"associated_object_type" : "URIObjectType",1346 "associated_object_element" : "Value",1347 "association_type" : "input"},1348 "ServerPort" : {"associated_object_type" : "PortObjectType",1349 "associated_object_element" : "Port_Value",1350 "association_type" : "input"}},1351 "parameter_associated_arguments" : {"Username" : {"associated_argument_name" : "Username"},1352 "Password" : {"associated_argument_name" : "Password"},1353 "Service" : {"associated_argument_name" : "Service Type"},1354 "Flags" : {"associated_argument_name" : "Flags"}}},1355"InternetConnectW" : {"action_name" : "connect to server",1356 "parameter_associated_objects" : {"InternetHandle" : {"associated_object_type" : "WindowsHandleObjectType",1357 "associated_object_element" : "ID",1358 "association_type" : "input",1359 "forced" : {"associated_object_element" : "Type", 1360 "value" : "Internet Resource"}},1361 "ServerName" : {"associated_object_type" : "URIObjectType",1362 "associated_object_element" : "Value",1363 "association_type" : "input"},1364 "ServerPort" : {"associated_object_type" : "PortObjectType",1365 "associated_object_element" : "Port_Value",1366 "association_type" : "input"}},1367 "parameter_associated_arguments" : {"Username" : {"associated_argument_name" : "Username"},1368 "Password" : {"associated_argument_name" : "Password"},1369 "Service" : {"associated_argument_name" : "Service Type"},1370 "Flags" : {"associated_argument_name" : "Flags"}}},1371"InternetOpenURLA" : {"action_name" : "connect to url",1372 "action_vocab" : "maecVocabs:NetworkActionNameVocab-1.0",1373 "parameter_associated_objects" : {"ConnectionHandle" : {"associated_object_type" : "WindowsHandleObjectType",1374 "associated_object_element" : "ID",1375 "association_type" : "input",1376 "forced" : {"associated_object_element" : "Type", 1377 "value" : "Internet Connection"}},1378 "URL" : {"associated_object_type" : "URIObjectType",1379 "associated_object_element" : "Value",1380 "association_type" : "input"},1381 "Headers" : {"associated_object_type" : "HTTPSessionObjectType",1382 "associated_object_element" : "list__HTTP_Request_Response/HTTP_Client_Request/HTTP_Request_Header/Parsed_Header/Raw_Header",1383 "association_type" : "input"}},1384 "parameter_associated_arguments" : {"Flags" : {"associated_argument_name" : "Flags"}}},1385"InternetOpenURLW" : {"action_name" : "connect to url",1386 "action_vocab" : "maecVocabs:NetworkActionNameVocab-1.0",1387 "parameter_associated_objects" : {"ConnectionHandle" : {"associated_object_type" : "WindowsHandleObjectType",1388 "associated_object_element" : "ID",1389 "association_type" : "input",1390 "forced" : {"associated_object_element" : "Type", 1391 "value" : "Internet Connection"}},1392 "URL" : {"associated_object_type" : "URIObjectType",1393 "associated_object_element" : "Value",1394 "association_type" : "input"},1395 "Headers" : {"associated_object_type" : "HTTPSessionObjectType",1396 "associated_object_element" : "list__HTTP_Request_Response/HTTP_Client_Request/HTTP_Request_Header/Parsed_Header/Raw_Header",1397 "association_type" : "input"}},1398 "parameter_associated_arguments" : {"Flags" : {"associated_argument_name" : "Flags"}}},1399"HttpOpenRequestA" : { "action_name" : "open http request",1400 "parameter_associated_objects" : {"InternetHandle" : {"associated_object_type" : "WindowsHandleObjectType",1401 "associated_object_element" : "ID",1402 "association_type" : "input",1403 "forced" : {"associated_object_element" : "Type", 1404 "value" : "Internet Resource"}},1405 "Path" : {"associated_object_type" : "URIObjectType",1406 "associated_object_element" : "Value",1407 "association_type" : "input"}},1408 "parameter_associated_arguments" : {"Flags" : {"associated_argument_name" : "Flags"}}},1409"HttpOpenRequestW" : { "action_name" : "open http request",1410 "parameter_associated_objects" : {"InternetHandle" : {"associated_object_type" : "WindowsHandleObjectType",1411 "associated_object_element" : "ID",1412 "association_type" : "input",1413 "forced" : {"associated_object_element" : "Type", 1414 "value" : "Internet Resource"}},1415 "Path" : {"associated_object_type" : "URIObjectType",1416 "associated_object_element" : "Value",1417 "association_type" : "input"}},1418 "parameter_associated_arguments" : {"Flags" : {"associated_argument_name" : "Flags"}}},1419"InternetReadFile" : {"action_name" : "read from internet resource",1420 "parameter_associated_objects" : {"InternetHandle" : {"associated_object_type" : "WindowsHandleObjectType",1421 "associated_object_element" : "ID",1422 "association_type" : "input",1423 "forced" : {"associated_object_element" : "Type", 1424 "value" : "Internet Resource"}}}},1425"InternetWriteFile" : {"action_name" : "write to internet resource",1426 "parameter_associated_objects" : {"InternetHandle" : {"associated_object_type" : "WindowsHandleObjectType",1427 "associated_object_element" : "ID",1428 "association_type" : "input",1429 "forced" : {"associated_object_element" : "Type", 1430 "value" : "Internet Resource"}}}},1431"InternetCloseHandle" : {"action_name" : "close internet resource handle",1432 "parameter_associated_objects" : {"InternetHandle" : {"associated_object_type" : "WindowsHandleObjectType",1433 "associated_object_element" : "ID",1434 "association_type" : "input",1435 "forced" : {"associated_object_element" : "Type", 1436 "value" : "Internet Resource"}}}},1437"HttpSendRequestA" : {"action_name" : "send http request",1438 "parameter_associated_objects" : {"RequestHandle" : {"associated_object_type" : "WindowsHandleObjectType",1439 "associated_object_element" : "ID",1440 "association_type" : "input",1441 "forced" : {"associated_object_element" : "Type", 1442 "value" : "HTTPRequest"}},1443 "Headers" : {"associated_object_type" : "HTTPSessionObjectType",1444 "associated_object_element" : "list__HTTP_Request_Response/HTTP_Client_Request/HTTP_Request_Header/Raw_Header",1445 "association_type" : "input"}},1446 "parameter_associated_arguments" : {"PostData" : {"associated_argument_name" : "Post Data"}}},1447"HttpSendRequestW" : {"action_name" : "send http request",1448 "parameter_associated_objects" : {"RequestHandle" : {"associated_object_type" : "WindowsHandleObjectType",1449 "associated_object_element" : "ID",1450 "association_type" : "input",1451 "forced" : {"associated_object_element" : "Type", 1452 "value" : "HTTPRequest"}},1453 "Headers" : {"associated_object_type" : "HTTPSessionObjectType",1454 "associated_object_element" : "list__HTTP_Request_Response/HTTP_Client_Request/HTTP_Request_Header/Raw_Header",1455 "association_type" : "input"}},1456 "parameter_associated_arguments" : {"PostData" : {"associated_argument_name" : "Post Data"}}},1457"DnsQuery_A" : {"action_name" : "send dns query",1458 "action_vocab" : "maecVocabs:DNSActionNameVocab-1.0",1459 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "Name", "element_name" : "QName/Value"},1460 {"parameter_name" : "Type", "element_name" : "QType"}],1461 "associated_object_type" : "DNSQueryObjectType",1462 "associated_object_element" : "Question",1463 "association_type" : "input"}},1464 "parameter_associated_arguments" : {"Options" : {"associated_argument_name" : "Options"}}},1465"DnsQuery_UTF8" : {"action_name" : "send dns query",1466 "action_vocab" : "maecVocabs:DNSActionNameVocab-1.0",1467 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "Name", "element_name" : "QName/Value"},1468 {"parameter_name" : "Type", "element_name" : "QType"}],1469 "associated_object_type" : "DNSQueryObjectType",1470 "associated_object_element" : "Question",1471 "association_type" : "input"}},1472 "parameter_associated_arguments" : {"Options" : {"associated_argument_name" : "Options"}}},1473"DnsQuery_W" : {"action_name" : "send dns query",1474 "action_vocab" : "maecVocabs:DNSActionNameVocab-1.0",1475 "parameter_associated_objects" : {"group_together_nested" : {"parameter_mappings" : [{"parameter_name" : "Name", "element_name" : "QName/Value"},1476 {"parameter_name" : "Type", "element_name" : "QType"}],1477 "associated_object_type" : "DNSQueryObjectType",1478 "associated_object_element" : "Question",1479 "association_type" : "input"}},1480 "parameter_associated_arguments" : {"Options" : {"associated_argument_name" : "Options"}}},1481"getaddrinfo" : {"action_name" : "get host by name",1482 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",1483 "parameter_associated_objects" : {"NodeName" : {"associated_object_type" : "URIObjectType",1484 "associated_object_element" : "Value",1485 "association_type" : "input"}},1486 "parameter_associated_arguments" : {"ServiceName" : {"associated_argument_name" : "Service Name"}}},1487"GetAddrInfoW" : {"action_name" : "get host by name",1488 "action_vocab" : "maecVocabs:SocketActionNameVocab-1.0",1489 "parameter_associated_objects" : {"NodeName" : {"associated_object_type" : "URIObjectType",1490 "associated_object_element" : "Value",1491 "association_type" : "input"}},1492 "parameter_associated_arguments" : {"ServiceName" : {"associated_argument_name" : "Service Name"}}}1493}1494def hiveHexToString(hive_hex_value):1495 """Maps a Registry Hive hex input to its String (name) equivalent"""1496 str_val = str(hive_hex_value)1497 if str_val == "0x80000000" or str_val == "-2147483648" or str_val == "2147483648":1498 return "HKEY_CLASSES_ROOT"1499 elif str_val == "0x80000001" or str_val == "-2147483647" or str_val == "2147483649":1500 return "HKEY_CURRENT_USER"1501 elif str_val == "0x80000002" or str_val == "-2147483646" or str_val == "2147483650":1502 return "HKEY_LOCAL_MACHINE"1503 elif str_val == "0x80000003" or str_val == "-2147483645" or str_val == "2147483651":1504 return "HKEY_USERS"1505 elif str_val == "0x80000004":1506 return "HKEY_PERFORMANCE_DATA"1507 elif str_val == "0x80000005" or str_val == "2147483653":1508 return "HKEY_CURRENT_CONFIG"1509 elif str_val == "0x80000006":1510 return "HKEY_DYN_DATA"1511 else:1512 return hive_hex_value1513def regDatatypeToString(datatype_int_value):1514 """Maps a Registry Datatype integer input to its String (name) equivalent"""1515 if str(datatype_int_value) == "1":1516 return "REG_SZ"1517 elif str(datatype_int_value) == "2":1518 return "REG_EXPAND_SZ"1519 elif str(datatype_int_value) == "3":1520 return "REG_BINARY"1521 elif str(datatype_int_value) == "4":1522 return "REG_DWORD"1523 elif str(datatype_int_value) == "5":1524 return "REG_DWORD_BIG_ENDIAN"1525 elif str(datatype_int_value) == "6":1526 return "REG_LINK"1527 elif str(datatype_int_value) == "7":1528 return "REG_MULTI_SZ"1529 elif str(datatype_int_value) == "8":1530 return "REG_RESOURCE_LIST"1531 elif str(datatype_int_value) == "9":1532 return "REG_FULL_RESOURCE_DESCRIPTOR"1533 elif str(datatype_int_value) == "10":1534 return "REG_RESOURCE_REQUIREMENTS_LIST"1535 elif str(datatype_int_value) == "11":1536 return "REG_QWORD"1537 else:1538 return datatype_int_value1539def socketProtoToString(proto_int_value):1540 """Maps a Socket Protocol integer input to its String (name) equivalent"""1541 if str(proto_int_value) == "1":1542 return "IPPROTO_ICMP"1543 elif str(proto_int_value) == "2":1544 return "IPPROTO_IGMP"1545 elif str(proto_int_value) == "3":1546 return "BTHPROTO_RFCOMM"1547 elif str(proto_int_value) == "6":1548 return "IPPROTO_TCP"1549 elif str(proto_int_value) == "17":1550 return "IPPROTO_UDP"1551 elif str(proto_int_value) == "58":1552 return "IPPROTO_ICMPV6"1553 elif str(proto_int_value) == "113":1554 return "IPPROTO_RM"1555 else:1556 return proto_int_value1557def socketAFToString(af_int_value):1558 """Maps a Socket Address Family integer input to its String (name) equivalent"""1559 if str(af_int_value) == "0":1560 return "AF_UNSPEC"1561 elif str(af_int_value) == "2":1562 return "AF_INET"1563 elif str(af_int_value) == "6":1564 return "AF_IPX"1565 elif str(af_int_value) == "16":1566 return "AF_APPLETALK"1567 elif str(af_int_value) == "17":1568 return "AF_NETBIOS"1569 elif str(af_int_value) == "23":1570 return "AF_INET6"1571 elif str(af_int_value) == "26":1572 return "AF_IRDA"1573 elif str(af_int_value) == "32":1574 return "AF_BTH"1575 else:1576 return af_int_value1577def socketTypeToString(type_int_value):1578 """Maps a Socket Type integer input to its String (name) equivalent"""1579 if str(type_int_value) == "1":1580 return "SOCK_STREAM"1581 elif str(type_int_value) == "2":1582 return "SOCK_DGRAM"1583 elif str(type_int_value) == "3":1584 return "SOCK_RAW"1585 elif str(type_int_value) == "4":1586 return "SOCK_RDM"1587 elif str(type_int_value) == "5":1588 return "SOCK_SEQPACKET"1589 else:1590 return type_int_value1591def intToHex(value):1592 """Convert an integer to a hex string"""1593 if isinstance(value, int):1594 value = "0x{0:08x}".format(value)1595 return value1596def regStringToHive(reg_string):1597 """Maps a string representing a Registry Key from a NT* API call input to its normalized hive"""1598 normalized_key = fix_key(reg_string)1599 return normalized_key.split("\\")[0]1600def regStringToKey(reg_string):1601 """Maps a string representing a Registry Key from a NT* API call input to its normalized key portion"""1602 normalized_key = fix_key(reg_string)...

Full Screen

Full Screen

Sidebar.Object.js

Source:Sidebar.Object.js Github

copy

Full Screen

1/**2 * @author mrdoob / http://mrdoob.com/3 */4import * as THREE from '../../build/three.module.js';5import { UIPanel, UIRow, UIInput, UIButton, UIColor, UICheckbox, UIInteger, UITextArea, UIText, UINumber } from './libs/ui.js';6import { UIBoolean } from './libs/ui.three.js';7import { SetUuidCommand } from './commands/SetUuidCommand.js';8import { SetValueCommand } from './commands/SetValueCommand.js';9import { SetPositionCommand } from './commands/SetPositionCommand.js';10import { SetRotationCommand } from './commands/SetRotationCommand.js';11import { SetScaleCommand } from './commands/SetScaleCommand.js';12import { SetColorCommand } from './commands/SetColorCommand.js';13var SidebarObject = function ( editor ) {14 var strings = editor.strings;15 var signals = editor.signals;16 var container = new UIPanel();17 container.setBorderTop( '0' );18 container.setPaddingTop( '20px' );19 container.setDisplay( 'none' );20 // Actions21 /*22 var objectActions = new UI.Select().setPosition( 'absolute' ).setRight( '8px' ).setFontSize( '11px' );23 objectActions.setOptions( {24 'Actions': 'Actions',25 'Reset Position': 'Reset Position',26 'Reset Rotation': 'Reset Rotation',27 'Reset Scale': 'Reset Scale'28 } );29 objectActions.onClick( function ( event ) {30 event.stopPropagation(); // Avoid panel collapsing31 } );32 objectActions.onChange( function ( event ) {33 var object = editor.selected;34 switch ( this.getValue() ) {35 case 'Reset Position':36 editor.execute( new SetPositionCommand( editor, object, new Vector3( 0, 0, 0 ) ) );37 break;38 case 'Reset Rotation':39 editor.execute( new SetRotationCommand( editor, object, new Euler( 0, 0, 0 ) ) );40 break;41 case 'Reset Scale':42 editor.execute( new SetScaleCommand( editor, object, new Vector3( 1, 1, 1 ) ) );43 break;44 }45 this.setValue( 'Actions' );46 } );47 container.addStatic( objectActions );48 */49 // type50 var objectTypeRow = new UIRow();51 var objectType = new UIText();52 objectTypeRow.add( new UIText( strings.getKey( 'sidebar/object/type' ) ).setWidth( '90px' ) );53 objectTypeRow.add( objectType );54 container.add( objectTypeRow );55 // uuid56 var objectUUIDRow = new UIRow();57 var objectUUID = new UIInput().setWidth( '102px' ).setFontSize( '12px' ).setDisabled( true );58 var objectUUIDRenew = new UIButton( strings.getKey( 'sidebar/object/new' ) ).setMarginLeft( '7px' ).onClick( function () {59 objectUUID.setValue( THREE.Math.generateUUID() );60 editor.execute( new SetUuidCommand( editor, editor.selected, objectUUID.getValue() ) );61 } );62 objectUUIDRow.add( new UIText( strings.getKey( 'sidebar/object/uuid' ) ).setWidth( '90px' ) );63 objectUUIDRow.add( objectUUID );64 objectUUIDRow.add( objectUUIDRenew );65 container.add( objectUUIDRow );66 // name67 var objectNameRow = new UIRow();68 var objectName = new UIInput().setWidth( '150px' ).setFontSize( '12px' ).onChange( function () {69 editor.execute( new SetValueCommand( editor, editor.selected, 'name', objectName.getValue() ) );70 } );71 objectNameRow.add( new UIText( strings.getKey( 'sidebar/object/name' ) ).setWidth( '90px' ) );72 objectNameRow.add( objectName );73 container.add( objectNameRow );74 // position75 var objectPositionRow = new UIRow();76 var objectPositionX = new UINumber().setPrecision( 3 ).setWidth( '50px' ).onChange( update );77 var objectPositionY = new UINumber().setPrecision( 3 ).setWidth( '50px' ).onChange( update );78 var objectPositionZ = new UINumber().setPrecision( 3 ).setWidth( '50px' ).onChange( update );79 objectPositionRow.add( new UIText( strings.getKey( 'sidebar/object/position' ) ).setWidth( '90px' ) );80 objectPositionRow.add( objectPositionX, objectPositionY, objectPositionZ );81 container.add( objectPositionRow );82 // rotation83 var objectRotationRow = new UIRow();84 var objectRotationX = new UINumber().setStep( 10 ).setUnit( '°' ).setWidth( '50px' ).onChange( update );85 var objectRotationY = new UINumber().setStep( 10 ).setUnit( '°' ).setWidth( '50px' ).onChange( update );86 var objectRotationZ = new UINumber().setStep( 10 ).setUnit( '°' ).setWidth( '50px' ).onChange( update );87 objectRotationRow.add( new UIText( strings.getKey( 'sidebar/object/rotation' ) ).setWidth( '90px' ) );88 objectRotationRow.add( objectRotationX, objectRotationY, objectRotationZ );89 container.add( objectRotationRow );90 // scale91 var objectScaleRow = new UIRow();92 var objectScaleLock = new UICheckbox( true ).setPosition( 'absolute' ).setLeft( '75px' );93 var objectScaleX = new UINumber( 1 ).setPrecision( 3 ).setRange( 0.001, Infinity ).setWidth( '50px' ).onChange( updateScaleX );94 var objectScaleY = new UINumber( 1 ).setPrecision( 3 ).setRange( 0.001, Infinity ).setWidth( '50px' ).onChange( updateScaleY );95 var objectScaleZ = new UINumber( 1 ).setPrecision( 3 ).setRange( 0.001, Infinity ).setWidth( '50px' ).onChange( updateScaleZ );96 objectScaleRow.add( new UIText( strings.getKey( 'sidebar/object/scale' ) ).setWidth( '90px' ) );97 objectScaleRow.add( objectScaleLock );98 objectScaleRow.add( objectScaleX, objectScaleY, objectScaleZ );99 container.add( objectScaleRow );100 // fov101 var objectFovRow = new UIRow();102 var objectFov = new UINumber().onChange( update );103 objectFovRow.add( new UIText( strings.getKey( 'sidebar/object/fov' ) ).setWidth( '90px' ) );104 objectFovRow.add( objectFov );105 container.add( objectFovRow );106 // left107 var objectLeftRow = new UIRow();108 var objectLeft = new UINumber().onChange( update );109 objectLeftRow.add( new UIText( strings.getKey( 'sidebar/object/left' ) ).setWidth( '90px' ) );110 objectLeftRow.add( objectLeft );111 container.add( objectLeftRow );112 // right113 var objectRightRow = new UIRow();114 var objectRight = new UINumber().onChange( update );115 objectRightRow.add( new UIText( strings.getKey( 'sidebar/object/right' ) ).setWidth( '90px' ) );116 objectRightRow.add( objectRight );117 container.add( objectRightRow );118 // top119 var objectTopRow = new UIRow();120 var objectTop = new UINumber().onChange( update );121 objectTopRow.add( new UIText( strings.getKey( 'sidebar/object/top' ) ).setWidth( '90px' ) );122 objectTopRow.add( objectTop );123 container.add( objectTopRow );124 // bottom125 var objectBottomRow = new UIRow();126 var objectBottom = new UINumber().onChange( update );127 objectBottomRow.add( new UIText( strings.getKey( 'sidebar/object/bottom' ) ).setWidth( '90px' ) );128 objectBottomRow.add( objectBottom );129 container.add( objectBottomRow );130 // near131 var objectNearRow = new UIRow();132 var objectNear = new UINumber().onChange( update );133 objectNearRow.add( new UIText( strings.getKey( 'sidebar/object/near' ) ).setWidth( '90px' ) );134 objectNearRow.add( objectNear );135 container.add( objectNearRow );136 // far137 var objectFarRow = new UIRow();138 var objectFar = new UINumber().onChange( update );139 objectFarRow.add( new UIText( strings.getKey( 'sidebar/object/far' ) ).setWidth( '90px' ) );140 objectFarRow.add( objectFar );141 container.add( objectFarRow );142 // intensity143 var objectIntensityRow = new UIRow();144 var objectIntensity = new UINumber().setRange( 0, Infinity ).onChange( update );145 objectIntensityRow.add( new UIText( strings.getKey( 'sidebar/object/intensity' ) ).setWidth( '90px' ) );146 objectIntensityRow.add( objectIntensity );147 container.add( objectIntensityRow );148 // color149 var objectColorRow = new UIRow();150 var objectColor = new UIColor().onChange( update );151 objectColorRow.add( new UIText( strings.getKey( 'sidebar/object/color' ) ).setWidth( '90px' ) );152 objectColorRow.add( objectColor );153 container.add( objectColorRow );154 // ground color155 var objectGroundColorRow = new UIRow();156 var objectGroundColor = new UIColor().onChange( update );157 objectGroundColorRow.add( new UIText( strings.getKey( 'sidebar/object/groundcolor' ) ).setWidth( '90px' ) );158 objectGroundColorRow.add( objectGroundColor );159 container.add( objectGroundColorRow );160 // distance161 var objectDistanceRow = new UIRow();162 var objectDistance = new UINumber().setRange( 0, Infinity ).onChange( update );163 objectDistanceRow.add( new UIText( strings.getKey( 'sidebar/object/distance' ) ).setWidth( '90px' ) );164 objectDistanceRow.add( objectDistance );165 container.add( objectDistanceRow );166 // angle167 var objectAngleRow = new UIRow();168 var objectAngle = new UINumber().setPrecision( 3 ).setRange( 0, Math.PI / 2 ).onChange( update );169 objectAngleRow.add( new UIText( strings.getKey( 'sidebar/object/angle' ) ).setWidth( '90px' ) );170 objectAngleRow.add( objectAngle );171 container.add( objectAngleRow );172 // penumbra173 var objectPenumbraRow = new UIRow();174 var objectPenumbra = new UINumber().setRange( 0, 1 ).onChange( update );175 objectPenumbraRow.add( new UIText( strings.getKey( 'sidebar/object/penumbra' ) ).setWidth( '90px' ) );176 objectPenumbraRow.add( objectPenumbra );177 container.add( objectPenumbraRow );178 // decay179 var objectDecayRow = new UIRow();180 var objectDecay = new UINumber().setRange( 0, Infinity ).onChange( update );181 objectDecayRow.add( new UIText( strings.getKey( 'sidebar/object/decay' ) ).setWidth( '90px' ) );182 objectDecayRow.add( objectDecay );183 container.add( objectDecayRow );184 // shadow185 var objectShadowRow = new UIRow();186 objectShadowRow.add( new UIText( strings.getKey( 'sidebar/object/shadow' ) ).setWidth( '90px' ) );187 var objectCastShadow = new UIBoolean( false, strings.getKey( 'sidebar/object/cast' ) ).onChange( update );188 objectShadowRow.add( objectCastShadow );189 var objectReceiveShadow = new UIBoolean( false, strings.getKey( 'sidebar/object/receive' ) ).onChange( update );190 objectShadowRow.add( objectReceiveShadow );191 var objectShadowRadius = new UINumber( 1 ).onChange( update );192 objectShadowRow.add( objectShadowRadius );193 container.add( objectShadowRow );194 // visible195 var objectVisibleRow = new UIRow();196 var objectVisible = new UICheckbox().onChange( update );197 objectVisibleRow.add( new UIText( strings.getKey( 'sidebar/object/visible' ) ).setWidth( '90px' ) );198 objectVisibleRow.add( objectVisible );199 container.add( objectVisibleRow );200 // frustumCulled201 var objectFrustumCulledRow = new UIRow();202 var objectFrustumCulled = new UICheckbox().onChange( update );203 objectFrustumCulledRow.add( new UIText( strings.getKey( 'sidebar/object/frustumcull' ) ).setWidth( '90px' ) );204 objectFrustumCulledRow.add( objectFrustumCulled );205 container.add( objectFrustumCulledRow );206 // renderOrder207 var objectRenderOrderRow = new UIRow();208 var objectRenderOrder = new UIInteger().setWidth( '50px' ).onChange( update );209 objectRenderOrderRow.add( new UIText( strings.getKey( 'sidebar/object/renderorder' ) ).setWidth( '90px' ) );210 objectRenderOrderRow.add( objectRenderOrder );211 container.add( objectRenderOrderRow );212 // user data213 var objectUserDataRow = new UIRow();214 var objectUserData = new UITextArea().setWidth( '150px' ).setHeight( '40px' ).setFontSize( '12px' ).onChange( update );215 objectUserData.onKeyUp( function () {216 try {217 JSON.parse( objectUserData.getValue() );218 objectUserData.dom.classList.add( 'success' );219 objectUserData.dom.classList.remove( 'fail' );220 } catch ( error ) {221 objectUserData.dom.classList.remove( 'success' );222 objectUserData.dom.classList.add( 'fail' );223 }224 } );225 objectUserDataRow.add( new UIText( strings.getKey( 'sidebar/object/userdata' ) ).setWidth( '90px' ) );226 objectUserDataRow.add( objectUserData );227 container.add( objectUserDataRow );228 //229 function updateScaleX() {230 var object = editor.selected;231 if ( objectScaleLock.getValue() === true ) {232 var scale = objectScaleX.getValue() / object.scale.x;233 objectScaleY.setValue( objectScaleY.getValue() * scale );234 objectScaleZ.setValue( objectScaleZ.getValue() * scale );235 }236 update();237 }238 function updateScaleY() {239 var object = editor.selected;240 if ( objectScaleLock.getValue() === true ) {241 var scale = objectScaleY.getValue() / object.scale.y;242 objectScaleX.setValue( objectScaleX.getValue() * scale );243 objectScaleZ.setValue( objectScaleZ.getValue() * scale );244 }245 update();246 }247 function updateScaleZ() {248 var object = editor.selected;249 if ( objectScaleLock.getValue() === true ) {250 var scale = objectScaleZ.getValue() / object.scale.z;251 objectScaleX.setValue( objectScaleX.getValue() * scale );252 objectScaleY.setValue( objectScaleY.getValue() * scale );253 }254 update();255 }256 function update() {257 var object = editor.selected;258 if ( object !== null ) {259 var newPosition = new THREE.Vector3( objectPositionX.getValue(), objectPositionY.getValue(), objectPositionZ.getValue() );260 if ( object.position.distanceTo( newPosition ) >= 0.01 ) {261 editor.execute( new SetPositionCommand( editor, object, newPosition ) );262 }263 var newRotation = new THREE.Euler( objectRotationX.getValue() * THREE.Math.DEG2RAD, objectRotationY.getValue() * THREE.Math.DEG2RAD, objectRotationZ.getValue() * THREE.Math.DEG2RAD );264 if ( object.rotation.toVector3().distanceTo( newRotation.toVector3() ) >= 0.01 ) {265 editor.execute( new SetRotationCommand( editor, object, newRotation ) );266 }267 var newScale = new THREE.Vector3( objectScaleX.getValue(), objectScaleY.getValue(), objectScaleZ.getValue() );268 if ( object.scale.distanceTo( newScale ) >= 0.01 ) {269 editor.execute( new SetScaleCommand( editor, object, newScale ) );270 }271 if ( object.fov !== undefined && Math.abs( object.fov - objectFov.getValue() ) >= 0.01 ) {272 editor.execute( new SetValueCommand( editor, object, 'fov', objectFov.getValue() ) );273 object.updateProjectionMatrix();274 }275 if ( object.left !== undefined && Math.abs( object.left - objectLeft.getValue() ) >= 0.01 ) {276 editor.execute( new SetValueCommand( editor, object, 'left', objectLeft.getValue() ) );277 object.updateProjectionMatrix();278 }279 if ( object.right !== undefined && Math.abs( object.right - objectRight.getValue() ) >= 0.01 ) {280 editor.execute( new SetValueCommand( editor, object, 'right', objectRight.getValue() ) );281 object.updateProjectionMatrix();282 }283 if ( object.top !== undefined && Math.abs( object.top - objectTop.getValue() ) >= 0.01 ) {284 editor.execute( new SetValueCommand( editor, object, 'top', objectTop.getValue() ) );285 object.updateProjectionMatrix();286 }287 if ( object.bottom !== undefined && Math.abs( object.bottom - objectBottom.getValue() ) >= 0.01 ) {288 editor.execute( new SetValueCommand( editor, object, 'bottom', objectBottom.getValue() ) );289 object.updateProjectionMatrix();290 }291 if ( object.near !== undefined && Math.abs( object.near - objectNear.getValue() ) >= 0.01 ) {292 editor.execute( new SetValueCommand( editor, object, 'near', objectNear.getValue() ) );293 if ( object.isOrthographicCamera ) {294 object.updateProjectionMatrix();295 }296 }297 if ( object.far !== undefined && Math.abs( object.far - objectFar.getValue() ) >= 0.01 ) {298 editor.execute( new SetValueCommand( editor, object, 'far', objectFar.getValue() ) );299 if ( object.isOrthographicCamera ) {300 object.updateProjectionMatrix();301 }302 }303 if ( object.intensity !== undefined && Math.abs( object.intensity - objectIntensity.getValue() ) >= 0.01 ) {304 editor.execute( new SetValueCommand( editor, object, 'intensity', objectIntensity.getValue() ) );305 }306 if ( object.color !== undefined && object.color.getHex() !== objectColor.getHexValue() ) {307 editor.execute( new SetColorCommand( editor, object, 'color', objectColor.getHexValue() ) );308 }309 if ( object.groundColor !== undefined && object.groundColor.getHex() !== objectGroundColor.getHexValue() ) {310 editor.execute( new SetColorCommand( editor, object, 'groundColor', objectGroundColor.getHexValue() ) );311 }312 if ( object.distance !== undefined && Math.abs( object.distance - objectDistance.getValue() ) >= 0.01 ) {313 editor.execute( new SetValueCommand( editor, object, 'distance', objectDistance.getValue() ) );314 }315 if ( object.angle !== undefined && Math.abs( object.angle - objectAngle.getValue() ) >= 0.01 ) {316 editor.execute( new SetValueCommand( editor, object, 'angle', objectAngle.getValue() ) );317 }318 if ( object.penumbra !== undefined && Math.abs( object.penumbra - objectPenumbra.getValue() ) >= 0.01 ) {319 editor.execute( new SetValueCommand( editor, object, 'penumbra', objectPenumbra.getValue() ) );320 }321 if ( object.decay !== undefined && Math.abs( object.decay - objectDecay.getValue() ) >= 0.01 ) {322 editor.execute( new SetValueCommand( editor, object, 'decay', objectDecay.getValue() ) );323 }324 if ( object.visible !== objectVisible.getValue() ) {325 editor.execute( new SetValueCommand( editor, object, 'visible', objectVisible.getValue() ) );326 }327 if ( object.frustumCulled !== objectFrustumCulled.getValue() ) {328 editor.execute( new SetValueCommand( editor, object, 'frustumCulled', objectFrustumCulled.getValue() ) );329 }330 if ( object.renderOrder !== objectRenderOrder.getValue() ) {331 editor.execute( new SetValueCommand( editor, object, 'renderOrder', objectRenderOrder.getValue() ) );332 }333 if ( object.castShadow !== undefined && object.castShadow !== objectCastShadow.getValue() ) {334 editor.execute( new SetValueCommand( editor, object, 'castShadow', objectCastShadow.getValue() ) );335 }336 if ( object.receiveShadow !== undefined && object.receiveShadow !== objectReceiveShadow.getValue() ) {337 object.material.needsUpdate = true;338 editor.execute( new SetValueCommand( editor, object, 'receiveShadow', objectReceiveShadow.getValue() ) );339 }340 if ( object.shadow !== undefined ) {341 if ( object.shadow.radius !== objectShadowRadius.getValue() ) {342 editor.execute( new SetValueCommand( editor, object.shadow, 'radius', objectShadowRadius.getValue() ) );343 }344 }345 try {346 var userData = JSON.parse( objectUserData.getValue() );347 if ( JSON.stringify( object.userData ) != JSON.stringify( userData ) ) {348 editor.execute( new SetValueCommand( editor, object, 'userData', userData ) );349 }350 } catch ( exception ) {351 console.warn( exception );352 }353 }354 }355 function updateRows( object ) {356 var properties = {357 'fov': objectFovRow,358 'left': objectLeftRow,359 'right': objectRightRow,360 'top': objectTopRow,361 'bottom': objectBottomRow,362 'near': objectNearRow,363 'far': objectFarRow,364 'intensity': objectIntensityRow,365 'color': objectColorRow,366 'groundColor': objectGroundColorRow,367 'distance': objectDistanceRow,368 'angle': objectAngleRow,369 'penumbra': objectPenumbraRow,370 'decay': objectDecayRow,371 'castShadow': objectShadowRow,372 'receiveShadow': objectReceiveShadow,373 'shadow': objectShadowRadius374 };375 for ( var property in properties ) {376 properties[ property ].setDisplay( object[ property ] !== undefined ? '' : 'none' );377 }378 }379 function updateTransformRows( object ) {380 if ( object.isLight ||381 ( object.isObject3D && object.userData.targetInverse ) ) {382 objectRotationRow.setDisplay( 'none' );383 objectScaleRow.setDisplay( 'none' );384 } else {385 objectRotationRow.setDisplay( '' );386 objectScaleRow.setDisplay( '' );387 }388 }389 // events390 signals.objectSelected.add( function ( object ) {391 if ( object !== null ) {392 container.setDisplay( 'block' );393 updateRows( object );394 updateUI( object );395 } else {396 container.setDisplay( 'none' );397 }398 } );399 signals.objectChanged.add( function ( object ) {400 if ( object !== editor.selected ) return;401 updateUI( object );402 } );403 signals.refreshSidebarObject3D.add( function ( object ) {404 if ( object !== editor.selected ) return;405 updateUI( object );406 } );407 function updateUI( object ) {408 objectType.setValue( object.type );409 objectUUID.setValue( object.uuid );410 objectName.setValue( object.name );411 objectPositionX.setValue( object.position.x );412 objectPositionY.setValue( object.position.y );413 objectPositionZ.setValue( object.position.z );414 objectRotationX.setValue( object.rotation.x * THREE.Math.RAD2DEG );415 objectRotationY.setValue( object.rotation.y * THREE.Math.RAD2DEG );416 objectRotationZ.setValue( object.rotation.z * THREE.Math.RAD2DEG );417 objectScaleX.setValue( object.scale.x );418 objectScaleY.setValue( object.scale.y );419 objectScaleZ.setValue( object.scale.z );420 if ( object.fov !== undefined ) {421 objectFov.setValue( object.fov );422 }423 if ( object.left !== undefined ) {424 objectLeft.setValue( object.left );425 }426 if ( object.right !== undefined ) {427 objectRight.setValue( object.right );428 }429 if ( object.top !== undefined ) {430 objectTop.setValue( object.top );431 }432 if ( object.bottom !== undefined ) {433 objectBottom.setValue( object.bottom );434 }435 if ( object.near !== undefined ) {436 objectNear.setValue( object.near );437 }438 if ( object.far !== undefined ) {439 objectFar.setValue( object.far );440 }441 if ( object.intensity !== undefined ) {442 objectIntensity.setValue( object.intensity );443 }444 if ( object.color !== undefined ) {445 objectColor.setHexValue( object.color.getHexString() );446 }447 if ( object.groundColor !== undefined ) {448 objectGroundColor.setHexValue( object.groundColor.getHexString() );449 }450 if ( object.distance !== undefined ) {451 objectDistance.setValue( object.distance );452 }453 if ( object.angle !== undefined ) {454 objectAngle.setValue( object.angle );455 }456 if ( object.penumbra !== undefined ) {457 objectPenumbra.setValue( object.penumbra );458 }459 if ( object.decay !== undefined ) {460 objectDecay.setValue( object.decay );461 }462 if ( object.castShadow !== undefined ) {463 objectCastShadow.setValue( object.castShadow );464 }465 if ( object.receiveShadow !== undefined ) {466 objectReceiveShadow.setValue( object.receiveShadow );467 }468 if ( object.shadow !== undefined ) {469 objectShadowRadius.setValue( object.shadow.radius );470 }471 objectVisible.setValue( object.visible );472 objectFrustumCulled.setValue( object.frustumCulled );473 objectRenderOrder.setValue( object.renderOrder );474 try {475 objectUserData.setValue( JSON.stringify( object.userData, null, ' ' ) );476 } catch ( error ) {477 console.log( error );478 }479 objectUserData.setBorderColor( 'transparent' );480 objectUserData.setBackgroundColor( '' );481 updateTransformRows( object );482 }483 return container;484};...

Full Screen

Full Screen

JSON-stringify.js

Source:JSON-stringify.js Github

copy

Full Screen

1function createTests() {2 var simpleArray = ['a', 'b', 'c'];3 var simpleObject = {a:"1", b:"2", c:"3"};4 var complexArray = ['a', 'b', 'c',,,simpleObject, simpleArray, [simpleObject,simpleArray]];5 var complexObject = {a:"1", b:"2", c:"3", d:undefined, e:null, "":12, get f(){ return simpleArray; }, array: complexArray};6 var simpleArrayWithProto = ['d', 'e', 'f'];7 simpleArrayWithProto.__proto__ = simpleObject;8 var simpleObjectWithProto = {d:"4", e:"5", f:"6", __proto__:simpleObject};9 var complexArrayWithProto = ['d', 'e', 'f',,,simpleObjectWithProto, simpleArrayWithProto, [simpleObjectWithProto,simpleArrayWithProto]];10 complexArrayWithProto.__proto__ = simpleObjectWithProto;11 var complexObjectWithProto = {d:"4", e:"5", f:"6", g:undefined, h:null, "":12, get i(){ return simpleArrayWithProto; }, array2: complexArrayWithProto, __proto__:complexObject};12 var objectWithSideEffectGetter = {get b() {this.foo=1;}};13 var objectWithSideEffectGetterAndProto = {__proto__:{foo:"bar"}, get b() {this.foo=1;}};14 var arrayWithSideEffectGetter = [];15 arrayWithSideEffectGetter.__defineGetter__("b", function(){this.foo=1;});16 var arrayWithSideEffectGetterAndProto = [];17 arrayWithSideEffectGetterAndProto.__defineGetter__("b", function(){this.foo=1;});18 arrayWithSideEffectGetterAndProto.__proto__ = {foo:"bar"};19 var result = [];20 result.push(function(jsonObject){21 return jsonObject.stringify(1);22 });23 result.push(function(jsonObject){24 return jsonObject.stringify(1.5);25 });26 result.push(function(jsonObject){27 return jsonObject.stringify(-1);28 });29 result.push(function(jsonObject){30 return jsonObject.stringify(-1.5);31 });32 result.push(function(jsonObject){33 return jsonObject.stringify(null);34 });35 result.push(function(jsonObject){36 return jsonObject.stringify("string");37 });38 result.push(function(jsonObject){39 return jsonObject.stringify(new Number(0));40 });41 result.push(function(jsonObject){42 return jsonObject.stringify(new Number(1));43 });44 result.push(function(jsonObject){45 return jsonObject.stringify(new Number(1.5));46 });47 result.push(function(jsonObject){48 return jsonObject.stringify(new Number(-1));49 });50 result.push(function(jsonObject){51 return jsonObject.stringify(new Number(-1.5));52 });53 result.push(function(jsonObject){54 return jsonObject.stringify(new String("a string object"));55 });56 result.push(function(jsonObject){57 return jsonObject.stringify(new Boolean(true));58 });59 result.push(function(jsonObject){60 var value = new Number(1);61 value.valueOf = function() { return 2; }62 return jsonObject.stringify(value);63 });64 result[result.length - 1].expected = '2';65 result.push(function(jsonObject){66 var value = new Boolean(true);67 value.valueOf = function() { return 2; }68 return jsonObject.stringify(value);69 });70 result[result.length - 1].expected = '2';71 result.push(function(jsonObject){72 var value = new String("fail");73 value.toString = function() { return "converted string"; }74 return jsonObject.stringify(value);75 });76 result[result.length - 1].expected = '"converted string"';77 result.push(function(jsonObject){78 return jsonObject.stringify(true);79 });80 result.push(function(jsonObject){81 return jsonObject.stringify(false);82 });83 result.push(function(jsonObject){84 return jsonObject.stringify(new Date(0));85 });86 result.push(function(jsonObject){87 return jsonObject.stringify({toJSON: Date.prototype.toJSON});88 });89 result[result.length - 1].throws = true;90 result.push(function(jsonObject){91 return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ return "custom toISOString"; }});92 });93 result.push(function(jsonObject){94 return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ return {}; }});95 });96 result[result.length - 1].throws = true;97 result.push(function(jsonObject){98 return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ throw "An exception"; }});99 });100 result[result.length - 1].throws = true;101 result.push(function(jsonObject){102 var d = new Date(0);103 d.toISOString = null;104 return jsonObject.stringify(d);105 });106 result[result.length - 1].throws = true;107 result.push(function(jsonObject){108 var d = new Date(0);109 d.toJSON = undefined;110 return jsonObject.stringify(d);111 });112 result.push(function(jsonObject){113 return jsonObject.stringify({get Foo() { return "bar"; }});114 });115 result.push(function(jsonObject){116 return jsonObject.stringify({get Foo() { this.foo="wibble"; return "bar"; }});117 });118 result.push(function(jsonObject){119 var count = 0;120 jsonObject.stringify({get Foo() { count++; return "bar"; }});121 return count;122 });123 result.push(function(jsonObject){124 var count = 0;125 return jsonObject.stringify({get Foo() { count++; delete this.bar; return "bar"; }, bar: "wibble"});126 });127 result.push(function(jsonObject){128 var count = 0;129 return jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7});130 });131 result.push(function(jsonObject){132 var allString = true;133 jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7}, function(k,v){allString = allString && (typeof k == "string"); return v});134 return allString;135 });136 result.push(function(jsonObject){137 var allString = true;138 jsonObject.stringify([1,2,3,4,5], function(k,v){allString = allString && (typeof k == "string"); return v});139 return allString;140 });141 result.push(function(jsonObject){142 var allString = true;143 var array = [];144 return jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7}, array);145 });146 result.push(function(jsonObject){147 var allString = true;148 var array = ["a"];149 return jsonObject.stringify({get a(){return 1;array[1]="b";array[2]="c"}, b:"2", c:"3"}, array);150 });151 result.push(function(jsonObject){152 var allString = true;153 var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];154 return jsonObject.stringify(simpleObject, array);155 });156 result.push(function(jsonObject){157 var allString = true;158 var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];159 return jsonObject.stringify(simpleObjectWithProto, array);160 });161 result.push(function(jsonObject){162 var allString = true;163 var array = [1, new Number(2), NaN, Infinity, -Infinity, new String("str")];164 return jsonObject.stringify({"1":"1","2":"2","NaN":"NaN","Infinity":"Infinity","-Infinity":"-Infinity","str":"str"}, array);165 });166 result[result.length - 1].expected = '{"1":"1","2":"2","NaN":"NaN","Infinity":"Infinity","-Infinity":"-Infinity","str":"str"}';167 result.push(function(jsonObject){168 var allString = true;169 var array = ["1","2","3"];170 return jsonObject.stringify({1:'a', 2:'b', 3:'c'}, array);171 });172 result.push(function(jsonObject){173 var allString = true;174 var array = ["1","2","3"];175 return jsonObject.stringify(simpleArray, array);176 });177 result.push(function(jsonObject){178 return jsonObject.stringify(simpleArray, null, " ");179 });180 result.push(function(jsonObject){181 return jsonObject.stringify(simpleArray, null, 4);182 });183 result.push(function(jsonObject){184 return jsonObject.stringify(simpleArray, null, "ab");185 });186 result.push(function(jsonObject){187 return jsonObject.stringify(simpleArray, null, 4);188 });189 result.push(function(jsonObject){190 return jsonObject.stringify(simpleObject, null, " ");191 });192 result.push(function(jsonObject){193 return jsonObject.stringify(simpleObject, null, 4);194 });195 result.push(function(jsonObject){196 return jsonObject.stringify(simpleObject, null, "ab");197 });198 result.push(function(jsonObject){199 return jsonObject.stringify(simpleObject, null, 4);200 });201 result.push(function(jsonObject){202 return jsonObject.stringify(simpleObject, null, 10);203 });204 result.push(function(jsonObject){205 return jsonObject.stringify(simpleObject, null, 11);206 });207 result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);208 result.push(function(jsonObject){209 return jsonObject.stringify(simpleObject, null, " ");210 });211 result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);212 result.push(function(jsonObject){213 return jsonObject.stringify(simpleObject, null, " ");214 });215 result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);216 result.push(function(jsonObject){217 return jsonObject.stringify(complexArray, null, " ");218 });219 result.push(function(jsonObject){220 return jsonObject.stringify(complexArray, null, 4);221 });222 result.push(function(jsonObject){223 return jsonObject.stringify(complexArray, null, "ab");224 });225 result.push(function(jsonObject){226 return jsonObject.stringify(complexArray, null, 4);227 });228 result.push(function(jsonObject){229 return jsonObject.stringify(complexObject, null, " ");230 });231 result.push(function(jsonObject){232 return jsonObject.stringify(complexObject, null, 4);233 });234 result.push(function(jsonObject){235 return jsonObject.stringify(complexObject, null, "ab");236 });237 result.push(function(jsonObject){238 return jsonObject.stringify(complexObject, null, 4);239 });240 result.push(function(jsonObject){241 var allString = true;242 var array = ["1","2","3"];243 return jsonObject.stringify(simpleArrayWithProto, array);244 });245 result.push(function(jsonObject){246 return jsonObject.stringify(simpleArrayWithProto, null, " ");247 });248 result.push(function(jsonObject){249 return jsonObject.stringify(simpleArrayWithProto, null, 4);250 });251 result.push(function(jsonObject){252 return jsonObject.stringify(simpleArrayWithProto, null, "ab");253 });254 result.push(function(jsonObject){255 return jsonObject.stringify(simpleArrayWithProto, null, 4);256 });257 result.push(function(jsonObject){258 return jsonObject.stringify(simpleObjectWithProto, null, " ");259 });260 result.push(function(jsonObject){261 return jsonObject.stringify(simpleObjectWithProto, null, 4);262 });263 result.push(function(jsonObject){264 return jsonObject.stringify(simpleObjectWithProto, null, "ab");265 });266 result.push(function(jsonObject){267 return jsonObject.stringify(simpleObjectWithProto, null, 4);268 });269 result.push(function(jsonObject){270 return jsonObject.stringify(simpleObjectWithProto, null, 10);271 });272 result.push(function(jsonObject){273 return jsonObject.stringify(simpleObjectWithProto, null, 11);274 });275 result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);276 result.push(function(jsonObject){277 return jsonObject.stringify(simpleObjectWithProto, null, " ");278 });279 result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);280 result.push(function(jsonObject){281 return jsonObject.stringify(simpleObjectWithProto, null, " ");282 });283 result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);284 result.push(function(jsonObject){285 return jsonObject.stringify(complexArrayWithProto, null, " ");286 });287 result.push(function(jsonObject){288 return jsonObject.stringify(complexArrayWithProto, null, 4);289 });290 result.push(function(jsonObject){291 return jsonObject.stringify(complexArrayWithProto, null, "ab");292 });293 result.push(function(jsonObject){294 return jsonObject.stringify(complexArrayWithProto, null, 4);295 });296 result.push(function(jsonObject){297 return jsonObject.stringify(complexObjectWithProto, null, " ");298 });299 result.push(function(jsonObject){300 return jsonObject.stringify(complexObjectWithProto, null, 4);301 });302 result.push(function(jsonObject){303 return jsonObject.stringify(complexObjectWithProto, null, "ab");304 });305 result.push(function(jsonObject){306 return jsonObject.stringify(complexObjectWithProto, null, 4);307 });308 result.push(function(jsonObject){309 return jsonObject.stringify(objectWithSideEffectGetter);310 });311 result.push(function(jsonObject){312 return jsonObject.stringify(objectWithSideEffectGetterAndProto);313 });314 result.push(function(jsonObject){315 return jsonObject.stringify(arrayWithSideEffectGetter);316 });317 result.push(function(jsonObject){318 return jsonObject.stringify(arrayWithSideEffectGetterAndProto);319 });320 var replaceTracker;321 function replaceFunc(key, value) {322 replaceTracker += key + "("+(typeof key)+")" + JSON.stringify(value) + ";";323 return value;324 }325 result.push(function(jsonObject){326 replaceTracker = "";327 jsonObject.stringify([1,2,3,,,,4,5,6], replaceFunc);328 return replaceTracker;329 });330 result[result.length - 1].expected = '(string)[1,2,3,null,null,null,4,5,6];0(number)1;1(number)2;2(number)3;3(number)undefined;4(number)undefined;5(number)undefined;6(number)4;7(number)5;8(number)6;'331 result.push(function(jsonObject){332 replaceTracker = "";333 jsonObject.stringify({a:"a", b:"b", c:"c", 3: "d", 2: "e", 1: "f"}, replaceFunc);334 return replaceTracker;335 });336 result[result.length - 1].expected = '(string){"a":"a","b":"b","c":"c","3":"d","2":"e","1":"f"};a(string)"a";b(string)"b";c(string)"c";3(string)"d";2(string)"e";1(string)"f";';337 result.push(function(jsonObject){338 var count = 0;339 var array = [{toString:function(){count++; array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];340 jsonObject.stringify(simpleObject, array);341 return count;342 });343 result.push(function(jsonObject){344 var allString = true;345 var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}, 'b', 'c'];346 return jsonObject.stringify(simpleObject, array);347 });348 result.push(function(jsonObject){349 var count = 0;350 var array = [{toString:function(){count++; array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}, 'b', 'c'];351 jsonObject.stringify(simpleObject, array);352 return count;353 });354 result.push(function(jsonObject){355 return jsonObject.stringify({a:"1", get b() { this.a="foo"; return "getter"; }, c:"3"});356 });357 result.push(function(jsonObject){358 return jsonObject.stringify({a:"1", get b() { this.c="foo"; return "getter"; }, c:"3"});359 });360 result.push(function(jsonObject){361 var setterCalled = false;362 jsonObject.stringify({a:"1", set b(s) { setterCalled = true; return "setter"; }, c:"3"});363 return setterCalled;364 });365 result.push(function(jsonObject){366 return jsonObject.stringify({a:"1", get b(){ return "getter"; }, set b(s) { return "setter"; }, c:"3"});367 });368 result.push(function(jsonObject){369 return jsonObject.stringify(new Array(10));370 });371 result.push(function(jsonObject){372 return jsonObject.stringify([undefined,,null,0,false]);373 });374 result.push(function(jsonObject){375 return jsonObject.stringify({p1:undefined,p2:null,p3:0,p4:false});376 });377 var cycleTracker = "";378 var cyclicObject = { get preSelf1() { cycleTracker+="preSelf1,"; return "preSelf1"; },379 preSelf2: {toJSON:function(){cycleTracker+="preSelf2,"; return "preSelf2"}},380 self: [],381 get postSelf1() { cycleTracker+="postSelf1,"; return "postSelf1" },382 postSelf2: {toJSON:function(){cycleTracker+="postSelf2,"; return "postSelf2"}},383 toJSON : function(key) { cycleTracker += key + "("+(typeof key)+"):" + this; return this; }384 };385 cyclicObject.self = cyclicObject;386 result.push(function(jsonObject){387 cycleTracker = "";388 return jsonObject.stringify(cyclicObject);389 });390 result[result.length - 1].throws = true;391 result.push(function(jsonObject){392 cycleTracker = "";393 try { jsonObject.stringify(cyclicObject); } catch(e) { cycleTracker += " -> exception" }394 return cycleTracker;395 });396 result[result.length - 1].expected = "(string):[object Object]preSelf1,preSelf2,self(string):[object Object] -> exception"397 var cyclicArray = [{toJSON : function(key,value) { cycleTracker += key + "("+(typeof key)+"):" + this; cycleTracker += "first,"; return this; }},398 cyclicArray,399 {toJSON : function(key,value) { cycleTracker += key + "("+(typeof key)+"):" + this; cycleTracker += "second,"; return this; }}];400 cyclicArray[1] = cyclicArray;401 result.push(function(jsonObject){402 cycleTracker = "";403 return jsonObject.stringify(cyclicArray);404 });405 result[result.length - 1].throws = true;406 result.push(function(jsonObject){407 cycleTracker = "";408 try { jsonObject.stringify(cyclicArray); } catch(e) { cycleTracker += " -> exception" }409 return cycleTracker;410 });411 result[result.length - 1].expected = "0(number):[object Object]first, -> exception";412 function createArray(len, o) { var r = []; for (var i = 0; i < len; i++) r[i] = o; return r; }413 var getterCalls;414 var magicObject = createArray(10, {abcdefg: [1,2,5,"ab", null, undefined, true, false,,], 415 get calls() {return ++getterCalls; }, 416 "123":createArray(15, "foo"), 417 "":{a:"b"}});418 result.push(function(jsonObject){419 getterCalls = 0;420 return jsonObject.stringify(magicObject) + " :: getter calls = " + getterCalls;421 });422 result.push(function(jsonObject){423 return jsonObject.stringify(undefined);424 });425 result.push(function(jsonObject){426 return jsonObject.stringify(null);427 });428 result.push(function(jsonObject){429 return jsonObject.stringify({toJSON:function(){ return undefined; }});430 });431 result.push(function(jsonObject){432 return jsonObject.stringify({toJSON:function(){ return null; }});433 });434 result.push(function(jsonObject){435 return jsonObject.stringify([{toJSON:function(){ return undefined; }}]);436 });437 result.push(function(jsonObject){438 return jsonObject.stringify([{toJSON:function(){ return null; }}]);439 });440 result.push(function(jsonObject){441 return jsonObject.stringify({a:{toJSON:function(){ return undefined; }}});442 });443 result.push(function(jsonObject){444 return jsonObject.stringify({a:{toJSON:function(){ return null; }}});445 });446 result.push(function(jsonObject){447 return jsonObject.stringify({a:{toJSON:function(){ return function(){}; }}});448 });449 result.push(function(jsonObject){450 return jsonObject.stringify({a:function(){}});451 });452 result.push(function(jsonObject){453 var deepObject = {};454 for (var i = 0; i < 2048; i++)455 deepObject = {next:deepObject};456 return jsonObject.stringify(deepObject);457 });458 result.push(function(jsonObject){459 var deepArray = [];460 for (var i = 0; i < 2048; i++)461 deepArray = [deepArray];462 return jsonObject.stringify(deepArray);463 });464 result.push(function(jsonObject){465 var depth = 0;466 function toDeepVirtualJSONObject() {467 if (++depth >= 2048)468 return {};469 var r = {};470 r.toJSON = toDeepVirtualJSONObject;471 return {recurse: r};472 }473 return jsonObject.stringify(toDeepVirtualJSONObject());474 });475 result.push(function(jsonObject){476 var depth = 0;477 function toDeepVirtualJSONArray() {478 if (++depth >= 2048)479 return [];480 var r = [];481 r.toJSON = toDeepJSONArray;482 return [r];483 }484 return jsonObject.stringify(toDeepVirtualJSONArray());485 });486 var fullCharsetString = "";487 for (var i = 0; i < 65536; i++)488 fullCharsetString += String.fromCharCode(i);489 result.push(function(jsonObject){490 return jsonObject.stringify(fullCharsetString);491 }); 492 return result;493}494var tests = createTests();495for (var i = 0; i < tests.length; i++) {496 try {497 debug(tests[i]);498 if (tests[i].throws)499 shouldThrow('tests[i](nativeJSON)');500 else if (tests[i].expected)501 shouldBe('tests[i](nativeJSON)', "tests[i].expected");502 else503 shouldBe('tests[i](nativeJSON)', "tests[i](JSON)");504 }catch(e){}...

Full Screen

Full Screen

JSON-parse.js

Source:JSON-parse.js Github

copy

Full Screen

1function createTests() {2 var result = [];3 result.push(function(jsonObject){4 return jsonObject.parse();5 });6 result[result.length - 1].throws = true;7 result.push(function(jsonObject){8 return jsonObject.parse('');9 });10 result[result.length - 1].throws = true;11 result.push(function(jsonObject){12 return jsonObject.parse('1');13 });14 result.push(function(jsonObject){15 return jsonObject.parse('-1');16 });17 result.push(function(jsonObject){18 return jsonObject.parse('Infinity');19 });20 result[result.length - 1].throws = true;21 result.push(function(jsonObject){22 return jsonObject.parse('NaN');23 });24 result[result.length - 1].throws = true;25 result.push(function(jsonObject){26 return jsonObject.parse('null');27 });28 result.push(function(jsonObject){29 return jsonObject.parse('undefined');30 });31 result[result.length - 1].throws = true;32 result.push(function(jsonObject){33 return jsonObject.parse('{}');34 });35 result.push(function(jsonObject){36 return jsonObject.parse('({})');37 });38 result[result.length - 1].throws = true;39 result.push(function(jsonObject){40 return jsonObject.parse('{a}');41 });42 result[result.length - 1].throws = true;43 result.push(function(jsonObject){44 return jsonObject.parse('{a:}');45 });46 result[result.length - 1].throws = true;47 result.push(function(jsonObject){48 return jsonObject.parse('{a:5}');49 });50 result[result.length - 1].throws = true;51 result.push(function(jsonObject){52 return jsonObject.parse('{a:5,}');53 });54 result[result.length - 1].throws = true;55 result.push(function(jsonObject){56 return jsonObject.parse('{"a"}');57 });58 result[result.length - 1].throws = true;59 result.push(function(jsonObject){60 return jsonObject.parse('{"a":}');61 });62 result[result.length - 1].throws = true;63 result.push(function(jsonObject){64 return jsonObject.parse('{"a":5}');65 });66 result.push(function(jsonObject){67 return jsonObject.parse('{"__proto__":5}');68 });69 result.push(function(jsonObject){70 return jsonObject.parse('{"a":5,}');71 });72 result[result.length - 1].throws = true;73 result.push(function(jsonObject){74 return jsonObject.parse('{"a":5,,}');75 });76 result[result.length - 1].throws = true;77 result.push(function(jsonObject){78 return jsonObject.parse('{"a":5,"a",}');79 });80 result[result.length - 1].throws = true;81 result.push(function(jsonObject){82 return jsonObject.parse('{"a":(5,"a"),}');83 });84 result[result.length - 1].throws = true;85 result.push(function(jsonObject){86 return jsonObject.parse('[]');87 });88 result.push(function(jsonObject){89 return jsonObject.parse('[1]');90 });91 result.push(function(jsonObject){92 return jsonObject.parse('[1,]');93 });94 result[result.length - 1].throws = true;95 result.push(function(jsonObject){96 return jsonObject.parse('[1,2]');97 });98 result.push(function(jsonObject){99 return jsonObject.parse('[1,2,,]');100 });101 result[result.length - 1].throws = true;102 result.push(function(jsonObject){103 return jsonObject.parse('[1,2,,4]');104 });105 result[result.length - 1].throws = true;106 result.push(function(jsonObject){107 return jsonObject.parse('""');108 });109 result.push(function(jsonObject){110 return jsonObject.parse('"\'"');111 });112 result.push(function(jsonObject){113 return jsonObject.parse('"a\"');114 });115 result.push(function(jsonObject){116 return jsonObject.parse('"a\\"');117 });118 result[result.length - 1].throws = true;119 result.push(function(jsonObject){120 return jsonObject.parse('"a\\z"');121 });122 result[result.length - 1].throws = true;123 result.push(function(jsonObject){124 return jsonObject.parse('"a\\\z"');125 });126 result[result.length - 1].throws = true;127 result.push(function(jsonObject){128 return jsonObject.parse('"a\\\\z"');129 });130 result.push(function(jsonObject){131 return jsonObject.parse('"a\tz"');132 });133 result[result.length - 1].throws = true; // rfc4627 does not allow literal tab characters in JSON source134 result.push(function(jsonObject){135 return jsonObject.parse('"a\\tz"');136 });137 result.push(function(jsonObject){138 return jsonObject.parse('"a\nz"');139 });140 result[result.length - 1].throws = true;141 result.push(function(jsonObject){142 return jsonObject.parse('"a\\nz"');143 });144 result.push(function(jsonObject){145 return jsonObject.parse('"a\rz"');146 });147 result[result.length - 1].throws = true;148 result.push(function(jsonObject){149 return jsonObject.parse('"a\\rz"');150 });151 result.push(function(jsonObject){152 return jsonObject.parse('"a\/z"');153 });154 result.push(function(jsonObject){155 return jsonObject.parse('"a\\/z"');156 });157 result.push(function(jsonObject){158 return jsonObject.parse('"a\bz"');159 });160 result[result.length - 1].throws = true;161 result.push(function(jsonObject){162 return jsonObject.parse('"a\\bz"');163 });164 result.push(function(jsonObject){165 return jsonObject.parse('"a\rz"');166 });167 result[result.length - 1].throws = true;168 result.push(function(jsonObject){169 return jsonObject.parse('"a\\rz"');170 });171 result.push(function(jsonObject){172 return jsonObject.parse('"a\\uz" ');173 });174 result[result.length - 1].throws = true;175 result.push(function(jsonObject){176 return jsonObject.parse('"a\\u0z" ');177 });178 result[result.length - 1].throws = true;179 result.push(function(jsonObject){180 return jsonObject.parse('"a\\u00z" ');181 });182 result[result.length - 1].throws = true;183 result.push(function(jsonObject){184 return jsonObject.parse('"a\\u000z" ');185 });186 result[result.length - 1].throws = true;187 result.push(function(jsonObject){188 return jsonObject.parse('"a\\u0000z" ');189 });190 result.push(function(jsonObject){191 return jsonObject.parse('"a\\u000Az" ');192 });193 result.push(function(jsonObject){194 return jsonObject.parse('"a\\u000az" ');195 });196 result.push(function(jsonObject){197 return jsonObject.parse('"a\\u000Gz" ');198 });199 result[result.length - 1].throws = true;200 result.push(function(jsonObject){201 return jsonObject.parse('"a\\u000gz" ');202 });203 result[result.length - 1].throws = true;204 result.push(function(jsonObject){205 return jsonObject.parse('"a\\u00A0z" ');206 });207 result.push(function(jsonObject){208 return jsonObject.parse('"a\\u00a0z" ');209 });210 result.push(function(jsonObject){211 return jsonObject.parse('"a\\u00G0z" ');212 });213 result[result.length - 1].throws = true;214 result.push(function(jsonObject){215 return jsonObject.parse('"a\\u00g0z" ');216 });217 result[result.length - 1].throws = true;218 result.push(function(jsonObject){219 return jsonObject.parse('"a\\u0A00z" ');220 });221 result.push(function(jsonObject){222 return jsonObject.parse('"a\\u0a00z" ');223 });224 result.push(function(jsonObject){225 return jsonObject.parse('"a\\u0G00z" ');226 });227 result[result.length - 1].throws = true;228 result.push(function(jsonObject){229 return jsonObject.parse('"a\\u0g00z" ');230 });231 result[result.length - 1].throws = true;232 result.push(function(jsonObject){233 return jsonObject.parse('"a\\uA000z" ');234 });235 result.push(function(jsonObject){236 return jsonObject.parse('"a\\ua000z" ');237 });238 result.push(function(jsonObject){239 return jsonObject.parse('"a\\uG000z" ');240 });241 result[result.length - 1].throws = true;242 result.push(function(jsonObject){243 return jsonObject.parse('"a\\ug000z" ');244 });245 result[result.length - 1].throws = true;246 result.push(function(jsonObject){247 return jsonObject.parse('00');248 });249 result[result.length - 1].throws = true;250 result.push(function(jsonObject){251 return jsonObject.parse('01');252 });253 result[result.length - 1].throws = true;254 result.push(function(jsonObject){255 return jsonObject.parse('0.a');256 });257 result[result.length - 1].throws = true;258 result.push(function(jsonObject){259 return jsonObject.parse('0x0');260 });261 result[result.length - 1].throws = true;262 result.push(function(jsonObject){263 return jsonObject.parse('2e1.3');264 });265 result[result.length - 1].throws = true;266 result.push(function(jsonObject){267 return jsonObject.parse('2e-+10');268 });269 result[result.length - 1].throws = true;270 result.push(function(jsonObject){271 return jsonObject.parse('2e+-10');272 });273 result[result.length - 1].throws = true;274 result.push(function(jsonObject){275 return jsonObject.parse('2e3e4');276 });277 result[result.length - 1].throws = true;278 result.push(function(jsonObject){279 return jsonObject.parse('-01.0');280 });281 result[result.length - 1].throws = true;282 result.push(function(jsonObject){283 return jsonObject.parse('-01');284 });285 result[result.length - 1].throws = true;286 result.push(function(jsonObject){287 return jsonObject.parse('-01.a');288 });289 result[result.length - 1].throws = true;290 result.push(function(jsonObject){291 return jsonObject.parse('1.e1');292 });293 result[result.length - 1].throws = true;294 result.push(function(jsonObject){295 return jsonObject.parse('{/* block comments are not allowed */}');296 });297 result[result.length - 1].throws = true;298 result.push(function(jsonObject){299 return jsonObject.parse('{// line comments are not allowed \n}');300 });301 result[result.length - 1].throws = true;302 result.push(function(jsonObject){303 return jsonObject.parse('true');304 });305 result.push(function(jsonObject){306 return jsonObject.parse('false');307 });308 var simpleArray = ['a', 'b', 'c'];309 var simpleObject = {a:"1", b:"2", c:"3"};310 var complexArray = ['a', 'b', 'c',,,simpleObject, simpleArray, [simpleObject,simpleArray]];311 var complexObject = {a:"1", b:"2", c:"3", d:4.5e10, g: 0.45e-5, h: 0.0, i: 0, j:.5, k:0., l:-0, m:-0.0, n:-0., o:-.5, p:-0.45e-10, q:-4.5e10, e:null, "":12, f: simpleArray, array: complexArray};312 result.push(function(jsonObject){313 return jsonObject.parse(JSON.stringify(simpleObject));314 });315 result[result.length - 1].expected = JSON.stringify(simpleObject);316 result.push(function(jsonObject){317 return jsonObject.parse(JSON.stringify(complexObject));318 });319 result.push(function(jsonObject){320 return jsonObject.parse(JSON.stringify(complexObject));321 });322 result[result.length - 1].expected = JSON.stringify(complexObject);323 result.push(function(jsonObject){324 return jsonObject.parse(JSON.stringify(simpleObject,null,100));325 });326 result[result.length - 1].expected = JSON.stringify(simpleObject);327 result.push(function(jsonObject){328 return jsonObject.parse(JSON.stringify(complexObject,null,100));329 });330 result.push(function(jsonObject){331 return jsonObject.parse(JSON.stringify(complexObject,null,100));332 });333 result[result.length - 1].expected = JSON.stringify(complexObject);334 result.push(function(jsonObject){335 return jsonObject.parse(JSON.stringify(simpleObject,null," "));336 });337 result[result.length - 1].expected = JSON.stringify(simpleObject);338 result.push(function(jsonObject){339 return jsonObject.parse(JSON.stringify(complexObject,null," "));340 });341 result.push(function(jsonObject){342 return jsonObject.parse(JSON.stringify(complexObject,null," "));343 });344 result[result.length - 1].expected = JSON.stringify(complexObject);345 346 result.push(function(jsonObject){347 return jsonObject.parse(JSON.stringify(simpleObject,null,"\t"));348 });349 result[result.length - 1].expected = JSON.stringify(simpleObject);350 result.push(function(jsonObject){351 return jsonObject.parse(JSON.stringify(complexObject,null,"\t"));352 });353 result.push(function(jsonObject){354 return jsonObject.parse(JSON.stringify(complexObject,null,"\t"));355 });356 result[result.length - 1].expected = JSON.stringify(complexObject);357 358 result.push(function(jsonObject){359 return jsonObject.parse(JSON.stringify(simpleObject,null,"\n"));360 });361 result[result.length - 1].expected = JSON.stringify(simpleObject);362 result.push(function(jsonObject){363 return jsonObject.parse(JSON.stringify(complexObject,null,"\n"));364 });365 result[result.length - 1].expected = JSON.stringify(complexObject);366 function log(key, value) {367 var o = {};368 o[key] = value;369 o.keyType = typeof key;370 return o;371 }372 result.push(function(jsonObject){373 return jsonObject.parse("true", log);374 });375 result.push(function(jsonObject){376 return jsonObject.parse("false", log);377 });378 result.push(function(jsonObject){379 return jsonObject.parse("null", log);380 });381 result.push(function(jsonObject){382 return jsonObject.parse("1", log);383 });384 result.push(function(jsonObject){385 return jsonObject.parse("1.5", log);386 });387 result.push(function(jsonObject){388 return jsonObject.parse('"a string"', log);389 });390 result.push(function(jsonObject){391 return jsonObject.parse(JSON.stringify(simpleArray), log);392 });393 result.push(function(jsonObject){394 return jsonObject.parse(JSON.stringify(complexArray), log);395 });396 result.push(function(jsonObject){397 return jsonObject.parse(JSON.stringify(simpleObject), log);398 });399 result.push(function(jsonObject){400 return jsonObject.parse(JSON.stringify(complexObject), log);401 });402 result.push(function(jsonObject){403 return jsonObject.parse('{"__proto__":{"a":5}}', log);404 });405 var logOrderString;406 function logOrder(key, value) {407 logOrderString += key +":"+JSON.stringify(value);408 return null;409 }410 result.push(function(jsonObject){411 logOrderString = "";412 return jsonObject.parse("true", logOrder);413 });414 result.push(function(jsonObject){415 logOrderString = "";416 return jsonObject.parse("false", logOrder);417 });418 result.push(function(jsonObject){419 logOrderString = "";420 return jsonObject.parse("null", logOrder);421 });422 result.push(function(jsonObject){423 logOrderString = "";424 return jsonObject.parse("1", logOrder);425 });426 result.push(function(jsonObject){427 logOrderString = "";428 return jsonObject.parse("1.5", logOrder);429 });430 result.push(function(jsonObject){431 logOrderString = "";432 return jsonObject.parse('"a string"', logOrder);433 });434 result.push(function(jsonObject){435 logOrderString = "";436 return jsonObject.parse(JSON.stringify(simpleArray), logOrder);437 });438 result.push(function(jsonObject){439 logOrderString = "";440 return jsonObject.parse(JSON.stringify(complexArray), logOrder);441 });442 result.push(function(jsonObject){443 logOrderString = "";444 return jsonObject.parse(JSON.stringify(simpleObject), logOrder);445 });446 result.push(function(jsonObject){447 logOrderString = "";448 return jsonObject.parse(JSON.stringify(complexObject), logOrder);449 });450 result.push(function(jsonObject){451 logOrderString = "";452 jsonObject.parse("true", logOrder);453 return logOrderString;454 });455 result.push(function(jsonObject){456 logOrderString = "";457 jsonObject.parse("false", logOrder);458 return logOrderString;459 });460 result.push(function(jsonObject){461 logOrderString = "";462 jsonObject.parse("null", logOrder);463 return logOrderString;464 });465 result.push(function(jsonObject){466 logOrderString = "";467 jsonObject.parse("1", logOrder);468 return logOrderString;469 });470 result.push(function(jsonObject){471 logOrderString = "";472 jsonObject.parse("1.5", logOrder);473 return logOrderString;474 });475 result.push(function(jsonObject){476 logOrderString = "";477 jsonObject.parse('"a string"', logOrder);478 return logOrderString;479 });480 result.push(function(jsonObject){481 logOrderString = "";482 jsonObject.parse(JSON.stringify(simpleArray), logOrder);483 return logOrderString;484 });485 result.push(function(jsonObject){486 logOrderString = "";487 jsonObject.parse(JSON.stringify(complexArray), logOrder);488 return logOrderString;489 });490 result.push(function(jsonObject){491 logOrderString = "";492 jsonObject.parse(JSON.stringify(simpleObject), logOrder);493 return logOrderString;494 });495 result.push(function(jsonObject){496 logOrderString = "";497 jsonObject.parse(JSON.stringify(complexObject), logOrder);498 return logOrderString;499 });500 var callCount = 0;501 function throwAfterFifthCall(key, value) {502 logOrder(key, value);503 if (++callCount > 5)504 throw "from reviver";505 return null;506 }507 result.push(function(jsonObject){508 callCount = 0;509 logOrderString = "";510 return jsonObject.parse(JSON.stringify(complexArray), throwAfterFifthCall);511 });512 result[result.length - 1].throws = true;513 result.push(function(jsonObject){514 callCount = 0;515 logOrderString = "";516 return jsonObject.parse(JSON.stringify(simpleObject), throwAfterFifthCall);517 });518 result.push(function(jsonObject){519 callCount = 0;520 logOrderString = "";521 return jsonObject.parse(JSON.stringify(complexObject), throwAfterFifthCall);522 });523 result[result.length - 1].throws = true;524 result.push(function(jsonObject){525 callCount = 0;526 logOrderString = "";527 try { jsonObject.parse(JSON.stringify(complexArray), throwAfterFifthCall); } catch (e) {}528 return logOrderString;529 });530 result.push(function(jsonObject){531 callCount = 0;532 logOrderString = "";533 try { jsonObject.parse(JSON.stringify(simpleObject), throwAfterFifthCall); } catch (e) {}534 return logOrderString;535 });536 result.push(function(jsonObject){537 callCount = 0;538 logOrderString = "";539 try { jsonObject.parse(JSON.stringify(complexObject), throwAfterFifthCall); } catch (e) {}540 return logOrderString;541 });542 var unicode = "";543 for (var i = 0; i < 1<<16; i++)544 unicode += String.fromCharCode(i);545 result.push(function(jsonObject){546 return jsonObject.parse(JSON.stringify(unicode));547 });548 result[result.length - 1].unstringifiedExpected = unicode;549 return result;550}551var tests = createTests();552for (var i = 0; i < tests.length; i++) {553 try {554 debug(tests[i]);555 if (tests[i].throws) {556 shouldThrow('tests[i](nativeJSON)');557 try {558 var threw = false;559 tests[i](JSON);560 } catch(e) {561 var threw = true;562 }563 if (!threw)564 debug("json2.js did not throw for a test we expect to throw.");565 } else if (tests[i].expected)566 try { shouldBe('JSON.stringify(tests[i](nativeJSON))', "tests[i].expected") } catch(e) { debug("threw - " + e)}567 else if (tests[i].unstringifiedExpected)568 try { shouldBe('tests[i](nativeJSON)', "tests[i].unstringifiedExpected") } catch(e) { debug("threw - " + e)}569 else570 try { shouldBe('JSON.stringify(tests[i](nativeJSON))', 'JSON.stringify(tests[i](JSON))') } catch(e) { debug("threw - " + e) };571 }catch(e){572 debug(e);573 }...

Full Screen

Full Screen

red_black_tree.py

Source:red_black_tree.py Github

copy

Full Screen

1__author__ = 'art'234import binary_tree5678class Tree(object):9 """1011 """12 def __init__(self):13 """1415 :return:16 """17 self.nil = ListObject()18 self.nil.color = 'black'19 self.nil.size = 020 self.root = self.nil21 self.nil.left = self.root22 self.nil.right = self.root232425 def tree_insert(self, list_object):26 """2728 :param list_object:29 :return:30 """31 member_curent_list = self.nil32 curent_list = self.root33 while curent_list is not self.nil:34 curent_list.size += 135 member_curent_list = curent_list36 if list_object.key < curent_list.key:37 curent_list = curent_list.left38 else:39 curent_list = curent_list.right40 list_object.parent = member_curent_list41 if member_curent_list is self.nil:42 self.root = list_object43 elif list_object.key < member_curent_list.key:44 member_curent_list.left = list_object45 else:46 member_curent_list.right = list_object47 list_object.left = self.nil48 list_object.right = self.nil49 list_object.color = 'red'50 self.insert_fixup(list_object)5152 def insert_fixup(self, list_object):53 """54 """5556 while list_object.parent.color == 'red':57 if list_object.parent == list_object.parent.parent.left:58 curent_list = list_object.parent.parent.right59 if curent_list.color == 'red':60 list_object.parent.color = 'black'61 curent_list.color = 'black'62 list_object.parent.parent.color = 'red'63 list_object = list_object.parent.parent64 else:65 if list_object == list_object.parent.right:66 list_object = list_object.parent67 self.left_rotate(list_object)68 list_object.parent.color = 'black'69 list_object.parent.parent.color = 'red'70 self.right_rotate(list_object.parent.parent)71 else:72 curent_list = list_object.parent.parent.left73 if curent_list.color == 'red':74 list_object.parent.color = 'black'75 curent_list.color = 'black'76 list_object.parent.parent.color = 'red'77 list_object = list_object.parent.parent78 else:79 if list_object == list_object.parent.left:80 list_object = list_object.parent81 self.right_rotate(list_object)82 list_object.parent.color = 'black'83 list_object.parent.parent.color = 'red'84 self.left_rotate(list_object.parent.parent)85 self.root.color = 'black'8687 def left_rotate(self, list_object):88 """89 """90 curent_list = list_object.right91 list_object.right = curent_list.left9293 if curent_list.left is not self.nil:94 curent_list.left.parent = list_object95 curent_list.parent = list_object.parent96 if list_object.parent == self.nil:97 self.root = curent_list98 elif list_object == list_object.parent.left:99 list_object.parent.left = curent_list100 else:101 list_object.parent.right = curent_list102 curent_list.left = list_object103 list_object.parent = curent_list104 curent_list.size = list_object.size105 list_object.size = list_object.left.size + list_object.right.size + 1106107 def right_rotate(self, list_object):108 """109 """110 curent_list = list_object.left111 list_object.left = curent_list.right112 if curent_list.right is not self.nil:113 curent_list.right.parent = list_object114 curent_list.parent = list_object.parent115 if list_object.parent == self.nil:116 self.root = curent_list117 elif list_object == list_object.parent.right:118 list_object.parent.right = curent_list119 else:120 list_object.parent.left = curent_list121 curent_list.right = list_object122 list_object.parent = curent_list123 curent_list.size = list_object.size124 list_object.size = list_object.left.size + list_object.right.size + 1125126 def inorder_tree_walk(self, list_tree):127 """128129 :return:130 """131 if list_tree is not self.nil:132 return (self.inorder_tree_walk(list_tree.left), list_tree.key,133 self.inorder_tree_walk(list_tree.right))134135 def transplant(self, old_subroot, new_subroot):136 """137138 :return: different_size. How change size of root.139 """140 print('transplate')141 if old_subroot is self.nil:142 self.root = new_subroot143 elif old_subroot == old_subroot.parent.left:144 old_subroot.parent.left = new_subroot145 else:146 old_subroot.parent.right = new_subroot147 new_subroot.parent = old_subroot.parent148 different_size = new_subroot.size - old_subroot.size149 self.return_true_size(new_subroot, different_size)150 return different_size151152 def return_true_size(self, new_subroot, different_size):153 up_parent = new_subroot.parent154 while up_parent is not self.root:155 up_parent.size += different_size156 up_parent = up_parent.parent157 self.root.size += different_size158159 def delete_list(self, list_object):160 """161162 :param list_object:163 :return:164 """165 print('delete', self.root.size)166 curent_list = list_object167 curent_list_original_color = curent_list.color168 if list_object.left is self.nil:169 member_list = list_object.right170 self.transplant(list_object, list_object.right)171 elif list_object.right is self.nil:172 member_list = list_object.left173 self.transplant(list_object, list_object.left)174 else:175 curent_list = self.tree_minimum(list_object.right)176 curent_list_original_color = curent_list.color177 member_list = curent_list.right178 self.true_size(self.root)179 if curent_list.parent is list_object:180 member_list.parent = curent_list181 assert(self.root.size == 200), "{}".format(self.root.size)182 # curent_list.size += list_object.left.size183 else:184 self.transplant(curent_list, curent_list.right)185 assert(self.root.size == 199), "{}".format(self.root.size)186 curent_list.right = list_object.right187 curent_list.right.parent = curent_list188 curent_list.size = list_object.right.size + 1189 self.true_size(self.root)190 curent_list.size += list_object.left.size191 self.transplant(list_object, curent_list)192 curent_list.left = list_object.left193 curent_list.left.parent = curent_list194 curent_list.color = list_object.color195 assert(self.root.size == 199), "{}".format(self.root.size)196 self.true_size(self.root)197 self.true_size(self.root)198 assert(self.root.size == 199), "{}".format(self.root.size)199 if curent_list_original_color == 'black':200 self.delete_fixup(member_list)201202 def delete_fixup(self, list_object):203 """204 """205 print('delete_fixup')206 while list_object is not self.nil and \207 list_object.color == 'black':208 if list_object == list_object.parent.left:209 curent_list = list_object.parent.right210 if curent_list.color == 'red':211 curent_list.color = 'black'212 list_object.parent.color = 'red'213 self.left_rotate(list_object.parent)214 curent_list = list_object.parent.right215 if curent_list.left.color == 'black' and \216 curent_list.right.color == 'black':217 curent_list.color = 'red'218 list_object = list_object.parent219 else:220 if curent_list.right.color == 'black':221 curent_list.left.color = 'black'222 curent_list.color = 'red'223 self.right_rotate(curent_list)224 curent_list = list_object.parent.right225 curent_list.color = list_object.parent.color226 list_object.parent.color = 'black'227 curent_list.right.color = 'black'228 self.left_rotate(list_object.parent)229 list_object = self.root230 else:231 if curent_list.color == 'red':232 curent_list.color = 'black'233 list_object.parent.color = 'red'234 self.right_rotate(list_object.parent)235 curent_list = list_object.parent.left236 if curent_list.right.color == 'black' and \237 curent_list.left.color == 'black':238 curent_list.color = 'red'239 list_object = list_object.parent240 else:241 if curent_list.left.color == 'black':242 curent_list.right.color = 'black'243 curent_list.color = 'red'244 self.left_rotate(curent_list)245 curent_list = list_object.parent.left246 curent_list.color = list_object.parent.color247 list_object.parent.color = 'black'248 curent_list.left.color = 'black'249 self.right_rotate(list_object.parent)250 list_object = self.root251 list_object.color = 'black'252253 def tree_minimum(self, list_object):254 """255 list_object must be root256 :return:257 """258 while list_object.left is not self.nil:259 list_object = list_object.left260 return list_object261262 def tree_maximum(self, list_oblect):263 """264 list_object must be root265 :return:266 """267 while list_oblect.right is not self.nil:268 list_oblect = list_oblect.right269 return list_oblect270271 def tree_search(self, list_object, key):272 """273 list_object must be root274 :param key:275 :return:276 """277 while list_object is not self.nil and key != list_object.key:278 if key < list_object.key:279 list_object = list_object.left280 else:281 list_object = list_object.right282 return list_object283284 def os_select(self, list_object, rank):285 """286287 :param list_obgect: must be root288 :param rank:289 :return:290 """291 assert list_object.size != 0292 seach_rank = list_object.left.size + 1293 if seach_rank == rank:294 return list_object295 elif rank < seach_rank:296 return self.os_select(list_object.left, rank)297 else:298 return self.os_select(list_object.right, rank - seach_rank)299300 def os_rank(self, list_object):301 """302 """303 assert list_object.size != 0304 seach_rank = list_object.left.size + 1305 curent_list = list_object306 while curent_list is not self.root:307 if curent_list == curent_list.parent.right:308 seach_rank += curent_list.parent.left.size + 1309 curent_list = curent_list.parent310 return seach_rank311312 def true_size(self, list_object):313 """314315 :param list_object: must be root316 :return:317 """318 if list_object is not self.nil:319 assert(list_object.size == list_object.left.size +320 list_object.right.size + 1), "{} {}".format(list_object.size,321 list_object.left.size +322 list_object.right.size + 1)323 self.true_size(list_object.left)324 self.true_size(list_object.right)325326class ListObject(binary_tree.ListObject):327 """328 """329330 def __init__(self, key=None):331 """332333 :param key:334 :return:335 """336 super().__init__(key)337 self.color = None ...

Full Screen

Full Screen

window-properties.js

Source:window-properties.js Github

copy

Full Screen

1// The property name and type.2var propertyInfo = [3 ["alert", "function"],4 ["atob", "function"],5 ["blur", "function"],6 ["btoa", "function"],7 ["captureEvents", "function"],8 ["clearInterval", "function"],9 ["clearTimeout", "function"],10 ["close", "function"],11 ["confirm", "function"],12 ["find", "function"],13 ["focus", "function"],14 ["getComputedStyle", "function"],15 ["getMatchedCSSRules", "function"],16 ["getSelection", "function"],17 ["moveBy", "function"],18 ["moveTo", "function"],19 ["open", "function"],20 ["print", "function"],21 ["prompt", "function"],22 ["releaseEvents", "function"],23 ["resizeBy", "function"],24 ["resizeTo", "function"],25 ["scroll", "function"],26 ["scrollBy", "function"],27 ["scrollTo", "function"],28 ["setInterval", "function"],29 ["setTimeout", "function"],30 ["showModalDialog", "function"],31 ["stop", "function"],32 ["toString", "function"],33 ["Attr", "object"],34 ["CDATASection", "object"],35 ["CSSCharsetRule", "object"],36 ["CSSFontFaceRule", "object"],37 ["CSSImportRule", "object"],38 ["CSSMediaRule", "object"],39 ["CSSPageRule", "object"],40 ["CSSPrimitiveValue", "object"],41 ["CSSRule", "object"],42 ["CSSRuleList", "object"],43 ["CSSStyleDeclaration", "object"],44 ["CSSStyleRule", "object"],45 ["CSSStyleSheet", "object"],46 ["CSSValue", "object"],47 ["CSSValueList", "object"],48 ["CharacterData", "object"],49 ["Comment", "object"],50 ["Counter", "object"],51 ["DOMException", "object"],52 ["DOMImplementation", "object"],53 ["DOMParser", "object"],54 ["Document", "object"],55 ["DocumentFragment", "object"],56 ["DocumentType", "object"],57 ["Element", "object"],58 ["Entity", "object"],59 ["EntityReference", "object"],60 ["Event", "object"],61 ["EventException", "object"],62 ["HTMLAnchorElement", "object"],63 ["HTMLAppletElement", "object"],64 ["HTMLAreaElement", "object"],65 ["HTMLBRElement", "object"],66 ["HTMLBaseElement", "object"],67 ["HTMLBaseFontElement", "object"],68 ["HTMLBodyElement", "object"],69 ["HTMLButtonElement", "object"],70 ["HTMLCanvasElement", "object"],71 ["HTMLDListElement", "object"],72 ["HTMLDataListElement", "object"],73 ["HTMLDirectoryElement", "object"],74 ["HTMLDivElement", "object"],75 ["HTMLDocument", "object"],76 ["HTMLElement", "object"],77 ["HTMLEmbedElement", "object"],78 ["HTMLFieldSetElement", "object"],79 ["HTMLFontElement", "object"],80 ["HTMLFormElement", "object"],81 ["HTMLFrameElement", "object"],82 ["HTMLFrameSetElement", "object"],83 ["HTMLHRElement", "object"],84 ["HTMLHeadElement", "object"],85 ["HTMLHeadingElement", "object"],86 ["HTMLHtmlElement", "object"],87 ["HTMLIFrameElement", "object"],88 ["HTMLImageElement", "object"],89 ["HTMLInputElement", "object"],90 ["HTMLLIElement", "object"],91 ["HTMLLabelElement", "object"],92 ["HTMLLegendElement", "object"],93 ["HTMLLinkElement", "object"],94 ["HTMLMapElement", "object"],95 ["HTMLMarqueeElement", "object"],96 ["HTMLMenuElement", "object"],97 ["HTMLMetaElement", "object"],98 ["HTMLModElement", "object"],99 ["HTMLOListElement", "object"],100 ["HTMLObjectElement", "object"],101 ["HTMLOptGroupElement", "object"],102 ["HTMLOptionElement", "object"],103 ["HTMLParagraphElement", "object"],104 ["HTMLParamElement", "object"],105 ["HTMLPreElement", "object"],106 ["HTMLQuoteElement", "object"],107 ["HTMLScriptElement", "object"],108 ["HTMLSelectElement", "object"],109 ["HTMLStyleElement", "object"],110 ["HTMLTableCaptionElement", "object"],111 ["HTMLTableCellElement", "object"],112 ["HTMLTableColElement", "object"],113 ["HTMLTableElement", "object"],114 ["HTMLTableRowElement", "object"],115 ["HTMLTableSectionElement", "object"],116 ["HTMLTextAreaElement", "object"],117 ["HTMLTitleElement", "object"],118 ["HTMLUListElement", "object"],119 ["KeyboardEvent", "object"],120 ["MediaList", "object"],121 ["MouseEvent", "object"],122 ["MutationEvent", "object"],123 ["NamedNodeMap", "object"],124 ["Node", "object"],125 ["NodeFilter", "object"],126 ["NodeList", "object"],127 ["Notation", "object"],128 ["OverflowEvent", "object"],129 ["ProcessingInstruction", "object"],130 ["ProgressEvent", "object"],131 ["Range", "object"],132 ["RangeException", "object"],133 ["Rect", "object"],134 ["SVGAngle", "object"],135 ["SVGColor", "object"],136 ["SVGException", "object"],137 ["SVGGradientElement", "object"],138 ["SVGLength", "object"],139 ["SVGMarkerElement", "object"],140 ["SVGPaint", "object"],141 ["SVGPathSeg", "object"],142 ["SVGPreserveAspectRatio", "object"],143 ["SVGRenderingIntent", "object"],144 ["SVGTextContentElement", "object"],145 ["SVGTextPathElement", "object"],146 ["SVGTransform", "object"],147 ["SVGUnitTypes", "object"],148 ["StyleSheet", "object"],149 ["StyleSheetList", "object"],150 ["Text", "object"],151 ["TextEvent", "object"],152 ["UIEvent", "object"],153 ["WheelEvent", "object"],154 ["XMLDocument", "object"],155 ["XMLHttpRequest", "object"],156 ["XMLHttpRequestException", "object"],157 ["XMLSerializer", "object"],158 ["XPathEvaluator", "object"],159 ["XPathException", "object"],160 ["XPathResult", "object"],161 ["XSLTProcessor", "object"],162 ["onload", "object"],163 ["frames", "object"],164 ["parent", "object"],165 ["self", "object"],166 ["top", "object"],167 ["window", "object"],168 ["locationbar", "object"],169 ["menubar", "object"],170 ["personalbar", "object"],171 ["scrollbars", "object"],172 ["statusbar", "object"],173 ["toolbar", "object"],174 ["console", "object"],175 ["history", "object"],176 ["navigator", "object"],177 ["screen", "object"],178 ["clientInformation", "object"],179 ["document", "object"],180 ["location", "object"],181 ["onabort", "object"],182 ["onbeforeunload", "object"],183 ["onblur", "object"],184 ["onchange", "object"],185 ["onclick", "object"],186 ["ondblclick", "object"],187 ["onerror", "object"],188 ["onfocus", "object"],189 ["onkeydown", "object"],190 ["onkeypress", "object"],191 ["onkeyup", "object"],192 ["onmousedown", "object"],193 ["onmousemove", "object"],194 ["onmouseout", "object"],195 ["onmouseover", "object"],196 ["onmouseup", "object"],197 ["onmousewheel", "object"],198 ["onreset", "object"],199 ["onresize", "object"],200 ["onscroll", "object"],201 ["onsearch", "object"],202 ["onselect", "object"],203 ["onsubmit", "object"],204 ["onunload", "object"],205 ["opener", "object"],206 ["defaultStatus", "string"],207 ["defaultstatus", "string"],208 ["name", "string"],209 ["status", "string"],210 ["devicePixelRatio", "number"],211 ["innerHeight", "number"],212 ["innerWidth", "number"],213 ["length", "number"],214 ["outerHeight", "number"],215 ["outerWidth", "number"],216 ["pageXOffset", "number"],217 ["pageYOffset", "number"],218 ["screenLeft", "number"],219 ["screenTop", "number"],220 ["screenX", "number"],221 ["screenY", "number"],222 ["scrollX", "number"],223 ["scrollY", "number"],224 ["closed", "boolean"],225 ["offscreenBuffering", "boolean"],226];227// Also collect a list of only the property names.228var properties = [];229for (var i = 0; i < propertyInfo.length; ++i) {230 properties.push(propertyInfo[i][0]);...

Full Screen

Full Screen

binary_tree.py

Source:binary_tree.py Github

copy

Full Screen

1__author__ = 'art'234class ListObject(object):5 """67 """8 def __init__(self, key=None):9 """1011 :param key:12 :return:13 """14 self.key = key15 self.left = None16 self.right = None17 self.parent = None1819class Tree(object):20 """21 """22 def __init__(self):23 """2425 :return:26 """27 self.root = None28 self.high = 02930 # def __repr__(self):31 # for return_value in self.inorder_tree_walk(self.root):32 # while return_value is tuple:33 #34 # return 'end'3536 # def print_tree(self, list_tree):37 # """38 #39 # :return:40 # """41 # return424344 def inorder_tree_walk(self, list_tree):45 """4647 :return:48 """49 if list_tree is not None:50 return self.inorder_tree_walk(list_tree.left), list_tree.key,\51 self.inorder_tree_walk(list_tree.right)5253 def tree_search(self, list_object, key):54 """55 list_object must be root56 :param key:57 :return:58 """59 while list_object is not None and key != list_object.key:60 if key < list_object.key:61 list_object = list_object.left62 else:63 list_object = list_object.right64 return list_object6566 def tree_minimum(self, list_object):67 """68 list_object must be root69 :return:70 """71 while list_object.left is not None:72 list_object = list_object.left73 return list_object7475 def tree_maximum(self, list_oblect):76 """77 list_object must be root78 :return:79 """80 while list_oblect.right is not None:81 list_oblect = list_oblect.right82 return list_oblect8384 def tree_successor(self, list_object):85 """8687 :param list_object:88 :return: element with minimal key greater list_object.key89 """90 if list_object.right is not None:91 return self.tree_minimum(list_object.right)92 parent_list_object = list_object.parent93 while parent_list_object is not None and\94 parent_list_object.right == list_object:95 list_object = parent_list_object96 parent_list_object = parent_list_object.parent97 return parent_list_object9899 def tree_insert(self, list_object):100 """101102 :param list_object:103 :return:104 """105 member_curent_list = None106 curent_list = self.root107 high = 0108 while curent_list is not None:109 high += 1110 member_curent_list = curent_list111 if list_object.key < curent_list.key:112 curent_list = curent_list.left113 else:114 curent_list = curent_list.right115 list_object.parent = member_curent_list116 if high >= self.high:117 self.high = high + 1118 if member_curent_list is None:119 self.root = list_object120 elif list_object.key < member_curent_list.key:121 member_curent_list.left = list_object122 else:123 member_curent_list.right = list_object124125 def transplant(self, old_subroot, new_subroot):126 """127128 :return:129 """130 if old_subroot is None:131 self.root = new_subroot132 elif old_subroot == old_subroot.parent.left:133 old_subroot.parent.left = new_subroot134 else:135 old_subroot.parent.right = new_subroot136 if new_subroot is not None:137 new_subroot.parent = old_subroot.parent138139 def delete_list(self, list_object):140 """141142 :param list_object:143 :return:144 """145 if list_object.left is None:146 self.transplant(list_object, list_object.right)147 elif list_object.right is None:148 self.transplant(list_object, list_object.left)149 else:150 minimum_list_object = self.tree_minimum(list_object.right)151 if minimum_list_object.parent is not list_object:152 self.transplant(minimum_list_object, minimum_list_object.right)153 minimum_list_object.right = list_object.right154 minimum_list_object.right.parent = minimum_list_object155 self.transplant(list_object, minimum_list_object)156 minimum_list_object.left = list_object.left157 minimum_list_object.left.parent = minimum_list_object ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf } from 'storybook-root';2storiesOf('Storybook Knobs', module)3 .add('with a button', () => (4 <button onClick={action('clicked')}>Hello Button</button>5 .add('with some emoji', () => (6 <button onClick={action('clicked')}>😀 😎 👍 💯</button>7 ));8import { storiesOf } from 'storybook-root';9storiesOf('Storybook Knobs', module)10 .add('with a button', () => (11 <button onClick={action('clicked')}>Hello Button</button>12 .add('with some emoji', () => (13 <button onClick={action('clicked')}>😀 😎 👍 💯</button>14 ));15import { storiesOf } from 'storybook-root';16storiesOf('Storybook Knobs', module)17 .add('with a button', () => (18 <button onClick={action('clicked')}>Hello Button</button>19 .add('with some emoji', () => (20 <button onClick={action('clicked')}>😀 😎 👍 💯</button>21 ));22import { storiesOf } from 'storybook-root';23storiesOf('Storybook Knobs', module)24 .add('with a button', () => (25 <button onClick={action('clicked')}>Hello Button</button>26 .add('with some emoji', () => (27 <button onClick={action('clicked')}>😀 😎 👍 💯</button>28 ));29import { storiesOf } from 'storybook-root';30storiesOf('Storybook Knobs', module)31 .add('with a button', () => (32 <button onClick={action('clicked')}>Hello Button</button>33 .add('with some emoji', () => (34 <button onClick={action('clicked')}>😀 😎 👍 💯</button>35 ));36import { storiesOf

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';2import { storiesOf } from '@storybook/react';3import React from 'react';4import { Button } from './Button';5storiesOf('Button', module)6 .addDecorator(withKnobs)7 .add('with text', () => (8 disabled={boolean('Disabled', false)}9 label={text('Label', 'Hello Storybook')}10 onClick={action('clicked')}11 .add('with some emoji', () => (12 disabled={boolean('Disabled', false)}13 label={text('Label', '😀 😎 👍 💯')}14 onClick={action('clicked')}15 .add('with some numbers', () => (16 disabled={boolean('Disabled', false)}17 label={text('Label', '123')}18 onClick={action('clicked')}19 ));20import { configure } from '@storybook/react';21import '@storybook/addon-console';22import { setConsoleOptions } from '@storybook/addon-console';23setConsoleOptions({24});25const req = require.context('../src', true, /.stories.js$/);26function loadStories() {27 req.keys().forEach(filename => req(filename));28}29configure(loadStories, module);30{31 "scripts": {32 },33 "dependencies": {

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRoot = require('storybook-root');2storybookRoot.storybookRoot(__dirname);3const storybookRoot = require('storybook-root');4storybookRoot.storybookRoot(__dirname, 'storybook');5const storybookRoot = require('storybook-root');6storybookRoot.storybookRoot(__dirname, 'storybook', 'test');7const storybookRoot = require('storybook-root');8storybookRoot.storybookRoot(__dirname, 'storybook', 'test', 'test');9const storybookRoot = require('storybook-root');10storybookRoot.storybookRoot(__dirname, 'storybook', 'test', 'test', 'test');11const storybookRoot = require('storybook-root');12storybookRoot.storybookRoot(__dirname, 'storybook', 'test', 'test', 'test', 'test');13const storybookRoot = require('storybook-root');14storybookRoot.storybookRoot(__dirname, 'storybook', 'test', 'test', 'test', 'test', 'test');15const storybookRoot = require('storybook-root');16storybookRoot.storybookRoot(__dirname, 'storybook', 'test', 'test', 'test', 'test', 'test', 'test');17const storybookRoot = require('storybook-root');18storybookRoot.storybookRoot(__dirname, 'storybook', 'test', 'test', 'test', 'test', 'test', 'test', 'test');19const storybookRoot = require('storybook-root');20storybookRoot.storybookRoot(__dirname, 'storybook', 'test', 'test', 'test', 'test', 'test', 'test', 'test', 'test');21const storybookRoot = require('storybook-root');

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRoot = require('storybook-root');2storybookRoot.getStorybookRoot();3const StorybookRoot = require('storybook-root').StorybookRoot;4const root = new StorybookRoot();5root.getStorybookRoot();6const storybookRoot = require('storybook-root').storybookRoot;7storybookRoot();8const storybookRoot = require('storybook-root').storybookRoot;9storybookRoot('custom/path');10const storybookRoot = require('storybook-root').storybookRoot;11storybookRoot('custom/path', 'custom-config.js');12const storybookRoot = require('storybook-root').storybookRoot;13storybookRoot(undefined, 'custom-config.js');14const storybookRoot = require('storybook-root').storybookRoot;15storybookRoot('custom/path', 'custom-config.js', 'custom-package.json');16const storybookRoot = require('storybook-root').storybookRoot;17storybookRoot(undefined, 'custom-config.js', 'custom-package.json');18const storybookRoot = require('storybook-root').storybookRoot;19storybookRoot('custom/path', undefined, 'custom-package.json');20const storybookRoot = require('storybook-root').storybookRoot;21storybookRoot(undefined, undefined, 'custom-package.json');22const storybookRoot = require('storybook-root').storybookRoot;23storybookRoot('custom/path', 'custom-config.js', 'custom-package.json', 'custom-storybook.js');24const storybookRoot = require('storybook-root').storybookRoot;25storybookRoot(undefined, 'custom-config.js', 'custom-package.json', 'custom-storybook.js');26const storybookRoot = require('storybook-root').storybookRoot;27storybookRoot('custom/path', undefined

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Storybook } = require('storybook-root');2const storybook = new Storybook();3storybook.getStories();4const { Storybook } = require('storybook-root');5const storybook = new Storybook();6storybook.getStories();7const { Storybook } = require('storybook-root');8const storybook = new Storybook();9storybook.getStories();10const { Storybook } = require('storybook-root');11const storybook = new Storybook();12storybook.getStories();13const { Storybook } = require('storybook-root');14const storybook = new Storybook();15storybook.getStories();16const { Storybook } = require('storybook-root');17const storybook = new Storybook();18storybook.getStories();19const { Storybook } = require('storybook-root');20const storybook = new Storybook();21storybook.getStories();22const { Storybook } = require('storybook-root');23const storybook = new Storybook();24storybook.getStories();25const { Storybook } = require('storybook-root');26const storybook = new Storybook();27storybook.getStories();28const { Storybook } = require('storybook-root');29const storybook = new Storybook();30storybook.getStories();31const { Storybook } = require('storybook-root');32const storybook = new Storybook();33storybook.getStories();34const { Storybook } = require('storybook-root');35const storybook = new Storybook();36storybook.getStories();37const { Storybook } = require('storybook-root');38const storybook = new Storybook();

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf } from 'storybook-root';2storiesOf('Test')3 .add('test', () => <div>Test</div>)4import { storiesOf } from 'storybook-root';5storiesOf('Test')6 .add('test', () => <div>Test</div>)7import { storiesOf } from 'storybook-root';8storiesOf('Test')9 .add('test', () => <div>Test</div>)10import { storiesOf } from 'storybook-root';11storiesOf('Test')12 .add('test', () => <div>Test</div>)

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybook = require('storybook-root');2storybook.startStorybookServer();3const storybook = require('@storybook/react/standalone');4const path = require('path');5const storybookStart = () => {6 const configDir = path.resolve(__dirname, '../.storybook');7 const staticDir = [path.resolve(__dirname, '../public')];8 const port = 9001;9 const host = 'localhost';10 storybook({11 });12};13module.exports = {14};15"dependencies": {16 },17 "devDependencies": {18 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybook = require('storybook-root');2const path = require('path');3const storybookRoot = storybook.getRoot();4const storybookConfig = storybook.getConfig();5const storybookStories = storybook.getStories();6const storybookAddons = storybook.getAddons();7const storybookWebpackConfig = storybook.getWebpackConfig();8const storybookPreview = storybook.getPreview();9const storybookPreviewHead = storybook.getPreviewHead();10const storybookPreviewBody = storybook.getPreviewBody();11const storybookManagerHead = storybook.getManagerHead();12const storybookManagerBody = storybook.getManagerBody();13const storybookManagerWebpackConfig = storybook.getManagerWebpackConfig();14const storybookManagerEntries = storybook.getManagerEntries();15const storybookManagerBabel = storybook.getManagerBabel();16const storybookManagerBabelConfig = storybook.getManagerBabelConfig();17const storybookManagerBabelPlugins = storybook.getManagerBabelPlugins();18const storybookManagerBabelPresets = storybook.getManagerBabelPresets();19const storybookManagerBabelEnv = storybook.getManagerBabelEnv();20const storybookManagerBabelEnvOptions = storybook.getManagerBabelEnvOptions();21const storybookManagerBabelEnvOptionsTargets = storybook.getManagerBabelEnvOptionsTargets();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful