hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
qsc_code_num_words_quality_signal
int64
qsc_code_num_chars_quality_signal
float64
qsc_code_mean_word_length_quality_signal
float64
qsc_code_frac_words_unique_quality_signal
float64
qsc_code_frac_chars_top_2grams_quality_signal
float64
qsc_code_frac_chars_top_3grams_quality_signal
float64
qsc_code_frac_chars_top_4grams_quality_signal
float64
qsc_code_frac_chars_dupe_5grams_quality_signal
float64
qsc_code_frac_chars_dupe_6grams_quality_signal
float64
qsc_code_frac_chars_dupe_7grams_quality_signal
float64
qsc_code_frac_chars_dupe_8grams_quality_signal
float64
qsc_code_frac_chars_dupe_9grams_quality_signal
float64
qsc_code_frac_chars_dupe_10grams_quality_signal
float64
qsc_code_frac_chars_replacement_symbols_quality_signal
float64
qsc_code_frac_chars_digital_quality_signal
float64
qsc_code_frac_chars_whitespace_quality_signal
float64
qsc_code_size_file_byte_quality_signal
float64
qsc_code_num_lines_quality_signal
float64
qsc_code_num_chars_line_max_quality_signal
float64
qsc_code_num_chars_line_mean_quality_signal
float64
qsc_code_frac_chars_alphabet_quality_signal
float64
qsc_code_frac_chars_comments_quality_signal
float64
qsc_code_cate_xml_start_quality_signal
float64
qsc_code_frac_lines_dupe_lines_quality_signal
float64
qsc_code_cate_autogen_quality_signal
float64
qsc_code_frac_lines_long_string_quality_signal
float64
qsc_code_frac_chars_string_length_quality_signal
float64
qsc_code_frac_chars_long_word_length_quality_signal
float64
qsc_code_frac_lines_string_concat_quality_signal
float64
qsc_code_cate_encoded_data_quality_signal
float64
qsc_code_frac_chars_hex_words_quality_signal
float64
qsc_code_frac_lines_prompt_comments_quality_signal
float64
qsc_code_frac_lines_assert_quality_signal
float64
qsc_codepython_cate_ast_quality_signal
float64
qsc_codepython_frac_lines_func_ratio_quality_signal
float64
qsc_codepython_cate_var_zero_quality_signal
bool
qsc_codepython_frac_lines_pass_quality_signal
float64
qsc_codepython_frac_lines_import_quality_signal
float64
qsc_codepython_frac_lines_simplefunc_quality_signal
float64
qsc_codepython_score_lines_no_logic_quality_signal
float64
qsc_codepython_frac_lines_print_quality_signal
float64
qsc_code_num_words
int64
qsc_code_num_chars
int64
qsc_code_mean_word_length
int64
qsc_code_frac_words_unique
null
qsc_code_frac_chars_top_2grams
int64
qsc_code_frac_chars_top_3grams
int64
qsc_code_frac_chars_top_4grams
int64
qsc_code_frac_chars_dupe_5grams
int64
qsc_code_frac_chars_dupe_6grams
int64
qsc_code_frac_chars_dupe_7grams
int64
qsc_code_frac_chars_dupe_8grams
int64
qsc_code_frac_chars_dupe_9grams
int64
qsc_code_frac_chars_dupe_10grams
int64
qsc_code_frac_chars_replacement_symbols
int64
qsc_code_frac_chars_digital
int64
qsc_code_frac_chars_whitespace
int64
qsc_code_size_file_byte
int64
qsc_code_num_lines
int64
qsc_code_num_chars_line_max
int64
qsc_code_num_chars_line_mean
int64
qsc_code_frac_chars_alphabet
int64
qsc_code_frac_chars_comments
int64
qsc_code_cate_xml_start
int64
qsc_code_frac_lines_dupe_lines
int64
qsc_code_cate_autogen
int64
qsc_code_frac_lines_long_string
int64
qsc_code_frac_chars_string_length
int64
qsc_code_frac_chars_long_word_length
int64
qsc_code_frac_lines_string_concat
null
qsc_code_cate_encoded_data
int64
qsc_code_frac_chars_hex_words
int64
qsc_code_frac_lines_prompt_comments
int64
qsc_code_frac_lines_assert
int64
qsc_codepython_cate_ast
int64
qsc_codepython_frac_lines_func_ratio
int64
qsc_codepython_cate_var_zero
int64
qsc_codepython_frac_lines_pass
int64
qsc_codepython_frac_lines_import
int64
qsc_codepython_frac_lines_simplefunc
int64
qsc_codepython_score_lines_no_logic
int64
qsc_codepython_frac_lines_print
int64
effective
string
hits
int64
c0ad3883b24e4ff51c1c1050712c8fc339d25b50
100
py
Python
classes/BaseScaner.py
Alex014/CryptoContainer
22e9b88a3e289b3d75e0102495b6f0e9e09bca0c
[ "MIT" ]
2
2020-09-16T10:37:38.000Z
2021-09-07T10:56:32.000Z
classes/BaseScaner.py
Alex014/CryptoContainer
22e9b88a3e289b3d75e0102495b6f0e9e09bca0c
[ "MIT" ]
null
null
null
classes/BaseScaner.py
Alex014/CryptoContainer
22e9b88a3e289b3d75e0102495b6f0e9e09bca0c
[ "MIT" ]
1
2020-11-25T02:06:51.000Z
2020-11-25T02:06:51.000Z
import abc class BaseScaner: @abc.abstractmethod def scan(self, data: str): pass
11.111111
30
0.63
12
100
5.25
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.29
100
8
31
12.5
0.887324
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0.2
0.2
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
c0ff52accd97dfce04de3069fec3f9b14a913a6f
86
py
Python
vsutillib/vsutillib-log/vsutillib/log/__init__.py
akai10tsuki/vsutillib
6d623171cc2a5c66a94fb508bfc312abeab49ff2
[ "MIT" ]
null
null
null
vsutillib/vsutillib-log/vsutillib/log/__init__.py
akai10tsuki/vsutillib
6d623171cc2a5c66a94fb508bfc312abeab49ff2
[ "MIT" ]
null
null
null
vsutillib/vsutillib-log/vsutillib/log/__init__.py
akai10tsuki/vsutillib
6d623171cc2a5c66a94fb508bfc312abeab49ff2
[ "MIT" ]
null
null
null
""" logging related functions/classes """ from .classes import LogRotateFileHandler
12.285714
41
0.77907
8
86
8.375
0.875
0
0
0
0
0
0
0
0
0
0
0
0.127907
86
6
42
14.333333
0.893333
0.383721
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
23a02ca8757fa6c6a6fdb0ce131c79cad7eae1d2
177
py
Python
flexinfer/preprocess/__init__.py
rriyaldhi/flexinfer
523b9bf49226001c0477a3635ffe9071387ae788
[ "Apache-2.0" ]
81
2020-06-17T07:46:19.000Z
2022-03-29T23:29:33.000Z
flexinfer/preprocess/__init__.py
rriyaldhi/flexinfer
523b9bf49226001c0477a3635ffe9071387ae788
[ "Apache-2.0" ]
1
2020-07-02T08:14:49.000Z
2020-07-20T11:34:30.000Z
flexinfer/preprocess/__init__.py
rriyaldhi/flexinfer
523b9bf49226001c0477a3635ffe9071387ae788
[ "Apache-2.0" ]
20
2020-06-29T01:30:44.000Z
2022-03-23T09:47:41.000Z
from .transforms import Resize, PadIfNeeded, Normalize from .formating import ToFloat, ImageToTensor, Collect from .compose import Compose from .builder import build_preprocess
35.4
54
0.841808
21
177
7.047619
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.112994
177
4
55
44.25
0.942675
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
23b0555a45221e5187b6c7ba5690c7ab8fcf5486
274
py
Python
classes/exceptions.py
davidetacchini/overcord
87022afed8bf72cf3e0c4914c1c2f0b067654f9e
[ "MIT" ]
10
2019-06-07T00:54:55.000Z
2020-10-09T04:16:23.000Z
classes/exceptions.py
davidetacchini/overcord
87022afed8bf72cf3e0c4914c1c2f0b067654f9e
[ "MIT" ]
5
2019-09-16T23:40:48.000Z
2020-03-16T20:03:49.000Z
classes/exceptions.py
davidetacchini/overcord
87022afed8bf72cf3e0c4914c1c2f0b067654f9e
[ "MIT" ]
2
2020-09-17T21:31:37.000Z
2020-10-08T21:27:51.000Z
class NoChoice(Exception): def __init__(self): super().__init__("Took too long.") class PaginationError(Exception): pass class CannotEmbedLinks(PaginationError): def __init__(self): super().__init__("Bot cannot embed links in this channel.")
21.076923
67
0.693431
30
274
5.8
0.666667
0.08046
0.126437
0.183908
0.229885
0
0
0
0
0
0
0
0.193431
274
12
68
22.833333
0.78733
0
0
0.25
0
0
0.193431
0
0
0
0
0
0
1
0.25
false
0.125
0
0
0.625
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
23dc64a275184b89b2482bda0616b026d8c221be
604
py
Python
FetchPublicBlacklists/__init__.py
reactive-firewall/FetchPublicBlacklists
70050ab53882ec2b4a35ca87a15703c0106c95cd
[ "Apache-2.0" ]
null
null
null
FetchPublicBlacklists/__init__.py
reactive-firewall/FetchPublicBlacklists
70050ab53882ec2b4a35ca87a15703c0106c95cd
[ "Apache-2.0" ]
6
2018-05-30T05:58:31.000Z
2018-05-30T06:52:06.000Z
FetchPublicBlacklists/__init__.py
reactive-firewall/FetchPublicBlacklists
70050ab53882ec2b4a35ca87a15703c0106c95cd
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) try: from . import helpers except Exception: import helpers try: from . import FetchPublicBlacklists except Exception: import FetchPublicBlacklists try: if FetchPublicBlacklists.__name__ is None: raise ImportError(str("Failed to import FetchPublicBlacklists")) if helpers.__name__ is None: raise ImportError(str("Failed to import helpers")) except Exception: raise ImportError(str("Failed to import FetchPublicBlacklists"))
21.571429
82
0.720199
71
604
5.957746
0.394366
0.255319
0.134752
0.177305
0.380615
0.380615
0.380615
0.20331
0.20331
0
0
0.004032
0.178808
604
27
83
22.37037
0.84879
0.034768
0
0.444444
0
0
0.175862
0.072414
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
23e3ba82bb944fd096c99d9a87f9c5bcca16fccb
176
py
Python
backend/telegram/apps.py
appheap/social-media-analyzer
0f9da098bfb0b4f9eb38e0244aa3a168cf97d51c
[ "Apache-2.0" ]
5
2021-09-11T22:01:15.000Z
2022-03-16T21:33:42.000Z
backend/telegram/apps.py
iamatlasss/social-media-analyzer
429d1d2bbd8bfce80c50c5f8edda58f87ace668d
[ "Apache-2.0" ]
null
null
null
backend/telegram/apps.py
iamatlasss/social-media-analyzer
429d1d2bbd8bfce80c50c5f8edda58f87ace668d
[ "Apache-2.0" ]
3
2022-01-18T11:06:22.000Z
2022-02-26T13:39:28.000Z
from django.apps import AppConfig class TelegramConfig(AppConfig): name = 'telegram' def ready(self): import telegram.signals as signals _ = signals
17.6
42
0.676136
19
176
6.210526
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.255682
176
9
43
19.555556
0.900763
0
0
0
0
0
0.045455
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
9b09ee4b1fad41283a499b98cb7cb8a2faae13c4
183
py
Python
aflux_assurance_client/scheduler/engines.py
AfluxSystems/aflux-assurance-client
b5983671936736a92426753c7627a6160265ee41
[ "0BSD" ]
null
null
null
aflux_assurance_client/scheduler/engines.py
AfluxSystems/aflux-assurance-client
b5983671936736a92426753c7627a6160265ee41
[ "0BSD" ]
null
null
null
aflux_assurance_client/scheduler/engines.py
AfluxSystems/aflux-assurance-client
b5983671936736a92426753c7627a6160265ee41
[ "0BSD" ]
null
null
null
import logging from apscheduler.schedulers.blocking import BlockingScheduler logger = logging.getLogger(__name__.split('.')[0]) blocking_scheduler = BlockingScheduler(logger=logger)
30.5
61
0.830601
19
183
7.736842
0.684211
0.312925
0
0
0
0
0
0
0
0
0
0.005882
0.071038
183
6
62
30.5
0.858824
0
0
0
0
0
0.005435
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
9b15b029e217b12ee735e6a709833c22446578b4
82
py
Python
image/initialize_app.py
DrunkenCub/intro2pyimage
2cd3f12e39571c8a6ea5403eeac4a3f458bf4f45
[ "MIT" ]
null
null
null
image/initialize_app.py
DrunkenCub/intro2pyimage
2cd3f12e39571c8a6ea5403eeac4a3f458bf4f45
[ "MIT" ]
null
null
null
image/initialize_app.py
DrunkenCub/intro2pyimage
2cd3f12e39571c8a6ea5403eeac4a3f458bf4f45
[ "MIT" ]
null
null
null
from imageapp import imageapp as application application.run(debug=True,port=8080)
41
44
0.853659
12
82
5.833333
0.833333
0
0
0
0
0
0
0
0
0
0
0.052632
0.073171
82
2
45
41
0.868421
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
f198011340b96355a702db004a092fc692e1bda0
119
py
Python
BasicExerciseAndKnowledge/w3cschool/n95.py
Jonathan1214/learn-python
19d0299b30e953069f19402bff5c464c4d5580be
[ "MIT" ]
null
null
null
BasicExerciseAndKnowledge/w3cschool/n95.py
Jonathan1214/learn-python
19d0299b30e953069f19402bff5c464c4d5580be
[ "MIT" ]
null
null
null
BasicExerciseAndKnowledge/w3cschool/n95.py
Jonathan1214/learn-python
19d0299b30e953069f19402bff5c464c4d5580be
[ "MIT" ]
null
null
null
#coding:utf-8 # 题目:字符串日期转换为易读的日期格式 # from dateutil import parser # dt = parser.parse("Aug 28 2015 12:00AM") # print dt
19.833333
42
0.722689
19
119
4.526316
0.894737
0
0
0
0
0
0
0
0
0
0
0.108911
0.151261
119
6
43
19.833333
0.742574
0.915966
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
f1987566920edd14f29173c3ae474e48e1d38a7e
49
py
Python
zone2021/f/main.py
KeiNishikawa218/atcoder
0af5e091f8b1fd64d5ca7b46b06b9356eacfe601
[ "MIT" ]
null
null
null
zone2021/f/main.py
KeiNishikawa218/atcoder
0af5e091f8b1fd64d5ca7b46b06b9356eacfe601
[ "MIT" ]
null
null
null
zone2021/f/main.py
KeiNishikawa218/atcoder
0af5e091f8b1fd64d5ca7b46b06b9356eacfe601
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 def main(): main()
7
22
0.55102
7
49
3.857143
0.857143
0
0
0
0
0
0
0
0
0
0
0.027027
0.244898
49
7
23
7
0.702703
0.428571
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
f1a7a16e1db0d8fb81f038e146bc2c011609d01b
77
py
Python
app/tests/test.py
PyElite/mynotes
589db76aeb35f11f4b392368a860b958f922e284
[ "Apache-2.0" ]
null
null
null
app/tests/test.py
PyElite/mynotes
589db76aeb35f11f4b392368a860b958f922e284
[ "Apache-2.0" ]
null
null
null
app/tests/test.py
PyElite/mynotes
589db76aeb35f11f4b392368a860b958f922e284
[ "Apache-2.0" ]
null
null
null
# -*- coding:utf-8 -*- # @Time : 19-7-4 下午7:48 # @Author : zhangshanling
19.25
26
0.545455
11
77
3.818182
1
0
0
0
0
0
0
0
0
0
0
0.133333
0.220779
77
3
27
25.666667
0.566667
0.909091
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
f1cb0455b88c29fbbeadedd64758f3da323babd7
145
py
Python
scripts/github-rate-limit.py
bstriner/github-bot
4b77e882602bdba35182043b3cb9f30e828dd0e3
[ "MIT" ]
10
2017-09-28T16:22:49.000Z
2021-09-23T13:37:57.000Z
scripts/github-rate-limit.py
bstriner/github-bot
4b77e882602bdba35182043b3cb9f30e828dd0e3
[ "MIT" ]
7
2017-03-30T22:37:46.000Z
2020-01-24T21:37:35.000Z
scripts/github-rate-limit.py
bstriner/github-bot
4b77e882602bdba35182043b3cb9f30e828dd0e3
[ "MIT" ]
5
2017-06-12T07:41:32.000Z
2021-06-24T17:13:03.000Z
#!/usr/bin/env python from github_bot_close_inactive_issues.rate_limit import main import sys if __name__ == "__main__": main(sys.argv[1:])
20.714286
60
0.758621
23
145
4.217391
0.826087
0
0
0
0
0
0
0
0
0
0
0.007874
0.124138
145
6
61
24.166667
0.755906
0.137931
0
0
0
0
0.064516
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
f1cd5606a015416b18fbd05b485569ca2584869e
99
py
Python
src/model/exception/no_emote_results.py
konrad2508/kokomi-discord-bot
5a9d459e92d552fa24ba3ada5188db19d93f0aaa
[ "MIT" ]
2
2022-03-02T15:56:41.000Z
2022-03-10T16:30:41.000Z
src/model/exception/no_emote_results.py
konrad2508/kokomi-discord-bot
5a9d459e92d552fa24ba3ada5188db19d93f0aaa
[ "MIT" ]
2
2022-03-10T16:30:20.000Z
2022-03-16T14:33:59.000Z
src/model/exception/no_emote_results.py
konrad2508/kokomi-discord-bot
5a9d459e92d552fa24ba3ada5188db19d93f0aaa
[ "MIT" ]
null
null
null
class NoEmoteResults(Exception): '''Exception stating that no emotes were found for a query'''
33
65
0.747475
13
99
5.692308
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.161616
99
2
66
49.5
0.891566
0.555556
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
7b226d29e181842bdad45f1110142fd41f28e57b
30
py
Python
scrapli_community/eltex/__init__.py
ikievite/scrapli_community
b160ae6c21177c949a0b8210810ba2584b31861f
[ "MIT" ]
37
2020-11-13T20:50:30.000Z
2022-03-25T16:15:28.000Z
scrapli_community/eltex/__init__.py
ikievite/scrapli_community
b160ae6c21177c949a0b8210810ba2584b31861f
[ "MIT" ]
84
2020-08-02T16:20:15.000Z
2022-03-02T14:38:26.000Z
scrapli_community/eltex/__init__.py
ikievite/scrapli_community
b160ae6c21177c949a0b8210810ba2584b31861f
[ "MIT" ]
25
2020-08-01T23:51:37.000Z
2022-02-21T10:06:33.000Z
"""scrapli_community.eltex"""
15
29
0.733333
3
30
7
1
0
0
0
0
0
0
0
0
0
0
0
0.033333
30
1
30
30
0.724138
0.766667
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
9e4873251910a6caeec7c37a6767f49062f0b9cf
92
py
Python
Code/tools/admin.py
praktianerJones/LSD
8ca07bfcf53347dc466be0cae260387c90f0c2ed
[ "BSD-3-Clause" ]
2
2021-12-15T21:58:43.000Z
2021-12-15T22:17:26.000Z
Code/tools/admin.py
praktianerJones/LSD
8ca07bfcf53347dc466be0cae260387c90f0c2ed
[ "BSD-3-Clause" ]
null
null
null
Code/tools/admin.py
praktianerJones/LSD
8ca07bfcf53347dc466be0cae260387c90f0c2ed
[ "BSD-3-Clause" ]
1
2021-12-19T17:02:02.000Z
2021-12-19T17:02:02.000Z
from django.contrib import admin from tools.models import Tool admin.site.register(Tool)
13.142857
32
0.804348
14
92
5.285714
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.130435
92
6
33
15.333333
0.925
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
9e4dbeb9b97d0317fb72d84d08399b7120229707
126
py
Python
terrascript/data/camptocamp/jwt.py
mjuenema/python-terrascript
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
[ "BSD-2-Clause" ]
507
2017-07-26T02:58:38.000Z
2022-01-21T12:35:13.000Z
terrascript/data/camptocamp/jwt.py
mjuenema/python-terrascript
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
[ "BSD-2-Clause" ]
135
2017-07-20T12:01:59.000Z
2021-10-04T22:25:40.000Z
terrascript/data/camptocamp/jwt.py
mjuenema/python-terrascript
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
[ "BSD-2-Clause" ]
81
2018-02-20T17:55:28.000Z
2022-01-31T07:08:40.000Z
# terrascript/data/camptocamp/jwt.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:19:50 UTC) __all__ = []
21
73
0.746032
19
126
4.736842
0.947368
0
0
0
0
0
0
0
0
0
0
0.108108
0.119048
126
5
74
25.2
0.702703
0.84127
0
0
1
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
9e8de0d61bc3a7f7a0438557a8e4d92dc34e1fef
215
py
Python
python/const.py
STomoya/DLSite_analysis
b57917bf6510fced2b3fa7c0feb2b1eaf52447f3
[ "MIT" ]
null
null
null
python/const.py
STomoya/DLSite_analysis
b57917bf6510fced2b3fa7c0feb2b1eaf52447f3
[ "MIT" ]
null
null
null
python/const.py
STomoya/DLSite_analysis
b57917bf6510fced2b3fa7c0feb2b1eaf52447f3
[ "MIT" ]
null
null
null
BASE_URL = 'https://www.dlsite.com/maniax/fsr/=/language/jp/sex_category%5B0%5D/male/ana_flg/off/work_category%5B0%5D/doujin/order%5B0%5D/release_d/genre_and_or/or/options_and_or/or/per_page/100/show_type/1/page/'
71.666667
213
0.804651
43
215
3.767442
0.767442
0.092593
0.160494
0
0
0
0
0
0
0
0
0.061611
0.018605
215
2
214
107.5
0.706161
0
0
0
0
1
0.934579
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
9e9ff814bf1199394d4aeebff9a51b1443230c79
439
py
Python
package_name/module.py
EmilRamsvik/DataPlot
eead77dd20197952f26e13abcd4288b05abf4dba
[ "MIT" ]
null
null
null
package_name/module.py
EmilRamsvik/DataPlot
eead77dd20197952f26e13abcd4288b05abf4dba
[ "MIT" ]
1
2021-10-03T16:00:30.000Z
2021-10-03T16:01:51.000Z
package_name/module.py
EmilRamsvik/DataPlot
eead77dd20197952f26e13abcd4288b05abf4dba
[ "MIT" ]
null
null
null
""" Module provides a simple cubic_rectification function. """ import numpy as np import pandas as pd # plotting tools import plotly import plotly.express as px # import matplotlib.pyplot as plt import plotly.figure_factory as ff import plotly.graph_objects as go class Layout: def __init__(self): pass def patriotic(self): go.Layout() class dataplot: def __init__(self, df: pd.DataFrame): pass
15.678571
54
0.710706
61
439
4.934426
0.606557
0.159468
0.07309
0
0
0
0
0
0
0
0
0
0.220957
439
27
55
16.259259
0.880117
0.232346
0
0.142857
0
0
0
0
0
0
0
0
0
1
0.214286
false
0.142857
0.428571
0
0.785714
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
1
0
1
0
0
4
7b3ba4949d0f9047c081db395744009b60a60e75
79
py
Python
hw5/meta/dummy.py
lianglizxc/RLhomework
ff3de39af68f2ab5e0521ee491fe0ab95f756196
[ "MIT" ]
null
null
null
hw5/meta/dummy.py
lianglizxc/RLhomework
ff3de39af68f2ab5e0521ee491fe0ab95f756196
[ "MIT" ]
null
null
null
hw5/meta/dummy.py
lianglizxc/RLhomework
ff3de39af68f2ab5e0521ee491fe0ab95f756196
[ "MIT" ]
null
null
null
import numpy as np def dummy(): return 2, 3 x = dummy() print(x[:-1][0])
9.875
18
0.56962
15
79
3
0.866667
0
0
0
0
0
0
0
0
0
0
0.066667
0.240506
79
8
19
9.875
0.683333
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.6
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
7b64ad3dde83e64e4815ee69e84f4d34b46d7333
305
py
Python
python14/myapps/admin.py
RobertLuo1/College_Recommendation_System
f452479f9f84261aac9ac6d43171bcaf93d2d157
[ "Apache-2.0" ]
null
null
null
python14/myapps/admin.py
RobertLuo1/College_Recommendation_System
f452479f9f84261aac9ac6d43171bcaf93d2d157
[ "Apache-2.0" ]
null
null
null
python14/myapps/admin.py
RobertLuo1/College_Recommendation_System
f452479f9f84261aac9ac6d43171bcaf93d2d157
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from .import models # Register your models here. admin.site.register(models.Colleges) admin.site.register(models.Provinces) admin.site.register(models.Majors) admin.site.register(models.Category) admin.site.register(models.Firstlevel) admin.site.register(models.Rankings)
30.5
38
0.829508
42
305
6.02381
0.380952
0.213439
0.403162
0.545455
0
0
0
0
0
0
0
0
0.059016
305
10
39
30.5
0.881533
0.085246
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
7b6954ba1935040b792257d13948005696dbf980
198
py
Python
bot/bot/states.py
Doctorinna/telegram-bot
1fa07fd42173f5e8aad3c99d3fa6720286b9b7dd
[ "MIT" ]
13
2021-09-13T06:16:34.000Z
2021-09-24T21:13:52.000Z
bot/bot/states.py
Doctorinna/telegram-bot
1fa07fd42173f5e8aad3c99d3fa6720286b9b7dd
[ "MIT" ]
2
2021-09-28T22:48:49.000Z
2021-10-11T03:24:33.000Z
bot/bot/states.py
Doctorinna/telegram-bot
1fa07fd42173f5e8aad3c99d3fa6720286b9b7dd
[ "MIT" ]
null
null
null
from aiogram.dispatcher.filters.state import State, StatesGroup class QuestionnaireStates(StatesGroup): options_question = State() range_question = State() combined_question = State()
24.75
63
0.767677
20
198
7.45
0.65
0.261745
0
0
0
0
0
0
0
0
0
0
0.151515
198
7
64
28.285714
0.886905
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.2
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
7b6ba4d3de0de4d0e41b0c6e54a18d10c27e0501
375
py
Python
forty/reducers/get_total_remained_time.py
vikian050194/forty
7ef68fb06bb22a3008351c5a651eaa46b635d433
[ "MIT" ]
null
null
null
forty/reducers/get_total_remained_time.py
vikian050194/forty
7ef68fb06bb22a3008351c5a651eaa46b635d433
[ "MIT" ]
7
2021-03-15T17:18:36.000Z
2021-04-26T09:40:53.000Z
forty/reducers/get_total_remained_time.py
vikian050194/forty
7ef68fb06bb22a3008351c5a651eaa46b635d433
[ "MIT" ]
null
null
null
from ..common import State from ..managers.project_manager import Config from . import get_total_passed_time def get_total_remained_time(actions, config: Config): total_passed_time = get_total_passed_time(actions, config) value = config.total_limit * 3600 - total_passed_time.value state = State(value) return state __all__ = ["get_total_remained_time"]
25
63
0.776
52
375
5.173077
0.384615
0.118959
0.223048
0.133829
0
0
0
0
0
0
0
0.012539
0.149333
375
14
64
26.785714
0.830721
0
0
0
0
0
0.061333
0.061333
0
0
0
0
0
1
0.111111
false
0.333333
0.333333
0
0.555556
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
4
7b7f003250ee0fc671476a60c78627945c684783
2,551
py
Python
typings/bl_ui/space_spreadsheet.py
Argmaster/PyR3
6786bcb6a101fe4bd4cc50fe43767b8178504b15
[ "MIT" ]
2
2021-12-12T18:51:52.000Z
2022-02-23T09:49:16.000Z
typings/bl_ui/space_spreadsheet.py
Argmaster/PyR3
6786bcb6a101fe4bd4cc50fe43767b8178504b15
[ "MIT" ]
2
2021-11-08T12:09:02.000Z
2021-12-12T23:01:12.000Z
typings/bl_ui/space_spreadsheet.py
Argmaster/PyR3
6786bcb6a101fe4bd4cc50fe43767b8178504b15
[ "MIT" ]
null
null
null
import sys import typing import bpy_types class SPREADSHEET_HT_header(bpy_types.Header, bpy_types._GenericUI): bl_rna = None ''' ''' bl_space_type = None ''' ''' id_data = None ''' ''' def append(self, draw_func): ''' ''' pass def as_pointer(self): ''' ''' pass def bl_rna_get_subclass(self): ''' ''' pass def bl_rna_get_subclass_py(self): ''' ''' pass def draw(self, context): ''' ''' pass def draw_collapsed_context_path(self, context, layout, context_path): ''' ''' pass def draw_full_context_path(self, context, layout, context_path): ''' ''' pass def draw_spreadsheet_context(self, layout, ctx): ''' ''' pass def draw_spreadsheet_context_path_icon(self, layout, space, icon): ''' ''' pass def draw_without_context_path(self, layout): ''' ''' pass def driver_add(self): ''' ''' pass def driver_remove(self): ''' ''' pass def get(self): ''' ''' pass def is_extended(self): ''' ''' pass def is_property_hidden(self): ''' ''' pass def is_property_overridable_library(self): ''' ''' pass def is_property_readonly(self): ''' ''' pass def is_property_set(self): ''' ''' pass def items(self): ''' ''' pass def keyframe_delete(self): ''' ''' pass def keyframe_insert(self): ''' ''' pass def keys(self): ''' ''' pass def path_from_id(self): ''' ''' pass def path_resolve(self): ''' ''' pass def pop(self): ''' ''' pass def prepend(self, draw_func): ''' ''' pass def property_overridable_library_set(self): ''' ''' pass def property_unset(self): ''' ''' pass def remove(self, draw_func): ''' ''' pass def type_recast(self): ''' ''' pass def values(self): ''' ''' pass
12.691542
73
0.409643
217
2,551
4.539171
0.271889
0.213198
0.234518
0.06599
0.347208
0.156345
0.156345
0.101523
0.101523
0.101523
0
0
0.464132
2,551
200
74
12.755
0.720556
0
0
0.449275
0
0
0
0
0
0
0
0
0
1
0.449275
false
0.449275
0.043478
0
0.550725
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
4
7b87a6f15c9ffaaa075dcd8e8c57f7c2070fa57f
834
py
Python
utils.py
mheden/adventofcode2020
17440bb4dff6abf771b594f488e0c9e7ff363d1b
[ "MIT" ]
null
null
null
utils.py
mheden/adventofcode2020
17440bb4dff6abf771b594f488e0c9e7ff363d1b
[ "MIT" ]
null
null
null
utils.py
mheden/adventofcode2020
17440bb4dff6abf771b594f488e0c9e7ff363d1b
[ "MIT" ]
null
null
null
from collections import namedtuple BIGNUM = 10 ** 100 Point2d = namedtuple("Point2d", ["x", "y"]) Point3d = namedtuple("Point3d", ["x", "y", "z"]) def manhattan_distance(p0, p1): return sum(abs(a - b) for a, b in zip(p0, p1)) def read_file(filename): with open(filename) as f: lines = f.read().splitlines() return lines def read_file_int(filename): return list(map(int, read_file(filename))) def read_file_groups(filename): with open(filename) as f: groups = [] for group in f.read().strip().split("\n\n"): groups.append(group.split("\n")) return groups def xor(a, b): return bool(a) ^ bool(b) # TODO: # - Grid # # Reminders: # - collections.Counter # - collections.defaultdict # - collections.deque # - itertools
19.395349
53
0.593525
108
834
4.518519
0.481481
0.065574
0.067623
0.098361
0.110656
0.110656
0
0
0
0
0
0.0209
0.254197
834
42
54
19.857143
0.763666
0.123501
0
0.1
0
0
0.036765
0
0
0
0
0.02381
0
1
0.25
false
0
0.05
0.15
0.55
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
4
7bc4474bc09d66cede25183dc2159abe4db6f3ea
229
py
Python
core/serializers.py
SejaMuchhal/GeoPy
af382cfeed263f78f3227d24680dc9e4f7083ba5
[ "MIT" ]
null
null
null
core/serializers.py
SejaMuchhal/GeoPy
af382cfeed263f78f3227d24680dc9e4f7083ba5
[ "MIT" ]
null
null
null
core/serializers.py
SejaMuchhal/GeoPy
af382cfeed263f78f3227d24680dc9e4f7083ba5
[ "MIT" ]
null
null
null
from rest_framework import serializers class AddressSerializer(serializers.Serializer): address = serializers.CharField( required=True ) output_format = serializers.CharField( required=True )
22.9
48
0.707424
20
229
8
0.7
0.25
0.35
0.4
0
0
0
0
0
0
0
0
0.231441
229
10
49
22.9
0.909091
0
0
0.25
0
0
0
0
0
0
0
0
0
1
0
false
0
0.125
0
0.5
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
7bc49fe0b25a944a23903c75c52ff9bb540692a1
93
py
Python
System/Actors/__init__.py
vinaychetnani/Q-Learning-for-Non-Competitive-Bridge-Bidding
70ebe70c8522449759a4a5c4235c168104fff0d8
[ "BSD-2-Clause" ]
4
2019-10-24T06:37:51.000Z
2021-08-16T20:24:57.000Z
System/Actors/__init__.py
vinaychetnani/Q-Learning-for-Non-Competitive-Bridge-Bidding
70ebe70c8522449759a4a5c4235c168104fff0d8
[ "BSD-2-Clause" ]
null
null
null
System/Actors/__init__.py
vinaychetnani/Q-Learning-for-Non-Competitive-Bridge-Bidding
70ebe70c8522449759a4a5c4235c168104fff0d8
[ "BSD-2-Clause" ]
null
null
null
from Agent import Agent from Bandit import EpsilonBandit from DataManager import DataManager
23.25
35
0.870968
12
93
6.75
0.5
0
0
0
0
0
0
0
0
0
0
0
0.129032
93
3
36
31
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
c8ae62a55811c724439b017d883e9c1279703407
269
py
Python
serialization/serializer.py
Schille/weimar-graphstore
76b47f98fba419ec6290628b56a202c60d8f2d46
[ "MIT" ]
2
2016-08-27T04:51:01.000Z
2020-09-05T01:34:41.000Z
serialization/serializer.py
Schille/weimar-graphstore
76b47f98fba419ec6290628b56a202c60d8f2d46
[ "MIT" ]
null
null
null
serialization/serializer.py
Schille/weimar-graphstore
76b47f98fba419ec6290628b56a202c60d8f2d46
[ "MIT" ]
null
null
null
""" .. module:: serializer.py :platform: Linux .. moduleauthor:: Michael Schilonka <michael@schilonka.de> """ import cPickle def serialize(value): return cPickle.dumps(value, cPickle.HIGHEST_PROTOCOL) def deserialize(value): return cPickle.loads(value)
16.8125
58
0.724907
30
269
6.466667
0.666667
0.164948
0.185567
0
0
0
0
0
0
0
0
0
0.144981
269
16
59
16.8125
0.843478
0.390335
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0.2
0.4
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
c8c854200bd85a3091b7596985e16891339f5c36
160
py
Python
src/assoluto/admin.py
bylajs/mariom
2cf0c15aaaf0f500d4201985cbc6a991a1b25525
[ "MIT" ]
null
null
null
src/assoluto/admin.py
bylajs/mariom
2cf0c15aaaf0f500d4201985cbc6a991a1b25525
[ "MIT" ]
null
null
null
src/assoluto/admin.py
bylajs/mariom
2cf0c15aaaf0f500d4201985cbc6a991a1b25525
[ "MIT" ]
null
null
null
from django.contrib import admin # Register your models here. from .models import Contratti from .forms import LuceForm admin.site.register(Contratti)
14.545455
32
0.775
21
160
5.904762
0.619048
0
0
0
0
0
0
0
0
0
0
0
0.16875
160
10
33
16
0.932331
0.1625
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.75
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
c8ea883165141e46ee0eb5a6e75545f642dfeb79
101
py
Python
speech_to_text/apps.py
zace3d/video_analysis
9001486ae64160ca497f6b9a99df5d9a5c5422cc
[ "Apache-2.0" ]
null
null
null
speech_to_text/apps.py
zace3d/video_analysis
9001486ae64160ca497f6b9a99df5d9a5c5422cc
[ "Apache-2.0" ]
9
2019-12-04T22:38:16.000Z
2021-06-10T17:51:32.000Z
speech_to_text/apps.py
zace3d/video_analysis
9001486ae64160ca497f6b9a99df5d9a5c5422cc
[ "Apache-2.0" ]
null
null
null
from django.apps import AppConfig class SpeechToTextConfig(AppConfig): name = 'speech_to_text'
16.833333
36
0.782178
12
101
6.416667
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.148515
101
5
37
20.2
0.895349
0
0
0
0
0
0.138614
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
74069500e06fc635201e92f24e083ec678980320
118
py
Python
ex047.py
arthurfas123/Curso-De-Python
c4a15d92811bd101a8562d2c3a90fe2d5a3c360d
[ "MIT" ]
null
null
null
ex047.py
arthurfas123/Curso-De-Python
c4a15d92811bd101a8562d2c3a90fe2d5a3c360d
[ "MIT" ]
null
null
null
ex047.py
arthurfas123/Curso-De-Python
c4a15d92811bd101a8562d2c3a90fe2d5a3c360d
[ "MIT" ]
null
null
null
print('Numeros pares!!!') print('=-=' * 15) for c in range(2, 52, 2): print(c) print('=-=' * 15) print('ACABOU.')
16.857143
25
0.533898
18
118
3.5
0.611111
0.222222
0
0
0
0
0
0
0
0
0
0.081633
0.169492
118
6
26
19.666667
0.561224
0
0
0.333333
0
0
0.245763
0
0
0
0
0
0
1
0
false
0
0
0
0
0.833333
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
cdade563191e0beda9b9794159dd6aae0ad15eed
20,055
py
Python
TravelBookingSys/TravelBooking/views/customer.py
ZiHao256/Project_TravelBooking
476b5b2bc45dc76dc5e515c213871cb8f0cbbe13
[ "MIT" ]
null
null
null
TravelBookingSys/TravelBooking/views/customer.py
ZiHao256/Project_TravelBooking
476b5b2bc45dc76dc5e515c213871cb8f0cbbe13
[ "MIT" ]
null
null
null
TravelBookingSys/TravelBooking/views/customer.py
ZiHao256/Project_TravelBooking
476b5b2bc45dc76dc5e515c213871cb8f0cbbe13
[ "MIT" ]
null
null
null
# Create your views here. import json from datetime import datetime from django.core import serializers from django.db.models import Q, F from django.forms.models import model_to_dict from django.http import JsonResponse, response from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_http_methods from TravelBooking.forms import * from TravelBooking.models import * def object_to_json(obj): return dict([(kk, obj.__dict__[kk]) for kk in obj.__dict__.keys() if kk != "_state"]) @csrf_exempt @require_http_methods(['GET']) def deposit(request): response = {} try: custID = request.session.get('custID') customer = CUSTOMERS.objects.get(custID=custID) print(request.GET.get('balance')) print(type(request.GET.get('balance'))) customer.balance += int(request.GET.get('balance')) customer.save() response['msg'] = '充值成功,余额为: '+str(customer.balance) response['error_num'] = 0 except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) # 预定FLIGHT, BUS, HOTEL @csrf_exempt @require_http_methods(['POST']) def reserve_flight(request): response = {} if not request.session.get('is_login', None): response['msg'] = 'you must login' response['error_num'] = 1 return JsonResponse(response) try: res_flight_form = RES_FLIGHT_Form(request.POST) if res_flight_form.is_valid(): custID = request.session.get('custID') flightNum = res_flight_form.cleaned_data['flightNum'] flight = FLIGHTS.objects.get(flightNum=flightNum) customer = CUSTOMERS.objects.get(custID=request.session.get('custID')) # 剩余座位是否足够 if flight.numAvail > 0: flight.numAvail -= 1 # 余额是否足够 if customer.balance - flight.price >= 0: customer.balance -= flight.price res_flight = RES_FLIGHT( custID=CUSTOMERS.objects.get(custID=custID), flightNum=FLIGHTS.objects.get(flightNum=flightNum), resStatus='已预约', buildTime=datetime.now() ) res_flight.save() flight.save() customer.save() res_key = res_flight.resvKey res_flightNum = res_flight.flightNum_id res_from = FLIGHTS.objects.get(flightNum=res_flightNum).FromCity_id res_to = FLIGHTS.objects.get(flightNum=res_flightNum).ArivCity_id response['msg'] = '预约 ' + str(res_key) + ' flight(' + str(res_flightNum) + ') from ' + str( res_from) + ' to ' + str(res_to) + ' 成功' response['error_num'] = 0 else: response['msg'] = '余额不足!' response['error_num'] = 1 else: response['msg'] = '座位已满!' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 0 JsonResponse(response) except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) @csrf_exempt @require_http_methods(['POST']) def reserve_hotel(request): response = {} if not request.session.get('is_login', None): response['msg'] = 'you must login' response['error_num'] = 1 return JsonResponse(response) try: res_hotel_form = RES_HOTEL_Form(request.POST) if res_hotel_form.is_valid(): custID = request.session['custID'] hotel_loc = res_hotel_form.cleaned_data['hotelLocation'] hotel = HOTELS.objects.get(location=hotel_loc) customer = CUSTOMERS.objects.get(custID=custID) # 剩余房间是否足够 if hotel.numAvail > 0: hotel.numAvail -= 1 # 余额是否足够 if customer.balance-hotel.price >0: customer.balance -= hotel.price res_hotel = RES_HOTEL( custID=CUSTOMERS.objects.get(custID=custID), hotelLocation=LOCATIONS.objects.get(location=hotel_loc), resStatus='已预约', buildTime=datetime.now() ) customer.save() hotel.save() res_hotel.save() response['msg'] = '预约 hotel 成功' response['error_num'] = 0 else: response['msg'] = '余额不足' response['error_num'] = 1 else: response['msg'] = '座位已满' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 1 JsonResponse(response) except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) @csrf_exempt @require_http_methods(['POST']) def reserve_bus(request): response = {} if not request.session.get('is_login', None): response['msg'] = 'you must login' response['error_num'] = 1 return JsonResponse(response) try: res_bus_form = RES_BUS_Form(request.POST) if res_bus_form.is_valid(): custID = request.session['custID'] bus_loc = res_bus_form.cleaned_data['busLocation'] bus = BUS.objects.get(location=bus_loc) customer = CUSTOMERS.objects.get(custID=custID) if bus.numAvail > 0: bus.numAvail -= 1 if customer.balance - bus.price > 0: customer.balance -= bus.price res_bus = RES_BUS( custID=CUSTOMERS.objects.get(custID=custID), busLocation=LOCATIONS.objects.get(location=bus_loc), resStatus='已预约', buildTime=datetime.now() ) bus.save() customer.save() res_bus.save() resKey = res_bus.resvKey res_loc = res_bus.busLocation_id response['msg'] = '预约 ' + str(resKey) + ' bus to ' + str(res_loc) + ' 成功' response['error_num'] = 0 else: response['msg'] = '余额不足' response['error_num'] = 1 else: response['msg'] = '座位已满' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 0 JsonResponse(response) except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) # 展示flight, hotel, bus订单 @require_http_methods(['GET']) def show_res_flight(request): response = {} print(request.session.get('custID')) try: if request.GET.get('resvKey') is not None: res_flight = RES_FLIGHT.objects.get(resvKey=request.GET.get('resvKey')) response['list'] = object_to_json(res_flight) else: res_flight = RES_FLIGHT.objects.filter(custID=request.session.get('custID')).order_by('-resvKey') listall = json.loads(serializers.serialize("json", res_flight)) total = int(len(listall)) pagesize = int(request.GET.get('pagesize')) pagenum = int(request.GET.get('pagenum')) # print(pagesize, pagenum) if pagesize > total: pagesize = total sort_ls = [listall[i:i + pagesize] for i in range(0, len(listall), pagesize)] response['list'] = sort_ls[pagenum - 1] response['total'] = total response['error_num'] = 0 response['msg'] = 'success' except Exception as e: if str(e) == 'range() arg 3 must not be zero': response['msg'] = 'success' response['error_num'] = 0 else: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) @require_http_methods(['GET']) def show_res_hotel(request): response = {} try: if request.GET.get('resvKey') is not None: res_flight = RES_FLIGHT.objects.get(resvKey=request.GET.get('resvKey')) response['list'] = object_to_json(res_flight) else: res_hotel = RES_HOTEL.objects.filter(custID=request.session.get('custID')).order_by('-resvKey') listall = json.loads(serializers.serialize("json", res_hotel)) total = int(len(listall)) pagesize = int(request.GET.get('pagesize')) pagenum = int(request.GET.get('pagenum')) # print(pagesize, pagenum) if pagesize > total: pagesize = total sort_ls = [listall[i:i + pagesize] for i in range(0, len(listall), pagesize)] response['list'] = sort_ls[pagenum - 1] response['total'] = total response['error_num'] = 0 response['msg'] = 'success' except Exception as e: if str(e) == 'range() arg 3 must not be zero': response['msg'] = 'success' response['error_num'] = 0 else: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) @require_http_methods(['GET']) def show_res_bus(request): response = {} try: if request.GET.get('resvKey') is not None: res_bus = RES_BUS.objects.get(resvKey=request.GET.get('resvKey')) response['list'] = object_to_json(res_bus) else: res_bus = RES_BUS.objects.filter(custID=request.session.get('custID')).order_by('-resvKey') listall = json.loads(serializers.serialize("json", res_bus)) total = int(len(listall)) pagesize = int(request.GET.get('pagesize')) pagenum = int(request.GET.get('pagenum')) # print(pagesize, pagenum) if pagesize > total: pagesize = total sort_ls = [listall[i:i + pagesize] for i in range(0, len(listall), pagesize)] response['list'] = sort_ls[pagenum - 1] response['total'] = total response['error_num'] = 0 response['msg'] = 'success' except Exception as e: if str(e) == 'range() arg 3 must not be zero': response['msg'] = 'success' response['error_num'] = 0 else: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) # 开始flight, hotel, bus订单 @csrf_exempt @require_http_methods(['POST']) def start_res_flight(request): response = {} print(request.POST) try: res_flight_form = RES_FLIGHT_Form(request.POST) response['msg'] = 'check' if res_flight_form.is_valid(): res_flight = RES_FLIGHT.objects.get(resvKey=res_flight_form.cleaned_data['resvKey']) if res_flight.resStatus == '已预约': res_flight.resStatus = '订单已开始' res_flight.startTime = datetime.now() res_flight.save() res_key = res_flight.resvKey res_flightNum = res_flight.flightNum_id res_from = FLIGHTS.objects.get(flightNum=res_flightNum).FromCity_id res_to = FLIGHTS.objects.get(flightNum=res_flightNum).ArivCity_id response['msg'] = '预约 ' + str(res_key) + ' flight(' + str(res_flightNum) + ') from ' + str( res_from) + ' to ' + str(res_to) + ' 开始' response['error_num'] = 0 else: response['msg'] == '当前订单不是已预约' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 1 except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) @csrf_exempt @require_http_methods(['POST']) def start_res_hotel(request): response = {} try: res_hotel_form = RES_HOTEL_Form(request.POST) response['msg'] = 'check' if res_hotel_form.is_valid(): res_hotel = RES_HOTEL.objects.get(resvKey=res_hotel_form.cleaned_data['resvKey']) if res_hotel.resStatus == '已预约': res_hotel.resStatus = '订单已开始' res_hotel.startTime = datetime.now() res_hotel.save() response['msg'] = 'res_hotel starts successfully' response['error_num'] = 0 else: response['msg'] = '该订单不是已预约' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 1 except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) @csrf_exempt @require_http_methods(['POST']) def start_res_bus(request): response = {} try: res_bus_form = RES_BUS_Form(request.POST) response['msg'] = 'check' if res_bus_form.is_valid(): res_bus = RES_BUS.objects.get(resvKey=res_bus_form.cleaned_data['resvKey']) if res_bus.resStatus == '已预约': res_bus.resStatus = '订单已开始' res_bus.startTime = datetime.now() res_bus.save() res_bus_resKey = res_bus.resvKey res_bus_loc = res_bus.busLocation_id response['msg'] = '预约 ' + str(res_bus_resKey) + ' bus to ' + str(res_bus_loc) + ' starts successfully' response['error_num'] = 0 else: response['msg'] = '该订单不是已预约' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 1 except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) # 结束flight, hotel, bus订单 @csrf_exempt @require_http_methods(['POST']) def end_res_flight(request): response = {} try: res_flight_form = RES_FLIGHT_Form(request.POST) if res_flight_form.is_valid(): res_flight = RES_FLIGHT.objects.get(resvKey=res_flight_form.cleaned_data['resvKey']) if res_flight.resStatus == '订单已开始': res_flight.endTime = datetime.now() res_flight.resStatus = '订单已完成' flight = FLIGHTS.objects.get(flightNum=res_flight.flightNum_id) flight.numAvail += 1 flight.save() res_flight.save() res_key = res_flight.resvKey res_flightNum = res_flight.flightNum_id res_from = FLIGHTS.objects.get(flightNum=res_flightNum).FromCity_id res_to = FLIGHTS.objects.get(flightNum=res_flightNum).ArivCity_id response['msg'] = '预约 ' + str(res_key) + ' flight(' + str(res_flightNum) + ') from ' + str( res_from) + ' to ' + str(res_to) + ' 完成' response['error_num'] = 0 else: response['msg'] = '当前订单不是已开始' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 1 except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) @csrf_exempt @require_http_methods(['POST']) def end_res_hotel(request): response = {} try: res_hotel_form = RES_HOTEL_Form(request.POST) if res_hotel_form.is_valid(): res_hotel = RES_HOTEL.objects.get(resvKey=res_hotel_form.cleaned_data['resvKey']) if res_hotel.resStatus == '订单已开始': res_hotel.endTime = datetime.now() res_hotel.resStatus = '订单已完成' hotel = HOTELS.objects.get(location=res_hotel.hotelLocation_id) hotel.numAvail += 1 hotel.save() res_hotel.save() resvKey = res_hotel.resvKey response['msg'] = 'res_hotel ' + str(resvKey) + ' ends successfully' response['error_num'] = 0 else: response['msg'] = '当前订单不是已开始' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 1 except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) @csrf_exempt @require_http_methods(['POST']) def end_res_bus(request): response = {} try: res_bus_form = RES_BUS_Form(request.POST) if res_bus_form.is_valid(): res_bus = RES_BUS.objects.get(resvKey=res_bus_form.cleaned_data['resvKey']) if res_bus.resStatus == '订单已开始': res_bus.endTime = datetime.now() res_bus.resStatus = '订单已完成' bus = BUS.objects.get(location=res_bus.busLocation_id) bus.numAvail += 1 bus.save() res_bus.save() resvKey = res_bus.resvKey resv_loc = res_bus.busLocation_id response['msg'] = '预定 ' + str(resvKey) + ' bus to ' + str(resv_loc) + ' ends successfully' response['error_num'] = 0 else: response['msg'] = '当前订单不是已开始' response['error_num'] = 1 else: response['msg'] = 'form is not valid' response['error_num'] = 1 except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response) # 旅游路线 @require_http_methods(['GET']) def show_lines(request): response = {} try: if request.session.get('is_login'): resvKey = int(request.GET.get('resvKey')) custID = request.session.get('custID') res_flights = RES_FLIGHT.objects.filter(Q(custID=custID) and Q(resvKey__gte=resvKey)) complete_line_list = [] # 完整的路线 incomplete_line_list = [] # 不完整的路线 line = [] # 旅游路线 result = [] count = 1 # 记录已加入路线的res个数 line.append(str(FLIGHTS.objects.get(flightNum=res_flights[0].flightNum_id).FromCity_id)) line.append(str(FLIGHTS.objects.get(flightNum=res_flights[0].flightNum_id).ArivCity_id)) result.append(res_flights[0]) for i in res_flights: flight = FLIGHTS.objects.get(flightNum=i.flightNum_id) if flight.FromCity_id == line[len(line) - 1]: line.append(flight.ArivCity_id) result.append(i) if line[len(line) - 1] == line[0]: is_complete = 1 else: is_complete = 0 listall = json.loads(serializers.serialize("json", result)) total = int(len(listall)) pagesize = int(request.GET.get('pagesize')) pagenum = int(request.GET.get('pagenum')) if pagesize > total: pagesize = total sort_ls = [listall[i:i + pagesize] for i in range(0, len(listall), pagesize)] response['is_complete'] = is_complete response['line'] = line response['list'] = sort_ls[pagenum - 1] response['msg'] = 'successfully' response['error_num'] = 0 else: response['msg'] = 'you must login' response['error_num'] = 1 except Exception as e: response['msg'] = str(e) response['error_num'] = 1 return JsonResponse(response)
36.66362
118
0.550386
2,195
20,055
4.841913
0.074715
0.061065
0.084306
0.059183
0.820756
0.73297
0.67962
0.653745
0.642172
0.619307
0
0.006562
0.331289
20,055
546
119
36.730769
0.785922
0.012815
0
0.714286
0
0
0.094489
0
0
0
0
0
0
1
0.031983
false
0
0.021322
0.002132
0.091684
0.008529
0
0
0
null
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a80a5a4985f5a794109c2511cc9fa968c789a246
145
py
Python
model/inceptionresnetv2/train.py
wan-h/JD-AI-Fashion-Challenge
817f693672f418745e3a4c89a0417a3165b08130
[ "MIT" ]
3
2018-05-06T15:15:21.000Z
2018-05-13T12:31:42.000Z
model/inceptionresnetv2/train.py
wan-h/JD-AI-Fashion-Challenge
817f693672f418745e3a4c89a0417a3165b08130
[ "MIT" ]
null
null
null
model/inceptionresnetv2/train.py
wan-h/JD-AI-Fashion-Challenge
817f693672f418745e3a4c89a0417a3165b08130
[ "MIT" ]
null
null
null
from model.inceptionresnetv2 import model16_val3, model16_val4 from time import sleep model16_val3.train() sleep(1000) model16_val4.train()
24.166667
63
0.813793
20
145
5.7
0.55
0.192982
0
0
0
0
0
0
0
0
0
0.132813
0.117241
145
6
64
24.166667
0.757813
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b5299f99fab360b43a192b106390ec2f8d7c03b1
104
py
Python
src/user_polls_2_app/apps.py
JackCX777/user_polls_2
fa8fe9ad4c1fa36b4ea5bb402b3d485852a98d3b
[ "BSD-3-Clause" ]
null
null
null
src/user_polls_2_app/apps.py
JackCX777/user_polls_2
fa8fe9ad4c1fa36b4ea5bb402b3d485852a98d3b
[ "BSD-3-Clause" ]
null
null
null
src/user_polls_2_app/apps.py
JackCX777/user_polls_2
fa8fe9ad4c1fa36b4ea5bb402b3d485852a98d3b
[ "BSD-3-Clause" ]
null
null
null
from django.apps import AppConfig class UserPolls2AppConfig(AppConfig): name = 'user_polls_2_app'
17.333333
37
0.788462
13
104
6.076923
0.923077
0
0
0
0
0
0
0
0
0
0
0.022472
0.144231
104
5
38
20.8
0.865169
0
0
0
0
0
0.153846
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
b5381583da8620f687f1e8426a7e03b79e2e1cd8
71
py
Python
sandbox/__init__.py
kevin-brown/django-cacheback
f34b1942a90f13e9eaa7833c82df8190a32816d9
[ "MIT" ]
160
2015-01-02T05:55:29.000Z
2022-03-28T19:33:40.000Z
sandbox/__init__.py
kevin-brown/django-cacheback
f34b1942a90f13e9eaa7833c82df8190a32816d9
[ "MIT" ]
57
2015-01-08T03:32:55.000Z
2022-01-25T07:59:33.000Z
sandbox/__init__.py
kevin-brown/django-cacheback
f34b1942a90f13e9eaa7833c82df8190a32816d9
[ "MIT" ]
66
2015-01-13T14:41:59.000Z
2022-03-31T16:24:45.000Z
from .celeryconfig import app as celery_app __all__ = ('celery_app',)
17.75
43
0.760563
10
71
4.8
0.7
0.375
0
0
0
0
0
0
0
0
0
0
0.140845
71
3
44
23.666667
0.786885
0
0
0
0
0
0.140845
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
b53bd64e614faa74cbeed785cf59ac7d1f812aad
443
py
Python
basic_pytest/calculators.py
tszyrowski-MetOffice/python_testing
92a4c129c270179a3f333eaab617905ebc47e1c6
[ "MIT" ]
null
null
null
basic_pytest/calculators.py
tszyrowski-MetOffice/python_testing
92a4c129c270179a3f333eaab617905ebc47e1c6
[ "MIT" ]
null
null
null
basic_pytest/calculators.py
tszyrowski-MetOffice/python_testing
92a4c129c270179a3f333eaab617905ebc47e1c6
[ "MIT" ]
null
null
null
''' Module contains basic functions ''' def number_to_power(number, power): ''' :param number: number to be taken :param power: :return: number to power >>> number_to_power(3, 2) 9 >>> number_to_power(2, 3) 8 ''' return number**power def number_addition(number1, number2): return number1 + number2 def number_substract(number1, number2): return number1 - number2
19.26087
40
0.609481
53
443
4.943396
0.377358
0.152672
0.198473
0.145038
0.259542
0
0
0
0
0
0
0.044304
0.286682
443
22
41
20.136364
0.78481
0.367946
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.333333
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
b56bf61572814707d0d143a8cb0106e2f1fe1712
278
py
Python
new_mysql/app/api_1_0/control.py
hyteer/flaskdemo
604447396d36ced5ed2ed791c498833f94d0aaba
[ "Apache-2.0" ]
null
null
null
new_mysql/app/api_1_0/control.py
hyteer/flaskdemo
604447396d36ced5ed2ed791c498833f94d0aaba
[ "Apache-2.0" ]
null
null
null
new_mysql/app/api_1_0/control.py
hyteer/flaskdemo
604447396d36ced5ed2ed791c498833f94d0aaba
[ "Apache-2.0" ]
null
null
null
from flask import request def request_wants_json(): best = request.accept_mimetypes \ .best_match(['application/json', 'text/html']) return best == 'application/json' and \ request.accept_mimetypes[best] > \ request.accept_mimetypes['text/html']
34.75
54
0.679856
32
278
5.71875
0.5
0.213115
0.360656
0.284153
0
0
0
0
0
0
0
0
0.194245
278
8
55
34.75
0.816964
0
0
0
0
0
0.179211
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.428571
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
b593a11e3214dae56ee47df57a137e39b5312517
200
py
Python
tests/easy/query/test_url.py
lifeomic/phc-sdk-py
51709c1c2f129a3fbe336a44e4d501ae0249859e
[ "MIT" ]
1
2020-07-22T12:46:58.000Z
2020-07-22T12:46:58.000Z
tests/easy/query/test_url.py
lifeomic/phc-sdk-py
51709c1c2f129a3fbe336a44e4d501ae0249859e
[ "MIT" ]
54
2019-10-09T16:19:04.000Z
2022-01-19T20:28:59.000Z
tests/easy/query/test_url.py
lifeomic/phc-sdk-py
51709c1c2f129a3fbe336a44e4d501ae0249859e
[ "MIT" ]
2
2019-10-30T19:54:43.000Z
2020-12-03T18:57:15.000Z
from phc.easy.query.url import merge_pattern def test_merge_pattern(): assert merge_pattern("/api/{test}/value", {"test": "sub", "a": 1}) == ( "/api/sub/value", {"a": 1}, )
20
75
0.56
27
200
4
0.592593
0.333333
0
0
0
0
0
0
0
0
0
0.012903
0.225
200
9
76
22.222222
0.683871
0
0
0
0
0
0.201005
0
0
0
0
0
0.166667
1
0.166667
true
0
0.166667
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
b5b49cc5ad1d590ef01a3564fc1de057b150b66d
86
py
Python
tests/integration_tests_plugins/dockercompute/setup.py
ilan-WS/cloudify-manager
510d8a277c848db351f38fc5b264806b2cb36d0b
[ "Apache-2.0" ]
124
2015-01-22T22:28:37.000Z
2022-02-26T23:12:06.000Z
tests/integration_tests_plugins/dockercompute/setup.py
cloudify-cosmo/cloudify-manager
4a3f44ceb49d449bc5ebc8766b1c7b9c174ff972
[ "Apache-2.0" ]
345
2015-01-08T15:49:40.000Z
2022-03-29T08:33:00.000Z
tests/integration_tests_plugins/dockercompute/setup.py
ilan-WS/cloudify-manager
510d8a277c848db351f38fc5b264806b2cb36d0b
[ "Apache-2.0" ]
77
2015-01-07T14:04:35.000Z
2022-03-07T22:46:00.000Z
from setuptools import setup setup(name='dockercompute', packages=['dockercompute'])
21.5
55
0.790698
9
86
7.555556
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.081395
86
3
56
28.666667
0.860759
0
0
0
0
0
0.302326
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
a93fc5be2a31353d5681e1ac774062131fb75d0e
333
py
Python
ode/Development/apps/PythonSDK/odeClient/timehelpers.py
OSADP/SEMI-ODE
37cba20a7a54d891338068c1134c797ae977f279
[ "Apache-2.0" ]
null
null
null
ode/Development/apps/PythonSDK/odeClient/timehelpers.py
OSADP/SEMI-ODE
37cba20a7a54d891338068c1134c797ae977f279
[ "Apache-2.0" ]
null
null
null
ode/Development/apps/PythonSDK/odeClient/timehelpers.py
OSADP/SEMI-ODE
37cba20a7a54d891338068c1134c797ae977f279
[ "Apache-2.0" ]
null
null
null
from datetime import datetime, tzinfo, timedelta date_format = '%Y-%m-%dT%H:%M:%S.%f%Z' ZERO = timedelta(0) class UTC(tzinfo): def utcoffset(self, dt): return ZERO def tzname(self, dt): return "UTC" def dst(self, dt): return ZERO class ZULU(UTC): def tzname(self, dt): return "Z"
17.526316
48
0.591592
49
333
4
0.510204
0.122449
0.244898
0.163265
0.214286
0
0
0
0
0
0
0.004098
0.267267
333
18
49
18.5
0.79918
0
0
0.307692
0
0
0.078078
0.066066
0
0
0
0
0
1
0.307692
false
0
0.076923
0.307692
0.846154
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
a94fe546b224c08c33b84df7b5eb4ac1bc4b2cda
52
py
Python
mflowgen/demo/__init__.py
jbrzozo24/mflowgen
fe168e1ea2311feb35588333aa5d7d7c6ba79625
[ "BSD-3-Clause" ]
53
2020-11-05T20:13:03.000Z
2022-03-31T14:51:56.000Z
mflowgen/demo/__init__.py
jbrzozo24/mflowgen
fe168e1ea2311feb35588333aa5d7d7c6ba79625
[ "BSD-3-Clause" ]
27
2020-11-04T19:52:38.000Z
2022-03-17T17:11:01.000Z
mflowgen/demo/__init__.py
jbrzozo24/mflowgen
fe168e1ea2311feb35588333aa5d7d7c6ba79625
[ "BSD-3-Clause" ]
26
2020-11-02T18:43:57.000Z
2022-03-31T14:52:52.000Z
from mflowgen.demo.demo_handler import DemoHandler
17.333333
50
0.865385
7
52
6.285714
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.096154
52
2
51
26
0.93617
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
8d2cd6b5007d66224e6175086b265ee2668f82f4
1,846
py
Python
autorest/codegen/serializers/azure_functions/python/bindings_serializer.py
Azure/autorest.azure-functions-python
b0896d8aec6b0fd6f0bcb12ea8e0489652dc2783
[ "MIT" ]
4
2020-10-22T20:35:38.000Z
2021-12-21T07:29:01.000Z
autorest/codegen/serializers/azure_functions/python/bindings_serializer.py
Azure/autorest.azure-functions-python
b0896d8aec6b0fd6f0bcb12ea8e0489652dc2783
[ "MIT" ]
3
2020-09-09T15:16:15.000Z
2021-12-20T15:25:18.000Z
autorest/codegen/serializers/azure_functions/python/bindings_serializer.py
Azure/autorest.azure-functions-python
b0896d8aec6b0fd6f0bcb12ea8e0489652dc2783
[ "MIT" ]
2
2020-11-10T07:16:23.000Z
2020-12-30T11:03:14.000Z
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from abc import ABC, abstractmethod class BindingsSerializer(object): def __init__(self, operation, env): self.operation = operation self.env = env class OutputBinding(ABC): def __init__(self, operation, env): self.operation = operation self.env = env @abstractmethod def get_binding_type(self): """ :return: """ @abstractmethod def get_binding_name(self): """ :return: """ @abstractmethod def render_template(self): """ :return: """ @staticmethod def get_binding_direction(): return "out" class HTTPOutputBinding(OutputBinding): def get_binding_type(self): return "http" def get_binding_name(self): return "$return" def render_template(self): template = self.env.get_template("http-output-binding.jinja2") return template.render(binding_type=f'"{self.get_binding_type()}"', binding_direction=f'"{self.get_binding_direction()}"', return_variable_name=f'"{self.get_binding_name()}"') class OutputBindingsSerializer(BindingsSerializer): def _get_output_binding(self): # ToDo - this has to become generic return HTTPOutputBinding(self.operation, self.env) def __str__(self): return self._get_output_binding().render_template() class InputBindingsSerializer(BindingsSerializer): def __str__(self): return '"TO FILL"'
25.287671
85
0.583965
176
1,846
5.863636
0.329545
0.077519
0.062985
0.043605
0.21124
0.21124
0.106589
0.106589
0.106589
0.106589
0
0.000715
0.242687
1,846
72
86
25.638889
0.737482
0.195558
0
0.472222
0
0
0.095949
0.079602
0
0
0
0.013889
0
1
0.333333
false
0
0.027778
0.166667
0.694444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
4
8d2ef3d8376994e1de92b33d1c09dee0e19e781e
440
py
Python
active_reward_learning/envs/__init__.py
david-lindner/idrl
54cfad330b0598ad4f6621796f2411644e50a6ba
[ "MIT" ]
9
2021-11-20T18:14:38.000Z
2022-03-20T16:29:48.000Z
active_reward_learning/envs/__init__.py
david-lindner/idrl
54cfad330b0598ad4f6621796f2411644e50a6ba
[ "MIT" ]
null
null
null
active_reward_learning/envs/__init__.py
david-lindner/idrl
54cfad330b0598ad4f6621796f2411644e50a6ba
[ "MIT" ]
null
null
null
from .chain import FirstStateTrapChain, LimitedActionChain, SimpleChain from .gridworld import Gridworld from .gym_env import GymInfoWrapper from .highway_driving import HighwayDriving from .junction import JunctionMDP from .reward_model_mean_wrapper import RewardModelMeanWrapper from .reward_model_sample_wrapper import RewardModelSampleWrapper from .tabular_mdp import TabularMDP from .tabular_reward_wrapper import TabularRewardWrapper
44
71
0.888636
49
440
7.755102
0.530612
0.102632
0.078947
0
0
0
0
0
0
0
0
0
0.086364
440
9
72
48.888889
0.945274
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
8d3361d8f4076361063f9956b868a2555bae3aea
66
py
Python
comancpipeline/Summary/__init__.py
SharperJBCA/COMAPreduce
6722c2f59b4968c24b81be4a0f4b12955e270d2b
[ "MIT" ]
5
2019-03-05T11:56:13.000Z
2022-02-16T17:24:07.000Z
comancpipeline/Summary/__init__.py
SharperJBCA/COMAPreduce
6722c2f59b4968c24b81be4a0f4b12955e270d2b
[ "MIT" ]
null
null
null
comancpipeline/Summary/__init__.py
SharperJBCA/COMAPreduce
6722c2f59b4968c24b81be4a0f4b12955e270d2b
[ "MIT" ]
2
2021-02-12T14:32:51.000Z
2021-03-10T08:44:44.000Z
from comancpipeline.Summary import CalibrationFactors, Statistics
33
65
0.893939
6
66
9.833333
1
0
0
0
0
0
0
0
0
0
0
0
0.075758
66
1
66
66
0.967213
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
8d48e0784bd6f3696358c0a9f4e5f0f25a961f26
467,250
py
Python
rivendell/splunk/viewsHTML.py
ezaspy/elrond
3e358f20112be403b895d873a7e3892ce4181d8b
[ "MIT" ]
1
2021-03-29T08:05:31.000Z
2021-03-29T08:05:31.000Z
rivendell/splunk/viewsHTML.py
ezaspy/elrond
3e358f20112be403b895d873a7e3892ce4181d8b
[ "MIT" ]
17
2020-11-24T11:00:38.000Z
2021-05-18T18:20:21.000Z
rivendell/splunk/viewsHTML.py
ezaspy/elrond
3e358f20112be403b895d873a7e3892ce4181d8b
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 -tt def doHTML(sd): header = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n <head>\n <p><font size=\"3\"><strong>Description</strong></font></p>\n " headings = "</li>\n </ul>\n </head>\n <body>\n <p><br></p><p><font size=\"3\"><strong>Information</strong></font></p>\n <table id=\"mitre\">\n <tr>\n <th width=\"5%\">ID</th>\n <th width=\"15%\">Operating Systems</th>\n <th width=\"35%\">Tactics</th>\n <th width=\"45%\">Sub-Techniques</th>\n </tr>\n <tr>\n <td>" iocs = "</td>\n </tr>\n </table>\n <br><br>\n <p><font size=\"3\"><strong>Indicators of Compromise</strong></font></p>\n <ul>\n <li>" related = "</li> </ul>\n <p><br></p><p><font size=\"3\"><strong>Related Techniques</strong></font></p>\n <table id=\"id\">\n <tr>\n <th width=\"5%\">ID</th>\n <th width=\"95%\">Title</th>\n </tr>\n <tr>\n <td>" insert = "</td>\n </tr>\n <tr>\n <td>" mitigations = "</td>\n </tr>\n </table>\n <p><br></p><p><font size=\"3\"><strong>Mitigations</strong></font></p>\n <table id=\"id\">\n <tr>\n <th width=\"15%\">Mitigation</th>\n <th width=\"85%\">Description</th>\n </tr>\n <tr>\n <td>" footer = "</td>\n </tr>\n </table>\n <br/>\n <table id=\"break\">\n <tr>\n <th></th>\n </tr>\n </table>\n </body>\n</html>" # Initial Access with open(sd+"t1189.html", "w") as t1189html: # description t1189html.write("{}Adversaries may gain access to a system through a user visiting a website over the normal course of browsing. With this technique, the user's web browser is typically targeted for exploitation, but adversaries may also use compromised websites for non-exploitation behavior such as acquiring Application Access Token.<br>".format(header)) t1189html.write("Often the website used by an adversary is one visited by a specific community, such as government, a particular industry, or region, where the goal is to compromise a specific user or set of users based on a shared interest. This kind of targeted attack is referred to a strategic web compromise or watering hole attack. There are several known examples of this occurring.<br>") t1189html.write("Unlike Exploit Public-Facing Application, the focus of this technique is to exploit software on a client endpoint upon visiting a website. This will commonly give an adversary access to systems on the internal network instead of external systems that may be in a DMZ.<br>") t1189html.write("Adversaries may also use compromised websites to deliver a user to a malicious application designed to Steal Application Access Tokens, like OAuth tokens, to gain access to protected applications and information. These malicious applications have been delivered through popups on legitimate websites.") # information t1189html.write("{}T1189</td>\n <td>".format(headings)) # id t1189html.write("Windows, macOS, Linux, SaaS</td>\n <td>") # platforms t1189html.write("Initial Access</td>\n <td>") # tactics t1189html.write("-") # sub-techniques # indicator regex assignments t1189html.write("{}Ports: 80, 443".format(iocs)) # related techniques t1189html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1211 target=\"_blank\"\">T1211</a></td>\n <td>".format(related)) t1189html.write("Use Alternate Authentication Material: Application Access Token") t1189html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1528 target=\"_blank\"\">T1528</a></td>\n <td>".format(insert)) t1189html.write("Steal Application Access Token") # mitigations t1189html.write("{}Application Isolation and Sandboxing</td>\n <td>".format(mitigations)) t1189html.write("Browser sandboxes can be used to mitigate some of the impact of exploitation, but sandbox escapes may still exist. Other types of virtualization and application microsegmentation may also mitigate the impact of client-side exploitation. The risks of additional exploits and weaknesses in implementation may still exist for these types of systems.{}".format(insert)) t1189html.write("Exploit Protection</td>\n <td>") t1189html.write("Security applications that look for behavior used during exploitation such as Windows Defender Exploit Guard (WDEG) and the Enhanced Mitigation Experience Toolkit (EMET) can be used to mitigate some exploitation behavior. Control flow integrity checking is another way to potentially identify and stop a software exploit from occurring. Many of these protections depend on the architecture and target application binary for compatibility.{}".format(insert)) t1189html.write("Restrict Web-Based Content</td>\n <td>") t1189html.write("For malicious code served up through ads, adblockers can help prevent that code from executing in the first place.<br>") t1189html.write("Script blocking extensions can help prevent the execution of JavaScript that may commonly be used during the exploitation process{}".format(insert)) t1189html.write("Update Software</td>\n <td>") t1189html.write("Ensure all browsers and plugins kept updated can help prevent the exploit phase of this technique. Use modern browsers with security features turned on.{}".format(footer)) with open(sd+"t1190.html", "w") as t1190html: # description t1190html.write("{}Adversaries may attempt to take advantage of a weakness in an Internet-facing computer or program using software, data, or commands in order to cause unintended or unanticipated behavior. The weakness in the system can be a bug, a glitch, or a design vulnerability.<br>".format(header)) t1190html.write("These applications are often websites, but can include databases (like SQL), standard services (like SMB or SSH), and any other applications with Internet accessible open sockets, such as web servers and related services. Depending on the flaw being exploited this may include Exploitation for Defense Evasion.<br>") t1190html.write("If an application is hosted on cloud-based infrastructure, then exploiting it may lead to compromise of the underlying instance. This can allow an adversary a path to access the cloud APIs or to take advantage of weak identity and access management policies.<br>") t1190html.write("For websites and databases, the OWASP top 10 and CWE top 25 highlight the most common web-based vulnerabilities.") # information t1190html.write("{}T1190</td>\n <td>".format(headings)) # id t1190html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1190html.write("Initial Access</td>\n <td>") # tactics t1190html.write("-") # sub-techniques # indicator regex assignments t1190html.write("{}-".format(iocs)) # related techniques t1190html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1211 target=\"_blank\"\">T1211</a></td>\n <td>".format(related)) t1190html.write("Exploitation for Defense Evasion") # mitigations t1190html.write("{}Application Isolation and Sandboxing</td>\n <td>".format(mitigations)) t1190html.write("Application isolation will limit what other processes and system features the exploited target can access.{}".format(insert)) t1190html.write("Exploit Protection</td>\n <td>") t1190html.write("Web Application Firewalls may be used to limit exposure of applications to prevent exploit traffic from reaching the application.{}".format(insert)) t1190html.write("Network Segmentation</td>\n <td>") t1190html.write("Segment externally facing servers and services from the rest of the network with a DMZ or on separate hosting infrastructure.{}".format(insert)) t1190html.write("Privileged Account Management</td>\n <td>") t1190html.write("Use least privilege for service accounts will limit what permissions the exploited process gets on the rest of the system.{}".format(insert)) t1190html.write("Update Software</td>\n <td>") t1190html.write("Regularly scan externally facing systems for vulnerabilities and establish procedures to rapidly patch systems when critical vulnerabilities are discovered through scanning and through public disclosure.{}".format(insert)) t1190html.write("Vulnerability Scanning</td>\n <td>") t1190html.write("Regularly scan externally facing systems for vulnerabilities and establish procedures to rapidly patch systems when critical vulnerabilities are discovered through scanning and through public disclosure.{}".format(footer)) with open(sd+"t1133.html", "w") as t1133html: # description t1133html.write("{}Adversaries may leverage external-facing remote services to initially access and/or persist within a network. Remote services such as VPNs, Citrix, and other access mechanisms allow users to connect to internal enterprise network resources from external locations.<br>".format(header)) t1133html.write("There are often remote service gateways that manage connections and credential authentication for these services. Services such as Windows Remote Management can also be used externally.<br>") t1133html.write("Access to Valid Accounts to use the service is often a requirement, which could be obtained through credential pharming or by obtaining the credentials from users after compromising the enterprise network.<br>") t1133html.write("Access to remote services may be used as a redundant or persistent access mechanism during an operation.") # information t1133html.write("{}T1133</td>\n <td>".format(headings)) # id t1133html.write("Windows, Linux</td>\n <td>") # platforms t1133html.write("Initial Access, Persistence</td>\n <td>") # tactics t1133html.write("-") # sub-techniques # indicator regex assignments t1133html.write("{}Ports: 22, 23, 139, 445".format(iocs)) # related techniques t1133html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(related)) t1133html.write("Remote Services: Windows Remote Management") t1133html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(insert)) t1133html.write("Valid Accounts") # mitigations t1133html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1133html.write("Disable or block remotely available services that may be unnecessary.{}".format(insert)) t1133html.write("Limit Access to Resource Over Network</td>\n <td>") t1133html.write("Limit access to remote services through centrally managed concentrators such as VPNs and other managed remote access systems.{}".format(insert)) t1133html.write("Multi-factor Authentication</td>\n <td>") t1133html.write("Use strong two-factor or multi-factor authentication for remote service accounts to mitigate an adversary's ability to leverage stolen credentials, but be aware of Two-Factor Authentication Interception techniques for some two-factor authentication implementations.{}".format(insert)) t1133html.write("Network Segmentation</td>\n <td>") t1133html.write("Deny direct remote access to internal systems through the use of network proxies, gateways, and firewalls.{}".format(footer)) with open(sd+"t1200.html", "w") as t1200html: # description t1200html.write("{}Adversaries may introduce computer accessories, computers, or networking hardware into a system or network that can be used as a vector to gain access.<br>".format(header)) t1200html.write("While public references of usage by APT groups are scarce, many penetration testers leverage hardware additions for initial access.<br>") t1200html.write("Commercial and open source products are leveraged with capabilities such as passive network tapping, man-in-the middle encryption breaking, keystroke injection, kernel memory reading via DMA, adding new wireless access to an existing network, and others.") # information t1200html.write("{}T1200</td>\n <td>".format(headings)) # id t1200html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1200html.write("Initial Access</td>\n <td>") # tactics t1200html.write("-") # sub-techniques # indicator regex assignments t1200html.write("{}DISPLAY</li>\n <li>".format(iocs)) t1200html.write("HID</li>\n <li>") t1200html.write("PCI</li>\n <li>") t1200html.write("UMB</li>\n <li>") t1200html.write("FDC</li>\n <li>") t1200html.write("SCSI</li>\n <li>") t1200html.write("STORAGE</li>\n <li>") t1200html.write("USB</li>\n <li>") t1200html.write("WpdBusEnumRoot</li>") # related techniques t1200html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1091 target=\"_blank\"\">T1091</a></td>\n <td>".format(related)) t1200html.write("Replication Through Removable Media") # mitigations t1200html.write("{}Limit Access to Resource Over Network</td>\n <td>".format(mitigations)) t1200html.write("Establish network access control policies, such as using device certificates and the 802.1x standard. Restrict use of DHCP to registered devices to prevent unregistered devices from communicating with trusted systems.{}".format(insert)) t1200html.write("Limit Hardware Installation</td>\n <td>") t1200html.write("Block unknown devices and accessories by endpoint security configuration and monitoring agent.{}".format(footer)) with open(sd+"t1566.html", "w") as t1566html: # description t1566html.write("{}Adversaries may send phishing messages to elicit sensitive information and/or gain access to victim systems. All forms of phishing are electronically delivered social engineering.<br>".format(header)) t1566html.write("Phishing can be targeted, known as spearphishing. In spearphishing, a specific individual, company, or industry will be targeted by the adversary.<br>") t1566html.write("More generally, adversaries can conduct non-targeted phishing, such as in mass malware spam campaigns.<br>") t1566html.write("Adversaries may send victim’s emails containing malicious attachments or links, typically to execute malicious code on victim systems or to gather credentials for use of Valid Accounts.<br>") t1566html.write("Phishing may also be conducted via third-party services, like social media platforms.") # information t1566html.write("{}T1566</td>\n <td>".format(headings)) # id t1566html.write("Windows, macOS, Linux, Office 365, SaaS</td>\n <td>") # platforms t1566html.write("Initial Access</td>\n <td>") # tactics t1566html.write("T1566.001: Spearphishing Attachment<br>T1566.002: Spearphishing Link<br>T1566.003: Spearphishing via Service") # sub-techniques # indicator regex assignments t1566html.write("{}.msg</li>\n <li>".format(iocs)) t1566html.write(".eml</li>") # related techniques t1566html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(related)) t1566html.write("Valid Accounts") t1566html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1203 target=\"_blank\"\">T1203</a></td>\n <td>".format(insert)) t1566html.write("Exploitation for Client Execution") t1566html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1204 target=\"_blank\"\">T1204</a></td>\n <td>".format(insert)) t1566html.write("User Execution") t1566html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1534 target=\"_blank\"\">T1534</a></td>\n <td>".format(insert)) t1566html.write("Internal Spearphishing") # mitigations t1566html.write("{}Antivirus/Antimalware</td>\n <td>".format(mitigations)) t1566html.write("Anti-virus can automatically quarantine suspicious files.{}".format(insert)) t1566html.write("Network Intrusion Prevention</td>\n <td>") t1566html.write("Network intrusion prevention systems and systems designed to scan and remove malicious email attachments or links can be used to block activity.{}".format(insert)) t1566html.write("Restrict Web-Based Content</td>\n <td>") t1566html.write("Determine if certain websites or attachment types (ex: .scr, .exe, .pif, .cpl, etc.) that can be used for phishing are necessary for business operations and consider blocking access if activity cannot be monitored well or if it poses a significant risk.{}".format(insert)) t1566html.write("Software Configuration</td>\n <td>") t1566html.write("Use anti-spoofing and email authentication mechanisms to filter messages based on validity checks of the sender domain (using SPF) and integrity of messages (using DKIM). Enabling these mechanisms within an organization (through policies such as DMARC) may enable recipients (intra-org and cross domain) to perform similar message filtering and validation.{}".format(insert)) t1566html.write("User Training</td>\n <td>") t1566html.write("Users can be trained to identify social engineering techniques and phishing emails.{}".format(footer)) with open(sd+"t1091.html", "w") as t1091html: # description t1091html.write("{}Adversaries may move onto systems, possibly those on disconnected or air-gapped networks, by copying malware to removable media and taking advantage of Autorun features when the media is inserted into a system and executes.<br>".format(header)) t1091html.write("In the case of Initial Access, this may occur through manual manipulation of the media, modification of systems used to initially format the media, or modification to the media's firmware itself.<br>") t1091html.write("In the case of Lateral Movement, this may occur through modification of executable files stored on removable media or by copying malware and renaming it to look like a legitimate file to trick users into executing it on a separate system.") # information t1091html.write("{}T1091</td>\n <td>".format(headings)) # id t1091html.write("Windows</td>\n <td>") # platforms t1091html.write("Initial Access, Lateral Movement</td>\n <td>") # tactics t1091html.write("-") # sub-techniques # indicator regex assignments t1091html.write("{}DISPLAY</li>\n <li>".format(iocs)) t1091html.write("HID</li>\n <li>") t1091html.write("PCI</li>\n <li>") t1091html.write("UMB</li>\n <li>") t1091html.write("FDC</li>\n <li>") t1091html.write("SCSI</li>\n <li>") t1091html.write("STORAGE</li>\n <li>") t1091html.write("USB</li>\n <li>") t1091html.write("WpdBusEnumRoot</li>") # related techniques t1091html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1200 target=\"_blank\"\">T1200</a></td>\n <td>".format(related)) t1091html.write("Hardware Additions") # mitigations t1091html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1091html.write("Disable Autorun if it is unnecessary. Disallow or restrict removable media at an organizational policy level if it is not required for business operations.{}".format(insert)) t1091html.write("Limit Hardware Installation</td>\n <td>") t1091html.write("Limit the use of USB devices and removable media within a network.{}".format(footer)) with open(sd+"t1195.html", "w") as t1195html: # description t1195html.write("{}Adversaries may manipulate products or product delivery mechanisms prior to receipt by a final consumer for the purpose of data or system compromise.<br>".format(header)) t1195html.write("Supply chain compromise can take place at any stage of the supply chain including:<ul>\n <li>Manipulation of development tools</li>\n <li>Manipulation of a development environment</li>\n <li>Manipulation of source code repositories (public or private)</li>\n <li>Manipulation of source code in open-source dependencies</li>\n <li>Manipulation of software update/distribution mechanisms</li>\n <li>Compromised/infected system images (multiple cases of removable media infected at the factory)</li>\n <li>Replacement of legitimate software with modified versions</li>\n <li>Sales of modified/counterfeit products to legitimate distributors</li>\n <li>Shipment interdiction</li>\n </ul>While supply chain compromise can impact any component of hardware or software, attackers looking to gain execution have often focused on malicious additions to legitimate software in software distribution or update channels.<br>") t1195html.write("Targeting may be specific to a desired victim set or malicious software may be distributed to a broad set of consumers but only move on to additional tactics on specific victims.<br>") t1195html.write("Popular open source projects that are used as dependencies in many applications may also be targeted as a means to add malicious code to users of the dependency.") # information t1195html.write("{}T1195</td>\n <td>".format(headings)) # id t1195html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1195html.write("Initial Access</td>\n <td>") # tactics t1195html.write("T1195: Compromise Software Dependencies and Development Tools<br>T1195: Compromise Software Supply Chain<br>T1195: Compromise Hardware Supply Chain") # sub-techniques # indicator regex assignments t1195html.write("{}-".format(iocs)) # related techniques t1195html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1199 target=\"_blank\"\">T1199</a></td>\n <td>".format(related)) t1195html.write("Trusted Relationship") # mitigations t1195html.write("{}Update Software</td>\n <td>".format(mitigations)) t1195html.write("A patch management process should be implemented to check unused dependencies, unmaintained and/or previously vulnerable dependencies, unnecessary features, components, files, and documentation.{}".format(insert)) t1195html.write("Vulnerability Scanning</td>\n <td>") t1195html.write("Continuous monitoring of vulnerability sources and the use of automatic and manual code review tools should also be implemented as well.{}".format(footer)) with open(sd+"t1199.html", "w") as t1199html: # description t1199html.write("{}Adversaries may breach or otherwise leverage organizations who have access to intended victims. Access through trusted third party relationship exploits an existing connection that may not be protected or receives less scrutiny than standard mechanisms of gaining access to a network.<br>".format(header)) t1199html.write("Organizations often grant elevated access to second or third-party external providers in order to allow them to manage internal systems as well as cloud-based environments.<br>") t1199html.write("Some examples of these relationships include IT services contractors, managed security providers, infrastructure contractors (e.g. HVAC, elevators, physical security). The third-party provider's access may be intended to be limited to the infrastructure being maintained, but may exist on the same network as the rest of the enterprise.<br>") t1199html.write("As such, Valid Accounts used by the other party for access to internal network systems may be compromised and used.") # information t1199html.write("{}T1199</td>\n <td>".format(headings)) # id t1199html.write("Windows, macOS, Linux, AWS, Azure, GCP, SaaS</td>\n <td>") # platforms t1199html.write("Initial Access</td>\n <td>") # tactics t1199html.write("-") # sub-techniques # indicator regex assignments t1199html.write("{}-".format(iocs)) # related techniques t1199html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(related)) t1199html.write("Valid Accounts") # mitigations t1199html.write("{}Network Segmentation</td>\n <td>".format(mitigations)) t1199html.write("Network segmentation can be used to isolate infrastructure components that do not require broad network access.{}".format(insert)) t1199html.write("User Account Control</td>\n <td>") t1199html.write("Properly manage accounts and permissions used by parties in trusted relationships to minimize potential abuse by the party and if the party is compromised by an adversary.{}".format(footer)) with open(sd+"t1078.html", "w") as t1078html: # description t1078html.write("{}Adversaries may obtain and abuse credentials of existing accounts as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion.<br>".format(header)) t1078html.write("Compromised credentials may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop.<br>") t1078html.write("Compromised credentials may also grant an adversary increased privilege to specific systems or access to restricted areas of the network.<br>") t1078html.write("Adversaries may choose not to use malware or tools in conjunction with the legitimate access those credentials provide to make it harder to detect their presence.<br>") t1078html.write("The overlap of permissions for local, domain, and cloud accounts across a network of systems is of concern because the adversary may be able to pivot across accounts and systems to reach a high level of access (i.e., domain or enterprise administrator) to bypass access controls set within the enterprise.") # information t1078html.write("{}T1078</td>\n <td>".format(headings)) # id t1078html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1078html.write("Initial Access, Persistence, Privilege Escalation, Defense Evasion</td>\n <td>") # tactics t1078html.write("T1078: Default Accounts<br>T1078: Domain Accounts<br>T1078: Local Accounts<br>T1078: Cloud Accounts") # sub-techniques # indicator regex assignments t1078html.write("{}-".format(iocs)) # related techniques t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1133 target=\"_blank\"\">T1133</a></td>\n <td>".format(related)) t1078html.write("External Remote Services") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1566 target=\"_blank\"\">T1566</a></td>\n <td>".format(insert)) t1078html.write("Phishing") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1199 target=\"_blank\"\">T1199</a></td>\n <td>".format(insert)) t1078html.write("Trusted Relationship") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1556 target=\"_blank\"\">T1556</a></td>\n <td>".format(insert)) t1078html.write("Modify Authentication Process") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1112 target=\"_blank\"\">T1112</a></td>\n <td>".format(insert)) t1078html.write("Modify Registry") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1563 target=\"_blank\"\">T1563</a></td>\n <td>".format(insert)) t1078html.write("Remote Service Session Hijacking") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(insert)) t1078html.write("Remote Services") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1485 target=\"_blank\"\">T1485</a></td>\n <td>".format(insert)) t1078html.write("Data Destruction") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1486 target=\"_blank\"\">T1486</a></td>\n <td>".format(insert)) t1078html.write("Data Encrypted for Impact") t1078html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1561 target=\"_blank\"\">T1561</a></td>\n <td>".format(insert)) t1078html.write("Disk Wipe") # mitigations t1078html.write("{}Application Developer Guidance</td>\n <td>".format(mitigations)) t1078html.write("Ensure that applications do not store sensitive data or credentials insecurely. (e.g. plaintext credentials in code, published credentials in repositories, or credentials in public cloud storage).{}".format(insert)) t1078html.write("Password Policies</td>\n <td>") t1078html.write("Applications and appliances that utilize default username and password should be changed immediately after the installation, and before deployment to a production environment. When possible, applications that use SSH keys should be updated periodically and properly secured.{}".format(insert)) t1078html.write("Privileged Account Management</td>\n <td>") t1078html.write("Audit domain and local accounts as well as their permission levels routinely to look for situations that could allow an adversary to gain wide access by obtaining credentials of a privileged account. These audits should also include if default accounts have been enabled, or if new local accounts are created that have not be authorized. Follow best practices for design and administration of an enterprise network to limit privileged account use across administrative tiers.{}".format(footer)) # Execution with open(sd+"t1059.html", "w") as t1059html: # description t1059html.write("{}Adversaries may abuse command and script interpreters to execute commands, scripts, or binaries. These interfaces and languages provide ways of interacting with computer systems and are a common feature across many different platforms. Most systems come with some built-in command-line interface and scripting capabilities, for example, macOS and Linux distributions include some flavor of Unix Shell while Windows installations include the Windows Command Shell and PowerShell.<br>".format(header)) t1059html.write("There are also cross-platform interpreters such as Python, as well as those commonly associated with client applications such as JavaScript and Visual Basic.<br>") t1059html.write("Adversaries may abuse IPC to execute arbitrary code or commands. IPC mechanisms may differ depending on OS, but typically exists in a form accessible through programming languages/libraries or native interfaces such as Windows Dynamic Data Exchange or Component Object Model.<br>") t1059html.write("Adversaries may abuse these technologies in various ways as a means of executing arbitrary commands. Commands and scripts can be embedded in Initial Access payloads delivered to victims as lure documents or as secondary payloads downloaded from an existing C2. Adversaries may also execute commands through interactive terminals/shells.") # information t1059html.write("{}T1059</td>\n <td>".format(headings)) # id t1059html.write("Windows, macOS, Linux, Network</td>\n <td>") # platforms t1059html.write("Execution</td>\n <td>") # tactics t1059html.write("T1059.001: PowerShell<br>T1059.002: AppleScript<br>T1059.003: Windows Command Shell<br>T1059.004: Unix Shell<br>T1059.005: Visual Basic<br>T1059.006: Python<br>T1059.007: JavaScript<br>T1059.008: Network Device CLI") # sub-techniques # indicator regex assignments t1059html.write("{}.ps1</li>\n <li>".format(iocs)) t1059html.write(".py</li>\n <li>") t1059html.write("PowerShell</li>\n <li>") t1059html.write("cmd</li>\n <li>") t1059html.write("Invoke-Command</li>\n <li>") t1059html.write("Start-Process</li>\n <li>") t1059html.write("vbscript</li>\n <li>") t1059html.write("wscript</li>\n <li>") t1059html.write("system.management.automation</li>") # related techniques - unfinished MANY t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1559 target=\"_blank\"\">T1559</a></td>\n <td>".format(related)) t1059html.write("Inter-Process Communication") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1106 target=\"_blank\"\">T1106</a></td>\n <td>".format(insert)) t1059html.write("Native API") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1197 target=\"_blank\"\">T1197</a></td>\n <td>".format(insert)) t1059html.write("BITS Job") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1202 target=\"_blank\"\">T1202</a></td>\n <td>".format(insert)) t1059html.write("Indirect Command Execution") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1027 target=\"_blank\"\">T1027</a></td>\n <td>".format(insert)) t1059html.write("Obfuscated Files or Information") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1056 target=\"_blank\"\">T1056</a></td>\n <td>".format(insert)) t1059html.write("Input Capture") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1613 target=\"_blank\"\">T1613</a></td>\n <td>".format(insert)) t1059html.write("Container and Resource Discovery") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1057 target=\"_blank\"\">T1057</a></td>\n <td>".format(insert)) t1059html.write("Process Discovery") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1119 target=\"_blank\"\">T1119</a></td>\n <td>".format(insert)) t1059html.write("Automated Collection") t1059html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1005 target=\"_blank\"\">T1005</a></td>\n <td>".format(insert)) t1059html.write("Data from Local System") # mitigations t1059html.write("{}Antivirus/Antimalware</td>\n <td>".format(mitigations)) t1059html.write("Anti-virus can be used to automatically quarantine suspicious files.{}".format(insert)) t1059html.write("Code Signing</td>\n <td>") t1059html.write("Where possible, only permit execution of signed scripts.{}".format(insert)) t1059html.write("Disable or Remove Feature or Program</td>\n <td>") t1059html.write("Disable or remove any unnecessary or unused shells or interpreters.{}".format(insert)) t1059html.write("Execution Prevention</td>\n <td>") t1059html.write("Use application control where appropriate.{}".format(insert)) t1059html.write("Privileged Account Management</td>\n <td>") t1059html.write("When PowerShell is necessary, restrict PowerShell execution policy to administrators. Be aware that there are methods of bypassing the PowerShell execution policy, depending on environment configuration.{}".format(insert)) t1059html.write("Restrict Web-Based Content</td>\n <td>") t1059html.write("Script blocking extensions can help prevent the execution of scripts and HTA files that may commonly be used during the exploitation process. For malicious code served up through ads, adblockers can help prevent that code from executing in the first place.{}".format(footer)) with open(sd+"t1609.html", "w") as t1609html: # description t1609html.write("{}Adversaries may abuse a container administration service to execute commands within a container. A container administration service such as the Docker daemon, the Kubernetes API server, or the kubelet may allow remote management of containers within an environment.<br>".format(header)) t1609html.write("In Docker, adversaries may specify an entrypoint during container deployment that executes a script or command, or they may use a command such as docker exec to execute a command within a running container.<br>") t1609html.write("In Kubernetes, if an adversary has sufficient permissions, they may gain remote execution in a container in the cluster via interaction with the Kubernetes API server, the kubelet, or by running a command such as kubectl exec.") # indicator regex assignments t1609html.write("docker exec</li>\n <li>") t1609html.write("kubectl exec</li>") # information t1609html.write("{}T1609</td>\n <td>".format(headings)) # id t1609html.write("Windows</td>\n <td>") # platforms t1609html.write("Execution</td>\n <td>") # tactics t1609html.write("-") # sub-techniques # related techniques t1609html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1610 target=\"_blank\"\">T1610</a></td>\n <td>".format(related)) t1609html.write("Deploy Container") # mitigations t1609html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1609html.write("Use read-only containers and minimal images when possible to prevent the execution of commands.{}".format(insert)) t1609html.write("Limit Access to Resource Over Network</td>\n <td>") t1609html.write("Limit communications with the container service to local Unix sockets or remote access via SSH. Require secure port access to communicate with the APIs over TLS by disabling unauthenticated access to the Docker API and Kubernetes API Server.{}".format(insert)) t1609html.write("Privileged Account Management</td>\n <td>") t1609html.write("Ensure containers are not running as root by default.{}".format(footer)) with open(sd+"t1610.html", "w") as t1610html: # description t1610html.write("{}Adversaries may deploy a container into an environment to facilitate execution or evade defenses. In some cases, adversaries may deploy a new container to execute processes associated with a particular image or deployment, such as processes that execute or download malware. In others, an adversary may deploy a new container configured without network rules, user limitations, etc. to bypass existing defenses within the environment.<br>".format(header)) t1610html.write("Containers can be deployed by various means, such as via Docker's create and start APIs or via a web application such as the Kubernetes dashboard or Kubeflow. Adversaries may deploy containers based on retrieved or built malicious images or from benign images that download and execute malicious payloads at runtime.") # indicator regex assignments t1610html.write("docker create</li>\n <li>") t1610html.write("docker start</li>") # information t1610html.write("{}T1610</td>\n <td>".format(headings)) # id t1610html.write("Containers</td>\n <td>") # platforms t1610html.write("Execution</td>\n <td>") # tactics t1610html.write("-") # sub-techniques # related techniques t1610html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1609 target=\"_blank\"\">T1609</a></td>\n <td>".format(related)) t1610html.write("Container Administration Command") # mitigations t1610html.write("{}Limit Access to Resource Over Network</td>\n <td>".format(mitigations)) t1610html.write("Limit communications with the container service to local Unix sockets or remote access via SSH. Require secure port access to communicate with the APIs over TLS by disabling unauthenticated access to the Docker API, Kubernetes API Server, and container orchestration web applications.{}".format(insert)) t1610html.write("Network Segmentation</td>\n <td>") t1610html.write("Deny direct remote access to internal systems through the use of network proxies, gateways, and firewalls.{}".format(insert)) t1610html.write("User Account Management</td>\n <td>") t1610html.write("Enforce the principle of least privilege by limiting container dashboard access to only the necessary users.{}".format(footer)) with open(sd+"t1203.html", "w") as t1203html: # description t1203html.write("{}Adversaries may exploit software vulnerabilities in client applications to execute code. Vulnerabilities can exist in software due to unsecure coding practices that can lead to unanticipated behavior.<br>".format(header)) t1203html.write("Adversaries can take advantage of certain vulnerabilities through targeted exploitation for the purpose of arbitrary code execution.<br>") t1203html.write("Oftentimes the most valuable exploits to an offensive toolkit are those that can be used to obtain code execution on a remote system because they can be used to gain access to that system.<br>") t1203html.write("Users will expect to see files related to the applications they commonly used to do work, so they are a useful target for exploit research and development because of their high utility.<br>") t1203html.write("Several types exist:<ul>\n <li>Browser-based Exploitation</li>\n <ul>\n <li>Web browsers are a common target through Drive-by Compromise and Spearphishing Link.</li>\n <li>Endpoint systems may be compromised through normal web browsing or from certain users being targeted by links in spearphishing emails to adversary controlled sites used to exploit the web browser.</li>\n <li>These often do not require an action by the user for the exploit to be executed.\n </ul>\n <li>Office Applications</li>\n <ul>\n <li>Common office and productivity applications such as Microsoft Office are also targeted through Phishing.</li>\n <li>Malicious files will be transmitted directly as attachments or through links to download them.</li>\n <li>These require the user to open the document or file for the exploit to run.\n </ul>\n <li>Common Third-party Applications</li>\n <ul>\n <li>Other applications that are commonly seen or are part of the software deployed in a target network may also be used for exploitation.</li>\n <li>Applications such as Adobe Reader and Flash, which are common in enterprise environments, have been routinely targeted by adversaries attempting to gain access to systems.</li>\n <li>Depending on the software and nature of the vulnerability, some may be exploited in the browser or require the user to open a file. For instance, some Flash exploits have been delivered as objects within Microsoft Office documents.</li>\n </ul>") # information t1203html.write("{}T1203</td>\n <td>".format(headings)) # id t1203html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1203html.write("Execution</td>\n <td>") # tactics t1203html.write("-") # sub-techniques # indicator regex assignments t1203html.write("{}.doc</li>\n <li>".format(iocs)) t1203html.write(".xls</li>\n <li>") t1203html.write(".ppt</li>\n <li>") t1203html.write(".pdf</li>\n <li>") t1203html.write(".msg</li>\n <li>") t1203html.write(".eml</li>\n <li>") t1203html.write("WinWord</li>\n <li>") t1203html.write("Excel</li>\n <li>") t1203html.write("PowerPnt</li>\n <li>") t1203html.write("Acrobat</li>\n <li>") t1203html.write("Acrord32</li>") # related techniques t1203html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1189 target=\"_blank\"\">T1189</a></td>\n <td>".format(related)) t1203html.write("Drive-by Compromise") t1203html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1566 target=\"_blank\"\">T1566</a></td>\n <td>".format(insert)) t1203html.write("Phishing") t1203html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1204 target=\"_blank\"\">T1204</a></td>\n <td>".format(insert)) t1203html.write("User Execution") # mitigations t1203html.write("{}Application Isolation and Sandboxing</td>\n <td>".format(mitigations)) t1203html.write("Browser sandboxes can be used to mitigate some of the impact of exploitation, but sandbox escapes may still exist. Other types of virtualization and application microsegmentation may also mitigate the impact of client-side exploitation. The risks of additional exploits and weaknesses in implementation may still exist for these types of systems.</td>\n </tr>\n <tr>\n <td>".format(insert)) t1203html.write("Exploit Protection</td>\n <td>") t1203html.write("Security applications that look for behavior used during exploitation such as Windows Defender Exploit Guard (WDEG) and the Enhanced Mitigation Experience Toolkit (EMET) can be used to mitigate some exploitation behavior. Control flow integrity checking is another way to potentially identify and stop a software exploit from occurring. Many of these protections depend on the architecture and target application binary for compatibility.") with open(sd+"t1559.html", "w") as t1559html: # description t1559html.write("{}Adversaries may abuse inter-process communication (IPC) mechanisms for local code or command execution. IPC is typically used by processes to share data, communicate with each other, or synchronize execution. IPC is also commonly used to avoid situations such as deadlocks, which occurs when processes are stuck in a cyclic waiting pattern.<br>".format(header)) t1559html.write("Adversaries may abuse IPC to execute arbitrary code or commands. IPC mechanisms may differ depending on OS, but typically exists in a form accessible through programming languages/libraries or native interfaces such as Windows Dynamic Data Exchange or Component Object Model. Higher level execution mediums, such as those of Command and Scripting Interpreters, may also leverage underlying IPC mechanisms.") # information t1559html.write("{}T1559</td>\n <td>".format(headings)) # id t1559html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1559html.write("Execution</td>\n <td>") # tactics t1559html.write("T1559.001: Component Object Model<br>T1559.002: Dynamic Data Exchange") # sub-techniques # indicator regex assignments t1559html.write("{}.docm</li>\n <li>".format(iocs)) t1559html.write(".xlsm</li>\n <li>") t1559html.write(".pptm</li>\n <li>") t1559html.write("IPC$") ## itaskservice|itaskdefinition|itasksettings ## microsoft\\.office\\.interop # related techniques t1559html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(related)) t1559html.write("Command and Scripting Interpreter") t1559html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1106 target=\"_blank\"\">T1106</a></td>\n <td>".format(insert)) t1559html.write("Native API") t1559html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1197 target=\"_blank\"\">T1197</a></td>\n <td>".format(insert)) t1559html.write("BITS Jobs") # mitigations t1559html.write("{}Antivirus/Antimalware</td>\n <td>".format(mitigations)) t1559html.write("Anti-virus can be used to automatically quarantine suspicious files.{}".format(insert)) t1559html.write("Code Signing</td>\n <td>") t1559html.write("Where possible, only permit execution of signed scripts.{}".format(insert)) t1559html.write("Disable or Remove Feature or Program</td>\n <td>") t1559html.write("Disable or remove any unnecessary or unused shells or interpreters.{}".format(insert)) t1559html.write("Execution Prevention</td>\n <td>") t1559html.write("Use application control where appropriate.{}".format(insert)) t1559html.write("Privileged Account Management</td>\n <td>") t1559html.write("When PowerShell is necessary, restrict PowerShell execution policy to administrators. Be aware that there are methods of bypassing the PowerShell execution policy, depending on environment configuration.{}".format(insert)) t1559html.write("Restrict Web-Based Content</td>\n <td>") t1559html.write("Script blocking extensions can help prevent the execution of scripts and HTA files that may commonly be used during the exploitation process. For malicious code served up through ads, adblockers can help prevent that code from executing in the first place.{}".format(footer)) with open(sd+"t1106.html", "w") as t1106html: # description t1106html.write("{}Adversaries may directly interact with the native OS application programming interface (API) to execute behaviors. Native APIs provide a controlled means of calling low-level OS services within the kernel, such as those involving hardware/devices, memory, and processes.<br>".format(header)) t1106html.write("These native APIs are leveraged by the OS during system boot (when other system components are not yet initialized) as well as carrying out tasks and requests during routine operations.<br>") t1106html.write("Functionality provided by native APIs are often also exposed to user-mode applications via interfaces and libraries. For example, functions such as the Windows API CreateProcess() or GNU fork() will allow programs and scripts to start other processes.<br>") t1106html.write("This may allow API callers to execute a binary, run a CLI command, load modules, etc. as thousands of similar API functions exist for various system operations.<br>") t1106html.write("Higher level software frameworks, such as Microsoft .NET and macOS Cocoa, are also available to interact with native APIs. These frameworks typically provide language wrappers/abstractions to API functionalities and are designed for ease-of-use/portability of code.<br>") t1106html.write("Adversaries may abuse these native API functions as a means of executing behaviors. Similar to Command and Scripting Interpreter, the native API and its hierarchy of interfaces, provide mechanisms to interact with and utilize various components of a victimized system.") # information t1106html.write("{}T1106</td>\n <td>".format(headings)) # id t1106html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1106html.write("Execution</td>\n <td>") # tactics t1106html.write("-") # sub-techniques # indicator regex assignments t1106html.write("{}PowerShell</li>\n <li>".format(iocs)) t1106html.write("cmd.exe</li>\n <li>") t1106html.write("contentsOfDirectoryAtPath</li>\n <li>") t1106html.write("pathExtension</li>\n <li>") t1106html.write("compare</li>\n <li>") t1106html.write("fork</li>\n <li>") t1106html.write("CreateProcess</li>\n <li>") t1106html.write("CreateRemoteThread</li>\n <li>") t1106html.write("LoadLibrary</li>\n <li>") t1106html.write("ShellExecute</li>\n <li>") t1106html.write("IsDebuggerPresent</li>\n <li>") t1106html.write("OutputDebugString</li>\n <li>") t1106html.write("SetLastError</li>\n <li>") t1106html.write("HttpOpenRequestA</li>\n <li>") t1106html.write("CreatePipe</li>\n <li>") t1106html.write("GetUserNameW</li>\n <li>") t1106html.write("CallWindowProc</li>\n <li>") t1106html.write("EnumResourceTypesA</li>\n <li>") t1106html.write("ConnectNamedPipe</li>\n <li>") t1106html.write("WNetAddConnection2</li>\n <li>") t1106html.write("ZwWriteVirtualMemory</li>\n <li>") t1106html.write("ZwProtectVirtualMemory</li>\n <li>") t1106html.write("ZwQueueApcThread</li>\n <li>") t1106html.write("NtResumeThread</li>\n <li>") t1106html.write("TerminateProcess</li>\n <li>") t1106html.write("GetModuleFileName</li>\n <li>") t1106html.write("lstrcat</li>\n <li>") t1106html.write("CreateFile</li>\n <li>") t1106html.write("ReadFile</li>\n <li>") t1106html.write("GetProcessById</li>\n <li>") t1106html.write("WriteFile</li>\n <li>") t1106html.write("CloseHandle</li>\n <li>") t1106html.write("GetCurrentHwProfile</li>\n <li>") t1106html.write("GetProcAddress</li>\n <li>") t1106html.write("FindNextUrlCacheEntryA</li>\n <li>") t1106html.write("FindFirstUrlCacheEntryA</li>\n <li>") t1106html.write("GetWindowsDirectoryW</li>\n <li>") t1106html.write("MoveFileEx</li>\n <li>") t1106html.write("NtQueryInformationProcess</li>\n <li>") t1106html.write("RegEnumKeyW</li>\n <li>") t1106html.write("SetThreadContext</li>\n <li>") t1106html.write("VirtualAlloc</li>\n <li>") t1106html.write("WinExec</li>\n <li>") t1106html.write("WriteProcessMemory</li>") # related techniques t1106html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(related)) t1106html.write("Command and Scripting Interpreter") t1106html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1559 target=\"_blank\"\">T1559</a></td>\n <td>".format(insert)) t1106html.write("Inter-Process Communication") t1106html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1129 target=\"_blank\"\">T1129</a></td>\n <td>".format(insert)) t1106html.write("Shared Modules") # mitigations t1106html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1106html.write("Identify and block potentially malicious software executed that may be executed through this technique by using application control tools, like Windows Defender Application Control[90], AppLocker, or Software Restriction Policies where appropriate.{}".format(footer)) with open(sd+"t1053.html", "w") as t1053html: # description t1053html.write("{}Adversaries may abuse task scheduling functionality to facilitate initial or recurring execution of malicious code. Utilities exist within all major operating systems to schedule programs or scripts to be executed at a specified date and time.<br>".format(header)) t1053html.write("A task can also be scheduled on a remote system, provided the proper authentication is met (ex: RPC and file and printer sharing in Windows environments).<br>") t1053html.write("Scheduling a task on a remote system typically requires being a member of an admin or otherwise privileged group on the remote system.<br>") t1053html.write("Adversaries may use task scheduling to execute programs at system startup or on a scheduled basis for persistence. These mechanisms can also be abused to run a process under the context of a specified account (such as one with elevated permissions/privileges).") # information t1053html.write("{}T1133</td>\n <td>".format(headings)) # id t1053html.write("Windows, Linux</td>\n <td>") # platforms t1053html.write("Execution, Persistence, Privilege Escalation</td>\n <td>") # tactics t1053html.write("T1053.001: At (Linux)<br>T1053.002: At (Windows)<br>T1053.003: Cron<br>T1053.004: Launchd<br>T1053.005: Scheduled Task<br>T1053.006: Systemd Timers<br>T1053.007: Container Orchestration Job") # sub-techniques # indicator regex assignments t1053html.write("{}schtask</li>\n <li>".format(iocs)) t1053html.write("at</li>\n <li>") t1053html.write(".job") ## timer # related techniques t1053html.write("{}-</td>\n <td>".format(related)) t1053html.write("-") # mitigations t1053html.write("{}Audit</td>\n <td>".format(mitigations)) t1053html.write("Toolkits like the PowerSploit framework contain PowerUp modules that can be used to explore systems for permission weaknesses in scheduled tasks that could be used to escalate privileges.{}".format(insert)) t1053html.write("Operating System Configuration</td>\n <td>") t1053html.write("Configure settings for scheduled tasks to force tasks to run under the context of the authenticated account instead of allowing them to run as SYSTEM. The associated Registry key is located at HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\SubmitControl. The setting can be configured through GPO: Computer Configuration > [Policies] > Windows Settings > Security Settings > Local Policies > Security Options: Domain Controller: Allow server operators to schedule tasks, set to disabled.{}".format(insert)) t1053html.write("Privileged Account Management</td>\n <td>") t1053html.write("Configure the Increase Scheduling Priority option to only allow the Administrators group the rights to schedule a priority process. This can be can be configured through GPO: Computer Configuration > [Policies] > Windows Settings > Security Settings > Local Policies > User Rights Assignment: Increase scheduling priority.{}".format(insert)) t1053html.write("User Account Management</td>\n <td>") t1053html.write("Limit privileges of user accounts and remediate Privilege Escalation vectors so only authorized administrators can create scheduled tasks on remote systems.{}".format(footer)) with open(sd+"t1129.html", "w") as t1129html: # description t1129html.write("{}Adversaries may abuse shared modules to execute malicious payloads. The Windows module loader can be instructed to load DLLs from arbitrary local paths and arbitrary Universal Naming Convention (UNC) network paths.<br>".format(header)) t1129html.write("This functionality resides in NTDLL.dll and is part of the Windows Native API which is called from functions like CreateProcess, LoadLibrary, etc. of the Win32 API.") # information t1129html.write("{}T1129</td>\n <td>".format(headings)) # id t1129html.write("Windows</td>\n <td>") # platforms t1129html.write("Execution</td>\n <td>") # tactics t1129html.write("-") # sub-techniques # indicator regex assignments t1129html.write("{}-".format(iocs)) # related techniques t1129html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1106 target=\"_blank\"\">T1106</a></td>\n <td>".format(related)) t1129html.write("Native API") # mitigations t1129html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1129html.write("Identify and block potentially malicious software executed through this technique by using application control tools capable of preventing unknown DLLs from being loaded.{}".format(footer)) with open(sd+"t1072.html", "w") as t1072html: # description t1072html.write("{}Adversaries may gain access to and use third-party software suites installed within an enterprise network, such as administration, monitoring, and deployment systems, to move laterally through the network.<br>".format(header)) t1072html.write("Third-party applications and software deployment systems may be in use in the network environment for administration purposes (e.g., SCCM, VNC, HBSS, Altiris, etc.).<br>") t1072html.write("Access to a third-party network-wide or enterprise-wide software system may enable an adversary to have remote code execution on all systems that are connected to such a system.<br>") t1072html.write("The access may be used to laterally move to other systems, gather information, or cause a specific effect, such as wiping the hard drives on all endpoints.<br>") t1072html.write("The permissions required for this action vary by system configuration; local credentials may be sufficient with direct access to the third-party system, or specific domain credentials may be required.<br>") t1072html.write("However, the system may require an administrative account to log in or to perform it's intended purpose.") # information t1072html.write("{}T1072</td>\n <td>".format(headings)) # id t1072html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1072html.write("Execution, Lateral Movement</td>\n <td>") # tactics t1072html.write("-") # sub-techniques # indicator regex assignments t1072html.write("{}-".format(iocs)) # related techniques t1072html.write("{}-</a></td>\n <td>".format(related)) t1072html.write("-") # mitigations t1072html.write("{}Active Directory Configuration</td>\n <td>".format(mitigations)) t1072html.write("Ensure proper system and access isolation for critical network systems through use of group policy.{}".format(insert)) t1072html.write("Multi-factor Authentication</td>\n <td>") t1072html.write("Ensure proper system and access isolation for critical network systems through use of multi-factor authentication.{}".format(insert)) t1072html.write("Network Segmentation</td>\n <td>") t1072html.write("Ensure proper system isolation for critical network systems through use of firewalls.{}".format(insert)) t1072html.write("Password Policies</td>\n <td>") t1072html.write("Verify that account credentials that may be used to access deployment systems are unique and not used throughout the enterprise network.{}".format(insert)) t1072html.write("Privileged Account Management</td>\n <td>") t1072html.write("Grant access to application deployment systems only to a limited number of authorized administrators.{}".format(insert)) t1072html.write("Remote Data Storage</td>\n <td>") t1072html.write("If the application deployment system can be configured to deploy only signed binaries, then ensure that the trusted signing certificates are not co-located with the application deployment system and are instead located on a system that cannot be accessed remotely or to which remote access is tightly controlled.{}".format(insert)) t1072html.write("Update Software</td>\n <td>") t1072html.write("Patch deployment systems regularly to prevent potential remote access through Exploitation for Privilege Escalation.{}".format(insert)) t1072html.write("User Account Management</td>\n <td>") t1072html.write("Ensure that any accounts used by third-party providers to access these systems are traceable to the third-party and are not used throughout the network or used by other third-party providers in the same environment. Ensure there are regular reviews of accounts provisioned to these systems to verify continued business need, and ensure there is governance to trace de-provisioning of access that is no longer required. Ensure proper system and access isolation for critical network systems through use of account privilege separation.{}".format(insert)) t1072html.write("User Training</td>\n <td>") t1072html.write("Have a strict approval policy for use of deployment systems.{}".format(footer)) with open(sd+"t1569.html", "w") as t1569html: # description t1569html.write("{}Adversaries may abuse system services or daemons to execute commands or programs. Adversaries can execute malicious content by interacting with or creating services.<br>".format(header)) t1569html.write("Many services are set to run at boot, which can aid in achieving persistence (Create or Modify System Process), but adversaries can also abuse services for one-time or temporary execution.") # information t1569html.write("{}T1569</td>\n <td>".format(headings)) # id t1569html.write("Windows, macOS</td>\n <td>") # platforms t1569html.write("Execution</td>\n <td>") # tactics t1569html.write("T1569.001: Launchctl<br>T1569.002: Service Execution") # sub-techniques # indicator regex assignments t1569html.write("{}PsExec</li>\n <li>".format(iocs)) t1569html.write("services</li>\n <li>") t1569html.write("sc</li>\n <li>") t1569html.write("MSBuild</li>\n <li>") t1569html.write(".service</li>\n <li>") t1569html.write("launchctl</li>") # related techniques t1569html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1543 target=\"_blank\"\">T1543</a></td>\n <td>".format(related)) t1569html.write("Create or Modify System Process") # mitigations t1569html.write("{}Privileged Account Management</td>\n <td>".format(mitigations)) t1569html.write("Ensure that permissions disallow services that run at a higher permissions level from being created or interacted with by a user with a lower permission level.{}".format(insert)) t1569html.write("Restrict File and Directory Permissions</td>\n <td>") t1569html.write("Ensure that high permission level service binaries cannot be replaced or modified by users with a lower permission level.{}".format(insert)) t1569html.write("User Account Management</td>\n <td>") t1569html.write("Prevent users from installing their own launch agents or launch daemons.{}".format(footer)) with open(sd+"t1204.html", "w") as t1204html: # description t1204html.write("{}An adversary may rely upon specific actions by a user in order to gain execution.<br>".format(header)) t1204html.write("Users may be subjected to social engineering to get them to execute malicious code by, for example, opening a malicious document file or link.<br>") t1204html.write("These user actions will typically be observed as follow-on behavior from forms of Phishing.<br>") t1204html.write("While User Execution frequently occurs shortly after Initial Access it may occur at other phases of an intrusion, such as when an adversary places a file in a shared directory or on a user's desktop hoping that a user will click on it.<br>") t1204html.write("This activity may also be seen shortly after Internal Spearphishing.") # information t1204html.write("{}T1204</td>\n <td>".format(headings)) # id t1204html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1204html.write("Execution</td>\n <td>") # tactics t1204html.write("T1204.001: Malicious Link<br>T1204.002: Malicious File<br>T1204.003: Malicious Image") # sub-techniques # indicator regex assignments t1204html.write("{}WinWord</li>\n <li>".format(iocs)) t1204html.write("Excel</li>\n <li>") t1204html.write("PowerPnt</li>\n <li>") t1204html.write("Acrobat</li>\n <li>") t1204html.write("Acrord32</li>\n <li>") t1204html.write(".doc</li>\n <li>") t1204html.write(".xls</li>\n <li>") t1204html.write(".ppt</li>\n <li>") t1204html.write(".docx</li>\n <li>") t1204html.write(".xlsx</li>\n <li>") t1204html.write(".pptx</li>\n <li>") t1204html.write(".docm</li>\n <li>") t1204html.write(".xlsm</li>\n <li>") t1204html.write(".pptm</li>\n <li>") t1204html.write(".pdf</li>\n <li>") t1204html.write(".msg</li>\n <li>") t1204html.write(".eml</li>") # related techniques t1204html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1566 target=\"_blank\"\">T1566</a></td>\n <td>".format(related)) t1204html.write("Phishing") t1204html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1203 target=\"_blank\"\">T1203</a></td>\n <td>".format(insert)) t1204html.write("Exploitation for Client Execution") t1204html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1534 target=\"_blank\"\">T1534</a></td>\n <td>".format(insert)) t1204html.write("Internal Spearphishing") # mitigations t1204html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1204html.write("Application control may be able to prevent the running of executables masquerading as other files.{}".format(insert)) t1204html.write("Network Intrusion Prevention</td>\n <td>") t1204html.write("If a link is being visited by a user, network intrusion prevention systems and systems designed to scan and remove malicious downloads can be used to block activity.{}".format(insert)) t1204html.write("Restrict Web-Based Content</td>\n <td>") t1204html.write("If a link is being visited by a user, block unknown or unused files in transit by default that should not be downloaded or by policy from suspicious sites as a best practice to prevent some vectors, such as .scr, .exe, .pif, .cpl, etc. Some download scanning devices can open and analyze compressed and encrypted formats, such as zip and rar that may be used to conceal malicious files.{}".format(insert)) t1204html.write("User Training</td>\n <td>") t1204html.write("Use user training as a way to bring awareness to common phishing and spearphishing techniques and how to raise suspicion for potentially malicious events.{}".format(footer)) with open(sd+"t1047.html", "w") as t1047html: # description t1047html.write("{}Adversaries may abuse Windows Management Instrumentation (WMI) to achieve execution. WMI is a Windows administration feature that provides a uniform environment for local and remote access to Windows system components.<br>".format(header)) t1047html.write("It relies on the WMI service for local and remote access and the server message block (SMB) and Remote Procedure Call Service (RPCS) for remote access. RPCS operates over port 135.<br>") t1047html.write("An adversary can use WMI to interact with local and remote systems and use it as a means to perform many tactic functions, such as gathering information for Discovery and remote Execution of files as part of Lateral Movement.") # information t1047html.write("{}T1047</td>\n <td>".format(headings)) # id t1047html.write("Windows</td>\n <td>") # platforms t1047html.write("Execution</td>\n <td>") # tactics t1047html.write("-") # sub-techniques # indicator regex assignments t1047html.write("{}Ports: 135</li>\n <li>".format(iocs)) t1047html.write("wmic</li>\n <li>") t1047html.write("Invoke-Wmi</li>\n <li>") t1047html.write("msxsl</li>") # related techniques t1047html.write("{}-</td>\n <td>".format(related)) t1047html.write("-") # mitigations t1047html.write("{}Privileged Account Management</td>\n <td>".format(mitigations)) t1047html.write("Prevent credential overlap across systems of administrator and privileged accounts.{}".format(insert)) t1047html.write("User Account Management</td>\n <td>") t1047html.write("By default, only administrators are allowed to connect remotely using WMI. Restrict other users who are allowed to connect, or disallow all users to connect remotely to WMI.{}".format(footer)) # Persistence with open(sd+"t1098.html", "w") as t1098html: # description t1098html.write("{}Adversaries may manipulate accounts to maintain access to victim systems. Account manipulation may consist of any action that preserves adversary access to a compromised account, such as modifying credentials or permission groups.<br>".format(header)) t1098html.write("These actions could also include account activity designed to subvert security policies, such as performing iterative password updates to bypass password duration policies and preserve the life of compromised credentials.<br>") t1098html.write("In order to create or manipulate accounts, the adversary must already have sufficient permissions on systems or the domain.") # information t1098html.write("{}T1098</td>\n <td>".format(headings)) # id t1098html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365</td>\n <td>") # platforms t1098html.write("Persistence</td>\n <td>") # tactics t1098html.write("T1098.001: Additional Cloud Credentials<br>T1098.002: Exchange Email Delegate Permissions<br>T1098.003: Add Office 365 Global Administrator Role<br>T1098.004: SSH Authorized Keys") # sub-techniques # indicator regex assignments t1098html.write("{}authorized_keys</li>\n <li>".format(iocs)) t1098html.write("sshd_config</li>\n <li>") t1098html.write("ssh-keygen</li>") # related techniques t1098html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t0078 target=\"_blank\"\">T0078</a></td>\n <td>".format(related)) t1098html.write("Valid Accounts") # mitigations t1098html.write("{}Multi-factor Authentication</td>\n <td>".format(mitigations)) t1098html.write("Use multi-factor authentication for user and privileged accounts.{}".format(insert)) t1098html.write("Network Segmentation</td>\n <td>") t1098html.write("Configure access controls and firewalls to limit access to critical systems and domain controllers. Most cloud environments support separate virtual private cloud (VPC) instances that enable further segmentation of cloud systems.{}".format(insert)) t1098html.write("Operating System Configuration</td>\n <td>") t1098html.write("Protect domain controllers by ensuring proper security configuration for critical servers to limit access by potentially unnecessary protocols and services, such as SMB file sharing.{}".format(insert)) t1098html.write("Privileged Account Management</td>\n <td>") t1098html.write("Do not allow domain administrator accounts to be used for day-to-day operations that may expose them to potential adversaries on unprivileged systems.{}".format(footer)) with open(sd+"t1197.html", "w") as t1197html: # description t1197html.write("{}Adversaries may abuse BITS jobs to persistently execute or clean up after malicious payloads. Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through Component Object Model (COM).<br>".format(header)) t1197html.write("BITS is commonly used by updaters, messengers, and other applications preferred to operate in the background (using available idle bandwidth) without interrupting other networked applications. File transfer tasks are implemented as BITS jobs, which contain a queue of one or more file operations.<br>") t1197html.write("The interface to create and manage BITS jobs is accessible through PowerShell and the BITSAdmin tool.<br>") t1197html.write("Adversaries may abuse BITS to download, execute, and even clean up after running malicious code. BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and often permitted by host firewalls.<br>") t1197html.write("BITS enabled execution may also enable persistence by creating long-standing jobs (the default maximum lifetime is 90 days and extendable) or invoking an arbitrary program when a job completes or errors (including after system reboots).<br>") t1197html.write("BITS upload functionalities can also be used to perform Exfiltration Over Alternative Protocol.") # information t1197html.write("{}T1197</td>\n <td>".format(headings)) # id t1197html.write("Windows</td>\n <td>") # platforms t1197html.write("Persistence, Defense Evasion</td>\n <td>") # tactics t1197html.write("-") # sub-techniques # indicator regex assignments t1197html.write("{}addfile</li>\n <li>".format(iocs)) t1197html.write("bits</li>\n <li>") t1197html.write("setnotifyflags</li>\n <li>") t1197html.write("setnotifycmdline</li>\n <li>") t1197html.write("transfer</li>") # related techniques t1197html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1559 target=\"_blank\"\">T1559</a></td>\n <td>".format(related)) t1197html.write("Inter-Process Communication: Component Object Model") t1197html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(insert)) t1197html.write("Command and Scripting Interpreter: PowerShell") t1197html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1048 target=\"_blank\"\">T1048</a></td>\n <td>".format(insert)) t1197html.write("Exfiltration Over Alternative Protocol") # mitigations t1197html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1197html.write("Modify network and/or host firewall rules, as well as other network controls, to only allow legitimate BITS traffic.{}".format(insert)) t1197html.write("Operating System Configuration</td>\n <td>") t1197html.write("Consider reducing the default BITS job lifetime in Group Policy or by editing the JobInactivityTimeout and MaxDownloadTime Registry values in HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows\\BITS.{}".format(insert)) t1197html.write("User Account Management</td>\n <td>") t1197html.write("Consider limiting access to the BITS interface to specific users or groups.{}".format(footer)) with open(sd+"t1547.html", "w") as t1547html: # description t1547html.write("{}Adversaries may configure system settings to automatically execute a program during system boot or logon to maintain persistence or gain higher-level privileges on compromised systems. Operating systems may have mechanisms for automatically running a program on system boot or account logon.<br>".format(header)) t1547html.write("These mechanisms may include automatically executing programs that are placed in specially designated directories or are referenced by repositories that store configuration information, such as the Windows Registry. An adversary may achieve the same goal by modifying or extending features of the kernel.<br>") t1547html.write("Since some boot or logon autostart programs run with higher privileges, an adversary may leverage these to elevate privileges.") # information t1547html.write("{}T1547</td>\n <td>".format(headings)) # id t1547html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1547html.write("Persistence, Privilege Escalation</td>\n <td>") # tactics t1547html.write("T1547.001: Registry Run Keys/Startup Folder<br>T1547.002: Authentication Package<br>T1547.003: Time Providers<br>T1547.004: Winlogon Helper DLL<br>T1547.005: Security Support Provider<br>T1547.006: Kernel Modules and Extensions<br>T1547.007: Re-opened Applications<br>T1547.008: LSASS Driver<br>T1547.009: Shortcut Modification<br>T1547.010: Port Monitors<br>T1547.011: Plist Modification<br>T1547.012: Print Processors<br>T1547.013: XDG Autostart Entries<br>T1547.014: Active Setup") # sub-techniques # indicator regex assignments t1547html.write("{}Event IDs: 3033, 3063</li>\n <li>".format(iocs)) t1547html.write("-noprofile</li>\n <li>") t1547html.write("AddMonitor</li>\n <li>") t1547html.write("AddPrintProcessor</li>\n <li>") t1547html.write("GetPrintProcessorDirectory</li>\n <li>") t1547html.write("SeLoadDriverPrivilege</li>\n <li>") t1547html.write("BootExecute</li>\n <li>") t1547html.write("autocheck</li>\n <li>") t1547html.write("autochk</li>\n <li>") t1547html.write("COR_PROFILER</li>\n <li>") t1547html.write("failure</li>\n <li>") t1547html.write("lsass</li>\n <li>") t1547html.write(".lnk</li>\n <li>") t1547html.write("Authentication Packages</li>\n <li>") t1547html.write("Print Processors</li>\n <li>") t1547html.write("Active Setup/Installed Components</li>\n <li>") t1547html.write("CurrentControlSet/Control/Lsa</li>\n <li>") t1547html.write("CurrentControlSet/Control/Print/Monitors</li>\n <li>") t1547html.write("CurrentControlSet/Control/Session Manager</li>\n <li>") t1547html.write("CurrentControlSet/Services/W32Time/TimeProviders</li>\n <li>") t1547html.write("CurrentVersion/Image File Execution Options</li>\n <li>") t1547html.write("CurrentVersion/WinLogon/Notify</li>\n <li>") t1547html.write("CurrentVersion/WinLogon/UserInit</li>\n <li>") t1547html.write("CurrentVersion/WinLogon/Shell</li>\n <li>") t1547html.write("Manager/SafeDllSearchMode</li>\n <li>") t1547html.write("Security/Policy/Secrets</li>\n <li>") t1547html.write("emond</li>\n <li>") t1547html.write("lc_load_weak_dylib</li>\n <li>") t1547html.write("rpath</li>\n <li>") t1547html.write("loader_path</li>\n <li>") t1547html.write("executable_path</li>\n <li>") t1547html.write("ottol</li>\n <li>") t1547html.write("LD_PRELOAD</li>\n <li>") t1547html.write("DYLD_INSERT_LIBRARIES</li>\n <li>") t1547html.write("export</li>\n <li>") t1547html.write("setenv</li>\n <li>") t1547html.write("putenv</li>\n <li>") t1547html.write("os.environ</li>\n <li>") t1547html.write("ld.so.preload</li>\n <li>") t1547html.write("dlopen</li>\n <li>") t1547html.write("mmap</li>\n <li>") t1547html.write("failure</li>\n <li>") t1547html.write("modprobe</li>\n <li>") t1547html.write("insmod</li>\n <li>") t1547html.write("lsmod</li>\n <li>") t1547html.write("rmmod</li>\n <li>") t1547html.write("modinfo</li>\n <li>") t1547html.write("kextload</li>\n <li>") t1547html.write("kextunload</li>\n <li>") t1547html.write("autostart</li>\n <li>") t1547html.write("xdg</li>\n <li>") t1547html.write("autostart</li>\n <li>") t1547html.write("loginitems</li>\n <li>") t1547html.write("loginwindow</li>\n <li>") t1547html.write("SMLoginItemSetEnabled</li>\n <li>") t1547html.write("uielement</li>\n <li>") t1547html.write("quarantine</li>\n <li>") t1547html.write("startupparameters</li>") # related techniques t1547html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1037 target=\"_blank\"\">T1037</a></td>\n <td>".format(related)) t1547html.write("Boot or Logon Initialization Scripts") # mitigations t1547html.write("{}-</td>\n <td>".format(mitigations)) t1547html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1037.html", "w") as t1037html: # description t1037html.write("{}Adversaries may use scripts automatically executed at boot or logon initialization to establish persistence.<br>".format(header)) t1037html.write("Initialization scripts can be used to perform administrative functions, which may often execute other programs or send information to an internal logging server. These scripts can vary based on operating system and whether applied locally or remotely.<br>") t1037html.write("Adversaries may use these scripts to maintain persistence on a single system. Depending on the access configuration of the logon scripts, either local credentials or an administrator account may be necessary.<br>") t1037html.write("An adversary may also be able to escalate their privileges since some boot or logon initialization scripts run with higher privileges.") # information t1037html.write("{}T1037</td>\n <td>".format(headings)) # id t1037html.write("Windows, macOS</td>\n <td>") # platforms t1037html.write("Persistence, Privilege Escalation</td>\n <td>") # tactics t1037html.write("T1037.001: Logon Script (Windows)<br>T1037.002: Logon Script (Mac)<br>T1037.003: Network Logon Script<br>T1037.004: Rc.common<br>T1037.005: Startup Items") # sub-techniques # indicator regex assignments t1037html.write("{}StartupItems</li>\n <li>".format(iocs)) t1037html.write("StartupParameters</li>\n <li>") t1037html.write("init.d</li>\n <li>") t1037html.write("rc.local</li>\n <li>") t1037html.write("rc.common</li>\n <li>") t1037html.write("Environment/UserInitMprLogonScript</li>") # related techniques t1037html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1555 target=\"_blank\"\">T1555</a></td>\n <td>".format(related)) t1037html.write("Credentials from Password Stores: Credentials from Web Browsers") # mitigations t1037html.write("{}Audit</td>\n <td>".format(mitigations)) t1037html.write("Ensure extensions that are installed are the intended ones as many malicious extensions will masquerade as legitimate ones.{}".format(insert)) t1037html.write("Execution Prevention</td>\n <td>") t1037html.write("Set a browser extension allow or deny list as appropriate for your security policy.{}".format(insert)) t1037html.write("Limit Software Installation</td>\n <td>") t1037html.write("Only install browser extensions from trusted sources that can be verified. Browser extensions for some browsers can be controlled through Group Policy. Change settings to prevent the browser from installing extensions without sufficient permissions.{}".format(insert)) t1037html.write("Update Software</td>\n <td>") t1037html.write("Ensure operating systems and browsers are using the most current version.{}".format(insert)) t1037html.write("User Training</td>\n <td>") t1037html.write("Close out all browser sessions when finished using them to prevent any potentially malicious extensions from continuing to run.{}".format(footer)) with open(sd+"t1176.html", "w") as t1176html: # description t1176html.write("{}Adversaries may abuse Internet browser extensions to establish persistence access to victim systems. Browser extensions or plugins are small programs that can add functionality and customize aspects of Internet browsers.<br>".format(header)) t1176html.write("They can be installed directly or through a browser's app store and generally have access and permissions to everything that the browser can access.<br>") t1176html.write("Malicious extensions can be installed into a browser through malicious app store downloads masquerading as legitimate extensions, through social engineering, or by an adversary that has already compromised a system.<br>") t1176html.write("Security can be limited on browser app stores so it may not be difficult for malicious extensions to defeat automated scanners. Once the extension is installed, it can browse to websites in the background, steal all information that a user enters into a browser (including credentials) and be used as an installer for a RAT for persistence.<br>") t1176html.write("There have also been instances of botnets using a persistent backdoor through malicious Chrome extensions. There have also been similar examples of extensions being used for command & control.") # information t1176html.write("{}T1176</td>\n <td>".format(headings)) # id t1176html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1176html.write("Persistence</td>\n <td>") # tactics t1176html.write("-") # sub-techniques # indicator regex assignments t1176html.write("{}.mobileconfig</li>\n <li>".format(iocs)) t1176html.write("profiles</li>") # related techniques t1176html.write("{}T1554</td>\n <td>".format(related)) t1176html.write("-") # mitigations t1176html.write("{}Code Signing</td>\n <td>".format(mitigations)) t1176html.write("Ensure all application component binaries are signed by the correct application developers.{}".format(footer)) with open(sd+"t1554.html", "w") as t1554html: # description t1554html.write("{}Adversaries may modify client software binaries to establish persistent access to systems. Client software enables users to access services provided by a server.<br>".format(header)) t1554html.write("Common client software types are SSH clients, FTP clients, email clients, and web browsers.<br>") t1554html.write("Adversaries may make modifications to client software binaries to carry out malicious tasks when those applications are in use. For example, an adversary may copy source code for the client software, add a backdoor, compile for the target, and replace the legitimate application binary (or support files) with the backdoored one.<br>") t1554html.write("Since these applications may be routinely executed by the user, the adversary can leverage this for persistent access to the host.") # information t1554html.write("{}T1554</td>\n <td>".format(headings)) # id t1554html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1554html.write("Persistence</td>\n <td>") # tactics t1554html.write("-") # sub-techniques # indicator regex assignments t1554html.write("{}-".format(iocs)) # related techniques t1554html.write("{}--</a></td>\n <td>".format(related)) t1554html.write("-") # mitigations t1554html.write("{}Multi-factor Authentication</td>\n <td>".format(mitigations)) t1554html.write("Use multi-factor authentication for user and privileged accounts.{}".format(insert)) t1554html.write("Network Segmentation</td>\n <td>") t1554html.write("Configure access controls and firewalls to limit access to domain controllers and systems used to create and manage accounts.{}".format(insert)) t1554html.write("Operating System Configuration</td>\n <td>") t1554html.write("Protect domain controllers by ensuring proper security configuration for critical servers.{}".format(insert)) t1554html.write("Privileged Account Management</td>\n <td>") t1554html.write("Do not allow domain administrator accounts to be used for day-to-day operations that may expose them to potential adversaries on unprivileged systems.{}".format(footer)) with open(sd+"t1136.html", "w") as t1136html: # description t1136html.write("{}Adversaries may create an account to maintain access to victim systems. With a sufficient level of access, creating such accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.<br>".format(header)) t1136html.write("Accounts may be created on the local system or within a domain or cloud tenant. In cloud environments, adversaries may create accounts that only have access to specific services, which can reduce the chance of detection.") # information t1136html.write("{}T1136</td>\n <td>".format(headings)) # id t1136html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365</td>\n <td>") # platforms t1136html.write("Persistence</td>\n <td>") # tactics t1136html.write("T1136.001: Local Account<br>T1136.002: Domain Account<br>T1136.003: Cloud Account") # sub-techniques # indicator regex assignments t1136html.write("{}net.exe user /add</li>\n <li>".format(iocs)) t1136html.write("net.exe user /domain</li>\n <li>") t1136html.write("net1.exe user /add</li>\n <li>") t1136html.write("net1.exe user /domain</li>") # related techniques t1136html.write("{}-</a></td>\n <td>".format(related)) t1136html.write("-") # mitigations t1136html.write("{}Multi-factor Authentication</td>\n <td>".format(mitigations)) t1136html.write("Use multi-factor authentication for user and privileged accounts.{}".format(insert)) t1136html.write("Network Segmentation</td>\n <td>") t1136html.write("Configure access controls and firewalls to limit access to domain controllers and systems used to create and manage accounts.{}".format(insert)) t1136html.write("Operating System Configuration</td>\n <td>") t1136html.write("Protect domain controllers by ensuring proper security configuration for critical servers.{}".format(insert)) t1136html.write("Privileged Account Management</td>\n <td>") t1136html.write("Do not allow domain administrator accounts to be used for day-to-day operations that may expose them to potential adversaries on unprivileged systems.{}".format(footer)) with open(sd+"t1543.html", "w") as t1543html: # description t1543html.write("{}Adversaries may create or modify system-level processes to repeatedly execute malicious payloads as part of persistence. When operating systems boot up, they can start processes that perform background system functions.<br>".format(header)) t1543html.write("On Windows and Linux, these system processes are referred to as services. On macOS, launchd processes known as Launch Daemon and Launch Agent are run to finish system initialization and load user specific parameters.<br>") t1543html.write("Adversaries may install new services, daemons, or agents that can be configured to execute at startup or a repeatable interval in order to establish persistence. Similarly, adversaries may modify existing services, daemons, or agents to achieve the same effect.<br>") t1543html.write("Services, daemons, or agents may be created with administrator privileges but executed under root/SYSTEM privileges. Adversaries may leverage this functionality to create or modify system processes in order to escalate privileges.") # information t1543html.write("{}T1543</td>\n <td>".format(headings)) # id t1543html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1543html.write("Persistence, Privilege Escalation</td>\n <td>") # tactics t1543html.write("T1543.001: Launch Agent<br>T1543.002: Systemd Service<br>T1543.003: Windows Service<br>T1543.004: Launch Daemon") # sub-techniques # indicator regex assignments t1543html.write("{}services.exe</li>\n <li>".format(iocs)) t1543html.write("sc.exe</li>\n <li>") t1543html.write("WinExec</li>\n <li>") t1543html.write(".services</li>\n <li>") t1543html.write("LaunchAgent</li>\n <li>") t1543html.write("LaunchDaemon</li>\n <li>") t1543html.write("systemctl</li>") # related techniques t1543html.write("{}-</a></td>\n <td>".format(related)) t1543html.write("-") # mitigations t1543html.write("{}Audit</td>\n <td>".format(mitigations)) t1543html.write("Use auditing tools capable of detecting privilege and service abuse opportunities on systems within an enterprise and correct them.{}".format(insert)) t1543html.write("Limit Software Installation</td>\n <td>") t1543html.write("Restrict software installation to trusted repositories only and be cautious of orphaned software packages.{}".format(insert)) t1543html.write("Restrict File and Directory Permissions</td>\n <td>") t1543html.write("Restrict read/write access to system-level process files to only select privileged users who have a legitimate need to manage system services.{}".format(insert)) t1543html.write("User Account Management</td>\n <td>") t1543html.write("Limit privileges of user accounts and groups so that only authorized administrators can interact with system-level process changes and service configurations.{}".format(footer)) with open(sd+"t1546.html", "w") as t1546html: # description t1546html.write("{}Adversaries may establish persistence and/or elevate privileges using system mechanisms that trigger execution based on specific events. Various operating systems have means to monitor and subscribe to events such as logons or other user activity such as running specific applications/binaries.<br>".format(header)) t1546html.write("Adversaries may abuse these mechanisms as a means of maintaining persistent access to a victim via repeatedly executing malicious code. After gaining access to a victim system, adversaries may create/modify event triggers to point to malicious content that will be executed whenever the event trigger is invoked.<br>") t1546html.write("Since the execution can be proxied by an account with higher permissions, such as SYSTEM or service accounts, an adversary may be able to abuse these triggered execution mechanisms to escalate their privileges.") # information t1546html.write("{}T1546</td>\n <td>".format(headings)) # id t1546html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1546html.write("Persistence, Privilege Escalation</td>\n <td>") # tactics t1546html.write("T1546.001: Change Default File Association<br>T1546.002: Screensaver<br>T1546.003: Windows Management Instrumentation Event Subscription<br>T1546.004: .bash_profile and .bashrc<br>T1546.005: Trap<br>T1546.006: LC_LOAD_DYLIB Addition<br>T1546.007: Netsh Helper DLL<br>T1546.008: Accessibility Features<br>T1546.009: AppCert DLLs<br>T1546.010: AppInit DLLs<br>T1546.011: Application Shimming<br>T1546.012: Image File Execution Options Injection<br>T1546.013: PowerShell Profile<br>T1546.014: emond<br>T1546.015: Component Object Model Hijacking") # sub-techniques # indicator regex assignments t1546html.write("{}Event IDs: 5861</li>\n <li>".format(iocs)) t1546html.write("atbroker</li>\n <li>") t1546html.write("displayswitch</li>\n <li>") t1546html.write("magnify</li>\n <li>") t1546html.write("narrator</li>\n <li>") t1546html.write("osk</li>\n <li>") t1546html.write("sethc</li>\n <li>") t1546html.write("utilman</li>\n <li>") t1546html.write("scrnsave</li>\n <li>") t1546html.write("ntsd</li>\n <li>") t1546html.write("WmiPrvSe</li>\n <li>") t1546html.write("sysmain.sdb</li>\n <li>") t1546html.write("profile</li>\n <li>") t1546html.write("CreateProcess</li>\n <li>") t1546html.write("WinExec</li>\n <li>") t1546html.write("Register-WmiEvent</li>\n <li>") t1546html.write("EventFilter</li>\n <li>") t1546html.write("EventConsumer</li>\n <li>") t1546html.write("FilterToConsumerBinding</li>\n <li>") t1546html.write(".mof</li>\n <li>") t1546html.write("debug only this process</li>\n <li>") t1546html.write("debug process</li>\n <li>") t1546html.write("CurrentControlSet/Control/Session Manager</li>\n <li>") t1546html.write("CurrentVersion/AppCompatFlags/InstalledSDB</li>\n <li>") t1546html.write("CurrentVersion/Explorer/FileExts</li>\n <li>") t1546html.write("CurrentVersion/Image File Execution Options</li>\n <li>") t1546html.write("CurrentVersion/Windows</li>\n <li>") t1546html.write("Software/Microsoft/Netsh</li>\n <li>") t1546html.write("emond</li>\n <li>") t1546html.write("lc_code_signature</li>\n <li>") t1546html.write("lc_load_dylib</li>\n <li>") t1546html.write("profile\\.d</li>\n <li>") t1546html.write("bash_profile</li>\n <li>") t1546html.write("bashrc</li>\n <li>") t1546html.write("bash_login</li>\n <li>") t1546html.write("bash_logout</li>\n <li>") t1546html.write("trap</li>\n <li>") t1546html.write("zshrc</li>\n <li>") t1546html.write("zshenv</li>\n <li>") t1546html.write("zlogout</li>\n <li>") t1546html.write("zlogin</li>") # related techniques t1546html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1222 target=\"_blank\"\">T1222</a></td>\n <td>".format(related)) t1546html.write("File and Directory Permissions Modification") # mitigations t1546html.write("{}-</td>\n <td>".format(mitigations)) t1546html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1574.html", "w") as t1574html: # description t1574html.write("{}Adversaries may execute their own malicious payloads by hijacking the way operating systems run programs. Hijacking execution flow can be for the purposes of persistence, since this hijacked execution may reoccur over time.<br>".format(header)) t1574html.write("Adversaries may also use these mechanisms to elevate privileges or evade defenses, such as application control or other restrictions on execution.<br>") t1574html.write("There are many ways an adversary may hijack the flow of execution, including by manipulating how the operating system locates programs to be executed. How the operating system locates libraries to be used by a program can also be intercepted.<br>") t1574html.write("Locations where the operating system looks for programs/resources, such as file directories and in the case of Windows the Registry, could also be poisoned to include malicious payloads.") # information t1574html.write("{}T1574</td>\n <td>".format(headings)) # id t1574html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1574html.write("Persistence, Privilege Escalation, Defense Evasion</td>\n <td>") # tactics t1574html.write("T1574.001: DLL Search Order Hijacking<br>T1574.002: DLL Side-Loading<br>T1574.004: Dylib Hijacking<br>T1574.005: Executable Installer File Permissions Weakness<br>T1574.006: LD_PRELOAD<br>T1574.007: Path Interception by PATH Environment Variable<br>T1574.008: Path Interception by Search Order Hijacking<br>T1574.009: Path Interception by Unquoted Path<br>T1574.010: Services File Permissions Weakness<br>T1574.011: Services Registry Permissions Weakness<br>T1574.012: COR_PROFILER") # sub-techniques # indicator regex assignments t1574html.write("{}.local</li>\n <li>".format(iocs)) t1574html.write(".manifest</li>\n <li>") t1574html.write("net.exe use</li>\n <li>") t1574html.write("net1.exe use</li>\n <li>") t1574html.write("CurrentControlSet/Services/</li>\n <li>") t1574html.write("LC_CODE_SIGNATURE</li>\n <li>") t1574html.write("LC_LOAD_DYLIB</li>") # related techniques t1574html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1548 target=\"_blank\"\">T1548.002</a></td>\n <td>".format(related)) t1574html.write("Abuse Elevation Control Mechanism: Bypass User Account Control") # mitigations t1574html.write("{}Application Developer Guidance</td>\n <td>".format(mitigations)) t1574html.write("When possible, include hash values in manifest files to help prevent side-loading of malicious libraries.{}".format(insert)) t1574html.write("Audit</td>\n <td>") t1574html.write("Use auditing tools capable of detecting hijacking opportunities on systems within an enterprise and correct them. Toolkits like the PowerSploit framework contain PowerUp modules that can be used to explore systems for hijacking weaknesses. Use the program sxstrace.exe that is included with Windows along with manual inspection to check manifest files for side-loading vulnerabilities in software. Find and eliminate path interception weaknesses in program configuration files, scripts, the PATH environment variable, services, and in shortcuts by surrounding PATH variables with quotation marks when functions allow for them. Be aware of the search order Windows uses for executing or loading binaries and use fully qualified paths wherever appropriate. Clean up old Windows Registry keys when software is uninstalled to avoid keys with no associated legitimate binaries. Periodically search for and correct or report path interception weaknesses on systems that may have been introduced using custom or available tools that report software using insecure path configurations.{}".format(insert)) t1574html.write("Execution Prevention</td>\n <td>") t1574html.write("Adversaries may use new payloads to execute this technique. Identify and block potentially malicious software executed through hijacking by using application control solutions also capable of blocking libraries loaded by legitimate software.{}".format(insert)) t1574html.write("Restrict File and Directory Permissions</td>\n <td>") t1574html.write("Install software in write-protected locations. Set directory access controls to prevent file writes to the search paths for applications, both in the folders where applications are run from and the standard library folders.{}".format(insert)) t1574html.write("Restrict Library Loading</td>\n <td>") t1574html.write("Disallow loading of remote DLLs. This is included by default in Windows Server 2012+ and is available by patch for XP+ and Server 2003+. Enable Safe DLL Search Mode to force search for system DLLs in directories with greater restrictions (e.g. %SYSTEMROOT%)to be used before local directory DLLs (e.g. a user's home directory)<br>The Safe DLL Search Mode can be enabled via Group Policy at Computer Configuration > [Policies] > Administrative Templates > MSS (Legacy): MSS: (SafeDllSearchMode) Enable Safe DLL search mode. The associated Windows Registry key for this is located at HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\SafeDLLSearchMode{}".format(insert)) t1574html.write("Restrict Registry Permissions</td>\n <td>") t1574html.write("Ensure proper permissions are set for Registry hives to prevent users from modifying keys for system components that may lead to privilege escalation.{}".format(insert)) t1574html.write("Update Software</td>\n <td>") t1574html.write("Update software regularly to include patches that fix DLL side-loading vulnerabilities.{}".format(insert)) t1574html.write("User Account Control</td>\n <td>") t1574html.write("Turn off UAC's privilege elevation for standard users [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System] to automatically deny elevation requests, add: \"ConsentPromptBehaviorUser\"=dword:00000000. Consider enabling installer detection for all users by adding: \"EnableInstallerDetection\"=dword:00000001. This will prompt for a password for installation and also log the attempt. To disable installer detection, instead add: \"EnableInstallerDetection\"=dword:00000000. This may prevent potential elevation of privileges through exploitation during the process of UAC detecting the installer, but will allow the installation process to continue without being logged.{}".format(insert)) t1574html.write("User Account Management</td>\n <td>") t1574html.write("Limit privileges of user accounts and groups so that only authorized administrators can interact with service changes and service binary target path locations. Deny execution from user directories such as file download directories and temp directories where able.<>Ensure that proper permissions and directory access control are set to deny users the ability to write files to the top-level directory C: and system directories, such as C:\\Windows\\, to reduce places where malicious files could be placed for execution.{}".format(footer)) with open(sd+"t1525.html", "w") as t1525html: # description t1525html.write("{}Adversaries may implant cloud container images with malicious code to establish persistence. Amazon Web Service (AWS) Amazon Machine Images (AMI), Google Cloud Platform (GCP) Images, and Azure Images as well as popular container runtimes such as Docker can be implanted or backdoored.<br>".format(header)) t1525html.write("Depending on how the infrastructure is provisioned, this could provide persistent access if the infrastructure provisioning tool is instructed to always use the latest image.<br>") t1525html.write("A tool has been developed to facilitate planting backdoors in cloud container images. If an attacker has access to a compromised AWS instance, and permissions to list the available container images, they may implant a backdoor such as a Web Shell.<br>") t1525html.write("Adversaries may also implant Docker images that may be inadvertently used in cloud deployments, which has been reported in some instances of cryptomining botnets.") # information t1525html.write("{}T1525</td>\n <td>".format(headings)) # id t1525html.write("AWS, Azure, GCP</td>\n <td>") # platforms t1525html.write("Persistence</td>\n <td>") # tactics t1525html.write("-") # sub-techniques # indicator regex assignments t1525html.write("{}-".format(iocs)) # related techniques t1525html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1505 target=\"_blank\"\">T1505</a></td>\n <td>".format(related)) t1525html.write("Server Software Component: Web Shell") # mitigations t1525html.write("{}Audit</td>\n <td>".format(mitigations)) t1525html.write("Periodically check the integrity of images and containers used in cloud deployments to ensure they have not been modified to include malicious software.{}".format(insert)) t1525html.write("Code Signing</td>\n <td>") t1525html.write("Several cloud service providers support content trust models that require container images be signed by trusted sources.{}".format(insert)) t1525html.write("Privileged Account Management</td>\n <td>") t1525html.write("Limit permissions associated with creating and modifying platform images or containers based on the principle of least privilege.{}".format(footer)) with open(sd+"t1556.html", "w") as t1556html: # description t1556html.write("{}Adversaries may modify authentication mechanisms and processes to access user credentials or enable otherwise unwarranted access to accounts.<br>".format(header)) t1556html.write("The authentication process is handled by mechanisms, such as the Local Security Authentication Server (LSASS) process and the Security Accounts Manager (SAM) on Windows or pluggable authentication modules (PAM) on Unix-based systems, responsible for gathering, storing, and validating credentials.<br>") t1556html.write("Adversaries may maliciously modify a part of this process to either reveal credentials or bypass authentication mechanisms.<br>") t1556html.write("Compromised credentials or access may be used to bypass access controls placed on various resources on systems within the network and may even be used for persistent access to remote systems and externally available services, such as VPNs, Outlook Web Access and remote desktop.") # information t1556html.write("{}T1556</td>\n <td>".format(headings)) # id t1556html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1556html.write("Defense Evasion, Credential Access</td>\n <td>") # tactics t1556html.write("T1556.001: Domain Controller Authentication<br>T1556.002: Password Filter DLL<br>T1556.003: Pluggable Authentication Modules<br>T1556.004: Network Device Authenticiation") # sub-techniques # indicator regex assignments t1556html.write("{}OpenProcess</li>\n <li>".format(iocs)) t1556html.write("lsass</li>\n <li>") t1556html.write("CurrentControlSet/Control/Lsa</li>\n <li>") t1556html.write("pam_unix.so</li>\n <li>") t1556html.write("etc/passwd</li>\n <li>") t1556html.write("etc/shadow</li>") # related techniques t1556html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(related)) t1556html.write("Valid Accounts") # mitigations t1556html.write("{}Multi-factor Authentication</td>\n <td>".format(mitigations)) t1556html.write("Integrating multi-factor authentication (MFA) as part of organizational policy can greatly reduce the risk of an adversary gaining control of valid credentials that may be used for additional tactics such as initial access, lateral movement, and collecting information. MFA can also be used to restrict access to cloud resources and APIs.{}".format(insert)) t1556html.write("Operating System Configuration</td>\n <td>") t1556html.write("Ensure only valid password filters are registered. Filter DLLs must be present in Windows installation directory (C:\\Windows\\System32\\ by default) of a domain controller and/or local computer with a corresponding entry in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Notification Packages.{}".format(insert)) t1556html.write("Privileged Account Management</td>\n <td>") t1556html.write("Audit domain and local accounts as well as their permission levels routinely to look for situations that could allow an adversary to gain wide access by obtaining credentials of a privileged account. These audits should also include if default accounts have been enabled, or if new local accounts are created that have not be authorized. Follow best practices for design and administration of an enterprise network to limit privileged account use across administrative tiers. Limit access to the root account and prevent users from modifying protected components through proper privilege separation (ex SELinux, grsecurity, AppArmor, etc.) and limiting Privilege Escalation opportunities.{}".format(insert)) t1556html.write("Privileged Process Integrity</td>\n <td>") t1556html.write("Enabled features, such as Protected Process Light (PPL), for LSA.{}".format(insert)) t1556html.write("Restrict File and Directory Permissions</td>\n <td>") t1556html.write("Restrict write access to the /Library/Security/SecurityAgentPlugins directory.{}".format(footer)) with open(sd+"t1137.html", "w") as t1137html: # description t1137html.write("{}Adversaries may leverage Microsoft Office-based applications for persistence between startups. Microsoft Office is a fairly common application suite on Windows-based operating systems within an enterprise network.<br>".format(header)) t1137html.write("There are multiple mechanisms that can be used with Office for persistence when an Office-based application is started; this can include the use of Office Template Macros and add-ins.<br>") t1137html.write("A variety of features have been discovered in Outlook that can be abused to obtain persistence, such as Outlook rules, forms, and Home Page. These persistence mechanisms can work within Outlook or be used through Office 365.") # information t1137html.write("{}T1137</td>\n <td>".format(headings)) # id t1137html.write("Windows, Office 365</td>\n <td>") # platforms t1137html.write("Persistence</td>\n <td>") # tactics t1137html.write("T1137.001: Office Template Macros<br>T1137.002: Office Test<br>T1137.003: Outlook Forms<br>T1137.004: Outlook Home Page<br>T1137.005: Outlook Rules<br>T1137.006: Add-ins") # sub-techniques # indicator regex assignments t1137html.write("{}.docm</li>\n <li>".format(iocs)) t1137html.write(".xlsm</li>\n <li>") t1137html.write("pptm</li>\n <li>") t1137html.write("Normal.dotm</li>\n <li>") t1137html.write("PERSONAL.xlsb</li>") # related techniques t1137html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1203 target=\"_blank\"\">T1203</a></td>\n <td>".format(related)) t1137html.write("Exploitation for Client Execution") t1137html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1204 target=\"_blank\"\">T1204</a></td>\n <td>".format(insert)) t1137html.write("User Execution") # mitigations t1137html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1137html.write("Follow Office macro security best practices suitable for your environment. Disable Office VBA macros from executing. Disable Office add-ins. If they are required, follow best practices for securing them by requiring them to be signed and disabling user notification for allowing add-ins. For some add-ins types (WLL, VBA) additional mitigation is likely required as disabling add-ins in the Office Trust Center does not disable WLL nor does it prevent VBA code from executing.{}".format(insert)) t1137html.write("Software Configuration</td>\n <td>") t1137html.write("For the Office Test method, create the Registry key used to execute it and set the permissions to \"Read Control\" to prevent easy access to the key without administrator permissions or requiring Privilege Escalation.{}".format(insert)) t1137html.write("Update Software</td>\n <td>") t1137html.write("For the Outlook methods, blocking macros may be ineffective as the Visual Basic engine used for these features is separate from the macro scripting engine. Microsoft has released patches to try to address each issue. Ensure KB3191938 which blocks Outlook Visual Basic and displays a malicious code warning, KB4011091 which disables custom forms by default, and KB4011162 which removes the legacy Home Page feature, are applied to systems.{}".format(footer)) with open(sd+"t1542.html", "w") as t1542html: # description t1542html.write("{}Adversaries may abuse Pre-OS Boot mechanisms as a way to establish persistence on a system. During the booting process of a computer, firmware and various startup services are loaded before the operating system.<br>".format(header)) t1542html.write("These programs control flow of execution before the operating system takes control.<br>") t1542html.write("Adversaries may overwrite data in boot drivers or firmware such as BIOS (Basic Input/Output System) and The Unified Extensible Firmware Interface (UEFI) to persist on systems at a layer below the operating system.<br>") t1542html.write("This can be particularly difficult to detect as malware at this level will not be detected by host software-based defenses.") # information t1542html.write("{}T1542</td>\n <td>".format(headings)) # id t1542html.write("Windows, Linux</td>\n <td>") # platforms t1542html.write("Persistence, Defense Evasion</td>\n <td>") # tactics t1542html.write("T1542.001: System Firmware<br>T1542.002: Component Firmware<br>T1542.003: Bootkit<br>T1542.004: ROMMONkit<br>T1542.005: TFTP Boot") # sub-techniques # indicator regex assignments t1542html.write("{}-".format(iocs)) # related techniques t1542html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1200 target=\"_blank\"\">T1200</a></td>\n <td>".format(related)) t1542html.write("Hardware Additions") # mitigations t1542html.write("{}Boot Integrity</td>\n <td>".format(mitigations)) t1542html.write("Use Trusted Platform Module technology and a secure or trusted boot process to prevent system integrity from being compromised. Check the integrity of the existing BIOS or EFI to determine if it is vulnerable to modification.{}".format(insert)) t1542html.write("Privileged Account Management</td>\n <td>") t1542html.write("Ensure proper permissions are in place to help prevent adversary access to privileged accounts necessary to perform these actions.{}".format(insert)) t1542html.write("Update Software</td>\n <td>") t1542html.write("Patch the BIOS and EFI as necessary.{}".format(footer)) with open(sd+"t1505.html", "w") as t1505html: # description t1505html.write("{}Adversaries may abuse legitimate extensible development features of servers to establish persistent access to systems.<br>".format(header)) t1505html.write("Enterprise server applications may include features that allow developers to write and install software or scripts to extend the functionality of the main application.<br>") t1505html.write("Adversaries may install malicious components to extend and abuse server applications.") # information t1505html.write("{}T1505</td>\n <td>".format(headings)) # id t1505html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1505html.write("Persistence</td>\n <td>") # tactics t1505html.write("T1505.001: SQL Stored Procedures<br>T1505.002: Transport Agent<br>T1505.003: Web Shell") # sub-techniques # indicator regex assignments t1505html.write("{}-".format(iocs)) # related techniques t1505html.write("{}-</a></td>\n <td>".format(related)) t1505html.write("-") # mitigations t1505html.write("{}Audit</td>\n <td>".format(mitigations)) t1505html.write("Regularly check component software on critical services that adversaries may target for persistence to verify the integrity of the systems and identify if unexpected changes have been made.{}".format(insert)) t1505html.write("Code Signing</td>\n <td>") t1505html.write("Ensure all application component binaries are signed by the correct application developers.{}".format(insert)) t1505html.write("Privileged Account Management</td>\n <td>") t1505html.write("Do not allow administrator accounts that have permissions to add component software on these services to be used for day-to-day operations that may expose them to potential adversaries on unprivileged systems.{}".format(footer)) with open(sd+"t1205.html", "w") as t1205html: # description t1205html.write("{}Adversaries may use traffic signaling to hide open ports or other malicious functionality used for persistence or command and control.<br>".format(header)) t1205html.write("Traffic signaling involves the use of a magic value or sequence that must be sent to a system to trigger a special response, such as opening a closed port or executing a malicious task.<br>") t1205html.write("This may take the form of sending a series of packets with certain characteristics before a port will be opened that the adversary can use for command and control.<br>") t1205html.write("Usually this series of packets consists of attempted connections to a predefined sequence of closed ports (i.e. Port Knocking), but can involve unusual flags, specific strings, or other unique characteristics.<br>") t1205html.write("After the sequence is completed, opening a port may be accomplished by the host-based firewall, but could also be implemented by custom software.<br>") t1205html.write("Adversaries may also communicate with an already open port, but the service listening on that port will only respond to commands or trigger other malicious functionality if passed the appropriate magic value(s).<br>") t1205html.write("The observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r, is to use the libpcap libraries to sniff for the packets in question.<br>") t1205html.write("Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.") # information t1205html.write("{}T1205</td>\n <td>".format(headings)) # id t1205html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1205html.write("Persistence, Defense Evasion, Command &amp; Control</td>\n <td>") # tactics t1205html.write("T1205.001: Port Knocking") # sub-techniques # indicator regex assignments t1205html.write("{}-".format(iocs)) # related techniques t1205html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1556 target=\"_blank\"\">T1556.004</a></td>\n <td>".format(related)) t1205html.write("Modify Authentication Process: Network Device Authentication") t1205html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1601 target=\"_blank\"\">T1601.001</a></td>\n <td>".format(insert)) t1205html.write("Modify System Image: Patch System Image") # mitigations t1205html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1205html.write("Disable Wake-on-LAN if it is not needed within an environment.{}".format(insert)) t1205html.write("Filter Network Traffic</td>\n <td>") t1205html.write("Mitigation of some variants of this technique could be achieved through the use of stateful firewalls, depending upon how it is implemented.{}".format(footer)) # Privilege Escalation with open(sd+"t1548.html", "w") as t1548html: # description t1548html.write("{}Adversaries may circumvent mechanisms designed to control elevate privileges to gain higher-level permissions. Most modern systems contain native elevation control mechanisms that are intended to limit privileges that a user can perform on a machine.<br>".format(header)) t1548html.write("Authorization has to be granted to specific users in order to perform tasks that can be considered of higher risk. An adversary can perform several methods to take advantage of built-in control mechanisms in order to escalate privileges on a system.") # information t1548html.write("{}T1574</td>\n <td>".format(headings)) # id t1548html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1548html.write("Privilege Escalation, Defense Evasion</td>\n <td>") # tactics t1548html.write("T1574.001: Setuid and Setgid<br>T1574.002: Bypass User Access Control<br>T1574.003: Sudo and Sudo Caching<br>T1574.004: Elevated Execution with Prompt") # sub-techniques # indicator regex assignments t1548html.write("{}eventvwr.exe</li>\n <li>".format(iocs)) t1548html.write("sdclt.exe</li>\n <li>") t1548html.write("CurrentVersion/App Paths</li>\n <li>") t1548html.write("Software/Classes/ms-settings/shell/open/command</li>\n <li>") t1548html.write("CurrentVersion/App Paths</li>\n <li>") t1548html.write("Software/Classes/mscfile/shell/open/command</li>\n <li>") t1548html.write("Software/Classes/exefile/shell/runas/command/isolatedcommand</li>\n <li>") t1548html.write("AuthorizationExecuteWithPrivileges</li>\n <li>") t1548html.write("security_authtrampoline</li>\n <li>") t1548html.write("chmod</li>\n <li>") t1548html.write("kill</li>\n <li>") t1548html.write("sudo</li>\n <li>") t1548html.write("timestamp_timeout</li>\n <li>") t1548html.write("tty_tickets</li>") # related techniques t1548html.write("{}-</a></td>\n <td>".format(related)) t1548html.write("-") # mitigations t1548html.write("{}Audit</td>\n <td>".format(mitigations)) t1548html.write("Check for common UAC bypass weaknesses on Windows systems to be aware of the risk posture and address issues where appropriate.{}".format(insert)) t1548html.write("Execution Prevention</td>\n <td>") t1548html.write("System settings can prevent applications from running that haven't been downloaded from legitimate repositories which may help mitigate some of these issues. Not allowing unsigned applications from being run may also mitigate some risk.{}".format(insert)) t1548html.write("Operating System Configuration</td>\n <td>") t1548html.write("Applications with known vulnerabilities or known shell escapes should not have the setuid or setgid bits set to reduce potential damage if an application is compromised. Additionally, the number of programs with setuid or setgid bits set should be minimized across a system. Ensuring that the sudo tty_tickets setting is enabled will prevent this leakage across tty sessions.{}".format(insert)) t1548html.write("Privileged Account Management</td>\n <td>") t1548html.write("Remove users from the local administrator group on systems. By requiring a password, even if an adversary can get terminal access, they must know the password to run anything in the sudoers file. Setting the timestamp_timeout to 0 will require the user to input their password every time sudo is executed.{}".format(insert)) t1548html.write("Restrict File and Directory Permissions</td>\n <td>") t1548html.write("The sudoers file should be strictly edited such that passwords are always required and that users can't spawn risky processes as users with higher privilege.{}".format(insert)) t1548html.write("User Account Control</td>\n <td>") t1548html.write("Although UAC bypass techniques exist, it is still prudent to use the highest enforcement level for UAC when possible and mitigate bypass opportunities that exist with techniques such as DLL Search Order Hijacking.{}".format(footer)) with open(sd+"t1134.html", "w") as t1134html: # description t1134html.write("{}Adversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process.<br>".format(header)) t1134html.write("A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token.<br>") t1134html.write("An adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. These token can then be applied to an existing process (i.e. Token Impersonation/Theft) or used to spawn a new process (i.e. Create Process with Token).<br>") t1134html.write("An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can then use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.<br>") t1134html.write("Any standard user can use the runas command, and the Windows API functions, to create impersonation tokens; it does not require access to an administrator account. There are also other mechanisms, such as Active Directory fields, that can be used to modify access tokens.") # information t1134html.write("{}T1134</td>\n <td>".format(headings)) # id t1134html.write("Windows</td>\n <td>") # platforms t1134html.write("Privilege Escalation, Defense Evasion</td>\n <td>") # tactics t1134html.write("T1134.001: Token Impersonation/Theft<br>T1134.002: Create Process with Token<br>T1134.003: Make and Impersonate Token<br>T1134.004: Parent PID Spoofing<br>T1134.005: SID-History Injection") # sub-techniques # indicator regex assignments t1134html.write("{}Get-ADUser</li>\n <li>".format(iocs)) t1134html.write("DsAddSidHistory</li>\n <li>") t1134html.write("CreateProcess</li>\n <li>") t1134html.write("DuplicateToken</li>\n <li>") t1134html.write("ImpersonateLoggedOnUser</li>\n <li>") t1134html.write("runas</li>\n <li>") t1134html.write("SetThreadToken</li>\n <li>") t1134html.write("ImpersonateNamedPipeClient</li>\n <li>") t1134html.write("UpdateProcThreadAttribute</li>\n <li>") t1134html.write("LogonUser</li>") # related techniques t1134html.write("{}--</a></td>\n <td>".format(related)) t1134html.write("-") # mitigations t1134html.write("{}Privileged Account Management</td>\n <td>".format(mitigations)) t1134html.write("Limit permissions so that users and user groups cannot create tokens. This setting should be defined for the local system account only. GPO: Computer Configuration > [Policies] > Windows Settings > Security Settings > Local Policies > User Rights Assignment: Create a token object. Also define who can create a process level token to only the local and network service through GPO: Computer Configuration > [Policies] > Windows Settings > Security Settings > Local Policies > User Rights Assignment: Replace a process level token. Administrators should log in as a standard user but run their tools with administrator privileges using the built-in access token manipulation command runas.{}".format(insert)) t1134html.write("User Account Management</td>\n <td>") t1134html.write("An adversary must already have administrator level access on the local system to make full use of this technique; be sure to restrict users and accounts to the least privileges they require.{}".format(footer)) with open(sd+"t1484.html", "w") as t1484html: # description t1484html.write("{}Adversaries may modify Group Policy Objects (GPOs) to subvert the intended discretionary access controls for a domain, usually with the intention of escalating privileges on the domain. Group policy allows for centralized management of user and computer settings in Active Directory (AD).<br>".format(header)) t1484html.write("GPOs are containers for group policy settings made up of files stored within a predicable network path \\<DOMAIN>\\SYSVOL\\<DOMAIN>\\Policies\\.<br>") t1484html.write("Like other objects in AD, GPOs have access controls associated with them. By default all user accounts in the domain have permission to read GPOs. It is possible to delegate GPO access control permissions, e.g. write access, to specific users or groups in the domain.<br>") t1484html.write("Malicious GPO modifications can be used to implement many other malicious behaviors such as Scheduled Task/Job, Disable or Modify Tools, Ingress Tool Transfer, Create Account, Service Execution, and more.<br>") t1484html.write("Since GPOs can control so many user and machine settings in the AD environment, there are a great number of potential attacks that can stem from this GPO abuse.<br>") t1484html.write("For example, publicly available scripts such as New-GPOImmediateTask can be leveraged to automate the creation of a malicious Scheduled Task/Job by modifying GPO settings, in this case modifying <GPO_PATH>\\Machine\\Preferences\\ScheduledTasks\\ScheduledTasks.xml.<br>") t1484html.write("In some cases an adversary might modify specific user rights like SeEnableDelegationPrivilege, set in <GPO_PATH>\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf, to achieve a subtle AD backdoor with complete control of the domain because the user account under the adversary's control would then be able to modify GPOs.") # information t1484html.write("{}T1484</td>\n <td>".format(headings)) # id t1484html.write("Windows</td>\n <td>") # platforms t1484html.write("Privilege Escalation, Defense Evasion</td>\n <td>") # tactics t1484html.write("T1484.001: Group Policy Modification<br>T1484.002: Domain Trust Modification") # sub-techniques # indicator regex assignments t1484html.write("{}Event IDs: 307, 510, 4672, 4704, 5136, 5137, 5138, 5139, 5141</li>\n <li>".format(iocs)) t1484html.write("GptTmpl.inf</li>\n <li>") t1484html.write("ScheduledTasks.xml</li>\n <li>") t1484html.write("New-GPOImmediateTask</li>") # related techniques t1484html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1053 target=\"_blank\"\">T1053</a></td>\n <td>".format(related)) t1484html.write("Scheduled Task/Job") t1484html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1562 target=\"_blank\"\">T1562.001</a></td>\n <td>".format(insert)) t1484html.write("Impair Defenses: Disable or Modify Tools") t1484html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1105 target=\"_blank\"\">T1105</a></td>\n <td>".format(insert)) t1484html.write("Ingress Tool Transfer") t1484html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1136 target=\"_blank\"\">T1136</a></td>\n <td>".format(insert)) t1484html.write("Create Account") t1484html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1569 target=\"_blank\"\">T1569</a></td>\n <td>".format(insert)) t1484html.write("System Services: Service Execution") t1484html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1207 target=\"_blank\"\">T1207</a></td>\n <td>".format(insert)) t1484html.write("Rogue Domain Controller") # mitigations t1484html.write("{}Audit</td>\n <td>".format(mitigations)) t1484html.write("Identify and correct GPO permissions abuse opportunities (ex: GPO modification privileges) using auditing tools such as BloodHound (version 1.5.1 and later){}".format(insert)) t1484html.write("Privileged Account Management</td>\n <td>") t1484html.write("Use least privilege and protect administrative access to the Domain Controller and Active Directory Federation Services (AD FS) server. Do not create service accounts with administrative privileges.{}".format(insert)) t1484html.write("User Account Management</td>\n <td>") t1484html.write("Consider implementing WMI and security filtering to further tailor which users and computers a GPO will apply to.{}".format(footer)) with open(sd+"t1611.html", "w") as t1611html: # description t1611html.write("{}Adversaries may break out of a container to gain access to the underlying host. This can allow an adversary access to other containerized resources from the host level or to the host itself. In principle, containerized resources should provide a clear separation of application functionality and be isolated from the host environment.<br>".format(header)) t1611html.write("There are multiple ways an adversary may escape to a host environment. Examples include creating a container configured to mount the host’s filesystem using the bind parameter, which allows the adversary to drop payloads and execute control utilities such as cron on the host, and utilizing a privileged container to run commands on the underlying host. Gaining access to the host may provide the adversary with the opportunity to achieve follow-on objectives, such as establishing persistence, moving laterally within the environment, or setting up a command and control channel on the host.") # information t1611html.write("{}T1611</td>\n <td>".format(headings)) # id t1611html.write("Windows, Linux, Containers</td>\n <td>") # platforms t1611html.write("Privilege Escalation</td>\n <td>") # tactics t1611html.write("-") # sub-techniques # indicator regex assignments t1611html.write("{}-".format(iocs)) # related techniques t1611html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1612 target=\"_blank\"\">T1612</a></td>\n <td>".format(related)) t1611html.write("Build Image on Host") # mitigations t1611html.write("{}Application Isolation and Sandboxing</td>\n <td>".format(mitigations)) t1611html.write("Ensure all COM alerts and Protected View are enabled.{}".format(insert)) t1611html.write("Behavior Prevention on Endpoint</td>\n <td>") t1611html.write("Consider utilizing seccomp, seccomp-bpf, or a similar solution that restricts certain system calls such as mount.{}".format(insert)) t1611html.write("Execution Prevention</td>\n <td>") t1611html.write("Use read-only containers and minimal images when possible to prevent the running of commands.{}".format(insert)) t1611html.write("Privileged Account Management</td>\n <td>") t1611html.write("Ensure containers are not running as root by default.") with open(sd+"t1068.html", "w") as t1068html: # description t1068html.write("{}Adversaries may exploit software vulnerabilities in an attempt to collect elevate privileges. Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.<br>".format(header)) t1068html.write("Security constructs such as permission levels will often hinder access to information and use of certain techniques, so adversaries will likely need to perform privilege escalation to include use of software exploitation to circumvent those restrictions.<br>") t1068html.write("When initially gaining access to a system, an adversary may be operating within a lower privileged process which will prevent them from accessing certain resources on the system.<br>") t1068html.write("Vulnerabilities may exist, usually in operating system components and software commonly running at higher permissions, that can be exploited to gain higher levels of access on the system. This could enable someone to move from unprivileged or user level permissions to SYSTEM or root permissions depending on the component that is vulnerable.<br>") t1068html.write("This may be a necessary step for an adversary compromising a endpoint system that has been properly configured and limits other privilege escalation methods.") # information t1068html.write("{}T1068</td>\n <td>".format(headings)) # id t1068html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1068html.write("Privilege Escalation</td>\n <td>") # tactics t1068html.write("-") # sub-techniques # indicator regex assignments t1068html.write("{}-".format(iocs)) # related techniques t1068html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1105 target=\"_blank\"\">T1105</a></td>\n <td>".format(related)) t1068html.write("Ingress Tool Transfer") t1068html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1570 target=\"_blank\"\">T1570</a></td>\n <td>".format(insert)) t1068html.write("Lateral Tool Transfer") # mitigations t1068html.write("{}Application Isolation and Sandboxing</td>\n <td>".format(mitigations)) t1068html.write("Make it difficult for adversaries to advance their operation through exploitation of undiscovered or unpatched vulnerabilities by using sandboxing. Other types of virtualization and application microsegmentation may also mitigate the impact of some types of exploitation. Risks of additional exploits and weaknesses in these systems may still exist.{}".format(insert)) t1068html.write("Execution Prevention</td>\n <td>") t1068html.write("Consider blocking the execution of known vulnerable drivers that adversaries may exploit to execute code in kernel mode. Validate driver block rules in audit mode to ensure stability prior to production deployment.{}".format(insert)) t1068html.write("Exploit Protection</td>\n <td>") t1068html.write("Security applications that look for behavior used during exploitation such as Windows Defender Exploit Guard (WDEG) and the Enhanced Mitigation Experience Toolkit (EMET) can be used to mitigate some exploitation behavior. Control flow integrity checking is another way to potentially identify and stop a software exploit from occurring. Many of these protections depend on the architecture and target application binary for compatibility and may not work for software components targeted for privilege escalation.{}".format(insert)) t1068html.write("Threat Intelligence Program</td>\n <td>") t1068html.write("Develop a robust cyber threat intelligence capability to determine what types and levels of threat may use software exploits and 0-days against a particular organization.{}".format(insert)) t1068html.write("Update Software</td>\n <td>") t1068html.write("Update software regularly by employing patch management for internal enterprise endpoints and servers.{}".format(footer)) with open(sd+"t1055.html", "w") as t1055html: # description t1055html.write("{}Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges. Process injection is a method of executing arbitrary code in the address space of a separate live process.<br>".format(header)) t1055html.write("Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via process injection may also evade detection from security products since the execution is masked under a legitimate process.<br>") t1055html.write("There are many different ways to inject code into a process, many of which abuse legitimate functionalities. These implementations exist for every major OS but are typically platform specific.<br>") t1055html.write("More sophisticated samples may perform multiple process injections to segment modules and further evade detection, utilizing named pipes or other inter-process communication (IPC) mechanisms as a communication channel.") # information t1055html.write("{}T1055</td>\n <td>".format(headings)) # id t1055html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1055html.write("Privilege Escalation, Defense Evasion</td>\n <td>") # tactics t1055html.write("T1574.001: Dynamic-link Library Injection<br>T1574.002: Portable Execution Injection<br>T1574.003: Thread Execution Hijacking<br>T1574.004: Asynchronous Procedure Call<br>T1574.005: Thread Local Storage<br>T1574.008: Ptrace System Calls<br>T1574.009: Proc Memory<br>T1574.011: Extra Windows Memory Injection<br>T1574.012: Process Hollowing<br>T1574.013: Process Doppelganging<br>T1574.014: VDSO Hijacking") # sub-techniques # indicator regex assignments t1055html.write("{}Event IDs: 17, 18</li>\n <li>".format(iocs)) t1055html.write("CreateFileTransacted</li>\n <li>") t1055html.write("CreateTransaction</li>\n <li>") t1055html.write("NtCreateThreadEx</li>\n <li>") t1055html.write("NtUnmapViewOfSection</li>\n <li>") t1055html.write("RollbackTransaction</li>\n <li>") t1055html.write("VirtualProtectEx</li>\n <li>") t1055html.write("CreateRemoteThread</li>\n <li>") t1055html.write("GetWindowLong</li>\n <li>") t1055html.write("SetWindowLong</li>\n <li>") t1055html.write("LoadLibrary</li>\n <li>") t1055html.write("NtUnmapViewOfSection</li>\n <li>") t1055html.write("NtQueueApcThread</li>\n <li>") t1055html.write("QueueUserApc</li>\n <li>") t1055html.write("ResumeThread</li>\n <li>") t1055html.write("SetThreadContext</li>\n <li>") t1055html.write("SuspendThread</li>\n <li>") t1055html.write("VirtualAlloc</li>\n <li>") t1055html.write("ZwUnmapViewOfSection</li>\n <li>") t1055html.write("malloc</li>\n <li>") t1055html.write("ptrace_setregs</li>\n <li>") t1055html.write("ptrace_poketext</li>\n <li>") t1055html.write("ptrace_pokedata</li>") # related techniques t1055html.write("{}-</a></td>\n <td>".format(related)) t1055html.write("-") # mitigations t1055html.write("{}Behavior Prevention on Endpoint</td>\n <td>".format(mitigations)) t1055html.write("Some endpoint security solutions can be configured to block some types of process injection based on common sequences of behavior that occur during the injection process.{}".format(insert)) t1055html.write("Privileged Account Management</td>\n <td>") t1055html.write("Utilize Yama (ex: /proc/sys/kernel/yama/ptrace_scope) to mitigate ptrace based process injection by restricting the use of ptrace to privileged users only. Other mitigation controls involve the deployment of security kernel modules that provide advanced access control and process restrictions such as SELinux, grsecurity, and AppArmor.{}".format(footer)) # Defense Evasion with open(sd+"t1612.html", "w") as t1612html: # description t1612html.write("{}Adversaries may build a container image directly on a host to bypass defenses that monitor for the retrieval of malicious images from a public registry. A remote build request may be sent to the Docker API that includes a Dockerfile that pulls a vanilla base image, such as alpine, from a public or local registry and then builds a custom image upon it.<br>".format(header)) t1612html.write("An adversary may take advantage of that build API to build a custom image on the host that includes malware downloaded from their C2 server, and then they then may utilize Deploy Container using that custom image. If the base image is pulled from a public registry, defenses will likely not detect the image as malicious since it’s a vanilla image. If the base image already resides in a local registry, the pull may be considered even less suspicious since the image is already in the environment.") # information t1612html.write("{}T1610</td>\n <td>".format(headings)) # id t1612html.write("Containers</td>\n <td>") # platforms t1612html.write("Execution</td>\n <td>") # tactics t1612html.write("-") # sub-techniques # indicator regex assignments t1612html.write("{}Ports: 2375, 2376</li>\n <li>".format(iocs)) t1612html.write("docker build</li>") # related techniques t1612html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1610 target=\"_blank\"\">T1610</a></td>\n <td>".format(related)) t1612html.write("Deploy Container") t1612html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1609 target=\"_blank\"\">T1609</a></td>\n <td>".format(insert)) t1612html.write("Container Administration Command") # mitigations t1612html.write("{}Audit</td>\n <td>".format(mitigations)) t1612html.write("Audit images deployed within the environment to ensure they do not contain any malicious components.{}".format(insert)) t1612html.write("Limit Access to Resource Over Network</td>\n <td>") t1612html.write("Limit communications with the container service to local Unix sockets or remote access via SSH. Require secure port access to communicate with the APIs over TLS by disabling unauthenticated access to the Docker API on port 2375. Instead, communicate with the Docker API over TLS on port 2376.{}".format(insert)) t1612html.write("Network Segmentation</td>\n <td>") t1612html.write("Deny direct remote access to internal systems through the use of network proxies, gateways, and firewalls.{}".format(insert)) t1612html.write("Privileged Account Management</td>\n <td>") t1612html.write("Ensure containers are not running as root by default.{}".format(footer)) with open(sd+"t1140.html", "w") as t1140html: # description t1140html.write("{}Adversaries may use Obfuscated Files or Information to hide artifacts of an intrusion from analysis. They may require separate mechanisms to decode or deobfuscate that information depending on how they intend to use it.<br>".format(header)) t1140html.write("Methods for doing that include built-in functionality of malware or by using utilities present on the system.<br>") t1140html.write("One such example is use of certutil to decode a remote access tool portable executable file that has been hidden inside a certificate file. Another example is using the Windows copy /b command to reassemble binary fragments into a malicious payload.<br>") t1140html.write("Sometimes a user's action may be required to open it for deobfuscation or decryption as part of User Execution. The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary.") # information t1140html.write("{}T1140</td>\n <td>".format(headings)) # id t1140html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1140html.write("Defense Evasion</td>\n <td>") # tactics t1140html.write("-") # sub-techniques # indicator regex assignments t1140html.write("{}certutil</li>\n <li>".format(iocs)) t1140html.write("-decode</li>\n <li>") t1140html.write("openssl</li>") # related techniques t1140html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1027 target=\"_blank\"\">T1027</a></td>\n <td>".format(related)) t1140html.write("Obfuscated Files or Information") t1140html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1204 target=\"_blank\"\">T1204</a></td>\n <td>".format(insert)) t1140html.write("User Execution") # mitigations t1140html.write("{}-</td>\n <td>".format(mitigations)) t1140html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1006.html", "w") as t1006html: # description t1006html.write("{}Adversaries may directly access a volume to bypass file access controls and file system monitoring.<br>".format(header)) t1006html.write("Windows allows programs to have direct access to logical volumes. Programs with direct access may read and write files directly from the drive by analyzing file system data structures.<br>") t1006html.write("This technique bypasses Windows file access controls as well as file system monitoring tools.<br>") t1006html.write("Utilities, such as NinjaCopy, exist to perform these actions in PowerShell.") # information t1006html.write("{}T1006</td>\n <td>".format(headings)) # id t1006html.write("Windows</td>\n <td>") # platforms t1006html.write("Defense Evasion</td>\n <td>") # tactics t1006html.write("-") # sub-techniques # indicator regex assignments t1006html.write("{}-".format(iocs)) # related techniques t1006html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059.001</a></td>\n <td>".format(related)) t1006html.write("Command and Scripting Interpreter: PowerShell") # mitigations t1006html.write("{}-</td>\n <td>".format(mitigations)) t1006html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1480.html", "w") as t1480html: # description t1480html.write("{}Adversaries may use execution guardrails to constrain execution or actions based on adversary supplied and environment specific conditions that are expected to be present on the target.<br>".format(header)) t1480html.write("Guardrails ensure that a payload only executes against an intended target and reduces collateral damage from an adversary’s campaign.<br>") t1480html.write("Values an adversary can provide about a target system or environment to use as guardrails may include specific network share names, attached physical devices, files, joined Active Directory (AD) domains, and local/external IP addresses.<br>") t1480html.write("Guardrails can be used to prevent exposure of capabilities in environments that are not intended to be compromised or operated within. This use of guardrails is distinct from typical Virtualization/Sandbox Evasion.<br>") t1480html.write("While use of Virtualization/Sandbox Evasion may involve checking for known sandbox values and continuing with execution only if there is no match, the use of guardrails will involve checking for an expected target-specific value and only continuing with execution if there is such a match.") # information t1480html.write("{}T1480</td>\n <td>".format(headings)) # id t1480html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1480html.write("Defense Evasion</td>\n <td>") # tactics t1480html.write("T1480.001: Environmental Keying") # sub-techniques # indicator regex assignments t1480html.write("{}-".format(iocs)) # related techniques t1480html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1487 target=\"_blank\"\">T1487</a></td>\n <td>".format(related)) t1480html.write("Virtualization/Sandbox Evasion") # mitigations t1480html.write("{}Do Not Mitigate</td>\n <td>".format(mitigations)) t1480html.write("Execution Guardrails likely should not be mitigated with preventative controls because it may protect unintended targets from being compromised. If targeted, efforts should be focused on preventing adversary tools from running earlier in the chain of activity and on identifying subsequent malicious behavior if compromised.{}".format(footer)) with open(sd+"t1211.html", "w") as t1211html: # description t1211html.write("{}Adversaries may exploit software vulnerabilities in an attempt to collect credentials.<br>".format(header)) t1211html.write("Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.<br>") t1211html.write("Credentialing and authentication mechanisms may be targeted for exploitation by adversaries as a means to gain access to useful credentials or circumvent the process to gain access to systems.<br>") t1211html.write("One example of this is MS14-068, which targets Kerberos and can be used to forge Kerberos tickets using domain user permissions.<br>") t1211html.write("Exploitation for credential access may also result in Privilege Escalation depending on the process targeted or credentials obtained.") # information t1211html.write("{}T1212</td>\n <td>".format(headings)) # id t1211html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1211html.write("Credential Access</td>\n <td>") # tactics t1211html.write("-") # sub-techniques # indicator regex assignments t1211html.write("{}-".format(iocs)) # related techniques t1211html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1518 target=\"_blank\"\">T1518</a></td>\n <td>".format(related)) t1211html.write("Security Software Discovery") # mitigations t1211html.write("{}Application Isolation and Sandboxing</td>\n <td>".format(mitigations)) t1211html.write("Make it difficult for adversaries to advance their operation through exploitation of undiscovered or unpatched vulnerabilities by using sandboxing. Other types of virtualization and application microsegmentation may also mitigate the impact of some types of exploitation. Risks of additional exploits and weaknesses in these systems may still exist.{}".format(insert)) t1211html.write("Exploit Protection</td>\n <td>") t1211html.write("Security applications that look for behavior used during exploitation such as Windows Defender Exploit Guard (WDEG) and the Enhanced Mitigation Experience Toolkit (EMET) can be used to mitigate some exploitation behavior. Control flow integrity checking is another way to potentially identify and stop a software exploit from occurring. Many of these protections depend on the architecture and target application binary for compatibility and may not work for software targeted for defense evasion.{}".format(insert)) t1211html.write("Threat Intelligence Program</td>\n <td>") t1211html.write("Develop a robust cyber threat intelligence capability to determine what types and levels of threat may use software exploits and 0-days against a particular organization.{}".format(insert)) t1211html.write("Update Software</td>\n <td>") t1211html.write("Update software regularly by employing patch management for internal enterprise endpoints and servers.{}".format(footer)) with open(sd+"t1222.html", "w") as t1222html: # description t1222html.write("{}Adversaries may modify file or directory permissions/attributes to evade access control lists (ACLs) and access protected files. File and directory permissions are commonly managed by ACLs configured by the file or directory owner, or users with the appropriate permissions.<br>".format(header)) t1222html.write("File and directory ACL implementations vary by platform, but generally explicitly designate which users or groups can perform which actions (read, write, execute, etc.).<br>") t1222html.write("Modifications may include changing specific access rights, which may require taking ownership of a file or directory and/or elevated permissions depending on the file or directory’s existing permissions. This may enable malicious activity such as modifying, replacing, or deleting specific files or directories.<br>") t1222html.write("Specific file and directory modifications may be a required step for many techniques, such as establishing Persistence via Accessibility Features, Boot or Logon Initialization Scripts, .bash_profile and .bashrc, or tainting/hijacking other instrumental binary/configuration files via Hijack Execution Flow.") # information t1222html.write("{}T1222</td>\n <td>".format(headings)) # id t1222html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1222html.write("Defense Evasion</td>\n <td>") # tactics t1222html.write("T1222.001: Windows File and Directory Permissions Modification<br>T1222.002: Linux and Mac File and Directory Permissions Modification") # sub-techniques # indicator regex assignments t1222html.write("{}Event IDs: 4670</li>\n <li>".format(iocs)) t1222html.write("icacls</li>\n <li>") t1222html.write("cacls</li>\n <li>") t1222html.write("takeown</li>\n <li>") t1222html.write("attrib</li>\n <li>") t1222html.write("chmod</li>\n <li>") t1222html.write("chown</li>\n <li>") t1222html.write("chgrp</li>") # related t1222html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1546 target=\"_blank\"\">T1546.008</a></td>\n <td>".format(insert)) t1222html.write("Event Triggered Execution: Accessibility Features") t1222html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1037 target=\"_blank\"\">T1037</a></td>\n <td>".format(insert)) t1222html.write("Boot or Logon Initialization Scripts") t1222html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1546 target=\"_blank\"\">T1546.004</a></td>\n <td>".format(insert)) t1222html.write("Event Triggered Execution: Unix Shell Configuration Modification") t1222html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1574 target=\"_blank\"\">T1574</a></td>\n <td>".format(insert)) t1222html.write("Hijack Execution Flow") # mitigations t1222html.write("{}Privileged Account Management</td>\n <td>".format(mitigations)) t1222html.write("Ensure critical system files as well as those known to be abused by adversaries have restrictive permissions and are owned by an appropriately privileged account, especially if access is not required by users nor will inhibit system functionality.{}".format(insert)) t1222html.write("Restrict File and Directory Permissions</td>\n <td>") t1222html.write("Applying more restrictive permissions to files and directories could prevent adversaries from modifying the access control lists.{}".format(footer)) with open(sd+"t1564.html", "w") as t1564html: # description t1564html.write("{}Adversaries may attempt to hide artifacts associated with their behaviors to evade detection. Operating systems may have features to hide various artifacts, such as important system files and administrative task execution, to avoid disrupting user work environments and prevent users from changing files or features on the system.<br>".format(header)) t1564html.write("Adversaries may abuse these features to hide artifacts such as files, directories, user accounts, or other system activity to evade detection.<br>") t1564html.write("Adversaries may also attempt to hide artifacts associated with malicious behavior by creating computing regions that are isolated from common security instrumentation, such as through the use of virtualization technology.") # information t1564html.write("{}T1564</td>\n <td>".format(headings)) # id t1564html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1564html.write("Defense Evasion</td>\n <td>") # tactics t1564html.write("T1564.001: Hidden Files and Directories<br>T1564.002: Hidden Users<br>T1564.003: Hidden Window<br>T1564.004: NTFS File Attributes<br>T1564.005: Hidden File System<br>T1564.006: Run Virtual Instance<br>T1564.007: VBA Stomping") # sub-techniques # indicator regex assignments t1564html.write("{}-create</li>\n <li>".format(iocs)) t1564html.write("attrib</li>\n <li>") t1564html.write("dscl</li>\n <li>") t1564html.write("windowstyle</li>\n <li>") t1564html.write("hidden</li>\n <li>") t1564html.write("vboxmanage</li>\n <li>") t1564html.write("virtualbox</li>\n <li>") t1564html.write("vmplayer</li>\n <li>") t1564html.write("vmprocess</li>\n <li>") t1564html.write("vmware</li>\n <li>") t1564html.write("hyper-v</li>\n <li>") t1564html.write("qemu</li>\n <li>") t1564html.write("performancecache</li>\n <li>") t1564html.write("_vba_project</li>\n <li>") t1564html.write("zwqueryeafile</li>\n <li>") t1564html.write("zwseteafile</li>\n <li>") t1564html.write("stream</li>\n <li>") t1564html.write(":ads</li>\n <li>") t1564html.write("LoginWindow</li>\n <li>") t1564html.write("Hide500Users</li>\n <li>") t1564html.write("UniqueID</li>\n <li>") t1564html.write("UIElement</li>") # related techniques t1564html.write("{}-</a></td>\n <td>".format(related)) t1564html.write("-") # mitigations t1564html.write("{}-</td>\n <td>".format(mitigations)) t1564html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1562.html", "w") as t1562html: # description t1562html.write("{}Adversaries may maliciously modify components of a victim environment in order to hinder or disable defensive mechanisms. This not only involves impairing preventative defenses, such as firewalls and anti-virus, but also detection capabilities that defenders can use to audit activity and identify malicious behavior.<br>".format(header)) t1562html.write("This may also span both native defenses as well as supplemental capabilities installed by users and administrators.<br>") t1562html.write("Adversaries could also target event aggregation and analysis mechanisms, or otherwise disrupt these procedures by altering other system components.") # information t1562html.write("{}T1562</td>\n <td>".format(headings)) # id t1562html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1562html.write("Defense Evasion</td>\n <td>") # tactics t1562html.write("T1562.001: Disable or Modify Tools<br>T1562.002: Disable Windows Event Logging<br>T1562.003: HISTCONTROL<br>T1562.004: Disable or Modify System Firewall<br>T1562.006: Indicator Blocking<br>T1562.007: Disable or Modify Cloud Firewall<br>T1562.008: Disable Cloud Logs") # sub-techniques # indicator regex assignments t1562html.write("{}AUDITPOL</li>\n <li>".format(iocs)) t1562html.write("history</li>\n <li>") t1562html.write("ConsoleHost</li>\n <li>") t1562html.write("Clear-History</li>\n <li>") t1562html.write("HistorySaveStyle</li>\n <li>") t1562html.write("SaveNothing</li>\n <li>") t1562html.write("PSReadLine</li>\n <li>") t1562html.write("Set-PSReadLinePption</li>\n <li>") t1562html.write("Set-EtwTraceProvider</li>\n <li>") t1562html.write("ZwOpenProcess</li>\n <li>") t1562html.write("GetExtendedTcpTable</li>\n <li>") t1562html.write("HISTCONTROL</li>\n <li>") t1562html.write("HISTFILE</li>\n <li>") t1562html.write("kill</li>") # related techniques t1562html.write("{}-</a></td>\n <td>".format(related)) t1562html.write("-") # mitigations t1562html.write("{}Restrict File and Directory Permissions</td>\n <td>".format(mitigations)) t1562html.write("Ensure proper process and file permissions are in place to prevent adversaries from disabling or interfering with security/logging services.{}".format(insert)) t1562html.write("Restrict Registry Permissions</td>\n <td>") t1562html.write("Ensure proper Registry permissions are in place to prevent adversaries from disabling or interfering with security/logging services.{}".format(insert)) t1562html.write("User Account Management</td>\n <td>") t1562html.write("Ensure proper user permissions are in place to prevent adversaries from disabling or interfering with security/logging services.{}".format(footer)) with open(sd+"t1070.html", "w") as t1070html: # description t1070html.write("{}Adversaries may delete or alter generated artifacts on a host system, including logs or captured files such as quarantined malware.<br>".format(header)) t1070html.write("Locations and format of logs are platform or product-specific, however standard operating system logs are captured as Windows events or Linux/macOS files such as Bash History and /var/log/*.<br>") t1070html.write("These actions may interfere with event collection, reporting, or other notifications used to detect intrusion activity. This that may compromise the integrity of security solutions by causing notable events to go unreported.<br>") t1070html.write("This activity may also impede forensic analysis and incident response, due to lack of sufficient data to determine what occurred.") # information t1070html.write("{}T1070</td>\n <td>".format(headings)) # id t1070html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1070html.write("Defense Evasion</td>\n <td>") # tactics t1070html.write("T1070.001: Clear Windows Event Logs<br>T1070.002: Clear Linux or Mac System Logs<br>T1070.003: Clear Command History<br>T1070.004: File Deletion<br>T1070.005: Network Share Connection Removal<br>T1070.006: Timestomp") # sub-techniques # indicator regex assignments t1070html.write("{}Event IDs: 1102</li>\n <li>".format(iocs)) t1070html.write("/delete</li>\n <li>") t1070html.write("sdelete</li>\n <li>") t1070html.write("del</li>\n <li>") t1070html.write("rm</li>\n <li>") t1070html.write("clear-history</li>\n <li>") t1070html.write("PSReadLine</li>\n <li>") t1070html.write("Set-PSReadLineOption</li>\n <li>") t1070html.write("wevtutil</li>\n <li>") t1070html.write("OpenEventLog ClearEventLog</li>\n <li>") t1070html.write("net.exe use</li>\n <li>") t1070html.write("net1.exe use</li>\n <li>") t1070html.write("/var/log</li>") # related techniques t1070html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1552 target=\"_blank\"\">T1552</a></td>\n <td>".format(related)) t1070html.write("Unsecured Credentials: Bash History") # mitigations t1070html.write("{}Encrypt Sensitive Information</td>\n <td>".format(mitigations)) t1070html.write("Obfuscate/encrypt event files locally and in transit to avoid giving feedback to an adversary.{}".format(insert)) t1070html.write("Remote Data Storage</td>\n <td>") t1070html.write("Automatically forward events to a log server or data repository to prevent conditions in which the adversary can locate and manipulate data on the local system. When possible, minimize time delay on event reporting to avoid prolonged storage on the local system.{}".format(insert)) t1070html.write("Restrict File and Directory Permissions</td>\n <td>") t1070html.write("Protect generated event files that are stored locally with proper permissions and authentication and limit opportunities for adversaries to increase privileges by preventing Privilege Escalation opportunities.{}".format(footer)) with open(sd+"t1202.html", "w") as t1202html: # description t1202html.write("{}Adversaries may abuse utilities that allow for command execution to bypass security restrictions that limit the use of command-line interpreters. Various Windows utilities may be used to execute commands, possibly without invoking cmd.<br>".format(header)) t1202html.write("For example, Forfiles, the Program Compatibility Assistant (pcalua.exe), components of the Windows Subsystem for Linux (WSL), as well as other utilities may invoke the execution of programs and commands from a Command and Scripting Interpreter, Run window, or via scripts.<br>") t1202html.write("Adversaries may abuse these features for Defense Evasion, specifically to perform arbitrary execution while subverting detections and/or mitigation controls (such as Group Policy) that limit/prevent the usage of cmd or file extensions more commonly associated with malicious payloads.") # information t1202html.write("{}T1202</td>\n <td>".format(headings)) # id t1202html.write("Windows</td>\n <td>") # platforms t1202html.write("Defense Evasion</td>\n <td>") # tactics t1202html.write("-") # sub-techniques # indicator regex assignments t1202html.write("{}-".format(iocs)) # related techniques t1202html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(related)) t1202html.write("Command and Scripting Interpreter") # mitigations t1202html.write("{}-</td>\n <td>".format(mitigations)) t1202html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1036.html", "w") as t1036html: # description t1036html.write("{}Adversaries may attempt to manipulate features of their artifacts to make them appear legitimate or benign to users and/or security tools.<br>".format(header)) t1036html.write("Masquerading occurs when the name or location of an object, legitimate or malicious, is manipulated or abused for the sake of evading defenses and observation.<br>") t1036html.write("This may include manipulating file metadata, tricking users into misidentifying the file type, and giving legitimate task or service names.<br>") t1036html.write("Renaming abusable system utilities to evade security monitoring is also a form of Masquerading.") # information t1036html.write("{}T1036</td>\n <td>".format(headings)) # id t1036html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1036html.write("Defense Evasion</td>\n <td>") # tactics t1036html.write("T1036.001: Invalid Code Signature<br>T1036.002: Right-to-Left Override<br>T1036.003: Rename System Utilities<br>T1036.004: Masquerade Task or Service<br>T1036.005: Match Legitimate Name or Location<br>T1036.006: Space after Filename") # sub-techniques # indicator regex assignments t1036html.write("{}certutil</li>\n <li>".format(iocs)) t1036html.write("PubPrn</li>\n <li>") t1036html.write("rundll32.exe</li>\n <li>") t1036html.write("CPlApplet</li>\n <li>") t1036html.write("DllEntryPoint</li>\n <li>") t1036html.write("Control_RunDLL</li>\n <li>") t1036html.write("ControlRunDLLAsUser</li>\n <li>") t1036html.write("GetWindowsDirectoryW</li>\n <li>") t1036html.write("u202E</li>\n <li>") t1036html.write("scvhost</li>\n <li>") t1036html.write("svchast</li>\n <li>") t1036html.write("svchust</li>\n <li>") t1036html.write("svchest</li>\n <li>") t1036html.write("lssas</li>\n <li>") t1036html.write("lsasss</li>\n <li>") t1036html.write("lsaas</li>\n <li>") t1036html.write("cssrs</li>\n <li>") t1036html.write("canhost</li>\n <li>") t1036html.write("conhast</li>\n <li>") t1036html.write("connhost</li>\n <li>") t1036html.write("connhst</li>\n <li>") t1036html.write("iexplorer</li>\n <li>") t1036html.write("iexploror</li>\n <li>") t1036html.write("iexplorar</li>") # related techniques t1036html.write("{}-</a></td>\n <td>".format(related)) t1036html.write("-") # mitigations t1036html.write("{}Code Signing</td>\n <td>".format(mitigations)) t1036html.write("Require signed binaries.{}".format(insert)) t1036html.write("Execution Prevention</td>\n <td>") t1036html.write("Use tools that restrict program execution via application control by attributes other than file name for common operating system utilities that are needed.{}".format(insert)) t1036html.write("Restrict File and Directory Permissions</td>\n <td>") t1036html.write("Use file system access controls to protect folders such as C:\\Windows\\System32.{}".format(footer)) with open(sd+"t1578.html", "w") as t1578html: # description t1578html.write("{}An adversary may attempt to modify a cloud account's compute service infrastructure to evade defenses.<br>".format(header)) t1578html.write("A modification to the compute service infrastructure can include the creation, deletion, or modification of one or more components such as compute instances, virtual machines, and snapshots.<br>") t1578html.write("Permissions gained from the modification of infrastructure components may bypass restrictions that prevent access to existing infrastructure.<br>") t1578html.write("Modifying infrastructure components may also allow an adversary to evade detection and remove evidence of their presence.") # information t1578html.write("{}T1578</td>\n <td>".format(headings)) # id t1578html.write("AWS, Azure, GCP</td>\n <td>") # platforms t1578html.write("Defense Evasion</td>\n <td>") # tactics t1578html.write("T1578.001: Create Snapshot<br>T1578.002: Create Cloud Instance<br>T1578: Delete Cloud Instance<br>T1578.003: Revert Cloud Instance") # sub-techniques # indicator regex assignments t1578html.write("{}-".format(iocs)) # related techniques t1578html.write("{}-</a></td>\n <td>".format(related)) t1578html.write("-") # mitigations t1578html.write("{}Audit</td>\n <td>".format(mitigations)) t1578html.write("Routinely monitor user permissions to ensure only the expected users have the capability to modify cloud compute infrastructure components.{}".format(insert)) t1578html.write("User Account Management</td>\n <td>") t1578html.write("Limit permissions for creating, deleting, and otherwise altering compute components in accordance with least privilege. Organizations should limit the number of users within the organization with an IAM role that has administrative privileges, strive to reduce all permanent privileged role assignments, and conduct periodic entitlement reviews on IAM users, roles and policies.{}".format(footer)) with open(sd+"t1112.html", "w") as t1112html: # description t1112html.write("{}Adversaries may interact with the Windows Registry to hide configuration information within Registry keys, remove information as part of cleaning up, or as part of other techniques to aid in persistence and execution.<br>".format(header)) t1112html.write("Access to specific areas of the Registry depends on account permissions, some requiring administrator-level access.<br>") t1112html.write("The built-in Windows command-line utility Reg may be used for local or remote Registry modification. Other tools may also be used, such as a remote access tool, which may contain functionality to interact with the Registry through the Windows API.<br>") t1112html.write("Registry modifications may also include actions to hide keys, such as prepending key names with a null character, which will cause an error and/or be ignored when read via Reg or other utilities using the Win32 API.<br>") t1112html.write("Adversaries may abuse these pseudo-hidden keys to conceal payloads/commands used to maintain persistence.<br>") t1112html.write("The Registry of a remote system may be modified to aid in execution of files as part of lateral movement. It requires the remote Registry service to be running on the target system. Often Valid Accounts are required, along with access to the remote system's SMB/Windows Admin Shares for RPC communication.") # information t1112html.write("{}T1112</td>\n <td>".format(headings)) # id t1112html.write("Windows</td>\n <td>") # platforms t1112html.write("Defense Evasion</td>\n <td>") # tactics t1112html.write("-") # sub-techniques # indicator regex assignments t1112html.write("{}autoruns</li>\n <li>".format(iocs)) t1112html.write("regdelnull</li>\n <li>") t1112html.write("reg.exe</li>") # related techniques t1112html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(related)) t1112html.write("Valid Accounts") t1112html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(insert)) t1112html.write("Remote Services: SMB/Windows Admin Shares") # mitigations t1112html.write("{}Restrict Registry Permissions</td>\n <td>".format(mitigations)) t1112html.write("Ensure proper permissions are set for Registry hives to prevent users from modifying keys for system components that may lead to privilege escalation.{}".format(footer)) with open(sd+"t1601.html", "w") as t1601html: # description t1601html.write("{}Adversaries may make changes to the operating system of embedded network devices to weaken defenses and provide new capabilities for themselves. On such devices, the operating systems are typically monolithic and most of the device functionality and capabilities are contained within a single file.<br>".format(header)) t1601html.write("To change the operating system, the adversary typically only needs to affect this one file, replacing or modifying it. This can either be done live in memory during system runtime for immediate effect, or in storage to implement the change on the next boot of the network device.") # information t1601html.write("{}T1601</td>\n <td>".format(headings)) # id t1601html.write("Containers</td>\n <td>") # platforms t1601html.write("Defense Evasion</td>\n <td>") # tactics t1601html.write("T1601.001: Patch System Image<br>T1601.002: Downgrade System Image<br>") # sub-techniques # indicator regex assignments t1601html.write("{}-".format(iocs)) # related techniques t1601html.write("{}-</a></td>\n <td>".format(related)) t1601html.write("-") # mitigations t1601html.write("{}Boot Integrity</td>\n <td>".format(mitigations)) t1601html.write("Some vendors of embedded network devices provide cryptographic signing to ensure the integrity of operating system images at boot time. Implement where available, following vendor guidelines.{}".format(insert)) t1601html.write("Code Signing</td>\n <td>") t1601html.write("Many vendors provide digitally signed operating system images to validate the integrity of the software used on their platform. Make use of this feature where possible in order to prevent and/or detect attempts by adversaries to compromise the system image. {}".format(insert)) t1601html.write("Credential Access Protection</td>\n <td>") t1601html.write("Some embedded network devices are capable of storing passwords for local accounts in either plain-text or encrypted formats. Ensure that, where available, local passwords are always encrypted, per vendor recommendations.{}".format(insert)) t1601html.write("Multi-factor Authentication</td>\n <td>") t1601html.write("Use multi-factor authentication for user and privileged accounts. Most embedded network devices support TACACS+ and/or RADIUS. Follow vendor prescribed best practices for hardening access control.{}".format(insert)) t1601html.write("Password Policies</td>\n <td>") t1601html.write("Refer to NIST guidelines when creating password policies.{}".format(insert)) t1601html.write("Privileged Account Management</td>\n <td>") t1601html.write("Restrict administrator accounts to as few individuals as possible, following least privilege principles. Prevent credential overlap across systems of administrator and privileged accounts, particularly between network and non-network platforms, such as servers or endpoints.{}".format(footer)) with open(sd+"t1599.html", "w") as t1599html: # description t1599html.write("{}Adversaries may bridge network boundaries by compromising perimeter network devices. Breaching these devices may enable an adversary to bypass restrictions on traffic routing that otherwise separate trusted and untrusted networks.<br>".format(header)) t1599html.write("Devices such as routers and firewalls can be used to create boundaries between trusted and untrusted networks. They achieve this by restricting traffic types to enforce organizational policy in an attempt to reduce the risk inherent in such connections. Restriction of traffic can be achieved by prohibiting IP addresses, layer 4 protocol ports, or through deep packet inspection to identify applications. To participate with the rest of the network, these devices can be directly addressable or transparent, but their mode of operation has no bearing on how the adversary can bypass them when compromised.<br>") t1599html.write("When an adversary takes control of such a boundary device, they can bypass its policy enforcement to pass normally prohibited traffic across the trust boundary between the two separated networks without hinderance. By achieving sufficient rights on the device, an adversary can reconfigure the device to allow the traffic they want, allowing them to then further achieve goals such as command and control via Multi-hop Proxy or exfiltration of data via Traffic Duplication. In the cases where a border device separates two separate organizations, the adversary can also facilitate lateral movement into new victim environments.") # information t1599html.write("{}T1599</td>\n <td>".format(headings)) # id t1599html.write("Network</td>\n <td>") # platforms t1599html.write("Defense Evasion</td>\n <td>") # tactics t1599html.write("T1599.001: Network Address Translation Traversal") # sub-techniques # indicator regex assignments t1599html.write("{}-".format(iocs)) # related techniques t1599html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1090 target=\"_blank\"\">T1090</a></td>\n <td>".format(related)) t1599html.write("Multi-hop Proxy") t1599html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1020 target=\"_blank\"\">T1020</a></td>\n <td>".format(insert)) t1599html.write("Traffic Duplication") # mitigations t1599html.write("{}Credential Access Protection</td>\n <td>".format(mitigations)) t1599html.write("Some embedded network devices are capable of storing passwords for local accounts in either plain-text or encrypted formats. Ensure that, where available, local passwords are always encrypted, per vendor recommendations.{}".format(insert)) t1599html.write("Filter Network Traffic</td>\n <td>") t1599html.write("Upon identifying a compromised network device being used to bridge a network boundary, block the malicious packets using an unaffected network device in path, such as a firewall or a router that has not been compromised. Continue to monitor for additional activity and to ensure that the blocks are indeed effective.{}".format(insert)) t1599html.write("Multi-factor Authentication</td>\n <td>") t1599html.write("Use multi-factor authentication for user and privileged accounts. Most embedded network devices support TACACS+ and/or RADIUS. Follow vendor prescribed best practices for hardening access control.[{}".format(insert)) t1599html.write("Password Policies</td>\n <td>") t1599html.write("Refer to NIST guidelines when creating password policies.{}".format(insert)) t1599html.write("Privileged Account Management</td>\n <td>") t1599html.write("Restrict administrator accounts to as few individuals as possible, following least privilege principles. Prevent credential overlap across systems of administrator and privileged accounts, particularly between network and non-network platforms, such as servers or endpoints.{}".format(footer)) with open(sd+"t1027.html", "w") as t1027html: # description t1027html.write("{}Adversaries may attempt to make an executable or file difficult to discover or analyze by encrypting, encoding, or otherwise obfuscating its contents on the system or in transit. This is common behavior that can be used across different platforms and the network to evade defenses.<br>".format(header)) t1027html.write("Payloads may be compressed, archived, or encrypted in order to avoid detection. These payloads may be used during Initial Access or later to mitigate detection. Sometimes a user's action may be required to open and Deobfuscate/Decode Files or Information for User Execution.<br>") t1027html.write("The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. Adversaries may also used compressed or archived scripts, such as JavaScript.<br>") t1027html.write("Portions of files can also be encoded to hide the plain-text strings that would otherwise help defenders with discovery. Payloads may also be split into separate, seemingly benign files that only reveal malicious functionality when reassembled.<br>") t1027html.write("Adversaries may also obfuscate commands executed from payloads or directly via a Command and Scripting Interpreter. Environment variables, aliases, characters, and other platform/language specific semantics can be used to evade signature based detections and application control mechanisms.") # information t1027html.write("{}T1027</td>\n <td>".format(headings)) # id t1027html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1027html.write("Defense Evasion</td>\n <td>") # tactics t1027html.write("T1027.001: Binary Padding<br>T1027.002: Software Packing<br>T1027.003: Steganography<br>T1027.004: Complie After Delivery<br>T1027.005: Indicator Removal from Tools") # sub-techniques # indicator regex assignments t1027html.write("{}csc.exe</li>\n <li>".format(iocs)) t1027html.write("gcc</li>\n <li>") t1027html.write("MinGW</li>\n <li>") t1027html.write("FileRecvWriteRand</li>") # related techniques t1027html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1140 target=\"_blank\"\">T1140</a></td>\n <td>".format(related)) t1027html.write("Deobfuscate/Decode Files or Information") t1027html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(insert)) t1027html.write("Command and Scripting Interpreter") # mitigations t1027html.write("{}Antivirus/Antimalware</td>\n <td>".format(mitigations)) t1027html.write("Consider utilizing the Antimalware Scan Interface (AMSI) on Windows 10 to analyze commands after being processed/interpreted.{}".format(footer)) with open(sd+"t1207.html", "w") as t1207html: # description t1207html.write("{}Adversaries may register a rogue Domain Controller to enable manipulation of Active Directory data. DCShadow may be used to create a rogue Domain Controller (DC).<br>".format(header)) t1207html.write("DCShadow is a method of manipulating Active Directory (AD) data, including objects and schemas, by registering (or reusing an inactive registration) and simulating the behavior of a DC.<br>") t1207html.write("Once registered, a rogue DC may be able to inject and replicate changes into AD infrastructure for any domain object, including credentials and keys.<br>") t1207html.write("Registering a rogue DC involves creating a new server and nTDSDSA objects in the Configuration partition of the AD schema, which requires Administrator privileges (either Domain or local to the DC) or the KRBTGT hash.<br>") t1207html.write("This technique may bypass system logging and security monitors such as security information and event management (SIEM) products (since actions taken on a rogue DC may not be reported to these sensors).<br>") t1207html.write("The technique may also be used to alter and delete replication and other associated metadata to obstruct forensic analysis.<br>") t1207html.write("Adversaries may also utilize this technique to perform SID-History Injection and/or manipulate AD objects (such as accounts, access control lists, schemas) to establish backdoors for Persistence.") # information t1207html.write("{}T1207</td>\n <td>".format(headings)) # id t1207html.write("Windows</td>\n <td>") # platforms t1207html.write("Defense Evasion</td>\n <td>") # tactics t1207html.write("-") # indicator regex assignments t1207html.write("{}lsadump</li>\n <li>".format(iocs)) t1207html.write("DCShadow</li>") # related techniques t1207html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1134 target=\"_blank\"\">T1134</a></td>\n <td>".format(related)) t1207html.write("SID-History Injection") # mitigations t1207html.write("{}-</td>\n <td>".format(mitigations)) t1207html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1014.html", "w") as t1014html: # description t1014html.write("{}Adversaries may use rootkits to hide the presence of programs, files, network connections, services, drivers, and other system components. Rootkits are programs that hide the existence of malware by intercepting/hooking and modifying operating system API calls that supply system information.<br>".format(header)) t1014html.write("Rootkits or rootkit enabling functionality may reside at the user or kernel level in the operating system or lower, to include a hypervisor, Master Boot Record, or System Firmware. Rootkits have been seen for Windows, Linux, and Mac OS X systems.") # information t1014html.write("{}T1014</td>\n <td>".format(headings)) # id t1014html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1014html.write("Defense Evasion</td>\n <td>") # tactics t1014html.write("-") # sub-techniques # indicator regex assignments t1014html.write("{}-".format(iocs)) # related techniques t1014html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1542 target=\"_blank\"\">T1542.001</a></td>\n <td>".format(related)) t1014html.write("Pre-OS Boot: System Firmware") # mitigations t1014html.write("{}-</td>\n <td>".format(mitigations)) t1014html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1218.html", "w") as t1218html: # description t1218html.write("{}Adversaries may bypass process and/or signature-based defenses by proxying execution of malicious content with signed binaries.<br>".format(header)) t1218html.write("Binaries signed with trusted digital certificates can execute on Windows systems protected by digital signature validation.<br>") t1218html.write("Several Microsoft signed binaries that are default on Windows installations can be used to proxy execution of other files.") # information t1218html.write("{}T1218</td>\n <td>".format(headings)) # id t1218html.write("Windows</td>\n <td>") # platforms t1218html.write("Defense Evasion</td>\n <td>") # tactics t1218html.write("T1218.001: Compiled HTML File<br>T1218.002: Control Panel<br>T1218.003: CMSTP<br>T1218.004: InstallUtil<br>T1218.005: Mshta<br>T1218.007: Msiexec<br>T1218.008: Odbcconf<br>T1218.009: Regsvcs/Regasm<br>T1218.010: Regsvr32<br>T1218.011: Rundll32<br>T1218.012: Verclsid") # sub-techniques # indicator regex assignments t1218html.write("{}Event IDs: 10, 12, 13</li>\n <li>".format(iocs)) t1218html.write(".chm</li>\n <li>") t1218html.write(".hh</li>\n <li>") t1218html.write(".cpl</li>\n <li>") t1218html.write("rundll32.exe</li>\n <li>") t1218html.write("CMSTP.exe</li>\n <li>") t1218html.write("Mshta.exe</li>\n <li>") t1218html.write("Msiexec.exe</li>\n <li>") t1218html.write("odbcconf.exe</li>\n <li>") t1218html.write("verclsid.exe</li>\n <li>") t1218html.write("Regasm</li>\n <li>") t1218html.write("Regsvcs</li>\n <li>") t1218html.write("Regsvr</li>\n <li>") t1218html.write("CMMGR32</li>\n <li>") t1218html.write("CMLUA</li>\n <li>") t1218html.write("InstallUtil</li>\n <li>") t1218html.write("AlwaysInstallElevated</li>\n <li>") t1218html.write("ComRegisterFunction</li>\n <li>") t1218html.write("ComUnregisterFunction</li>\n <li>") t1218html.write("CPlApplet</li>\n <li>") t1218html.write("DllEntryPoint</li>\n <li>") t1218html.write("Control_RunDLL</li>\n <li>") t1218html.write("ControlRunDLLAsUser</li>\n <li>") t1218html.write("panel/cpls</li>") # related techniques t1218html.write("{}-</a></td>\n <td>".format(related)) t1218html.write("-") # mitigations t1218html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1218html.write("Many native binaries may not be necessary within a given environment.{}".format(insert)) t1218html.write("Execution Prevention</td>\n <td>") t1218html.write("Consider using application control to prevent execution of binaries that are susceptible to abuse and not required for a given system or network.{}".format(insert)) t1218html.write("Exploit Protection</td>\n <td>") t1218html.write("Microsoft's Enhanced Mitigation Experience Toolkit (EMET) Attack Surface Reduction (ASR) feature can be used to block methods of using using trusted binaries to bypass application control.{}".format(insert)) t1218html.write("Privileged Account Management</td>\n <td>") t1218html.write("Restrict execution of particularly vulnerable binaries to privileged accounts or groups that need to use it to lessen the opportunities for malicious usage.{}".format(footer)) with open(sd+"t1216.html", "w") as t1216html: # description t1216html.write("{}Adversaries may use scripts signed with trusted certificates to proxy execution of malicious files. Several Microsoft signed scripts that are default on Windows installations can be used to proxy execution of other files.<br>".format(header)) t1216html.write("This behavior may be abused by adversaries to execute malicious files that could bypass application control and signature validation on systems.") # information t1216html.write("{}T1216</td>\n <td>".format(headings)) # id t1216html.write("Windows</td>\n <td>") # platforms t1216html.write("Defense Evasion</td>\n <td>") # tactics t1216html.write("T1216.001: PubPrn") # sub-techniques # indicator regex assignments t1216html.write("{}PubPrn</li>\n <li>".format(iocs)) t1216html.write("cscript.exe</li>") # related techniques t1216html.write("{}-</a></td>\n <td>".format(related)) t1216html.write("-") # mitigations t1216html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1216html.write("Certain signed scripts that can be used to execute other programs may not be necessary within a given environment. Use application control configured to block execution of these scripts if they are not required for a given system or network to prevent potential misuse by adversaries.{}".format(footer)) with open(sd+"t1553.html", "w") as t1553html: # description t1553html.write("{}Adversaries may undermine security controls that will either warn users of untrusted activity or prevent execution of untrusted programs. Operating systems and security products may contain mechanisms to identify programs or websites as possessing some level of trust.<br>".format(header)) t1553html.write("Examples of such features would include a program being allowed to run because it is signed by a valid code signing certificate, a program prompting the user with a warning because it has an attribute set from being downloaded from the Internet, or getting an indication that you are about to connect to an untrusted site.<br>") t1553html.write("Adversaries may attempt to subvert these trust mechanisms. The method adversaries use will depend on the specific mechanism they seek to subvert. Adversaries may conduct File and Directory Permissions Modification or Modify Registry in support of subverting these controls. Adversaries may also create or steal code signing certificates to acquire trust on target systems.") # information t1553html.write("{}T1553</td>\n <td>".format(headings)) # id t1553html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1553html.write("Defense Evasion</td>\n <td>") # tactics t1553html.write("T1553.001: Gatekeeper Bypass<br>T1553.002: Code Signing<br>T1553.003: SIP and Trust Provider Hijacking<br>T1553.004: Install Root Certificate<br>T1553.005: Mark-of-the-Web Bypass<br>T1553.006: Code Signing Policy Modification") # sub-techniques # indicator regex assignments t1553html.write("{}Event IDs: 81, 3033</li>\n <li>".format(iocs)) t1553html.write("bcdedit</li>\n <li>") t1553html.write("vssadmin</li>\n <li>") t1553html.write("wbadmin</li>\n <li>") t1553html.write("shadows</li>\n <li>") t1553html.write("shadowcopy</li>\n <li>") t1553html.write("certmgr</li>\n <li>") t1553html.write("certutil</li>\n <li>") t1553html.write("add-trusted-cert</li>\n <li>") t1553html.write("trustRoot</li>\n <li>") t1553html.write("g_CiOptions</li>\n <li>") t1553html.write("requiresigned</li>\n <li>") t1553html.write("testsigning</li>\n <li>") t1553html.write("curl</li>\n <li>") t1553html.write("com.apple.quarantine</li>\n <li>") t1553html.write("xattr</li>\n <li>") t1553html.write("xttr</li>") # related techniques t1553html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1222 target=\"_blank\"\">T1222</a></td>\n <td>".format(related)) t1553html.write("File and Directory Permissions Modification") t1553html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1112 target=\"_blank\"\">T1112</a></td>\n <td>".format(insert)) t1553html.write("Modify Registry") # mitigations t1553html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1553html.write("System settings can prevent applications from running that haven't been downloaded through the Apple Store (or other legitimate repositories) which can help mitigate some of these issues. Also enable application control solutions such as AppLocker and/or Device Guard to block the loading of malicious content.{}".format(insert)) t1553html.write("Operating System Configuration</td>\n <td>") t1553html.write("Windows Group Policy can be used to manage root certificates and the Flags value of HKLM\\SOFTWARE\\Policies\\Microsoft\\SystemCertificates\\Root\\ProtectedRoots can be set to 1 to prevent non-administrator users from making further root installations into their own HKCU certificate store.{}".format(insert)) t1553html.write("Restrict Registry Permissions</td>\n <td>") t1553html.write("Ensure proper permissions are set for Registry hives to prevent users from modifying keys related to SIP and trust provider components. Components may still be able to be hijacked to suitable functions already present on disk if malicious modifications to Registry keys are not prevented.{}".format(insert)) t1553html.write("Software Configuration</td>\n <td>") t1553html.write("HTTP Public Key Pinning (HPKP) is one method to mitigate potential man-in-the-middle situations where and adversary uses a mis-issued or fraudulent certificate to intercept encrypted communications by enforcing use of an expected certificate.{}".format(footer)) with open(sd+"t1221.html", "w") as t1221html: # description t1221html.write("{}Adversaries may create or modify references in Office document templates to conceal malicious code or force authentication attempts. Microsoft’s Office Open XML (OOXML) specification defines an XML-based format for Office documents (.docx, xlsx, .pptx) to replace older binary formats (.doc, .xls, .ppt).<br>".format(header)) t1221html.write("OOXML files are packed together ZIP archives compromised of various XML files, referred to as parts, containing properties that collectively define how a document is rendered.<br>") t1221html.write("Properties within parts may reference shared public resources accessed via online URLs. For example, template properties reference a file, serving as a pre-formatted document blueprint, that is fetched when the document is loaded.<br>") t1221html.write("Adversaries may abuse this technology to initially conceal malicious code to be executed via documents. Template references injected into a document may enable malicious payloads to be fetched and executed when the document is loaded.<br>") t1221html.write("These documents can be delivered via other techniques such as Phishing and/or Taint Shared Content and may evade static detections since no typical indicators (VBA macro, script, etc.) are present until after the malicious payload is fetched. Examples have been seen in the wild where template injection was used to load malicious code containing an exploit.<br>") t1221html.write("This technique may also enable Forced Authentication by injecting a SMB/HTTPS (or other credential prompting) URL and triggering an authentication attempt.") # information t1221html.write("{}T1221</td>\n <td>".format(headings)) # id t1221html.write("Windows</td>\n <td>") # platforms t1221html.write("Defense Evasion</td>\n <td>") # tactics t1221html.write("-") # sub-techniques # indicator regex assignments t1221html.write("{}.docx</li>\n <li>".format(iocs)) t1221html.write(".xlsx</li>\n <li>") t1221html.write(".pptx</li>") # related techniques t1221html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1566 target=\"_blank\"\">T1566</a></td>\n <td>".format(related)) t1221html.write("Phishing") t1221html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1080 target=\"_blank\"\">T1080</a></td>\n <td>".format(insert)) t1221html.write("Taint Shared Content") t1221html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1187 target=\"_blank\"\">T1187</a></td>\n <td>".format(insert)) t1221html.write("Forced Authentication") # mitigations t1221html.write("{}Antivirus/Antimalware</td>\n <td>".format(mitigations)) t1221html.write("Network/Host intrusion prevention systems, antivirus, and detonation chambers can be employed to prevent documents from fetching and/or executing malicious payloads.{}".format(insert)) t1221html.write("Disable or Remove Feature or Program</td>\n <td>") t1221html.write("Consider disabling Microsoft Office macros/active content to prevent the execution of malicious payloads in documents, though this setting may not mitigate the Forced Authentication use for this technique.{}".format(insert)) t1221html.write("Network Intrusion Prevention</td>\n <td>") t1221html.write("Network/Host intrusion prevention systems, antivirus, and detonation chambers can be employed to prevent documents from fetching and/or executing malicious payloads.{}".format(insert)) t1221html.write("User Training</td>\n <td>") t1221html.write("Train users to identify social engineering techniques and spearphishing emails.{}".format(footer)) with open(sd+"t1127.html", "w") as t1127html: # description t1127html.write("{}Adversaries may take advantage of trusted developer utilities to proxy execution of malicious payloads.<br>".format(header)) t1127html.write("There are many utilities used for software development related tasks that can be used to execute code in various forms to assist in development, debugging, and reverse engineering.<br>") t1127html.write("These utilities may often be signed with legitimate certificates that allow them to execute on a system and proxy execution of malicious code through a trusted process that effectively bypasses application control solutions.") # information t1127html.write("{}T1127</td>\n <td>".format(headings)) # id t1127html.write("Windows</td>\n <td>") # platforms t1127html.write("Defense Evasion</td>\n <td>") # tactics t1127html.write("T1127.001: MSBuild") # sub-techniques # indicator regex assignments t1127html.write("{}MSBuild".format(iocs)) # related techniques t1127html.write("{}-</a></td>\n <td>".format(related)) t1127html.write("-") # mitigations t1127html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1127html.write("Specific developer utilities may not be necessary within a given environment and should be removed if not used.{}".format(insert)) t1127html.write("Execution Prevention</td>\n <td>") t1127html.write("Certain developer utilities should be blocked or restricted if not required.{}".format(footer)) with open(sd+"t1550.html", "w") as t1550html: # description t1550html.write("{}Adversaries may use alternate authentication material, such as password hashes, Kerberos tickets, and application access tokens, in order to move laterally within an environment and bypass normal system access controls.<br>".format(header)) t1550html.write("Authentication processes generally require a valid identity (e.g., username) along with one or more authentication factors (e.g., password, pin, physical smart card, token generator, etc.).<br>") t1550html.write("Alternate authentication material is legitimately generated by systems after a user or application successfully authenticates by providing a valid identity and the required authentication factor(s). Alternate authentication material may also be generated during the identity creation process.<br>") t1550html.write("Caching alternate authentication material allows the system to verify an identity has successfully authenticated without asking the user to reenter authentication factor(s).<br>") t1550html.write("Because the alternate authentication must be maintained by the system—either in memory or on disk—it may be at risk of being stolen through Credential Access techniques.<br>") t1550html.write("By stealing alternate authentication material, adversaries are able to bypass system access controls and authenticate to systems without knowing the plaintext password or any additional authentication factors.") # information t1550html.write("{}T1550</td>\n <td>".format(headings)) # id t1550html.write("Windows, Office 365, SaaS</td>\n <td>") # platforms t1550html.write("Defense Evasion, Lateral Movement</td>\n <td>") # tactics t1550html.write("T1550.001: Application Access Token<br>T1550.002: Pass the Hash<br>T1550.003: Pass the Ticket<br>T1550.004: Web Session Cookie") # sub-techniques # indicator regex assignments t1550html.write("{}Event IDs: 4768, 4769</li>\n <li>".format(iocs)) t1550html.write("DCSync</li>\n <li>") t1550html.write("duo-sid</li>") # related techniques t1550html.write("{}-</a></td>\n <td>".format(related)) t1550html.write("-") # mitigations t1550html.write("{}Privileged Account Management</td>\n <td>".format(mitigations)) t1550html.write("Limit credential overlap across systems to prevent the damage of credential compromise and reduce the adversary's ability to perform Lateral Movement between systems.{}".format(insert)) t1550html.write("User Account Management</td>\n <td>") t1550html.write("Enforce the principle of least-privilege. Do not allow a domain user to be in the local administrator group on multiple systems.{}".format(footer)) with open(sd+"t1535.html", "w") as t1535html: # description t1535html.write("{}Adversaries may create cloud instances in unused geographic service regions in order to evade detection. Access is usually obtained through compromising accounts used to manage cloud infrastructure.<br>".format(header)) t1535html.write("Cloud service providers often provide infrastructure throughout the world in order to improve performance, provide redundancy, and allow customers to meet compliance requirements.<br>") t1535html.write("Oftentimes, a customer will only use a subset of the available regions and may not actively monitor other regions. If an adversary creates resources in an unused region, they may be able to operate undetected.<br>") t1535html.write("A variation on this behavior takes advantage of differences in functionality across cloud regions. An adversary could utilize regions which do not support advanced detection services in order to avoid detection of their activity. For example, AWS GuardDuty is not supported in every region.<br>") t1535html.write("An example of adversary use of unused AWS regions is to mine cryptocurrency through Resource Hijacking, which can cost organizations substantial amounts of money over time depending on the processing power used.") # information t1535html.write("{}T1535</td>\n <td>".format(headings)) # id t1535html.write("AWS, Azure, GCP</td>\n <td>") # platforms t1535html.write("Defense Evasion</td>\n <td>") # tactics t1535html.write("-") # sub-techniques # indicator regex assignments t1535html.write("{}-".format(iocs)) # related techniques t1535html.write("{}-</a></td>\n <td>".format(related)) t1535html.write("-") # mitigations t1535html.write("{}Software Configuration</td>\n <td>".format(mitigations)) t1535html.write("Cloud service providers may allow customers to deactivate unused regions.{}".format(footer)) with open(sd+"t1497.html", "w") as t1497html: # description t1497html.write("{}Adversaries may employ various means to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox.<br>".format(header)) t1497html.write("If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads.<br>") t1497html.write("Adversaries may use the information learned from Virtualization/Sandbox Evasion during automated discovery to shape follow-on behaviors.<br>") t1497html.write("Adversaries may use several methods to accomplish Virtualization/Sandbox Evasion such as checking for security monitoring tools (e.g., Sysinternals, Wireshark, etc.) or other system artifacts associated with analysis or virtualization.<br>") t1497html.write("Adversaries may also check for legitimate user activity to help determine if it is in an analysis environment. Additional methods include use of sleep timers or loops within malware code to avoid operating within a temporary sandbox.") # information t1497html.write("{}T1497</td>\n <td>".format(headings)) # id t1497html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1497html.write("Defense Evasion, Discovery</td>\n <td>") # tactics t1497html.write("T1497.001: System Checks<br>T1497.002: User Activity Based Checks<br>T1497.003: Time Based Evasion") # sub-techniques # indicator regex assignments t1497html.write("{}vpcext</li>\n <li>".format(iocs)) t1497html.write("vmtoolsd</li>\n <li>") t1497html.write("MSAcpi_ThermalZoneTemperature</li>\n <li>") t1497html.write("is_debugging</li>\n <li>") t1497html.write("sysctl</li>\n <li>") t1497html.write("ptrace</li>\n <li>") t1497html.write("time</li>\n <li>") t1497html.write("sleep</li>") # related techniques t1497html.write("{}-</a></td>\n <td>".format(related)) t1497html.write("-") # mitigations t1497html.write("{}-</td>\n <td>".format(mitigations)) t1497html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1600.html", "w") as t1600html: # description t1600html.write("{}Adversaries may compromise a network device’s encryption capability in order to bypass encryption that would otherwise protect data communications.<br>".format(header)) t1600html.write("Encryption can be used to protect transmitted network traffic to maintain its confidentiality (protect against unauthorized disclosure) and integrity (protect against unauthorized changes). Encryption ciphers are used to convert a plaintext message to ciphertext and can be computationally intensive to decipher without the associated decryption key. Typically, longer keys increase the cost of cryptanalysis, or decryption without the key.<br>") t1600html.write("Adversaries can compromise and manipulate devices that perform encryption of network traffic. For example, through behaviors such as Modify System Image, Reduce Key Space, and Disable Crypto Hardware, an adversary can negatively effect and/or eliminate a device’s ability to securely encrypt network traffic. This poses a greater risk of unauthorized disclosure and may help facilitate data manipulation, Credential Access, or Collection efforts.") # information t1600html.write("{}T1600</td>\n <td>".format(headings)) # id t1600html.write("Network</td>\n <td>") # platforms t1600html.write("Execution</td>\n <td>") # tactics t1600html.write("T1600.001: Reduce Key Space<br>T1600.002: Disable Crypto Hardware") # sub-techniques # indicator regex assignments t1600html.write("{}-".format(iocs)) # related techniques t1600html.write("{}-</a></td>\n <td>".format(related)) t1600html.write("-") # mitigations t1600html.write("{}-</td>\n <td>".format(mitigations)) t1600html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1220.html", "w") as t1220html: # description t1220html.write("{}Adversaries may bypass application control and obscure execution of code by embedding scripts inside XSL files. Extensible Stylesheet Language (XSL) files are commonly used to describe the processing and rendering of data within XML files.<br>".format(header)) t1220html.write("To support complex operations, the XSL standard includes support for embedded scripting in various languages.<br>") t1220html.write("Adversaries may abuse this functionality to execute arbitrary files while potentially bypassing application control. Similar to Trusted Developer Utilities Proxy Execution, the Microsoft common line transformation utility binary (msxsl.exe) can be installed and used to execute malicious JavaScript embedded within local or remote (URL referenced) XSL files.<br>") t1220html.write("Since msxsl.exe is not installed by default, an adversary will likely need to package it with dropped files. Msxsl.exe takes two main arguments, an XML source file and an XSL stylesheet. Since the XSL file is valid XML, the adversary may call the same XSL file twice. When using msxsl.exe adversaries may also give the XML/XSL files an arbitrary file extension.") # information t1220html.write("{}T1220</td>\n <td>".format(headings)) # id t1220html.write("Windows</td>\n <td>") # platforms t1220html.write("Defense Evasion</td>\n <td>") # tactics t1220html.write("-") # sub-techniques # indicator regex assignments t1220html.write("{}MSXML</li>\n <li>".format(iocs)) t1220html.write("wmic</li>\n <li>") t1220html.write("Invoke-Wmi</li>") # related techniques t1220html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1127 target=\"_blank\"\">T1127</a></td>\n <td>".format(related)) t1220html.write("Trusted Developer Utilities Proxy Execution") t1220html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1047 target=\"_blank\"\">T1047</a></td>\n <td>".format(insert)) t1220html.write("Windows Management Instrumentation") t1220html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1218 target=\"_blank\"\">T1218</a></td>\n <td>".format(insert)) t1220html.write("Signed Binary Proxy Execution: Regsvr32") # mitigations t1220html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1220html.write("If msxsl.exe is unnecessary, then block its execution to prevent abuse by adversaries.{}".format(footer)) # Credential Access with open(sd+"t1110.html", "w") as t1110html: # description t1110html.write("{}Adversaries may use brute force techniques to gain access to accounts when passwords are unknown or when password hashes are obtained. Without knowledge of the password for an account or set of accounts, an adversary may systematically guess the password using a repetitive or iterative mechanism.</li>\n <liv>Brute forcing passwords can take place via interaction with a service that will check the validity of those credentials or offline against previously acquired credential data, such as password hashes.".format(header)) # information t1110html.write("{}T1110</td>\n <td>".format(headings)) # id t1110html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1110html.write("Credential Access</td>\n <td>") # tactics t1110html.write("T1110.001: Password Guessing<br>T1110.002: Password Cracking<br>T1110.003: Password Spraying<br>T1110.004: Credentials Stuffing") # sub-techniques # indicator regex assignments t1110html.write("{}Ports: 139, 22, 23, 389, 88, 1433, 1521, 3306, 445, 80, 443, </li>\n <li>".format(iocs)) t1110html.write("Event IDs: 4625, 4648, 4771</li>") # related techniques t1110html.write("{}-</a></td>\n <td>".format(related)) t1110html.write("-") # mitigations t1110html.write("{}Account Use Policies</td>\n <td>".format(mitigations)) t1110html.write("Set account lockout policies after a certain number of failed login attempts to prevent passwords from being guessed. Too strict a policy may create a denial of service condition and render environments un-usable, with all accounts used in the brute force being locked-out.{}".format(insert)) t1110html.write("Multi-factor Authentication</td>\n <td>") t1110html.write("Use multi-factor authentication. Where possible, also enable multi-factor authentication on externally facing services.{}".format(insert)) t1110html.write("Password Policies</td>\n <td>") t1110html.write("Refer to NIST guidelines when creating password policies.{}".format(insert)) t1110html.write("User Account Management</td>\n <td>") t1110html.write("Proactively reset accounts that are known to be part of breached credentials either immediately, or after detecting bruteforce attempts.{}".format(footer)) with open(sd+"t1555.html", "w") as t1555html: # description t1555html.write("{}Adversaries may search for common password storage locations to obtain user credentials. Passwords are stored in several places on a system, depending on the operating system or application holding the credentials.<br>".format(header)) t1555html.write("There are also specific applications that store passwords to make it easier for users manage and maintain. Once credentials are obtained, they can be used to perform lateral movement and access restricted information.") # information t1555html.write("{}T1555</td>\n <td>".format(headings)) # id t1555html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1555html.write("Credential Access</td>\n <td>") # tactics t1555html.write("T1555.001: Keychain<br>T1555.002: Securityd Memory<br>T1555.003: Credentials from Web Browsers<br>T1555.004: Windows Credential Manager<br>T1555.005: Password Managers") # sub-techniques # indicator regex assignments t1555html.write("{}policy.vpol</li>\n <li>".format(iocs)) t1555html.write("password</li>\n <li>") t1555html.write("secure</li>\n <li>") t1555html.write("credentials</li>\n <li>") t1555html.write("security</li>\n <li>") t1555html.write("vaultcmd</li>\n <li>") t1555html.write("vcrd</li>\n <li>") t1555html.write("listcreds</li>\n <li>") t1555html.write("credenumeratea</li>\n <li>") t1555html.write("keychain</li>\n <li>") t1555html.write("password</li>\n <li>") t1555html.write("pwd</li>\n <li>") t1555html.write("login</li>\n <li>") t1555html.write("store</li>\n <li>") t1555html.write("secure</li>\n <li>") t1555html.write("credentials</li>") # related techniques t1555html.write("{}-</a></td>\n <td>".format(related)) t1555html.write("-") # mitigations t1555html.write("{}Password Policies</td>\n <td>".format(mitigations)) t1555html.write("The password for the user's login keychain can be changed from the user's login password. This increases the complexity for an adversary because they need to know an additional password. Organizations may consider weighing the risk of storing credentials in password stores and web browsers. If system, software, or web browser credential disclosure is a significant concern, technical controls, policy, and user training may be used to prevent storage of credentials in improper locations.{}".format(footer)) with open(sd+"t1212.html", "w") as t1212html: # description t1212html.write("{}Adversaries may exploit software vulnerabilities in an attempt to collect credentials.<br>".format(header)) t1212html.write("Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.<br>") t1212html.write("Credentialing and authentication mechanisms may be targeted for exploitation by adversaries as a means to gain access to useful credentials or circumvent the process to gain access to systems.<br>") t1212html.write("One example of this is MS14-068, which targets Kerberos and can be used to forge Kerberos tickets using domain user permissions.<br>") t1212html.write("Exploitation for credential access may also result in Privilege Escalation depending on the process targeted or credentials obtained.") # information t1212html.write("{}T1212</td>\n <td>".format(headings)) # id t1212html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1212html.write("Credential Access</td>\n <td>") # tactics t1212html.write("-") # sub-techniques # indicator regex assignments t1212html.write("{}-".format(iocs)) # related techniques t1212html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1046 target=\"_blank\"\">T1046</a></td>\n <td>".format(related)) t1212html.write("Network Service Scanning") t1212html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1068 target=\"_blank\"\">T1068</a></td>\n <td>".format(insert)) t1212html.write("Exploitation for Privilege Escalation") # mitigations t1212html.write("{}Application Isolation and Sandboxing</td>\n <td>".format(mitigations)) t1212html.write("Make it difficult for adversaries to advance their operation through exploitation of undiscovered or unpatched vulnerabilities by using sandboxing. Other types of virtualization and application microsegmentation may also mitigate the impact of some types of exploitation. Risks of additional exploits and weaknesses in these systems may still exist.{}".format(insert)) t1212html.write("Exploit Protection</td>\n <td>") t1212html.write("Security applications that look for behavior used during exploitation such as Windows Defender Exploit Guard (WDEG) and the Enhanced Mitigation Experience Toolkit (EMET) can be used to mitigate some exploitation behavior. Control flow integrity checking is another way to potentially identify and stop a software exploit from occurring. Many of these protections depend on the architecture and target application binary for compatibility and may not work for software targeted for defense evasion.{}".format(insert)) t1212html.write("Threat Intelligence Program</td>\n <td>") #t1212html.write("Develop a robust cyber threat intelligence capability to determine what types and levels of threat may use software exploits and 0-days against a particular organization.{}".format(insert)) t1212html.write("Update Software</td>\n <td>") t1212html.write("Update software regularly by employing patch management for internal enterprise endpoints and servers.{}".format(footer)) with open(sd+"t1187.html", "w") as t1187html: # description t1187html.write("{}Adversaries may gather credential material by invoking or forcing a user to automatically provide authentication information through a mechanism in which they can intercept.<br>".format(header)) t1187html.write("The Server Message Block (SMB) protocol is commonly used in Windows networks for authentication and communication between systems for access to resources and file sharing.<br>") t1187html.write("When a Windows system attempts to connect to an SMB resource it will automatically attempt to authenticate and send credential information for the current user to the remote system.<br>") t1187html.write("This behavior is typical in enterprise environments so that users do not need to enter credentials to access network resources.<br>") t1187html.write("Web Distributed Authoring and Versioning (WebDAV) is also typically used by Windows systems as a backup protocol when SMB is blocked or fails. WebDAV is an extension of HTTP and will typically operate over TCP ports 80 and 443.<br>") t1187html.write("Adversaries may take advantage of this behavior to gain access to user account hashes through forced SMB/WebDAV authentication.<br>") t1187html.write("An adversary can send an attachment to a user through spearphishing that contains a resource link to an external server controlled by the adversary (i.e. Template Injection), or place a specially crafted file on navigation path for privileged accounts (e.g. .SCF file placed on desktop) or on a publicly accessible share to be accessed by victim(s).<br>") t1187html.write("When the user's system accesses the untrusted resource it will attempt authentication and send information, including the user's hashed credentials, over SMB to the adversary controlled server. With access to the credential hash, an adversary can perform off-line Brute Force cracking to gain access to plaintext credentials.") # information t1187html.write("{}T1187</td>\n <td>".format(headings)) # id t1187html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1187html.write("Credential Access</td>\n <td>") # tactics t1187html.write("-") # sub-techniques # indicator regex assignments t1187html.write("{}Ports: 137".format(iocs)) # related techniques t1187html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1221 target=\"_blank\"\">T1221</a></td>\n <td>".format(related)) t1187html.write("Template Injection") t1187html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1110 target=\"_blank\"\">T1110</a></td>\n <td>".format(insert)) t1187html.write("Brute Force") # mitigations t1187html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1187html.write("Block SMB traffic from exiting an enterprise network with egress filtering or by blocking TCP ports 139, 445 and UDP port 137. Filter or block WebDAV protocol traffic from exiting the network. If access to external resources over SMB and WebDAV is necessary, then traffic should be tightly limited with allowlisting.{}".format(insert)) t1187html.write("Password Policies</td>\n <td>") t1187html.write("Use strong passwords to increase the difficulty of credential hashes from being cracked if they are obtained.{}".format(footer)) with open(sd+"t1606.html", "w") as t1606html: # description t1606html.write("{}Adversaries may forge credential materials that can be used to gain access to web applications or Internet services. Web applications and services (hosted in cloud SaaS environments or on-premise servers) often use session cookies, tokens, or other materials to authenticate and authorize user access.<br>".format(header)) t1606html.write("Adversaries may generate these credential materials in order to gain access to web resources. This differs from Steal Web Session Cookie, Steal Application Access Token, and other similar behaviors in that the credentials are new and forged by the adversary, rather than stolen or intercepted from legitimate users. The generation of web credentials often requires secret values, such as passwords, Private Keys, or other cryptographic seed values.<br>") t1606html.write("Once forged, adversaries may use these web credentials to access resources (ex: Use Alternate Authentication Material), which may bypass multi-factor and other authentication protection mechanisms.") # information t1606html.write("{}T1606</td>\n <td>".format(headings)) # id t1606html.write("Windows, macOS, Linux, Azure, Google Workspace, Office 365, SaaS</td>\n <td>") # platforms t1606html.write("Credential Access</td>\n <td>") # tactics t1606html.write("T1606.001: Web Cookies<br>T1606.002: SAML Tokens") # sub-techniques # indicator regex assignments t1606html.write("{}NotOnOrAfter</li>\n <li>".format(iocs)) t1606html.write("AccessTokenLifetime</li>\n <li>") t1606html.write("LifetimeTokenPolicy</li>") # related techniques t1606html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1539 target=\"_blank\"\">T1539</a></td>\n <td>".format(related)) t1606html.write("Steal Web Session Cookie") t1606html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1528 target=\"_blank\"\">T1528</a></td>\n <td>".format(insert)) t1606html.write("Steal Application Access Token") t1606html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1552/004 target=\"_blank\"\">T1552.004</a></td>\n <td>".format(related)) t1606html.write("Private Keys") t1606html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1550 target=\"_blank\"\">T1550</a></td>\n <td>".format(insert)) t1606html.write("Use Alternate Authentication Material") # mitigations t1606html.write("{}Audit</td>\n <td>".format(mitigations)) t1606html.write("Administrators should perform an audit of all access lists and the permissions they have been granted to access web applications and services. This should be done extensively on all resources in order to establish a baseline, followed up on with periodic audits of new or updated resources. Suspicious accounts/credentials should be investigated and removed. Enable advanced auditing on ADFS. Check the success and failure audit options in the ADFS Management snap-in. Enable Audit Application Generated events on the AD FS farm via Group Policy Object.{}".format(insert)) t1606html.write("Privileged Account Management</td>\n <td>") t1606html.write("Restrict permissions and access to the AD FS server to only originate from privileged access workstations.{}".format(insert)) t1606html.write("Software Configuration</td>\n <td>") t1606html.write("Configure browsers/applications to regularly delete persistent web credentials (such as cookies).{}".format(insert)) t1606html.write("User Account Management</td>\n <td>") t1606html.write("Ensure that user accounts with administrative rights follow best practices, including use of privileged access workstations, Just in Time/Just Enough Administration (JIT/JEA), and strong authentication. Reduce the number of users that are members of highly privileged Directory Roles.{}".format(footer)) with open(sd+"t1056.html", "w") as t1056html: # description t1056html.write("{}Adversaries may use methods of capturing user input to obtain credentials or collect information. During normal system usage, users often provide credentials to various different locations, such as login pages/portals or system dialog boxes.<br>".format(header)) t1056html.write("Input capture mechanisms may be transparent to the user (e.g. Credential API Hooking) or rely on deceiving the user into providing input into what they believe to be a genuine service (e.g. Web Portal Capture).") # information t1056html.write("{}T1056</td>\n <td>".format(headings)) # id t1056html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1056html.write("Credential Access</td>\n <td>") # tactics t1056html.write("T1056.001: Keylogging<br>T1056.002: GUI Input Capture<br>T1056.003: Web Portal Capture<br>T1056.004: Credential API Hooking") # sub-techniques # indicator regex assignments t1056html.write("{}DISPLAY</li>\n <li>".format(iocs)) t1056html.write("HID</li>\n <li>") t1056html.write("PCI</li>\n <li>") t1056html.write("UMB</li>\n <li>") t1056html.write("FDC</li>\n <li>") t1056html.write("SCSI</li>\n <li>") t1056html.write("STORAGE</li>\n <li>") t1056html.write("USB</li>\n <li>") t1056html.write("WpdBusEnumRoot</li>") # related techniques t1056html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(related)) t1056html.write("Command and Scripting Interpreter") # mitigations t1056html.write("{}-</td>\n <td>".format(mitigations)) t1056html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1557.html", "w") as t1557html: # description t1557html.write("{}Adversaries may attempt to position themselves between two or more networked devices using a man-in-the-middle (MiTM) technique to support follow-on behaviors such as Network Sniffing or Transmitted Data Manipulation.<br>".format(header)) t1557html.write("By abusing features of common networking protocols that can determine the flow of network traffic (e.g. ARP, DNS, LLMNR, etc.), adversaries may force a device to communicate through an adversary controlled system so they can collect information or perform additional actions.<br>") t1557html.write("Adversaries may leverage the MiTM position to attempt to modify traffic, such as in Transmitted Data Manipulation. Adversaries can also stop traffic from flowing to the appropriate destination, causing denial of service.") # information t1557html.write("{}T1557</td>\n <td>".format(headings)) # id t1557html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1557html.write("Credential Access, Collection</td>\n <td>") # tactics t1557html.write("T1557.001: LLMNR/NBT-NS Poisoning and SMB Relay<br>T1557.002: ARP Cache Poisoning") # sub-techniques # indicator regex assignments t1557html.write("{}Ports: 137, 5355</li>\n <li>".format(iocs)) t1557html.write("Event IDs: 4657, 7045</li>\n <li>") t1557html.write("EnableMulticast</li>\n <li>") t1557html.write("NT/DNSClient</li>") # related techniques t1557html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1040 target=\"_blank\"\">T1040</a></td>\n <td>".format(related)) t1557html.write("Network Sniffing") t1557html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1565 target=\"_blank\"\">T1565</a></td>\n <td>".format(insert)) t1557html.write("Data Manipulation: Transmitted Data Manipulation") # mitigations t1557html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1557html.write("Disable legacy network protocols that may be used for MiTM if applicable and they are not needed within an environment.{}".format(insert)) t1557html.write("Encrypt Sensitive Information</td>\n <td>") t1557html.write("Ensure that all wired and/or wireless traffic is encrypted appropriately. Use best practices for authentication protocols, such as Kerberos, and ensure web traffic that may contain credentials is protected by SSL/TLS.{}".format(insert)) t1557html.write("Filter Network Traffic</td>\n <td>") t1557html.write("Use network appliances and host-based security software to block network traffic that is not necessary within the environment, such as legacy protocols that may be leveraged for MiTM.{}".format(insert)) t1557html.write("Limit Access to Resource Over Network</td>\n <td>") t1557html.write("Limit access to network infrastructure and resources that can be used to reshape traffic or otherwise produce MiTM conditions.{}".format(insert)) t1557html.write("Network Intrusion Prevention</td>\n <td>") t1557html.write("Network intrusion detection and prevention systems that can identify traffic patterns indicative of MiTM activity can be used to mitigate activity at the network level.{}".format(insert)) t1557html.write("Network Segmentation</td>\n <td>") t1557html.write("Network segmentation can be used to isolate infrastructure components that do not require broad network access. This may mitigate, or at least alleviate, the scope of MiTM activity.{}".format(insert)) t1557html.write("User Training</td>\n <td>") t1557html.write("Train users to be suspicious about certificate errors. Adversaries may use their own certificates in an attempt to MiTM HTTPS traffic. Certificate errors may arise when the application’s certificate does not match the one expected by the host.{}".format(footer)) with open(sd+"t1040.html", "w") as t1040html: # description t1040html.write("{}Adversaries may sniff network traffic to capture information about an environment, including authentication material passed over the network. Network sniffing refers to using the network interface on a system to monitor or capture information sent over a wired or wireless connection.<br>".format(header)) t1040html.write("An adversary may place a network interface into promiscuous mode to passively access data in transit over the network, or use span ports to capture a larger amount of data.<br>") t1040html.write("Data captured via this technique may include user credentials, especially those sent over an insecure, unencrypted protocol. Techniques for name service resolution poisoning, such as LLMNR/NBT-NS Poisoning and SMB Relay, can also be used to capture credentials to websites, proxies, and internal systems by redirecting traffic to an adversary.<br>") t1040html.write("Network sniffing may also reveal configuration details, such as running services, version numbers, and other network characteristics (e.g. IP addresses, hostnames, VLAN IDs) necessary for subsequent Lateral Movement and/or Defense Evasion activities.") # information t1040html.write("{}T1040</td>\n <td>".format(headings)) # id t1040html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1040html.write("Credential Access, Discovery</td>\n <td>") # tactics t1040html.write("-") # sub-techniques # indicator regex assignments t1040html.write("{}-".format(iocs)) # related techniques t1040html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1557 target=\"_blank\"\">T1557</a></td>\n <td>".format(related)) t1040html.write("Man-in-the-Middle: LLMNR/NBT-NS Poisoning and SMB Relay") # mitigations t1040html.write("{}Encrypt Sensitive Information</td>\n <td>".format(mitigations)) t1040html.write("Ensure that all wired and/or wireless traffic is encrypted appropriately. Use best practices for authentication protocols, such as Kerberos, and ensure web traffic that may contain credentials is protected by SSL/TLS.{}".format(insert)) t1040html.write("Multi-factor Authentication</td>\n <td>") t1040html.write("Use multi-factor authentication wherever possible.{}".format(footer)) with open(sd+"t1003.html", "w") as t1003html: # description t1003html.write("{}Adversaries may attempt to dump credentials to obtain account login and credential material, normally in the form of a hash or a clear text password, from the operating system and software.<br>".format(header)) t1003html.write("Credentials can then be used to perform Lateral Movement and access restricted information.<br>") t1003html.write("Several of the tools mentioned in associated sub-techniques may be used by both adversaries and professional security testers. Additional custom tools likely exist as well.") # information t1003html.write("{}T1003</td>\n <td>".format(headings)) # id t1003html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1003html.write("Credential Access</td>\n <td>") # tactics t1003html.write("T1003.001: LSASS Memory<br>T1003.002: Security Account Manager<br>T1003.003: NTDS<br>T1003.004: LSA Secrets<br>T1003.005: Cached Domain Credentials<br>T1003.006: DCSync<br>T1003.007: Proc Filesystem<br>T1003.008: /etc/passwd and /etc/shadow") # sub-techniques # indicator regex assignments t1003html.write("{}procdump</li>\n <li>".format(iocs)) t1003html.write("sekurlsa</li>\n <li>") t1003html.write("cmsadcs</li>\n <li>") t1003html.write("NTDS</li>\n <li>") t1003html.write("gsecdump</li>\n <li>") t1003html.write("mimikatz</li>\n <li>") t1003html.write("pwdumpx</li>\n <li>") t1003html.write("secretsdump</li>\n <li>") t1003html.write("procdump</li>\n <li>") t1003html.write("sekurlsa</li>\n <li>") t1003html.write("lsass</li>\n <li>") t1003html.write("psexec</li>\n <li>") t1003html.write("net user</li>\n <li>") t1003html.write("net1 user</li>\n <li>") t1003html.write("reg save</li>\n <li>") t1003html.write("hklm/sam</li>\n <li>") t1003html.write("hklm/system</li>\n <li>") t1003html.write("currentcontrolset/control/lsa</li>\n <li>") t1003html.write("/security/policy/secrets</li>\n <li>") t1003html.write("manager/safedllsearchmode</li>\n <li>") t1003html.write("passwd</li>\n <li>") t1003html.write("shadow</li>") # related techniques t1003html.write("{}--</a></td>\n <td>".format(related)) t1003html.write("-") # mitigations t1003html.write("{}Active Directory Configuration</td>\n <td>".format(mitigations)) t1003html.write("Manage the access control list for \"Replicating Directory Changes\" and other permissions associated with domain controller replication. Consider adding users to the \"Protected Users\" Active Directory security group. This can help limit the caching of users' plaintext credentials.{}".format(insert)) t1003html.write("Credential Access Protection</td>\n <td>") t1003html.write("With Windows 10, Microsoft implemented new protections called Credential Guard to protect the LSA secrets that can be used to obtain credentials through forms of credential dumping. It is not configured by default and has hardware and firmware system requirements. It also does not protect against all forms of credential dumping.{}".format(insert)) t1003html.write("Encrypt Sensitive Information</td>\n <td>") t1003html.write("Ensure Domain Controller backups are properly secured.{}".format(insert)) t1003html.write("Operating System Configuration</td>\n <td>") t1003html.write("Consider disabling or restricting NTLM. Consider disabling WDigest authentication.{}".format(insert)) t1003html.write("Password Policies</td>\n <td>") t1003html.write("Ensure that local administrator accounts have complex, unique passwords across all systems on the network.{}".format(insert)) t1003html.write("Privileged Account Management</td>\n <td>") t1003html.write("Windows: Do not put user or admin domain accounts in the local administrator groups across systems unless they are tightly controlled, as this is often equivalent to having a local administrator account with the same password on all systems. Follow best practices for design and administration of an enterprise network to limit privileged account use across administrative tiers. Linux: Scraping the passwords from memory requires root privileges. Follow best practices in restricting access to privileged accounts to avoid hostile programs from accessing such sensitive regions of memory.{}".format(insert)) t1003html.write("Privileged Process Integrity</td>\n <td>") t1003html.write("On Windows 8.1 and Windows Server 2012 R2, enable Protected Process Light for LSA.{}".format(insert)) t1003html.write("User Training</td>\n <td>") t1003html.write("Limit credential overlap across accounts and systems by training users and administrators not to use the same password for multiple accounts.{}".format(footer)) with open(sd+"t1528.html", "w") as t1528html: # description t1528html.write("{}Adversaries can steal user application access tokens as a means of acquiring credentials to access remote systems and resources. This can occur through social engineering and typically requires user action to grant access.<br>".format(header)) t1528html.write("Application access tokens are used to make authorized API requests on behalf of a user and are commonly used as a way to access resources in cloud-based applications and software-as-a-service (SaaS). OAuth is one commonly implemented framework that issues tokens to users for access to systems.<br>") t1528html.write("An application desiring access to cloud-based services or protected APIs can gain entry using OAuth 2.0 through a variety of authorization protocols. An example commonly-used sequence is Microsoft's Authorization Code Grant flow. An OAuth access token enables a third-party application to interact with resources containing user data in the ways requested by the application without obtaining user credentials.<br>") t1528html.write("Adversaries can leverage OAuth authorization by constructing a malicious application designed to be granted access to resources with the target user's OAuth token. The adversary will need to complete registration of their application with the authorization server, for example Microsoft Identity Platform using Azure Portal, the Visual Studio IDE, the command-line interface, PowerShell, or REST API calls.<br>") t1528html.write("Then, they can send a link through Spearphishing Link to the target user to entice them to grant access to the application. Once the OAuth access token is granted, the application can gain potentially long-term access to features of the user account through Application Access Token.<br>") t1528html.write("Adversaries have been seen targeting Gmail, Microsoft Outlook, and Yahoo Mail users.") # information t1528html.write("{}T1528</td>\n <td>".format(headings)) # id t1528html.write("Azure, Office 365, SaaS</td>\n <td>") # platforms t1528html.write("Credential Access</td>\n <td>") # tactics t1528html.write("-") # sub-techniques # indicator regex assignments t1528html.write("{}-".format(iocs)) # related techniques t1528html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1566 target=\"_blank\"\">T1566</a></td>\n <td>".format(related)) t1528html.write("Phishing: Spearphishing Link") t1528html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1550 target=\"_blank\"\">T1550</a></td>\n <td>".format(insert)) t1528html.write("Use Alternate Authentication Material: Application Access Token") # mitigations t1528html.write("{}Audit</td>\n <td>".format(mitigations)) t1528html.write("Administrators should perform an audit of all OAuth applications and the permissions they have been granted to access organizational data. This should be done extensively on all applications in order to establish a baseline, followed up on with periodic audits of new or updated applications. Suspicious applications should be investigated and removed.{}".format(insert)) t1528html.write("Restrict Web-Based Content</td>\n <td>") t1528html.write("Administrators can block end-user consent to OAuth applications, disabling users from authorizing third-party apps through OAuth 2.0 and forcing administrative consent for all requests. They can also block end-user registration of applications by their users, to reduce risk. A Cloud Access Security Broker can also be used to ban applications. Azure offers a couple of enterprise policy settings in the Azure Management Portal that may help: \"Users -> User settings -> App registrations: Users can register applications\" can be set to \"no\" to prevent users from registering new applications. \"Enterprise applications -> User settings -> Enterprise applications: Users can consent to apps accessing company data on their behalf\" can be set to \"no\" to prevent users from consenting to allow third-party multi-tenant applications.{}".format(insert)) t1528html.write("User Account Management</td>\n <td>") t1528html.write("A Cloud Access Security Broker (CASB) can be used to set usage policies and manage user permissions on cloud applications to prevent access to application access tokens.{}".format(insert)) t1528html.write("User Training</td>\n <td>") t1528html.write("Users need to be trained to not authorize third-party applications they don’t recognize. The user should pay particular attention to the redirect URL: if the URL is a misspelled or convoluted sequence of words related to an expected service or SaaS application, the website is likely trying to spoof a legitimate service. Users should also be cautious about the permissions they are granting to apps. For example, offline access and access to read emails should excite higher suspicions because adversaries can utilize SaaS APIs to discover credentials and other sensitive communications.{}".format(footer)) with open(sd+"t1558.html", "w") as t1558html: # description t1558html.write("{}Adversaries may attempt to subvert Kerberos authentication by stealing or forging Kerberos tickets to enable Pass the Ticket.<br>".format(header)) t1558html.write("Kerberos is an authentication protocol widely used in modern Windows domain environments. In Kerberos environments, referred to as \"realms\", there are three basic participants: client, service, and Key Distribution Center (KDC).<br>") t1558html.write("Clients request access to a service and through the exchange of Kerberos tickets, originating from KDC, they are granted access after having successfully authenticated.<br>") t1558html.write("The KDC is responsible for both authentication and ticket granting. Attackers may attempt to abuse Kerberos by stealing tickets or forging tickets to enable unauthorized access.") # information t1558html.write("{}T1558</td>\n <td>".format(headings)) # id t1558html.write("Windows</td>\n <td>") # platforms t1558html.write("Credential Access</td>\n <td>") # tactics t1558html.write("T1558.001: Golden Ticket<br>T1558.002: Silver Ticket<br>T1558.003: Kerberoasting<br>T1558.004: AS-REP Roasting") # sub-techniques # indicator regex assignments t1558html.write("{}Event IDs: 4624, 4634, 4768, 4769, 4672".format(iocs)) # related techniques t1558html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1550 target=\"_blank\"\">T1550</a></td>\n <td>".format(related)) t1558html.write("Use Alternate Authentication Material: Pass the Ticket") # mitigations t1558html.write("{}Active Directory Configuration</td>\n <td>".format(mitigations)) t1558html.write("For containing the impact of a previously generated golden ticket, reset the built-in KRBTGT account password twice, which will invalidate any existing golden tickets that have been created with the KRBTGT hash and other Kerberos tickets derived from it. For each domain, change the KRBTGT account password once, force replication, and then change the password a second time. Consider rotating the KRBTGT account password every 180 days.{}".format(insert)) t1558html.write("Encrypt Sensitive Information</td>\n <td>") t1558html.write("Enable AES Kerberos encryption (or another stronger encryption algorithm), rather than RC4, where possible.{}".format(insert)) t1558html.write("Password Policies</td>\n <td>") t1558html.write("Ensure strong password length (ideally 25+ characters) and complexity for service accounts and that these passwords periodically expire. Also consider using Group Managed Service Accounts or another third party product such as password vaulting.{}".format(insert)) t1558html.write("Privileged Account Management</td>\n <td>") t1558html.write("Limit domain admin account permissions to domain controllers and limited servers. Delegate other admin functions to separate accounts. nbsp;Limit service accounts to minimal required privileges, including membership in privileged groups such as Domain Administrators.{}".format(footer)) with open(sd+"t1539.html", "w") as t1539html: # description t1539html.write("{}An adversary may steal web application or service session cookies and use them to gain access web applications or Internet services as an authenticated user without needing credentials. Web applications and services often use session cookies as an authentication token after a user has authenticated to a website.<br>".format(header)) t1539html.write("Cookies are often valid for an extended period of time, even if the web application is not actively used. Cookies can be found on disk, in the process memory of the browser, and in network traffic to remote systems.<br>") t1539html.write("Additionally, other applications on the targets machine might store sensitive authentication cookies in memory (e.g. apps which authenticate to cloud services). Session cookies can be used to bypasses some multi-factor authentication protocols.<br>") t1539html.write("There are several examples of malware targeting cookies from web browsers on the local system. There are also open source frameworks such as Evilginx 2 and Muraena that can gather session cookies through a man-in-the-middle proxy that can be set up by an adversary and used in phishing campaigns.<br>") t1539html.write("After an adversary acquires a valid cookie, they can then perform a Web Session Cookie technique to login to the corresponding web application.") # information t1539html.write("{}T1539</td>\n <td>".format(headings)) # id t1539html.write("Windows, macOS, Linux, Office 365, SaaS</td>\n <td>") # platforms t1539html.write("Credential Access</td>\n <td>") # tactics t1539html.write("-") # sub-techniques # indicator regex assignments t1539html.write("{}-".format(iocs)) # related techniques t1539html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1550 target=\"_blank\"\">T1550.004</a></td>\n <td>".format(related)) t1539html.write("Use Alternate Authentication Material: Web Session Cookie") # mitigations t1539html.write("{}Multi-factor Authentication</td>\n <td>".format(mitigations)) t1539html.write("A physical second factor key that uses the target login domain as part of the negotiation protocol will prevent session cookie theft through proxy methods.{}".format(insert)) t1539html.write("Software Configuration</td>\n <td>") t1539html.write("Configure browsers or tasks to regularly delete persistent cookies.{}".format(insert)) t1539html.write("User Training</td>\n <td>") t1539html.write("Train users to identify aspects of phishing attempts where they're asked to enter credentials into a site that has the incorrect domain for the application they are logging into.{}".format(footer)) with open(sd+"t1111.html", "w") as t1111html: # description t1111html.write("{}Adversaries may target two-factor authentication mechanisms, such as smart cards, to gain access to credentials that can be used to access systems, services, and network resources.<br>".format(header)) t1111html.write("Use of two or multi-factor authentication (2FA or MFA) is recommended and provides a higher level of security than user names and passwords alone, but organizations should be aware of techniques that could be used to intercept and bypass these security mechanisms.<br>") t1111html.write("If a smart card is used for two-factor authentication, then a keylogger will need to be used to obtain the password associated with a smart card during normal use.<br>") t1111html.write("With both an inserted card and access to the smart card password, an adversary can connect to a network resource using the infected system to proxy the authentication with the inserted hardware token.<br>") t1111html.write("Adversaries may also employ a keylogger to similarly target other hardware tokens, such as RSA SecurID.<br>") t1111html.write("Capturing token input (including a user's personal identification code) may provide temporary access (i.e. replay the one-time passcode until the next value rollover) as well as possibly enabling adversaries to reliably predict future authentication values (given access to both the algorithm and any seed values used to generate appended temporary codes).<br>") t1111html.write("Other methods of 2FA may be intercepted and used by an adversary to authenticate. It is common for one-time codes to be sent via out-of-band communications (email, SMS).<br>") t1111html.write("If the device and/or service is not secured, then it may be vulnerable to interception. Although primarily focused on by cyber criminals, these authentication mechanisms have been targeted by advanced actors.") # information t1111html.write("{}T1111</td>\n <td>".format(headings)) # id t1111html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1111html.write("Credential Access</td>\n <td>") # tactics t1111html.write("-") # sub-techniques # indicator regex assignments t1111html.write("{}-".format(iocs)) # related techniques t1111html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1056 target=\"_blank\"\">T1056</a></td>\n <td>".format(related)) t1111html.write("Input Capture") # mitigations t1111html.write("{}User Training</td>\n <td>".format(mitigations)) t1111html.write("Remove smart cards when not in use.{}".format(footer)) with open(sd+"t1552.html", "w") as t1552html: # description t1552html.write("Adversaries may search compromised systems to find and obtain insecurely stored credentials. These credentials can be stored and/or misplaced in many locations on a system, including plaintext files (e.g. Bash History), operating system or application-specific repositories (e.g. Credentials in Registry), or other specialized files/artifacts (e.g. Private Keys).") # information t1552html.write("{}T1552</td>\n <td>".format(headings)) # id t1552html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1552html.write("Credential Access</td>\n <td>") # tactics t1552html.write("T1552.001: Credentials In Files<br>T1552.002: Credentials In Registry<br>T1552.003: Bash History<br>T1552.004: Private Keys<br>T1552.005: Cloud Instance Metadata API<br>T1552.006: Group Policy Preferences<br>T1552.007: Container API") # sub-techniques # indicator regex assignments t1552html.write("{}.asc</li>\n <li>".format(iocs)) t1552html.write(".cer</li>\n <li>") t1552html.write(".gpg</li>\n <li>") t1552html.write(".key</li>\n <li>") t1552html.write(".p12</li>\n <li>") t1552html.write(".p7b</li>\n <li>") t1552html.write(".pem</li>\n <li>") t1552html.write(".pfx</li>\n <li>") t1552html.write(".pgp</li>\n <li>") t1552html.write(".ppk</li>\n <li>") t1552html.write("Get-UnattendedInstallFile</li>\n <li>") t1552html.write("Get-WebConfig</li>\n <li>") t1552html.write("Get-ApplicationHost</li>\n <li>") t1552html.write("Get-SiteListPassword</li>\n <li>") t1552html.write("Get-CachedGPPPassword</li>\n <li>") t1552html.write("Get-RegistryAutoLogon</li>\n <li>") t1552html.write("password</li>\n <li>") t1552html.write("pwd</li>\n <li>") t1552html.write("login</li>\n <li>") t1552html.write("store</li>\n <li>") t1552html.write("secure</li>\n <li>") t1552html.write("credentials</li>\n <li>") t1552html.write("security</li>\n <li>") t1552html.write("bash_history</li>\n <li>") t1552html.write("history</li>\n <li>") t1552html.write("HISTFILE</li>") # related techniques t1552html.write("{}-</a></td>\n <td>".format(related)) t1552html.write("-") # mitigations t1552html.write("{}Active Directory Configuration</td>\n <td>".format(mitigations)) t1552html.write("Remove vulnerable Group Policy Preferences.{}".format(insert)) t1552html.write("Audit</td>\n <td>") t1552html.write("Preemptively search for files containing passwords or other credentials and take actions to reduce the exposure risk when found.{}".format(insert)) t1552html.write("Encrypt Sensitive Information</td>\n <td>") t1552html.write("When possible, store keys on separate cryptographic hardware instead of on the local system.{}".format(insert)) t1552html.write("Filter Network Traffic</td>\n <td>") t1552html.write("Limit access to the Instance Metadata API using a host-based firewall such as iptables. A properly configured Web Application Firewall (WAF) may help prevent external adversaries from exploiting Server-side Request Forgery (SSRF) attacks that allow access to the Cloud Instance Metadata API.{}".format(insert)) t1552html.write("Operating System Configuration</td>\n <td>") t1552html.write("There are multiple methods of preventing a user's command history from being flushed to their .bash_history file, including use of the following commands:set +o history and set -o history to start logging again; unset HISTFILE being added to a user's .bash_rc file; andln -s /dev/null ~/.bash_history to write commands to /dev/nullinstead.{}".format(insert)) t1552html.write("Password Policies</td>\n <td>") t1552html.write("Use strong passphrases for private keys to make cracking difficult. Do not store credentials within the Registry. Establish an organizational policy that prohibits password storage in files.{}".format(insert)) t1552html.write("Privileged Account Management</td>\n <td>") t1552html.write("If it is necessary that software must store credentials in the Registry, then ensure the associated accounts have limited permissions so they cannot be abused if obtained by an adversary.{}".format(insert)) t1552html.write("Restrict File and Directory Permissions</td>\n <td>") t1552html.write("Restrict file shares to specific directories with access only to necessary users.{}".format(insert)) t1552html.write("Update Software</td>\n <td>") t1552html.write("Apply patch KB2962486 which prevents credentials from being stored in GPPs.{}".format(insert)) t1552html.write("User Training</td>\n <td>") t1552html.write("Ensure that developers and system administrators are aware of the risk associated with having plaintext passwords in software configuration files that may be left on endpoint systems or servers.{}".format(footer)) # Discovery with open(sd+"t1087.html", "w") as t1087html: # description t1087html.write("{}Adversaries may attempt to get a listing of accounts on a system or within an environment. This information can help adversaries determine which accounts exist to aid in follow-on behavior.".format(header)) # information t1087html.write("{}T1087</td>\n <td>".format(headings)) # id t1087html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1087html.write("Discovery</td>\n <td>") # tactics t1087html.write("T1087.001: Local Account<br>T1087.002: Domain Account<br>T1087.003: Email Account<br>T1087.004: Cloud Account") # sub-techniques # indicator regex assignments t1087html.write("{}Get-GlobalAddressList</li>\n <li>".format(iocs)) t1087html.write("CurrentVersion\Policies\CredUI\EnumerateAdministrators</li>\n <li>") t1087html.write("dscacheutil</li>\n <li>") t1087html.write("ldapsearch</li>\n <li>") t1087html.write("passwd</li>\n <li>") t1087html.write("shadow</li>") # related techniques t1087html.write("{}-</a></td>\n <td>".format(related)) t1087html.write("-") # mitigations t1087html.write("{}Operating System Configuration</td>\n <td>".format(mitigations)) t1087html.write("Prevent administrator accounts from being enumerated when an application is elevating through UAC since it can lead to the disclosure of account names. The Registry key is located HKLM\\ SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\CredUI\\EnumerateAdministrators. It can be disabled through GPO: Computer Configuration > [Policies] > Administrative Templates > Windows Components > Credential User Interface: E numerate administrator accounts on elevation.{}".format(footer)) with open(sd+"t1010.html", "w") as t1010html: # description t1010html.write("{}Adversaries may attempt to get a listing of open application windows. Window listings could convey information about how the system is used or give context to information collected by a keylogger.".format(header)) # information t1010html.write("{}T1010</td>\n <td>".format(headings)) # id t1010html.write("Windows, macOS</td>\n <td>") # platforms t1010html.write("Discovery</td>\n <td>") # tactics t1010html.write("-") # sub-techniques # indicator regex assignments t1010html.write("{}-".format(iocs)) # related techniques t1010html.write("{}-</a></td>\n <td>".format(related)) t1010html.write("-") # mitigations t1010html.write("{}-</td>\n <td>".format(mitigations)) t1010html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1217.html", "w") as t1217html: # description t1217html.write("{}Adversaries may enumerate browser bookmarks to learn more about compromised hosts. Browser bookmarks may reveal personal information about users (ex: banking sites, interests, social media, etc.) as well as details about internal network resources such as servers, tools/dashboards, or other related infrastructure.<br>".format(header)) t1217html.write("Browser bookmarks may also highlight additional targets after an adversary has access to valid credentials, especially Credentials In Files associated with logins cached by a browser.<br>") t1217html.write("Specific storage locations vary based on platform and/or application, but browser bookmarks are typically stored in local files/databases.") # information t1217html.write("{}T1217</td>\n <td>".format(headings)) # id t1217html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1217html.write("Discovery</td>\n <td>") # tactics t1217html.write("-") # sub-techniques # indicator regex assignments t1217html.write("{}-".format(iocs)) # related techniques t1217html.write("<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1552 target=\"_blank\"\">T1552</a></td>\n <td>") t1217html.write("Unsecured Credentials: Credentials In Files") # mitigations t1217html.write("{}-</td>\n <td>".format(mitigations)) t1217html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1580.html", "w") as t1580html: # description t1580html.write("{}An adversary may attempt to discover resources that are available within an infrastructure-as-a-service (IaaS) environment. This includes compute service resources such as instances, virtual machines, and snapshots as well as resources of other services including the storage and database services.<br>".format(header)) t1580html.write("Cloud providers offer methods such as APIs and commands issued through CLIs to serve information about infrastructure. For example, AWS provides a DescribeInstances API within the Amazon EC2 API that can return information about one or more instances within an account, as well as the ListBuckets API that returns a list of all buckets owned by the authenticated sender of the request. Similarly, GCP's Cloud SDK CLI provides the gcloud compute instances list command to list all Google Compute Engine instances in a project, and Azure's CLI command az vm list lists details of virtual machines.<br>") t1580html.write("An adversary may enumerate resources using a compromised user's access keys to determine which are available to that user. The discovery of these available resources may help adversaries determine their next steps in the Cloud environment, such as establishing Persistence. Unlike in Cloud Service Discovery, this technique focuses on the discovery of components of the provided services rather than the services themselves.") # information t1580html.write("{}T1580</td>\n <td>".format(headings)) # id t1580html.write("IaaS</td>\n <td>") # platforms t1580html.write("Discovery</td>\n <td>") # tactics t1580html.write("-") # sub-techniques # indicator regex assignments t1580html.write("{}-".format(iocs)) # related techniques t1580html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1526 target=\"_blank\"\">T1526</a></td>\n <td>".format(related)) t1580html.write("Cloud Service Discovery") # mitigations t1580html.write("{}User Account Management</td>\n <td>") t1580html.write("Limit permissions to discover cloud infrastructure in accordance with least privilege. Organizations should limit the number of users within the organization with an IAM role that has administrative privileges, strive to reduce all permanent privileged role assignments, and conduct periodic entitlement reviews on IAM users, roles and policies.{}".format(footer)) with open(sd+"t1538.html", "w") as t1538html: # description t1538html.write("{}An adversary may use a cloud service dashboard GUI with stolen credentials to gain useful information from an operational cloud environment, such as specific services, resources, and features.<br>".format(header)) t1538html.write("For example, the GCP Command Center can be used to view all assets, findings of potential security risks, and to run additional queries, such as finding public IP addresses and open ports.<br>") t1538html.write("Depending on the configuration of the environment, an adversary may be able to enumerate more information via the graphical dashboard than an API. This allows the adversary to gain information without making any API requests.") # information t1538html.write("{}T1538</td>\n <td>".format(headings)) # id t1538html.write("AWS, Azure, GCP, Office 365</td>\n <td>") # platforms t1538html.write("Discovery</td>\n <td>") # tactics t1538html.write("-") # sub-techniques # indicator regex assignments t1538html.write("{}-".format(iocs)) # related techniques t1538html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t0000 target=\"_blank\"\">T0000</a></td>\n <td>".format(related)) t1538html.write("Scheduled Task/Job") # mitigations t1538html.write("{}User Account Management</td>\n <td>".format(mitigations)) t1538html.write("Enforce the principle of least-privilege by limiting dashboard visibility to only the resources required. This may limit the discovery value of the dashboard in the event of a compromised account.{}".format(footer)) with open(sd+"t1526.html", "w") as t1526html: # description t1526html.write("{}An adversary may attempt to enumerate the cloud services running on a system after gaining access. These methods can differ from platform-as-a-service (PaaS), to infrastructure-as-a-service (IaaS), or software-as-a-service (SaaS).<br>".format(header)) t1526html.write("Many services exist throughout the various cloud providers and can include Continuous Integration and Continuous Delivery (CI/CD), Lambda Functions, Azure AD, etc.<br>") t1526html.write("Adversaries may attempt to discover information about the services enabled throughout the environment. Azure tools and APIs, such as the Azure AD Graph API and Azure Resource Manager API, can enumerate resources and services, including applications, management groups, resources and policy definitions, and their relationships that are accessible by an identity.<br>") t1526html.write("Stormspotter is an open source tool for enumerating and constructing a graph for Azure resources and services, and Pacu is an open source AWS exploitation framework that supports several methods for discovering cloud services.") # information t1526html.write("{}T1526</td>\n <td>".format(headings)) # id t1526html.write("AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1526html.write("Discovery</td>\n <td>") # tactics t1526html.write("-") # sub-techniques # indicator regex assignments t1526html.write("{}-".format(iocs)) # related techniques t1526html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1580 target=\"_blank\"\">T1580</a></td>\n <td>".format(related)) t1526html.write("Cloud Infrastructure Discovery") # mitigations t1526html.write("{}User Account Management</td>\n <td>") t1526html.write("Limit permissions to discover cloud infrastructure in accordance with least privilege. Organizations should limit the number of users within the organization with an IAM role that has administrative privileges, strive to reduce all permanent privileged role assignments, and conduct periodic entitlement reviews on IAM users, roles and policies.{}".format(footer)) with open(sd+"t1613.html", "w") as t1613html: # description t1613html.write("{}Adversaries may attempt to discover containers and other resources that are available within a containers environment. Other resources may include images, deployments, pods, nodes, and other information such as the status of a cluster.<br>".format(header)) t1613html.write("These resources can be viewed within web applications such as the Kubernetes dashboard or can be queried via the Docker and Kubernetes APIs. In Docker, logs may leak information about the environment, such as the environment’s configuration, which services are available, and what cloud provider the victim may be utilizing. The discovery of these resources may inform an adversary’s next steps in the environment, such as how to perform lateral movement and which methods to utilize for execution.") # information t1613html.write("{}T1613</td>\n <td>".format(headings)) # id t1613html.write("Containers</td>\n <td>") # platforms t1613html.write("Discovery</td>\n <td>") # tactics t1613html.write("-") # sub-techniques # indicator regex assignments t1613html.write("{}-".format(iocs)) # related techniques t1613html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(related)) t1613html.write("Command and Scripting Interpreter") # mitigations t1613html.write("{}Limit Access to Resource Over Network</td>\n <td>".format(mitigations)) t1613html.write("Limit communications with the container service to local Unix sockets or remote access via SSH. Require secure port access to communicate with the APIs over TLS by disabling unauthenticated access to the Docker API and Kubernetes API Server.{}".format(insert)) t1613html.write("Network Segmentation</td>\n <td>") t1613html.write("Deny direct remote access to internal systems through the use of network proxies, gateways, and firewalls.{}".format(insert)) t1613html.write("User Account Management</td>\n <td>") t1613html.write("Enforce the principle of least privilege by limiting dashboard visibility to only the required users.{}".format(footer)) with open(sd+"t1482.html", "w") as t1482html: # description t1482html.write("{}Adversaries may attempt to gather information on domain trust relationships that may be used to identify lateral movement opportunities in Windows multi-domain/forest environments. Domain trusts provide a mechanism for a domain to allow access to resources based on the authentication procedures of another domain.<br>".format(header)) t1482html.write("Domain trusts allow the users of the trusted domain to access resources in the trusting domain. The information discovered may help the adversary conduct SID-History Injection, Pass the Ticket, and Kerberoasting.<br>") t1482html.write("Domain trusts can be enumerated using the DSEnumerateDomainTrusts() Win32 API call, .NET methods, and LDAP. The Windows utility Nltest is known to be used by adversaries to enumerate domain trusts.") # information t1482html.write("{}T1482</td>\n <td>".format(headings)) # id t1482html.write("Windows</td>\n <td>") # platforms t1482html.write("Discovery</td>\n <td>") # tactics t1482html.write("-") # sub-techniques # indicator regex assignments t1482html.write("{}DSEnumerateDomainTrusts</li>\n <li>".format(iocs)) t1482html.write("GetAllTrustRelationships</li>\n <li>") t1482html.write("Get-AcceptedDomain</li>\n <li>") t1482html.write("Get-NetDomainTrust</li>\n <li>") t1482html.write("Get-NetForestTrust</li>\n <li>") t1482html.write("nltest</li>\n <li>") t1482html.write("dsquery</li>") # related techniques t1482html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1134 target=\"_blank\"\">T1134</a></td>\n <td>".format(related)) t1482html.write("Access Token Manipulation: SID-History Injection") t1482html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1550 target=\"_blank\"\">T1550</a></td>\n <td>".format(insert)) t1482html.write("Use Alternate Authentication Material: Pass the Ticket") t1482html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1558 target=\"_blank\"\">T1558</a></td>\n <td>".format(insert)) t1482html.write("Steal or Forge Kerberos Tickets: Kerberoasting") # mitigations t1482html.write("{}Audit</td>\n <td>".format(mitigations)) t1482html.write("Map the trusts within existing domains/forests and keep trust relationships to a minimum.{}".format(insert)) t1482html.write("Network Segmentation</td>\n <td>") t1482html.write("Employ network segmentation for sensitive domains.{}".format(footer)) with open(sd+"t1083.html", "w") as t1083html: # description t1083html.write("{}Adversaries may enumerate files and directories or may search in specific locations of a host or network share for certain information within a file system.<br>".format(header)) t1083html.write("Adversaries may use the information from File and Directory Discovery during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.<br>") t1083html.write("Many command shell utilities can be used to obtain this information. Examples include dir, tree, ls, find, and locate. Custom tools may also be used to gather file and directory information and interact with the Native API.") # information t1083html.write("{}T1083</td>\n <td>".format(headings)) # id t1083html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1083html.write("Discovery</td>\n <td>") # tactics t1083html.write("-") # sub-techniques # indicator regex assignments t1083html.write("{}dir</li>\n <li>".format(iocs)) t1083html.write("tree</li>\n <li>") t1083html.write("ls</li>\n <li>") t1083html.write("find</li>\n <li>") t1083html.write("locate</li>") # related techniques t1083html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1106 target=\"_blank\"\">T1106</a></td>\n <td>".format(related)) t1083html.write("Native API") # mitigations t1083html.write("{}-</td>\n <td>".format(mitigations)) t1083html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1046.html", "w") as t1046html: # description t1046html.write("{}Adversaries may attempt to get a listing of services running on remote hosts, including those that may be vulnerable to remote software exploitation. Methods to acquire this information include port scans and vulnerability scans using tools that are brought onto a system.<br>".format(header)) t1046html.write("Within cloud environments, adversaries may attempt to discover services running on other cloud hosts. Additionally, if the cloud environment is connected to a on-premises environment, adversaries may be able to identify services running on non-cloud systems as well.") # information t1046html.write("{}T1046</td>\n <td>".format(headings)) # id t1046html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1046html.write("Discovery</td>\n <td>") # tactics t1046html.write("-") # sub-techniques # indicator regex assignments t1046html.write("{}-".format(iocs)) # related techniques t1046html.write("{}-</a></td>\n <td>".format(related)) t1046html.write("-") # mitigations t1046html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1046html.write("Ensure that unnecessary ports and services are closed to prevent risk of discovery and potential exploitation.{}".format(insert)) t1046html.write("Network Intrusion Prevention</td>\n <td>") t1046html.write("Use network intrusion detection/prevention systems to detect and prevent remote service scans.{}".format(insert)) t1046html.write("Network Segmentation</td>\n <td>") t1046html.write("Ensure proper network segmentation is followed to protect critical servers and devices.{}".format(footer)) with open(sd+"t1135.html", "w") as t1135html: # description t1135html.write("{}Adversaries may look for folders and drives shared on remote systems as a means of identifying sources of information to gather as a precursor for Collection and to identify potential systems of interest for Lateral Movement. Networks often contain shared network drives and folders that enable users to access file directories on various systems across a network.<br>".format(header)) t1135html.write("File sharing over a Windows network occurs over the SMB protocol. Net can be used to query a remote system for available shared drives using the net view \\remotesystem command. It can also be used to query shared drives on the local system using net share.<br>") t1135html.write("Cloud virtual networks may contain remote network shares or file storage services accessible to an adversary after they have obtained access to a system. For example, AWS, GCP, and Azure support creation of Network File System (NFS) shares and Server Message Block (SMB) shares that may be mapped on endpoint or cloud-based systems.") # information t1135html.write("{}T1135</td>\n <td>".format(headings)) # id t1135html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1135html.write("Discovery</td>\n <td>") # tactics t1135html.write("-") # sub-techniques # indicator regex assignments t1135html.write("{}net.exe share</li>\n <li>".format(iocs)) t1135html.write("net1.exe share</li>\n <li>") t1135html.write("net.exe view</li>\n <li>") t1135html.write("net1.exe view</li>\n <li>") t1135html.write("netsh</li>") # related techniques t1135html.write("{}--</a></td>\n <td>".format(related)) t1135html.write("-") # mitigations t1135html.write("{}Operating System Configuration</td>\n <td>".format(mitigations)) t1135html.write("Enable Windows Group Policy \"Do Not Allow Anonymous Enumeration of SAM Accounts and Shares\" security setting to limit users who can enumerate network shares.{}".format(footer)) with open(sd+"t1201.html", "w") as t1201html: # description t1201html.write("{}Adversaries may attempt to access detailed information about the password policy used within an enterprise network. Password policies for networks are a way to enforce complex passwords that are difficult to guess or crack through Brute Force.<br>".format(header)) t1201html.write("This would help the adversary to create a list of common passwords and launch dictionary and/or brute force attacks which adheres to the policy (e.g. if the minimum password length should be 8, then not trying passwords such as 'pass123'; not checking for more than 3-4 passwords per account if the lockout is set to 6 as to not lock out accounts).<br>") t1201html.write("Password policies can be set and discovered on Windows, Linux, and macOS systems via various command shell utilities such as net accounts (/domain), chage -l , cat /etc/pam.d/common-password, and pwpolicy getaccountpolicies.") # information t1201html.write("{}T1221</td>\n <td>".format(headings)) # id t1201html.write("Windows</td>\n <td>") # platforms t1201html.write("Defense Evasion</td>\n <td>") # tactics t1201html.write("-") # sub-techniques # indicator regex assignments t1201html.write("{}net.exe accounts</li>\n <li>".format(iocs)) t1201html.write("net1.exe accounts</li>\n <li>") t1201html.write("Get-AdDefaultDomainPasswordPolicy</li>\n <li>") t1201html.write("chage</li>\n <li>") t1201html.write("common-password</li>\n <li>") t1201html.write("pwpolicy</li>\n <li>") t1201html.write("getaccountpolicies</li>") # related techniques t1201html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1110 target=\"_blank\"\">T1110</a></td>\n <td>".format(related)) t1201html.write("Brute Force") # mitigations t1201html.write("{}Password Policies</td>\n <td>".format(mitigations)) t1201html.write("Ensure only valid password filters are registered. Filter DLLs must be present in Windows installation directory (C:\\Windows\\System32\\ by default) of a domain controller and/or local computer with a corresponding entry in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\Notification Packages.{}".format(footer)) with open(sd+"t1120.html", "w") as t1120html: # description t1120html.write("{}Adversaries may attempt to gather information about attached peripheral devices and components connected to a computer system. Peripheral devices could include auxiliary resources that support a variety of functionalities such as keyboards, printers, cameras, smart card readers, or removable storage.<br>".format(header)) t1120html.write("The information may be used to enhance their awareness of the system and network environment or may be used for further actions.") # information t1120html.write("{}T1120</td>\n <td>".format(headings)) # id t1120html.write("Windows, macOS</td>\n <td>") # platforms t1120html.write("Discovery</td>\n <td>") # tactics t1120html.write("-") # sub-techniques # indicator regex assignments t1120html.write("{}fsutil</li>\n <li>".format(iocs)) t1120html.write("fsinfo</li>") # related techniques t1120html.write("{}-</a></td>\n <td>".format(related)) t1120html.write("-") # mitigations t1120html.write("{}-</td>\n <td>".format(mitigations)) t1120html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1069.html", "w") as t1069html: # description t1069html.write("Adversaries may attempt to find group and permission settings. This information can help adversaries determine which user accounts and groups are available, the membership of users in particular groups, and which users and groups have elevated permissions.") # information t1069html.write("{}T1069</td>\n <td>".format(headings)) # id t1069html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1069html.write("Discovery</td>\n <td>") # tactics t1069html.write("T1069.001: Local Groups<br>T1069.002: Domain Groups<br>T1069.003: Cloud Groups") # sub-techniques # indicator regex assignments t1069html.write("{}dscacheutil</li>\n <li>".format(iocs)) t1069html.write("ldapsearch</li>\n <li>") t1069html.write("dscl</li>\n <li>") t1069html.write("group</li>") # related techniques t1069html.write("{}-</a></td>\n <td>".format(related)) t1069html.write("-") # mitigations t1069html.write("{}-</td>\n <td>".format(mitigations)) t1069html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1057.html", "w") as t1057html: # description t1057html.write("{}Adversaries may attempt to get information about running processes on a system. Information obtained could be used to gain an understanding of common software/applications running on systems within the network. Adversaries may use the information from Process Discovery during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.<br>".format(header)) t1057html.write("In Windows environments, adversaries could obtain details on running processes using the Tasklist utility via cmd or Get-Process via PowerShell. Information about processes can also be extracted from the output of Native API calls such as CreateToolhelp32Snapshot. In Mac and Linux, this is accomplished with the ps command. Adversaries may also opt to enumerate processes via /proc.") # information t1057html.write("{}T1057</td>\n <td>".format(headings)) # id t1057html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1057html.write("Discovery</td>\n <td>") # tactics t1057html.write("-") # sub-techniques # indicator regex assignments t1057html.write("{}Get-Process</li>\n <li>".format(iocs)) t1057html.write("CreateToolhelp32Snapshot</li>\n <li>") t1057html.write("ps</li>") # related techniques t1057html.write("<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>") t1057html.write("Command and Scripting Interpreter: PowerShell") t1057html.write("<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1057 target=\"_blank\"\">T1057</a></td>\n <td>") t1057html.write("Native API") # mitigations t1057html.write("{}-</td>\n <td>".format(mitigations)) t1057html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1012.html", "w") as t1012html: # description t1012html.write("{}Adversaries may interact with the Windows Registry to gather information about the system, configuration, and installed software.<br>".format(header)) t1012html.write("The Registry contains a significant amount of information about the operating system, configuration, software, and security. Information can easily be queried using the Reg utility, though other means to access the Registry exist. Some of the information may help adversaries to further their operation within a network.<br>") t1012html.write("Adversaries may use the information from Query Registry during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.") # information t1012html.write("{}T1012</td>\n <td>".format(headings)) # id t1012html.write("Windows</td>\n <td>") # platforms t1012html.write("Discovery</td>\n <td>") # tactics t1012html.write("-") # sub-techniques # indicator regex assignments t1012html.write("{}reg query".format(iocs)) # related techniques t1012html.write("{}-</a></td>\n <td>".format(related)) t1012html.write("-") # mitigations t1012html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1012html.write("Use read-only containers and minimal images when possible to prevent the execution of commands.{}".format(insert)) t1012html.write("Limit Access to Resource Over Network</td>\n <td>") t1012html.write("Limit communications with the container service to local Unix sockets or remote access via SSH. Require secure port access to communicate with the APIs over TLS by disabling unauthenticated access to the Docker API and Kubernetes API Server.{}".format(insert)) t1012html.write("Privileged Account Management</td>\n <td>") t1012html.write("Ensure containers are not running as root by default.{}".format(footer)) with open(sd+"t1018.html", "w") as t1018html: # description t1018html.write("{}Adversaries may attempt to get a listing of other systems by IP address, hostname, or other logical identifier on a network that may be used for Lateral Movement from the current system. Functionality could exist within remote access tools to enable this, but utilities available on the operating system could also be used such as Ping or net view using Net.<br>".format(header)) t1018html.write("Adversaries may also use local host files (ex: C:\\Windows\\System32\\Drivers\\etc\\hosts or /etc/hosts) in order to discover the hostname to IP address mappings of remote systems.<br>") t1018html.write("Specific to macOS, the bonjour protocol exists to discover additional Mac-based systems within the same broadcast domain.<br>") t1018html.write("Within IaaS (Infrastructure as a Service) environments, remote systems include instances and virtual machines in various states, including the running or stopped state. Cloud providers have created methods to serve information about remote systems, such as APIs and CLIs.<br>") t1018html.write("For example, AWS provides a DescribeInstances API within the Amazon EC2 API and a describe-instances command within the AWS CLI that can return information about all instances within an account. Similarly, GCP's Cloud SDK CLI provides the gcloud compute instances list command to list all Google Compute Engine instances in a project, and Azure's CLI az vm list lists details of virtual machines.") # information t1018html.write("{}T1018</td>\n <td>".format(headings)) # id t1018html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1018html.write("Discovery</td>\n <td>") # tactics t1018html.write("-") # sub-techniques # indicator regex assignments t1018html.write("{}net.exe view</li>\n <li>".format(iocs)) t1018html.write("net1.exe view</li>\n <li>") t1018html.write("ping</li>\n <li>") t1018html.write("tracert</li>\n <li>") t1018html.write("traceroute</li>\n <li>") t1018html.write("etc/host</li>\n <li>") t1018html.write("etc/hosts</li>\n <li>") t1018html.write("bonjour</li>") # related techniques t1018html.write("{}-</a></td>\n <td>".format(related)) t1018html.write("-") # mitigations t1018html.write("{}-</td>\n <td>".format(mitigations)) t1018html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1518.html", "w") as t1518html: # description t1518html.write("{}Adversaries may attempt to get a listing of software and software versions that are installed on a system or in a cloud environment.<br>".format(header)) t1518html.write("Adversaries may use the information from Software Discovery during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.<br>") t1518html.write("Adversaries may attempt to enumerate software for a variety of reasons, such as figuring out what security measures are present or if the compromised system has a version of software that is vulnerable to Exploitation for Privilege Escalation.") # information t1518html.write("{}T1518</td>\n <td>".format(headings)) # id t1518html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, Saas</td>\n <td>") # platforms t1518html.write("Discovery</td>\n <td>") # tactics t1518html.write("T1518.001: Security Software Discovery") # sub-techniques # indicator regex assignments t1518html.write("{}netsh</li>\n <li>".format(iocs)) t1518html.write("tasklist</li>") # related techniques t1518html.write("<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1068 target=\"_blank\"\">T1068</a></td>\n <td>") t1518html.write("Exploitation for Privilege Escalation") # mitigations t1518html.write("{}-</td>\n <td>".format(mitigations)) t1518html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1082.html", "w") as t1082html: # description t1082html.write("{}An adversary may attempt to get detailed information about the operating system and hardware, including version, patches, hotfixes, service packs, and architecture.<br>".format(header)) t1082html.write("Adversaries may use the information from System Information Discovery during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.<br>") t1082html.write("Tools such as Systeminfo can be used to gather detailed system information. A breakdown of system data can also be gathered through the macOS systemsetup command, but it requires administrative privileges.<br>") t1082html.write("Infrastructure as a Service (IaaS) cloud providers such as AWS, GCP, and Azure allow access to instance and virtual machine information via APIs. Successful authenticated API calls can return data such as the operating system platform and status of a particular instance or the model view of a virtual machine.") # information t1082html.write("{}T1082</td>\n <td>".format(headings)) # id t1082html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1082html.write("Defense Evasion</td>\n <td>") # tactics t1082html.write("-") # sub-techniques # indicator regex assignments t1082html.write("{}systemsetup".format(iocs)) # related techniques t1082html.write("{}-</a></td>\n <td>".format(related)) t1082html.write("-") # mitigations t1082html.write("{}-</td>\n <td>".format(mitigations)) t1082html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1614.html", "w") as t1614html: # description t1614html.write("{}Adversaries may gather information in an attempt to calculate the geographical location of a victim host. Adversaries may use the information from System Location Discovery during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.<br>".format(header)) t1614html.write("Adversaries may attempt to infer the location of a system using various system checks, such as time zone, keyboard layout, and/or language settings. Windows API functions such as GetLocaleInfoW can also be used to determine the locale of the host. In cloud environments, an instance's availability zone may also be discovered by accessing the instance metadata service from the instance.<br>") t1614html.write("Adversaries may also attempt to infer the location of a victim host using IP addressing, such as via online geolocation IP-lookup services.") # information t1614html.write("{}T1614</td>\n <td>".format(headings)) # id t1614html.write("Windows, macOS, Linux, IaaS</td>\n <td>") # platforms t1614html.write("Discovery</td>\n <td>") # tactics t1614html.write("-") # sub-techniques # indicator regex assignments t1614html.write("{}GetLocaleInfoW".format(iocs)) # related techniques t1614html.write("<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1053 target=\"_blank\"\">T1124</a></td>\n <td>") t1614html.write("System Time Discovery") # mitigations t1614html.write("{}-</td>\n <td>".format(mitigations)) t1614html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1016.html", "w") as t1016html: # description t1016html.write("{}Adversaries may look for details about the network configuration and settings of systems they access or through information discovery of remote systems. Several operating system administration utilities exist that can be used to gather this information. Examples include Arp, ipconfig/ifconfig, nbtstat, and route.<br>".format(header)) t1016html.write("Adversaries may use the information from System Network Configuration Discovery during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.") # information t1016html.write("{}T1016</td>\n <td>".format(headings)) # id t1016html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1016html.write("Discovery</td>\n <td>") # tactics t1016html.write("T1016:001: Internet Connection Discovery") # sub-techniques # indicator regex assignments t1016html.write("{}ipconfig</li>\n <li>".format(iocs)) t1016html.write("ifconfig</li>\n <li>") t1016html.write("ping</li>\n <li>") t1016html.write("traceroute</li>\n <li>") t1016html.write("etc/host</li>\n <li>") t1016html.write("etc/hosts</li>\n <li>") t1016html.write("bonjour</li>") # related techniques t1016html.write("{}-</a></td>\n <td>".format(related)) t1016html.write("-") # mitigations t1016html.write("{}-</td>\n <td>".format(mitigations)) t1016html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1049.html", "w") as t1049html: # description t1049html.write("{}Adversaries may attempt to get a listing of network connections to or from the compromised system they are currently accessing or from remote systems by querying for information over the network.<br>".format(header)) t1049html.write("An adversary who gains access to a system that is part of a cloud-based environment may map out Virtual Private Clouds or Virtual Networks in order to determine what systems and services are connected<br>") t1049html.write("The actions performed are likely the same types of discovery techniques depending on the operating system, but the resulting information may include details about the networked cloud environment relEvent to the adversary's goals. Cloud providers may have different ways in which their virtual networks operate.<br>") t1049html.write("Utilities and commands that acquire this information include netstat, \"net use,\" and \"net session\" with Net. In Mac and Linux, netstat and lsof can be used to list current connections. who -a and w can be used to show which users are currently logged in, similar to \"net session\".") # information t1049html.write("{}T1049</td>\n <td>".format(headings)) # id t1049html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1049html.write("Discovery</td>\n <td>") # tactics t1049html.write("-") # sub-techniques # indicator regex assignments t1049html.write("{}net use</li>\n <li>".format(iocs)) t1049html.write("net1 use</li>\n <li>") t1049html.write("net session</li>\n <li>") t1049html.write("net1 session</li>\n <li>") t1049html.write("netsh</li>\n <li>") t1049html.write("lsof</li>\n <li>") t1049html.write("who</li>") # related techniques t1049html.write("{}-</a></td>\n <td>".format(related)) t1049html.write("-") # mitigations t1049html.write("{}-</td>\n <td>".format(mitigations)) t1049html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1033.html", "w") as t1033html: # description t1033html.write("{}Adversaries may attempt to identify the primary user, currently logged in user, set of users that commonly uses a system, or whether a user is actively using the system. They may do this, for example, by retrieving account usernames or by using OS Credential Dumping.<br>".format(header)) t1033html.write("The information may be collected in a number of different ways using other Discovery techniques, because user and username details are prevalent throughout a system and include running process ownership, file/directory ownership, session information, and system logs.<br>") t1033html.write("Adversaries may use the information from System Owner/User Discovery during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.<br>") t1033html.write("Utilities and commands that acquire this information include whoami. In Mac and Linux, the currently logged in user can be identified with w and who.") # information t1033html.write("{}T1033</td>\n <td>".format(headings)) # id t1033html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1033html.write("Discovery</td>\n <td>") # tactics t1033html.write("-") # sub-techniques # indicator regex assignments t1033html.write("{}net config</li>\n <li>".format(iocs)) t1033html.write("net1 config</li>\n <li>") t1033html.write("query user</li>\n <li>") t1033html.write("hostname</li>\n <li>") t1033html.write("ipconfig</li>\n <li>") t1033html.write("quser</li>\n <li>") t1033html.write("systeminfo</li>\n <li>") t1033html.write("whoami</li>\n <li>") t1033html.write("NetUser-GetInfo</li>\n <li>") t1033html.write("ifconfig</li>") # related techniques t1033html.write("<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1003 target=\"_blank\"\">T1003</a></td>\n <td>") t1033html.write("OS Credential Dumping") # mitigations t1033html.write("{}-</td>\n <td>".format(mitigations)) t1033html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1007.html", "w") as t1007html: # description t1007html.write("{}Adversaries may try to get information about registered services. Commands that may obtain information about services using operating system utilities are \"sc,\" \"tasklist /svc\" using Tasklist, and \"net start\" using Net, but adversaries may also use other tools as well. Adversaries may use the information from System Service Discovery during automated discovery to shape follow-on behaviors, including whether or not the adversary fully infects the target and/or attempts specific actions.".format(header)) # information t1007html.write("{}T1007</td>\n <td>".format(headings)) # id t1007html.write("Windows</td>\n <td>") # platforms t1007html.write("Discovery</td>\n <td>") # tactics t1007html.write("-") # sub-techniques # indicator regex assignments t1007html.write("{}services.exe</li>\n <li>".format(iocs)) t1007html.write("sc.exe</li>\n <li>") t1007html.write("tasklist</li>\n <li>") t1007html.write("net start</li>\n <li>") t1007html.write("net1 start</li>\n <li>") t1007html.write("net stop</li>\n <li>") t1007html.write("net1 stop</li>") # related techniques t1007html.write("{}-</a></td>\n <td>".format(related)) t1007html.write("-") # mitigations t1007html.write("{}-</td>\n <td>".format(mitigations)) t1007html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1124.html", "w") as t1124html: # description t1124html.write("{}An adversary may gather the system time and/or time zone from a local or remote system. The system time is set and stored by the Windows Time Service within a domain to maintain time synchronization between systems and services in an enterprise network.<br>".format(header)) t1124html.write("System time information may be gathered in a number of ways, such as with Net on Windows by performing net time \\hostname to gather the system time on a remote system. The victim's time zone may also be inferred from the current system time or gathered by using w32tm /tz.<br>") t1124html.write("The information could be useful for performing other techniques, such as executing a file with a Scheduled Task/Job, or to discover locality information based on time zone to assist in victim targeting.") # information t1124html.write("{}T1124</td>\n <td>".format(headings)) # id t1124html.write("Windows</td>\n <td>") # platforms t1124html.write("Discovery</td>\n <td>") # tactics t1124html.write("-") # sub-techniques # indicator regex assignments t1124html.write("{}net time</li>\n <li>".format(iocs)) t1124html.write("net1 time</li>") # related techniques t1124html.write("<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1053 target=\"_blank\"\">T1053</a></td>\n <td>") t1124html.write("Scheduled Task/Job") t1124html.write("<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1053 target=\"_blank\"\">T1614</a></td>\n <td>") t1124html.write("System Location Discovery") # mitigations t1124html.write("{}-</td>\n <td>".format(mitigations)) t1124html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) # Lateral Movement with open(sd+"t1210.html", "w") as t1210html: # description t1210html.write("{}Adversaries may exploit remote services to gain unauthorized access to internal systems once inside of a network.<br>".format(header)) t1210html.write("Exploitation of a software vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code.<br>") t1210html.write("A common goal for post-compromise exploitation of remote services is for lateral movement to enable access to a remote system.<br>") t1210html.write("An adversary may need to determine if the remote system is in a vulnerable state, which may be done through Network Service Scanning or other Discovery methods looking for common, vulnerable software that may be deployed in the network, the lack of certain patches that may indicate vulnerabilities, or security software that may be used to detect or contain remote exploitation.<br>") t1210html.write("Servers are likely a high value target for lateral movement exploitation, but endpoint systems may also be at risk if they provide an advantage or access to additional resources.<br>") t1210html.write("There are several well-known vulnerabilities that exist in common services such as SMB and RDP as well as applications that may be used within internal networks such as MySQL and web server services.<br>") t1210html.write("Depending on the permissions level of the vulnerable remote service an adversary may achieve Exploitation for Privilege Escalation as a result of lateral movement exploitation as well.") # information t1210html.write("{}T1210</td>\n <td>".format(headings)) # id t1210html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1210html.write("Lateral Movement</td>\n <td>") # tactics t1210html.write("-") # sub-techniques # indicator regex assignments t1210html.write("{}Ports: 445, 3389".format(iocs)) # related techniques t1210html.write("{}-</a></td>\n <td>".format(related)) t1210html.write("-") # mitigations t1210html.write("{}Application Isolation and Sandboxing</td>\n <td>".format(mitigations)) t1210html.write("Make it difficult for adversaries to advance their operation through exploitation of undiscovered or unpatched vulnerabilities by using sandboxing. Other types of virtualization and application microsegmentation may also mitigate the impact of some types of exploitation. Risks of additional exploits and weaknesses in these systems may still exist.{}".format(insert)) t1210html.write("Disable or Remove Feature or Program</td>\n <td>") t1210html.write("Minimize available services to only those that are necessary.{}".format(insert)) t1210html.write("Exploit Protection</td>\n <td>") t1210html.write("Security applications that look for behavior used during exploitation such as Windows Defender Exploit Guard (WDEG) and the Enhanced Mitigation Experience Toolkit (EMET) can be used to mitigate some exploitation behavior. Control flow integrity checking is another way to potentially identify and stop a software exploit from occurring. Many of these protections depend on the architecture and target application binary for compatibility and may not work for all software or services targeted.{}".format(insert)) t1210html.write("Network Segmentation</td>\n <td>") t1210html.write("Segment networks and systems appropriately to reduce access to critical systems and services to controlled methods.{}".format(insert)) t1210html.write("Privileged Account Management</td>\n <td>") t1210html.write("Minimize permissions and access for service accounts to limit impact of exploitation.{}".format(insert)) t1210html.write("Threat Intelligence Program</td>\n <td>") t1210html.write("Develop a robust cyber threat intelligence capability to determine what types and levels of threat may use software exploits and 0-days against a particular organization.{}".format(insert)) t1210html.write("Update Software</td>\n <td>") t1210html.write("Update software regularly by employing patch management for internal enterprise endpoints and servers.{}".format(insert)) t1210html.write("Vulnerability Scanning</td>\n <td>") t1210html.write("Regularly scan the internal network for available services to identify new and potentially vulnerable services.{}".format(footer)) with open(sd+"t1534.html", "w") as t1534html: # description t1534html.write("{}Adversaries may use internal spearphishing to gain access to additional information or exploit other users within the same organization after they already have access to accounts or systems within the environment.<br>".format(header)) t1534html.write("Internal spearphishing is multi-staged attack where an email account is owned either by controlling the user's device with previously installed malware or by compromising the account credentials of the user.<br>") t1534html.write("Adversaries attempt to take advantage of a trusted internal account to increase the likelihood of tricking the target into falling for the phish attempt.<br>") t1534html.write("Adversaries may leverage Spearphishing Attachment or Spearphishing Link as part of internal spearphishing to deliver a payload or redirect to an external site to capture credentials through Input Capture on sites that mimic email login interfaces.<br>") t1534html.write("There have been notable incidents where internal spearphishing has been used. The Eye Pyramid campaign used phishing emails with malicious attachments for lateral movement between victims, compromising nearly 18,000 email accounts in the process.<br>") t1534html.write("The Syrian Electronic Army (SEA) compromised email accounts at the Financial Times (FT) to steal additional account credentials. Once FT learned of the attack and began warning employees of the threat, the SEA sent phishing emails mimicking the Financial Times IT department and were able to compromise even more users.") # information t1534html.write("{}T1534</td>\n <td>".format(headings)) # id t1534html.write("Windows, macOS, Linux, Office 365, SaaS</td>\n <td>") # platforms t1534html.write("Lateral Movement</td>\n <td>") # tactics t1534html.write("-") # sub-techniques # indicator regex assignments t1534html.write("{}-".format(iocs)) # related techniques t1534html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1566 target=\"_blank\"\">T1566</a></td>\n <td>".format(related)) t1534html.write("Phishing: Spearphishing Attachment") t1534html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1566 target=\"_blank\"\">T1566</a></td>\n <td>".format(insert)) t1534html.write("Phishing: Spearphishing Link") t1534html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1056 target=\"_blank\"\">T1056</a></td>\n <td>".format(insert)) t1534html.write("Input Capture") # mitigations t1534html.write("{}-</td>\n <td>".format(mitigations)) t1534html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1570.html", "w") as t1570html: # description t1570html.write("{}Adversaries may transfer tools or other files between systems in a compromised environment. Files may be copied from one system to another to stage adversary tools or other files over the course of an operation.<br>".format(header)) t1570html.write("Adversaries may copy files laterally between internal victim systems to support lateral movement using inherent file sharing protocols such as file sharing over SMB to connected network shares or with authenticated connections with SMB/Windows Admin Shares or Remote Desktop Protocol. Files can also be copied over on Mac and Linux with native tools like scp, rsync, and sftp.") # information t1570html.write("{}T1570</td>\n <td>".format(headings)) # id t1570html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1570html.write("Lateral Movement</td>\n <td>") # tactics t1570html.write("-") # sub-techniques # indicator regex assignments t1570html.write("{}ADMIN$</li>\n <li>".format(iocs)) t1570html.write("C$</li>\n <li>") t1570html.write("psexec</li>\n <li>") t1570html.write("DISPLAY</li>\n <li>") t1570html.write("HID</li>\n <li>") t1570html.write("PCI</li>\n <li>") t1570html.write("UMB</li>\n <li>") t1570html.write("FDC</li>\n <li>") t1570html.write("SCSI</li>\n <li>") t1570html.write("STORAGE</li>\n <li>") t1570html.write("USB</li>\n <li>") t1570html.write("WpdBusEnumRoot</li>") # related techniques t1570html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(related)) t1570html.write("Remote Services: SMB/Windows Admin Shares") t1570html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(insert)) t1570html.write("Remote Services: Remote Desktop Protocol") # mitigations t1570html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1570html.write("Consider using the host firewall to restrict file sharing communications such as SMB.{}".format(insert)) t1570html.write("Network Intrusion Prevention</td>\n <td>") t1570html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware or unusual data transfer over known tools and protocols like FTP can be used to mitigate activity at the network level. Signatures are often for unique indicators within protocols and may be based on the specific obfuscation technique used by a particular adversary or tool, and will likely be different across various malware families and versions.{}".format(footer)) with open(sd+"t1563.html", "w") as t1563html: # description t1563html.write("{}Adversaries may take control of preexisting sessions with remote services to move laterally in an environment.<br>".format(header)) t1563html.write("Users may use valid credentials to log into a service specifically designed to accept remote connections, such as telnet, SSH, and RDP. When a user logs into a service, a session will be established that will allow them to maintain a continuous interaction with that service.<br>") t1563html.write("Adversaries may commandeer these sessions to carry out actions on remote systems. Remote Service Session Hijacking differs from use of Remote Services because it hijacks an existing session rather than creating a new session using Valid Accounts.") # information t1563html.write("{}T1563</td>\n <td>".format(headings)) # id t1563html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1563html.write("Lateral Movement</td>\n <td>") # tactics t1563html.write("T1563.001: SSH Hijacking<br>T1563.002: RDP Hijacking") # sub-techniques # indicator regex assignments t1563html.write("{}tscon".format(iocs)) # related techniques t1563html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(related)) t1563html.write("Remote Services") t1563html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(insert)) t1563html.write("Valid Accounts") # mitigations t1563html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1563html.write("Disable the remote service (ex: SSH, RDP, etc.) if it is unnecessary.{}".format(insert)) t1563html.write("Network Segmentation</td>\n <td>") t1563html.write("Enable firewall rules to block unnecessary traffic between network security zones within a network.{}".format(insert)) t1563html.write("Privileged Account Management</td>\n <td>") t1563html.write("Do not allow remote access to services as a privileged account unless necessary.{}".format(insert)) t1563html.write("User Account Management</td>\n <td>") t1563html.write("Limit remote user permissions if remote access is necessary.{}".format(footer)) with open(sd+"t1021.html", "w") as t1021html: # description t1021html.write("{}Adversaries may use Valid Accounts to log into a service specifically designed to accept remote connections, such as telnet, SSH, and VNC. The adversary may then perform actions as the logged-on user.<br>".format(header)) t1021html.write("In an enterprise environment, servers and workstations can be organized into domains. Domains provide centralized identity management, allowing users to login using one set of credentials across the entire network.<br>") t1021html.write("If an adversary is able to obtain a set of valid domain credentials, they could login to many different machines using remote access protocols such as secure shell (SSH) or remote desktop protocol (RDP).") # information t1021html.write("{}T1021</td>\n <td>".format(headings)) # id t1021html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1021html.write("Lateral Movement</td>\n <td>") # tactics t1021html.write("T1021.001: Remote Desktop Protocol<br>T1021.002: SMB/Windows Admin Shares<br>T1021.003: Distributed Component Object Model<br>T1021.004: SSH<br>T1021.005: VNC<br>T1021.006: Windows Remote Management") # sub-techniques # indicator regex assignments t1021html.write("{}Ports: 22, 23, 445, 3389, 5900</li>\n <li>".format(iocs)) t1021html.write("Event IDs: 4697, 7045</li>\n <li>") t1021html.write("winrm</li>\n <li>") t1021html.write("ADMIN$</li>\n <li>") t1021html.write("C$</li>\n <li>") t1021html.write("IPC$</li>") # related techniques t1021html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1563 target=\"_blank\"\">T1563</a></td>\n <td>".format(related)) t1021html.write("Remote Service Session Hijacking") t1021html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(insert)) t1021html.write("Valid Accounts") # mitigations t1021html.write("{}Multi-factor Authentication</td>\n <td>".format(mitigations)) t1021html.write("Use multi-factor authentication on remote service logons where possible.{}".format(insert)) t1021html.write("User Account Management</td>\n <td>") t1021html.write("Limit the accounts that may use remote services. Limit the permissions for accounts that are at higher risk of compromise; for example, configure SSH so users can only run specific programs.{}".format(footer)) with open(sd+"t1080.html", "w") as t1080html: # description t1080html.write("{}Adversaries may deliver payloads to remote systems by adding content to shared storage locations, such as network drives or internal code repositories. Content stored on network drives or in other shared locations may be tainted by adding malicious programs, scripts, or exploit code to otherwise valid files.<br>".format(header)) t1080html.write("Once a user opens the shared tainted content, the malicious portion can be executed to run the adversary's code on a remote system. Adversaries may use tainted shared content to move laterally.<br>") t1080html.write("A directory share pivot is a variation on this technique that uses several other techniques to propagate malware when users access a shared network directory. It uses Shortcut Modification of directory .LNK files that use Masquerading to look like the real directories, which are hidden through Hidden Files and Directories.<br>") t1080html.write("The malicious .LNK-based directories have an embedded command that executes the hidden malware file in the directory and then opens the real intended directory so that the user's expected action still occurs. When used with frequently used network directories, the technique may result in frequent reinfections and broad access to systems and potentially to new and higher privileged accounts.<br>") t1080html.write("Adversaries may also compromise shared network directories through binary infections by appending or prepending its code to the healthy binary on the shared network directory. The malware may modify the original entry point (OEP) of the healthy binary to ensure that it is executed before the legitimate code.<br>") t1080html.write("The infection could continue to spread via the newly infected file when it is executed by a remote system. These infections may target both binary and non-binary formats that end with extensions including, but not limited to, .EXE, .DLL, .SCR, .BAT, and/or .VBS.") # information t1080html.write("{}T1221</td>\n <td>".format(headings)) # id t1080html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1080html.write("Lateral Movement</td>\n <td>") # tactics t1080html.write("-") # sub-techniques # indicator regex assignments t1080html.write("{}-".format(iocs)) # related techniques t1080html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1547 target=\"_blank\"\">T1547</a></td>\n <td>".format(related)) t1080html.write("Boot or Logon Autostart Execution: Shortcut Modification") t1080html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1036 target=\"_blank\"\">T1036</a></td>\n <td>".format(insert)) t1080html.write("Masquerading") t1080html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1564 target=\"_blank\"\">T1564</a></td>\n <td>".format(insert)) t1080html.write("Hide Artifacts: Hidden Files and Directories") # mitigations t1080html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1080html.write("Identify potentially malicious software that may be used to taint content or may result from it and audit and/or block the unknown programs by using application control tools, like AppLocker, or Software Restriction Policies [16] where appropriate.{}".format(insert)) t1080html.write("Exploit Protection</td>\n <td>") t1080html.write("Use utilities that detect or mitigate common features used in exploitation, such as the Microsoft Enhanced Mitigation Experience Toolkit (EMET).{}".format(insert)) t1080html.write("Restrict File and Directory Permissions</td>\n <td>") t1080html.write("Protect shared folders by minimizing users who have write access.{}".format(footer)) # Collection with open(sd+"t1560.html", "w") as t1560html: # description t1560html.write("{}An adversary may compress and/or encrypt data that is collected prior to exfiltration. Compressing the data can help to obfuscate the collected data and minimize the amount of data sent over the network.<br>".format(header)) t1560html.write("Encryption can be used to hide information that is being exfiltrated from detection or make exfiltration less conspicuous upon inspection by a defender.<br>") t1560html.write("Both compression and encryption are done prior to exfiltration, and can be performed using a utility, 3rd party library, or custom method.") # information t1560html.write("{}T1560</td>\n <td>".format(headings)) # id t1560html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1560html.write("Collection</td>\n <td>") # tactics t1560html.write("T1560.001: Archive via Utility<br>T1560.002: Archive via Library<br>T1560.003: Archive via Custom Method") # sub-techniques # indicator regex assignments t1560html.write("{}.7z</li>\n <li>".format(iocs)) t1560html.write(".arj</li>\n <li>") t1560html.write(".tar</li>\n <li>") t1560html.write(".tgz</li>\n <li>") t1560html.write(".zip</li>\n <li>") t1560html.write("libzip</li>\n <li>") t1560html.write("zlib</li>\n <li>") t1560html.write("rarfile</li>\n <li>") t1560html.write("bzip2</li>") # related techniques t1560html.write("{}-</a></td>\n <td>".format(related)) t1560html.write("-") # mitigations t1560html.write("{}Audit</td>\n <td>".format(mitigations)) t1560html.write("System scans can be performed to identify unauthorized archival utilities.{}".format(footer)) with open(sd+"t1123.html", "w") as t1123html: # description t1123html.write("{}Adversaries may abuse shared modules to execute malicious payloads. The Windows module loader can be instructed to load DLLs from arbitrary local paths and arbitrary Universal Naming Convention (UNC) network paths.<br>".format(header)) t1123html.write("This functionality resides in NTDLL.dll and is part of the Windows Native API which is called from functions like CreateProcess, LoadLibrary, etc. of the Win32 API.") # information t1123html.write("{}T1129</td>\n <td>".format(headings)) # id t1123html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1123html.write("Collection</td>\n <td>") # tactics t1123html.write("-") # sub-techniques # indicator regex assignments t1123html.write("{}.mp3</li>\n <li>".format(iocs)) t1123html.write(".wav</li>\n <li>") t1123html.write(".aac</li>\n <li>") t1123html.write(".m4a</li>\n <li>") t1123html.write("microphone</li>") # related techniques t1123html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1106 target=\"_blank\"\">T1106</a></td>\n <td>".format(related)) t1123html.write("Native API") # mitigations t1123html.write("{}-</td>\n <td>".format(mitigations)) t1123html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1119.html", "w") as t1119html: # description t1119html.write("{}Once established within a system or network, an adversary may use automated techniques for collecting internal data.<br>".format(header)) t1119html.write("Methods for performing this technique could include use of a Command and Scripting Interpreter to search for and copy information fitting set criteria such as file type, location, or name at specific time intervals. This functionality could also be built into remote access tools.<br>") t1119html.write("This technique may incorporate use of other techniques such as File and Directory Discovery and Lateral Tool Transfer to identify and move files.") # information t1119html.write("{}T1119</td>\n <td>".format(headings)) # id t1119html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1119html.write("Collection</td>\n <td>") # tactics t1119html.write("-") # sub-techniques # indicator regex assignments t1119html.write("{}-".format(iocs)) # related techniques t1119html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(related)) t1119html.write("Command and Scripting Interpreter") t1119html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1083 target=\"_blank\"\">T1083</a></td>\n <td>".format(insert)) t1119html.write("File and Directory Discovery") t1119html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1570 target=\"_blank\"\">T1570</a></td>\n <td>".format(insert)) t1119html.write("Lateral Tool Transfer") # mitigations t1119html.write("{}Encrypt Sensitive Information</td>\n <td>".format(mitigations)) t1119html.write("Encryption and off-system storage of sensitive information may be one way to mitigate collection of files, but may not stop an adversary from acquiring the information if an intrusion persists over a long period of time and the adversary is able to discover and access the data through other means. Strong passwords should be used on certain encrypted documents that use them to prevent offline cracking through Brute Force techniques.{}".format(insert)) t1119html.write("Remote Data Storage</td>\n <td>") t1119html.write("Encryption and off-system storage of sensitive information may be one way to mitigate collection of files, but may not stop an adversary from acquiring the information if an intrusion persists over a long period of time and the adversary is able to discover and access the data through other means.{}".format(footer)) with open(sd+"t1115.html", "w") as t1115html: # description t1115html.write("{}Adversaries may collect data stored in the clipboard from users copying information within or between applications.<br>".format(header)) t1115html.write("In Windows, Applications can access clipboard data by using the Windows API. OSX provides a native command, pbpaste, to grab clipboard contents.") # information t1115html.write("{}T1115</td>\n <td>".format(headings)) # id t1115html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1115html.write("Collection</td>\n <td>") # tactics t1115html.write("-") # sub-techniques # indicator regex assignments t1115html.write("{}clipboard</li>\n <li>".format(iocs)) t1115html.write("pbpaste</li>") # related techniques t1115html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1106 target=\"_blank\"\">T1106</a></td>\n <td>".format(related)) t1115html.write("Native API") # mitigations t1115html.write("{}-</td>\n <td>".format(mitigations)) t1115html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1530.html", "w") as t1530html: # description t1530html.write("{}Adversaries may access data objects from improperly secured cloud storage.<br>".format(header)) t1530html.write("Many cloud service providers offer solutions for online data storage such as Amazon S3, Azure Storage, and Google Cloud Storage. These solutions differ from other storage solutions (such as SQL or Elasticsearch) in that there is no overarching application.<br>") t1530html.write("Data from these solutions can be retrieved directly using the cloud provider's APIs. Solution providers typically offer security guides to help end users configure systems.<br>") t1530html.write("Misconfiguration by end users is a common problem. There have been numerous incidents where cloud storage has been improperly secured (typically by unintentionally allowing public access by unauthenticated users or overly-broad access by all users), allowing open access to credit cards, personally identifiable information, medical records, and other sensitive information.<br>") t1530html.write("Adversaries may also obtain leaked credentials in source repositories, logs, or other means as a way to gain access to cloud storage objects that have access permission controls.") # information t1530html.write("{}T1530</td>\n <td>".format(headings)) # id t1530html.write("AWS, Azure, GCP</td>\n <td>") # platforms t1530html.write("Collection</td>\n <td>") # tactics t1530html.write("-") # sub-techniques # indicator regex assignments t1530html.write("{}-".format(iocs)) # related techniques t1530html.write("{}-</a></td>\n <td>".format(related)) t1530html.write("-") # mitigations t1530html.write("{}Audit</td>\n <td>".format(mitigations)) t1530html.write("Frequently check permissions on cloud storage to ensure proper permissions are set to deny open or unprivileged access to resources.{}".format(insert)) t1530html.write("Encrypt Sensitive Information</td>\n <td>") t1530html.write("Encrypt data stored at rest in cloud storage. Managed encryption keys can be rotated by most providers. At a minimum, ensure an incident response plan to storage breach includes rotating the keys and test for impact on client applications.{}".format(insert)) t1530html.write("Filter Network Traffic</td>\n <td>") t1530html.write("Cloud service providers support IP-based restrictions when accessing cloud resources. Consider using IP allowlisting along with user account management to ensure that data access is restricted not only to valid users but only from expected IP ranges to mitigate the use of stolen credentials to access data.{}".format(insert)) t1530html.write("Multi-factor Authentication</td>\n <td>") t1530html.write("Consider using multi-factor authentication to restrict access to resources and cloud storage APIs.{}".format(insert)) t1530html.write("Restrict File and Directory Permissions</td>\n <td>") t1530html.write("Use access control lists on storage systems and objects.{}".format(insert)) t1530html.write("User Account Management</td>\n <td>") t1530html.write("Configure user permissions groups and roles for access to cloud storage. Implement strict Identity and Access Management (IAM) controls to prevent access to storage solutions except for the applications, users, and services that require access. Ensure that temporary access tokens are issued rather than permanent credentials, especially when access is being granted to entities outside of the internal security boundary.{}".format(footer)) with open(sd+"t1602.html", "w") as t1602html: # description t1602html.write("{}Adversaries may collect data related to managed devices from configuration repositories. Configuration repositories are used by management systems in order to configure, manage, and control data on remote systems. Configuration repositories may also facilitate remote access and administration of devices.<br>".format(header)) t1602html.write("Adversaries may target these repositories in order to collect large quantities of sensitive system administration data. Data from configuration repositories may be exposed by various protocols and software and can store a wide variety of data, much of which may align with adversary Discovery objectives.") # information t1602html.write("{}T1602</td>\n <td>".format(headings)) # id t1602html.write("Network</td>\n <td>") # platforms t1602html.write("Collection</td>\n <td>") # tactics t1602html.write("T1602.001: SNMP (MIB Dump)<br>T1602.002: Network Device Configuration Dump") # sub-techniques # indicator regex assignments t1602html.write("{}-".format(iocs)) # related techniques t1602html.write("{}-</a></td>\n <td>".format(related)) t1602html.write("-") # mitigations t1602html.write("{}Encrypt Sensitive Information</td>\n <td>".format(mitigations)) t1602html.write("Configure SNMPv3 to use the highest level of security (authPriv) available.{}".format(insert)) t1602html.write("Filter Network Traffic</td>\n <td>") t1602html.write("Apply extended ACLs to block unauthorized protocols outside the trusted network.{}".format(insert)) t1602html.write("Network Intrusion Prevention</td>\n <td>") t1602html.write("Configure intrusion prevention devices to detect SNMP queries and commands from unauthorized sources.{}".format(insert)) t1602html.write("Network Segmentation</td>\n <td>") t1602html.write("Segregate SNMP traffic on a separate management network.{}".format(insert)) t1602html.write("Software Configuration</td>\n <td>") t1602html.write("Allowlist MIB objects and implement SNMP views.{}".format(insert)) t1602html.write("UpdateSoftware</td>\n <td>") t1602html.write("Keep system images and software updated and migrate to SNMPv3.{}".format(footer)) with open(sd+"t1213.html", "w") as t1213html: # description t1213html.write("{}Adversaries may leverage information repositories to mine valuable information. Information repositories are tools that allow for storage of information, typically to facilitate collaboration or information sharing between users, and can store a wide variety of data that may aid adversaries in further objectives, or direct access to the target information.<br>".format(header)) t1213html.write("Adversaries may also collect information from shared storage repositories hosted on cloud infrastructure or in software-as-a-service (SaaS) applications, as storage is one of the more fundamental requirements for cloud services and systems.<br>") t1213html.write("The following is a brief list of example information that may hold potential value to an adversary and may also be found on an information repository:</li>\n <ul>\n <li>Policies, procedures, and standards</li>\n <li>Physical / logical network diagrams</li>\n <li>System architecture diagrams</li>\n <li>Technical system documentation</li>\n <li>Testing / development credentials</li>\n <li>Work / project schedules</li>\n <li>Source code snippets</li>\n <li>Links to network shares and other internal resources</li>\n </ul><br>Information stored in a repository may vary based on the specific instance or environment. Specific common information repositories include Sharepoint, Confluence, and enterprise databases such as SQL Server.") # information t1213html.write("{}T1213</td>\n <td>".format(headings)) # id t1213html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1213html.write("Collection</td>\n <td>") # tactics t1213html.write("T1213.001: Confluence<br>T1213.002: Sharepoint") # sub-techniques # indicator regex assignments t1213html.write("{}-".format(iocs)) # related techniques t1213html.write("{}-</a></td>\n <td>".format(related)) t1213html.write("-") # mitigations t1213html.write("{}Audit</td>\n <td>".format(mitigations)) t1213html.write("Consider periodic review of accounts and privileges for critical and sensitive repositories.{}".format(insert)) t1213html.write("User Account Management</td>\n <td>") t1213html.write("Enforce the principle of least-privilege. Consider implementing access control mechanisms that include both authentication and authorization.{}".format(insert)) t1213html.write("User Training</td>\n <td>") t1213html.write("Develop and publish policies that define acceptable information to be stored in repositories.{}".format(footer)) with open(sd+"t1005.html", "w") as t1005html: # description t1005html.write("{}Adversaries may search local system sources, such as file systems or local databases, to find files of interest and sensitive data prior to Exfiltration.<br>".format(header)) t1005html.write("Adversaries may do this using a Command and Scripting Interpreter, such as cmd, which has functionality to interact with the file system to gather information. Some adversaries may also use Automated Collection on the local system.") # information t1005html.write("{}T1005</td>\n <td>".format(headings)) # id t1005html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1005html.write("Collection</td>\n <td>") # tactics t1005html.write("-") # sub-techniques # indicator regex assignments t1005html.write("{}-".format(iocs)) # related techniques t1005html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1059 target=\"_blank\"\">T1059</a></td>\n <td>".format(related)) t1005html.write("Command and Scripting Interpreter") t1005html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1119 target=\"_blank\"\">T1119</a></td>\n <td>".format(insert)) t1005html.write("Automated Collection") # mitigations t1005html.write("{}-</td>\n <td>".format(mitigations)) t1005html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1039.html", "w") as t1039html: # description t1039html.write("{}Adversaries may search network shares on computers they have compromised to find files of interest.<br>".format(header)) t1039html.write("Sensitive data can be collected from remote systems via shared network drives (host shared directory, network file server, etc.) that are accessible from the current system prior to Exfiltration.<br>") t1039html.write("Interactive command shells may be in use, and common functionality within cmd may be used to gather information.") # information t1039html.write("{}T1039</td>\n <td>".format(headings)) # id t1039html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1039html.write("Collection</td>\n <td>") # tactics t1039html.write("-") # sub-techniques # indicator regex assignments t1039html.write("{}-".format(iocs)) # related techniques t1039html.write("{}-</a></td>\n <td>".format(related)) t1039html.write("-") # mitigations t1039html.write("{}-</td>\n <td>".format(mitigations)) t1039html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1025.html", "w") as t1025html: # description t1025html.write("{}Adversaries may search connected removable media on computers they have compromised to find files of interest. Sensitive data can be collected from any removable media (optical disk drive, USB memory, etc.) connected to the compromised system prior to Exfiltration.<br>".format(header)) t1025html.write("Interactive command shells may be in use, and common functionality within cmd may be used to gather information.<br>") t1025html.write("Some adversaries may also use Automated Collection on removable media.") # information t1025html.write("{}T1025</td>\n <td>".format(headings)) # id t1025html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1025html.write("Collection</td>\n <td>") # tactics t1025html.write("-") # sub-techniques # indicator regex assignments t1025html.write("{}DISPLAY</li>\n <li>".format(iocs)) t1025html.write("HID</li>\n <li>") t1025html.write("PCI</li>\n <li>") t1025html.write("UMB</li>\n <li>") t1025html.write("FDC</li>\n <li>") t1025html.write("SCSI</li>\n <li>") t1025html.write("STORAGE</li>\n <li>") t1025html.write("USB</li>\n <li>") t1025html.write("WpdBusEnumRoot</li>") # related techniques t1025html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1119 target=\"_blank\"\">T1119</a></td>\n <td>".format(related)) t1025html.write("Automated Collection") # mitigations t1025html.write("{}-</td>\n <td>".format(mitigations)) t1025html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1074.html", "w") as t1074html: # description t1074html.write("{}Adversaries may stage collected data in a central location or directory prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as Archive Collected Data. Interactive command shells may be used, and common functionality within cmd and bash may be used to copy data into a staging location.<br>".format(header)) t1074html.write("In cloud environments, adversaries may stage data within a particular instance or virtual machine before exfiltration. An adversary may Create Cloud Instance and stage data in that instance.<br>") t1074html.write("Adversaries may choose to stage data from a victim network in a centralized location prior to Exfiltration to minimize the number of connections made to their C2 server and better evade detection.") # information t1074html.write("{}T1074</td>\n <td>".format(headings)) # id t1074html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1074html.write("Collection</td>\n <td>") # tactics t1074html.write("T1074.001: Local Data Staging<br>T1074.002: Remote Data Staging") # indicator regex assignments t1074html.write("{}-".format(iocs)) # related techniques t1074html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1560 target=\"_blank\"\">T1560</a></td>\n <td>".format(related)) t1074html.write("Archive Collected Data") t1074html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1578 target=\"_blank\"\">T1578</a></td>\n <td>".format(insert)) t1074html.write("Modify Cloud Compute Infrastructure: Create Cloud Instance") # mitigations t1074html.write("{}-</td>\n <td>".format(mitigations)) t1074html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1114.html", "w") as t1114html: # description t1114html.write("{}Adversaries may target user email to collect sensitive information. Emails may contain sensitive data, including trade secrets or personal information, that can prove valuable to adversaries. Adversaries can collect or forward email from mail servers or clients.".format(header)) # information t1114html.write("{}T1114</td>\n <td>".format(headings)) # id t1114html.write("Windows, Office 365</td>\n <td>") # platforms t1114html.write("Collection</td>\n <td>") # tactics t1114html.write("T1114.001: Local Email Collection<br>T1114.002: Remote Email Collection<br>T1114.003: Email Forwarding Rule") # sub-techniques # indicator regex assignments t1114html.write("{}.ost</li>\n <li>".format(iocs)) t1114html.write(".pst</li>\n <li>") t1114html.write(".msg</li>\n <li>") t1114html.write(".eml</li>\n <li>") t1114html.write("*MailboxExportEequest</li>\n <li>") t1114html.write("X-MS-Exchange-Organization-AutoForwarded</li>\n <li>") t1114html.write("X-MailFwdBy</li>\n <li>") t1114html.write("X-Forwarded-To</li>\n <li>") t1114html.write("ForwardingSMTPAddress</li>") # related techniques t1114html.write("{}-</a></td>\n <td>".format(related)) t1114html.write("-") # mitigations t1114html.write("{}Audit</td>\n <td>".format(mitigations)) t1114html.write("Enterprise email solutions have monitoring mechanisms that may include the ability to audit auto-forwarding rules on a regular basis. In an Exchange environment, Administrators can use Get-InboxRule to discover and remove potentially malicious auto-forwarding rules.{}".format(insert)) t1114html.write("Encrypt Sensitive Information</td>\n <td>") t1114html.write("Use of encryption provides an added layer of security to sensitive information sent over email. Encryption using public key cryptography requires the adversary to obtain the private certificate along with an encryption key to decrypt messages.{}".format(insert)) t1114html.write("Multi-factor Authentication</td>\n <td>") t1114html.write("Use of multi-factor authentication for public-facing webmail servers is a recommended best practice to minimize the usefulness of usernames and passwords to adversaries.{}".format(footer)) with open(sd+"t1185.html", "w") as t1185html: # description t1185html.write("{}Adversaries can take advantage of security vulnerabilities and inherent functionality in browser software to change content, modify behavior, and intercept information as part of various man in the browser techniques.<br>".format(header)) t1185html.write("A specific example is when an adversary injects software into a browser that allows an them to inherit cookies, HTTP sessions, and SSL client certificates of a user and use the browser as a way to pivot into an authenticated intranet.<br>") t1185html.write("Browser pivoting requires the SeDebugPrivilege and a high-integrity process to execute. Browser traffic is pivoted from the adversary's browser through the user's browser by setting up an HTTP proxy which will redirect any HTTP and HTTPS traffic.<br>") t1185html.write("This does not alter the user's traffic in any way. The proxy connection is severed as soon as the browser is closed. Whichever browser process the proxy is injected into, the adversary assumes the security context of that process. Browsers typically create a new process for each tab that is opened and permissions and certificates are separated accordingly.<br>") t1185html.write("With these permissions, an adversary could browse to any resource on an intranet that is accessible through the browser and which the browser has sufficient permissions, such as Sharepoint or webmail. Browser pivoting also eliminates the security provided by 2-factor authentication.") # information t1185html.write("{}T1185</td>\n <td>".format(headings)) # id t1185html.write("Windows</td>\n <td>") # platforms t1185html.write("Collection</td>\n <td>") # tactics t1185html.write("-") # sub-techniques # indicator regex assignments t1185html.write("{}-".format(iocs)) # related techniques t1185html.write("{}-</a></td>\n <td>".format(related)) t1185html.write("-") # mitigations t1185html.write("{}User Account Management</td>\n <td>".format(mitigations)) t1185html.write("Since browser pivoting requires a high integrity process to launch from, restricting user permissions and addressing Privilege Escalation and Bypass User Account Control opportunities can limit the exposure to this technique.{}".format(insert)) t1185html.write("User Training</td>\n <td>") t1185html.write("Close all browser sessions regularly and when they are no longer needed.{}".format(footer)) with open(sd+"t1113.html", "w") as t1113html: # description t1113html.write("{}Adversaries may attempt to take screen captures of the desktop to gather information over the course of an operation. Screen capturing functionality may be included as a feature of a remote access tool used in post-compromise operations.<br>".format(header)) t1113html.write("Taking a screenshot is also typically possible through native utilities or API calls, such as CopyFromScreen, xwd, or screencapture.") # information t1113html.write("{}T1113</td>\n <td>".format(headings)) # id t1113html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1113html.write("Collection</td>\n <td>") # tactics t1113html.write("-") # sub-techniques # indicator regex assignments t1113html.write("{}CopyFromScreen</li>\n <li>".format(iocs)) t1113html.write("xwd</li>\n <li>") t1113html.write("screencapture</li>") # related techniques t1113html.write("{}-</a></td>\n <td>".format(related)) t1113html.write("-") # mitigations t1113html.write("{}-</td>\n <td>".format(mitigations)) t1113html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1125.html", "w") as t1125html: # description t1125html.write("{}An adversary can leverage a computer's peripheral devices (e.g., integrated cameras or webcams) or applications (e.g., video call services) to capture video recordings for the purpose of gathering information. Images may also be captured from devices or applications, potentially in specified intervals, in lieu of video files.<br>".format(header)) t1125html.write("Malware or scripts may be used to interact with the devices through an available API provided by the operating system or an application to capture video or images. Video or image files may be written to disk and exfiltrated later. This technique differs from Screen Capture due to use of specific devices or applications for video recording rather than capturing the victim's screen.<br>") t1125html.write("In macOS, there are a few different malware samples that record the user's webcam such as FruitFly and Proton.") # information t1125html.write("{}T1125</td>\n <td>".format(headings)) # id t1125html.write("Windows, macOS</td>\n <td>") # platforms t1125html.write("Collection</td>\n <td>") # tactics t1125html.write("-") # sub-techniques # indicator regex assignments t1125html.write("{}.mp4</li>\n <li>".format(iocs)) t1125html.write("mkv</li>\n <li>") t1125html.write("avi</li>\n <li>") t1125html.write("mov</li>\n <li>") t1125html.write("wmv</li>\n <li>") t1125html.write("mpg</li>\n <li>") t1125html.write("mpeg</li>\n <li>") t1125html.write("m4v</li>\n <li>") t1125html.write("flv</li>") # related techniques t1125html.write("{}-</a></td>\n <td>".format(related)) t1125html.write("-") # mitigations t1125html.write("{}-</td>\n <td>".format(mitigations)) t1125html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) # Command and Control with open(sd+"t1071.html", "w") as t1071html: # description t1071html.write("{}Adversaries may communicate using application layer protocols to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server.<br>".format(header)) t1071html.write("Adversaries may utilize many different protocols, including those used for web browsing, transferring files, electronic mail, or DNS. For connections that occur internally within an enclave (such as those between a proxy or pivot node and other nodes), commonly used protocols are SMB, SSH, or RDP.") # information t1071html.write("{}T1071</td>\n <td>".format(headings)) # id t1071html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1071html.write("Command &amp; Control</td>\n <td>") # tactics t1071html.write("T1071.001: Web Protocols<br>T1071.002: File Transfer Protocols<br>T1071.003: Mail Protocols<br>T1071.004: DNS") # sub-techniques # indicator regex assignments t1071html.write("{}Ports: 20, 21, 25, 53, 69, 80, 110, 143, 443, 465, 993, 995, 989, 990".format(iocs)) # related techniques t1071html.write("{}-</a></td>\n <td>".format(related)) t1071html.write("-") # mitigations t1071html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1071html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level.{}".format(footer)) with open(sd+"t1092.html", "w") as t1092html: # description t1092html.write("{}Adversaries can perform command and control between compromised hosts on potentially disconnected networks using removable media to transfer commands from system to system.<br>".format(header)) t1092html.write("Both systems would need to be compromised, with the likelihood that an Internet-connected system was compromised first and the second through lateral movement by Replication Through Removable Media.<br>") t1092html.write("Commands and files would be relayed from the disconnected system to the Internet-connected system to which the adversary has direct access.") # information t1092html.write("{}T1092</td>\n <td>".format(headings)) # id t1092html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1092html.write("Command &amp; Control</td>\n <td>") # tactics t1092html.write("-") # sub-techniques # indicator regex assignments t1092html.write("{}-".format(iocs)) # related techniques t1092html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1091 target=\"_blank\"\">T1091</a></td>\n <td>".format(related)) t1092html.write("Replication Through Removable Media") # mitigations t1092html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1092html.write("Disable Autoruns if it is unnecessary.{}".format(insert)) t1092html.write("Operating System Configuration</td>\n <td>") t1092html.write("Disallow or restrict removable media at an organizational policy level if they are not required for business operations.{}".format(footer)) with open(sd+"t1132.html", "w") as t1132html: # description t1132html.write("{}Adversaries may encode data to make the content of command and control traffic more difficult to detect. Command and control (C2) information can be encoded using a standard data encoding system.<br>".format(header)) t1132html.write("Use of data encoding may adhere to existing protocol specifications and includes use of ASCII, Unicode, Base64, MIME, or other binary-to-text and character encoding systems. Some data encoding systems may also result in data compression, such as gzip.") # information t1132html.write("{}T1132</td>\n <td>".format(headings)) # id t1132html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1132html.write("Command &amp; Control</td>\n <td>") # tactics t1132html.write("T1132.001: Standard Encoding<br>T1132.002: Non-Standard Encoding") # sub-techniques # indicator regex assignments t1132html.write("{}ASCII</li>\n <li>".format(iocs)) t1132html.write("unicode</li>\n <li>") t1132html.write("HEX</li>\n <li>") t1132html.write("base64</li>\n <li>") t1132html.write("MIME</li>") # related techniques t1132html.write("{}-</a></td>\n <td>".format(related)) t1132html.write("-") # mitigations t1132html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1132html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level. Signatures are often for unique indicators within protocols and may be based on the specific obfuscation technique used by a particular adversary or tool, and will likely be different across various malware families and versions. Adversaries will likely change tool C2 signatures over time or construct protocols in such a way as to avoid detection by common defensive tools.{}".format(footer)) with open(sd+"t1001.html", "w") as t1001html: # description t1001html.write("{}Adversaries may obfuscate command and control traffic to make it more difficult to detect.<br>".format(header)) t1001html.write("Command and control (C2) communications are hidden (but not necessarily encrypted) in an attempt to make the content more difficult to discover or decipher and to make the communication less conspicuous and hide commands from being seen.<br>") t1001html.write("This encompasses many methods, such as adding junk data to protocol traffic, using steganography, or impersonating legitimate protocols.") # information t1001html.write("{}T1001</td>\n <td>".format(headings)) # id t1001html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1001html.write("Command &amp; Control</td>\n <td>") # tactics t1001html.write("T1001.001: Junk Data<br>T1001.002: Steganography<br>T1001.003: Protocol Impersonation") # sub-techniques # indicator regex assignments t1001html.write("{}Invoke-PSImage".format(iocs)) # related techniques t1001html.write("{}-</a></td>\n <td>".format(related)) t1001html.write("-") # mitigations t1001html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1001html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate some obfuscation activity at the network level.{}".format(footer)) with open(sd+"t1568.html", "w") as t1568html: # description t1568html.write("{}Adversaries may dynamically establish connections to command and control infrastructure to evade common detections and remediations.<br>".format(header)) t1568html.write("This may be achieved by using malware that shares a common algorithm with the infrastructure the adversary uses to receive the malware's communications.<br>") t1568html.write("These calculations can be used to dynamically adjust parameters such as the domain name, IP address, or port number the malware uses for command and control.<br>") t1568html.write("Adversaries may use dynamic resolution for the purpose of Fallback Channels.<br>") t1568html.write("When contact is lost with the primary command and control server malware may employ dynamic resolution as a means to reestablishing command and control.") # information t1568html.write("{}T1568</td>\n <td>".format(headings)) # id t1568html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1568html.write("Command &amp; Control</td>\n <td>") # tactics t1568html.write("T1568.001: Fast Flux DNS<br>T1568.002: Domain Generation Algorithms<br>T1568.003: DNS Calculation") # sub-techniques # indicator regex assignments t1568html.write("{}-".format(iocs)) # related techniques t1568html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1008 target=\"_blank\"\">T1008</a></td>\n <td>".format(related)) t1568html.write("Fallback Channels") # mitigations t1568html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1568html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level. Malware researchers can reverse engineer malware variants that use dynamic resolution and determine future C2 infrastructure that the malware will attempt to contact, but this is a time and resource intensive effort.{}".format(insert)) t1568html.write("Restrict Web-Based Content</td>\n <td>") t1568html.write("In some cases a local DNS sinkhole may be used to help prevent behaviors associated with dynamic resolution.{}".format(footer)) with open(sd+"t1573.html", "w") as t1573html: # description t1573html.write("{}Adversaries may employ a known encryption algorithm to conceal command and control traffic rather than relying on any inherent protections provided by a communication protocol.<br>".format(header)) t1573html.write("Despite the use of a secure algorithm, these implementations may be vulnerable to reverse engineering if secret keys are encoded and/or generated within malware samples/configuration files.") # information t1573html.write("{}T1573</td>\n <td>".format(headings)) # id t1573html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1573html.write("Command &amp; Control</td>\n <td>") # tactics t1573html.write("T1573.001: Symmetric Cryptography<br>T1573.002: Asymmetric Cryptography") # sub-techniques # indicator regex assignments t1573html.write("{}encrypt".format(iocs)) # related techniques t1573html.write("{}-</a></td>\n <td>".format(related)) t1573html.write("-") # mitigations t1573html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1573html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level.{}".format(insert)) t1573html.write("SSL/TLS Inspection</td>\n <td>") t1573html.write("SSL/TLS inspection can be used to see the contents of encrypted sessions to look for network-based indicators of malware communication protocols.{}".format(footer)) with open(sd+"t1008.html", "w") as t1008html: # description t1008html.write("{}Adversaries may use fallback or alternate communication channels if the primary channel is compromised or inaccessible in order to maintain reliable command and control and to avoid data transfer thresholds.".format(header)) # information t1008html.write("{}T1008</td>\n <td>".format(headings)) # id t1008html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1008html.write("Command &amp; Control</td>\n <td>") # tactics t1008html.write("-") # sub-techniques # indicator regex assignments t1008html.write("{}-".format(iocs)) # related techniques t1008html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1568 target=\"_blank\"\">T1568</a></td>\n <td>".format(related)) t1008html.write("Dynamic Resolution") t1008html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1104 target=\"_blank\"\">T1104</a></td>\n <td>".format(insert)) t1008html.write("Multi-Stage Channels") # mitigations t1008html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1008html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level. Signatures are often for unique indicators within protocols and may be based on the specific protocol used by a particular adversary or tool, and will likely be different across various malware families and versions. Adversaries will likely change tool C2 signatures over time or construct protocols in such a way as to avoid detection by common defensive tools.{}".format(footer)) with open(sd+"t1105.html", "w") as t1105html: # description t1105html.write("{}Adversaries may transfer tools or other files from an external system into a compromised environment.<br>".format(header)) t1105html.write("Files may be copied from an external adversary controlled system through the command and control channel to bring tools into the victim network or through alternate protocols with another tool such as FTP.<br>") t1105html.write("Files can also be copied over on Mac and Linux with native tools like scp, rsync, and sftp.") # information t1105html.write("{}T1572</td>\n <td>".format(headings)) # id t1105html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1105html.write("Command &amp; Control</td>\n <td>") # tactics t1105html.write("-") # sub-techniques # indicator regex assignments t1105html.write("{}scp</li>\n <li>".format(iocs)) t1105html.write("rsync</li>\n <li>") t1105html.write("sftp</li>") # related techniques t1105html.write("{}-</a></td>\n <td>".format(related)) t1105html.write("-") # mitigations t1105html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1105html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware or unusual data transfer over known tools and protocols like FTP can be used to mitigate activity at the network level. Signatures are often for unique indicators within protocols and may be based on the specific obfuscation technique used by a particular adversary or tool, and will likely be different across various malware families and versions. Adversaries will likely change tool C2 signatures over time or construct protocols in such a way as to avoid detection by common defensive tools.{}".format(footer)) with open(sd+"t1104.html", "w") as t1104html: # description t1104html.write("{}Adversaries may create multiple stages for command and control that are employed under different conditions or for certain functions. Use of multiple stages may obfuscate the command and control channel to make detection more difficult.<br>".format(header)) t1104html.write("Remote access tools will call back to the first-stage command and control server for instructions. The first stage may have automated capabilities to collect basic host information, update tools, and upload additional files.<br>") t1104html.write("A second remote access tool (RAT) could be uploaded at that point to redirect the host to the second-stage command and control server. The second stage will likely be more fully featured and allow the adversary to interact with the system through a reverse shell and additional RAT features.<br>") t1104html.write("The different stages will likely be hosted separately with no overlapping infrastructure. The loader may also have backup first-stage callbacks or Fallback Channels in case the original first-stage communication path is discovered and blocked.") # information t1104html.write("{}T1104</td>\n <td>".format(headings)) # id t1104html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1104html.write("Command &amp; Control</td>\n <td>") # tactics t1104html.write("-") # sub-techniques # indicator regex assignments t1104html.write("{}-".format(iocs)) # related techniques t1104html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1008 target=\"_blank\"\">T1008</a></td>\n <td>".format(related)) t1104html.write("Fallback Channels") # mitigations t1104html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1104html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level.{}".format(footer)) with open(sd+"t1095.html", "w") as t1095html: # description t1095html.write("{}Adversaries may use a non-application layer protocol for communication between host and C2 server or among infected hosts within a network. The list of possible protocols is extensive.<br>".format(header)) t1095html.write("Specific examples include use of network layer protocols, such as the Internet Control Message Protocol (ICMP), transport layer protocols, such as the User Datagram Protocol (UDP), session layer protocols, such as Socket Secure (SOCKS), as well as redirected/tunneled protocols, such as Serial over LAN (SOL).<br>") t1095html.write("ICMP communication between hosts is one example. Because ICMP is part of the Internet Protocol Suite, it is required to be implemented by all IP-compatible hosts; however, it is not as commonly monitored as other Internet Protocols such as TCP or UDP and may be used by adversaries to hide communications.") # information t1095html.write("{}T1095</td>\n <td>".format(headings)) # id t1095html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1095html.write("Command &amp; Control</td>\n <td>") # tactics t1095html.write("-") # sub-techniques # indicator regex assignments t1095html.write("{}-".format(iocs)) # related techniques t1095html.write("{}-</a></td>\n <td>".format(related)) t1095html.write("-") # mitigations t1095html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1095html.write("Filter network traffic to prevent use of protocols across the network boundary that are unnecessary.{}".format(insert)) t1095html.write("Network Intrusion Prevention</td>\n <td>") t1095html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level.{}".format(insert)) t1095html.write("Network Segmentation</td>\n <td>") t1095html.write("Properly configure firewalls and proxies to limit outgoing traffic to only necessary ports and through proper network gateway systems. Also ensure hosts are only provisioned to communicate over authorized interfaces.{}".format(footer)) with open(sd+"t1571.html", "w") as t1571html: # description t1571html.write("{}Adversaries may communicate using a protocol and port paring that are typically not associated. For example, HTTPS over port 8088 or port 587 as opposed to the traditional port 443.<br>".format(header)) t1571html.write("Adversaries may make changes to the standard port used by a protocol to bypass filtering or muddle analysis/parsing of network data.") # information t1571html.write("{}T1571</td>\n <td>".format(headings)) # id t1571html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1571html.write("Command &amp; Control</td>\n <td>") # tactics t1571html.write("-") # sub-techniques # indicator regex assignments t1571html.write("{}-".format(iocs)) # related techniques t1571html.write("{}-</a></td>\n <td>".format(related)) t1571html.write("-") # mitigations t1571html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1571html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level.{}".format(insert)) t1571html.write("Network Segmentation</td>\n <td>") t1571html.write("Properly configure firewalls and proxies to limit outgoing traffic to only necessary ports for that particular network segment.{}".format(footer)) with open(sd+"t1572.html", "w") as t1572html: # description t1572html.write("{}Adversaries may tunnel network communications to and from a victim system within a separate protocol to avoid detection/network filtering and/or enable access to otherwise unreachable systems.<br>".format(header)) t1572html.write("Tunneling involves explicitly encapsulating a protocol within another. This behavior may conceal malicious traffic by blending in with existing traffic and/or provide an outer layer of encryption (similar to a VPN).<br>") t1572html.write("Tunneling could also enable routing of network packets that would otherwise not reach their intended destination, such as SMB, RDP, or other traffic that would be filtered by network appliances or not routed over the Internet.<br>") t1572html.write("There are various means to encapsulate a protocol within another protocol. For example, adversaries may perform SSH tunneling (also known as SSH port forwarding), which involves forwarding arbitrary data over an encrypted SSH tunnel.<br>") t1572html.write("Protocol Tunneling may also be abused by adversaries during Dynamic Resolution. Known as DNS over HTTPS (DoH), queries to resolve C2 infrastructure may be encapsulated within encrypted HTTPS packets.<br>") t1572html.write("Adversaries may also leverage Protocol Tunneling in conjunction with Proxy and/or Protocol Impersonation to further conceal C2 communications and infrastructure.") # information t1572html.write("{}T1572</td>\n <td>".format(headings)) # id t1572html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1572html.write("Command &amp; Control</td>\n <td>") # tactics t1572html.write("-") # sub-techniques # indicator regex assignments t1572html.write("{}-".format(iocs)) # related techniques t1572html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1568 target=\"_blank\"\">T1568</a></td>\n <td>".format(related)) t1572html.write("Dynamic Resolution") t1572html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1090 target=\"_blank\"\">T1090</a></td>\n <td>".format(insert)) t1572html.write("Proxy") t1572html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1001 target=\"_blank\"\">T1001</a></td>\n <td>".format(insert)) t1572html.write("Data Obfuscation: Protocol Impersonation") # mitigations t1572html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1572html.write("Consider filtering network traffic to untrusted or known bad domains and resources.{}".format(insert)) t1572html.write("Network Intrusion Prevention</td>\n <td>") t1572html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level.{}".format(footer)) with open(sd+"t1090.html", "w") as t1090html: # description t1090html.write("{}Adversaries may use a connection proxy to direct network traffic between systems or act as an intermediary for network communications to a command and control server to avoid direct connections to their infrastructure. Many tools exist that enable traffic redirection through proxies or port redirection, including HTRAN, ZXProxy, and ZXPortMap.<br>".format(header)) t1090html.write("Adversaries use these types of proxies to manage command and control communications, reduce the number of simultaneous outbound network connections, provide resiliency in the face of connection loss, or to ride over existing trusted communications paths between victims to avoid suspicion. Adversaries may chain together multiple proxies to further disguise the source of malicious traffic.<br>") t1090html.write("Adversaries can also take advantage of routing schemes in Content Delivery Networks (CDNs) to proxy command and control traffic.") # information t1090html.write("{}T1090</td>\n <td>".format(headings)) # id t1090html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1090html.write("Command &amp; Control</td>\n <td>") # tactics t1090html.write("T1090.001: Internal Proxy<br>T1090.002: External Proxy<br>T1090.003: Multi-hop Proxy<br>T1090.004: Domain Fronting") # sub-techniques # indicator regex assignments t1090html.write("{}netsh</li>\n <li>".format(iocs)) t1090html.write("portopening</li>") # related techniques t1090html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1572 target=\"_blank\"\">T1572</a></td>\n <td>".format(related)) t1090html.write("Protocol Tunneling") # mitigations t1090html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1090html.write("Traffic to known anonymity networks and C2 infrastructure can be blocked through the use of network allow and block lists. It should be noted that this kind of blocking may be circumvented by other techniques like Domain Fronting.{}".format(insert)) t1090html.write("Network Intrusion Prevention</td>\n <td>") t1090html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level. Signatures are often for unique indicators within protocols and may be based on the specific C2 protocol used by a particular adversary or tool, and will likely be different across various malware families and versions. Adversaries will likely change tool C2 signatures over time or construct protocols in such a way as to avoid detection by common defensive tools.{}".format(insert)) t1090html.write("SSL/TLS Inspection</td>\n <td>") t1090html.write("If it is possible to inspect HTTPS traffic, the captures can be analyzed for connections that appear to be domain fronting.{}".format(footer)) with open(sd+"t1219.html", "w") as t1219html: # description t1219html.write("{}An adversary may use legitimate desktop support and remote access software, such as Team Viewer, Go2Assist, LogMein, AmmyyAdmin, etc, to establish an interactive command and control channel to target systems within networks. These services are commonly used as legitimate technical support software, and may be allowed by application control within a target environment.<br>".format(header)) t1219html.write("Remote access tools like VNC, Ammyy, and Teamviewer are used frequently when compared with other legitimate software commonly used by adversaries.<br>") t1219html.write("Remote access tools may be established and used post-compromise as alternate communications channel for redundant access or as a way to establish an interactive remote desktop session with the target system. They may also be used as a component of malware to establish a reverse connection or back-connect to a service or adversary controlled system.<br>") t1219html.write("Admin tools such as TeamViewer have been used by several groups targeting institutions in countries of interest to the Russian state and criminal campaigns.") # information t1219html.write("{}T1219</td>\n <td>".format(headings)) # id t1219html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1219html.write("Command &amp; Control</td>\n <td>") # tactics t1219html.write("-") # sub-techniques # indicator regex assignments t1219html.write("{}Ports: 5800, 5895, 5900, 5938, 5984, 5986, 8200".format(iocs)) # related techniques t1219html.write("{}-</a></td>\n <td>".format(related)) t1219html.write("-") # mitigations t1219html.write("{}Execution Prevention</td>\n <td>".format(mitigations)) t1219html.write("Use application control to mitigate installation and use of unapproved software that can be used for remote access.{}".format(insert)) t1219html.write("Filter Network Traffic</td>\n <td>") t1219html.write("Properly configure firewalls, application firewalls, and proxies to limit outgoing traffic to sites and services used by remote access tools.{}".format(insert)) t1219html.write("Network Intrusion Prevention</td>\n <td>") t1219html.write("Network intrusion detection and prevention systems that use network signatures may be able to prevent traffic to remote access services.{}".format(footer)) with open(sd+"t1102.html", "w") as t1102html: # description t1102html.write("{}Adversaries may use an existing, legitimate external Web service as a means for relaying data to/from a compromised system. Popular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise.<br>".format(header)) t1102html.write("Using common services, such as those offered by Google or Twitter, makes it easier for adversaries to hide in expected noise. Web service providers commonly use SSL/TLS encryption, giving adversaries an added level of protection.<br>") t1102html.write("Use of Web services may also protect back-end C2 infrastructure from discovery through malware binary analysis while also enabling operational resiliency (since this infrastructure may be dynamically changed).") # information t1102html.write("{}T1102</td>\n <td>".format(headings)) # id t1102html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1102html.write("Command &amp; Control</td>\n <td>") # tactics t1102html.write("T1102.001: Dead Drop Resolver<br>T1102.002: Bidirectional Communication<br>T1102.003: One-Way Communication") # sub-techniques # indicator regex assignments t1102html.write("{}-".format(iocs)) # related techniques t1102html.write("{}-</a></td>\n <td>".format(related)) t1102html.write("-") # mitigations t1102html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1102html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level.{}".format(insert)) t1102html.write("Restrict Web-Based Content</td>\n <td>") t1102html.write("Web proxies can be used to enforce external network communication policy that prevents use of unauthorized external services.{}".format(footer)) # Exfiltration with open(sd+"t1020.html", "w") as t1020html: # description t1020html.write("{}Adversaries may exfiltrate data, such as sensitive documents, through the use of automated processing after being gathered during Collection.<br>".format(header)) t1020html.write("When automated exfiltration is used, other exfiltration techniques likely apply as well to transfer the information out of the network, such as Exfiltration Over C2 Channel and Exfiltration Over Alternative Protocol.") # information t1020html.write("{}T1030</td>\n <td>".format(headings)) # id t1020html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1020html.write("Exfiltration</td>\n <td>") # tactics t1020html.write("T1020.001: Traffic Duplication") # indicator regex assignments t1020html.write("{}-".format(iocs)) # related techniques t1020html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1041 target=\"_blank\"\">T1041</a></td>\n <td>".format(related)) t1020html.write("Exfiltration Over C2 Channel") t1020html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1048 target=\"_blank\"\">T1048</a></td>\n <td>".format(insert)) t1020html.write("Exfiltration Over Alternative Protocol") # mitigations t1020html.write("{}-</td>\n <td>".format(mitigations)) t1020html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1030.html", "w") as t1030html: # description t1030html.write("{}An adversary may exfiltrate data in fixed size chunks instead of whole files or limit packet sizes below certain thresholds. This approach may be used to avoid triggering network data transfer threshold alerts.".format(header)) # information t1030html.write("{}T1030</td>\n <td>".format(headings)) # id t1030html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1030html.write("Exfiltration</td>\n <td>") # tactics t1030html.write("-") # sub-techniques # indicator regex assignments t1030html.write("{}-".format(iocs)) # related techniques t1030html.write("{}-</a></td>\n <td>".format(related)) t1030html.write("-") # mitigations t1030html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1030html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary command and control infrastructure and malware can be used to mitigate activity at the network level.{}".format(footer)) with open(sd+"t1048.html", "w") as t1048html: # description t1048html.write("{}Adversaries may steal data by exfiltrating it over a different protocol than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server.<br>".format(header)) t1048html.write("Alternate protocols include FTP, SMTP, HTTP/S, DNS, SMB, or any other network protocol not being used as the main command and control channel. Different protocol channels could also include Web services such as cloud storage. Adversaries may also opt to encrypt and/or obfuscate these alternate channels.<br>") t1048html.write("Exfiltration Over Alternative Protocol can be done using various common operating system utilities such as Net/SMB or FTP.") # information t1048html.write("{}T1048</td>\n <td>".format(headings)) # id t1048html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1048html.write("Exfiltration</td>\n <td>") # tactics t1048html.write("T1048.001: Exfiltration Over Symmetric Encrypted Non-C2 Protocol<br>T1048.002: Exfiltration Over Asymmetric Encrypted Non-C2 Protocol<br>T1048.003: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol") # sub-techniques # indicator regex assignments t1048html.write("{}Ports: 20, 21, 22, 23, 25, 53, 69, 80, 110, 135, 143, 443, 465, 989, 990, 993, 995, 3389, 5355, 5800, 5895, 5900, 5938, 5984, 5986, 8200".format(iocs)) # related techniques t1048html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1029 target=\"_blank\"\">T1029</td>\n <td>".format(related)) t1048html.write("Scheduled Transfer") # mitigations t1048html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1048html.write("Enforce proxies and use dedicated servers for services such as DNS and only allow those systems to communicate over respective ports/protocols, instead of all systems within a network.{}".format(insert)) t1048html.write("Network Intrusion Prevention</td>\n <td>") t1048html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary command and control infrastructure and malware can be used to mitigate activity at the network level.{}".format(insert)) t1048html.write("Network Segmentation</td>\n <td>") t1048html.write("Follow best practices for network firewall configurations to allow only necessary ports and traffic to enter and exit the network.{}".format(footer)) with open(sd+"t1041.html", "w") as t1041html: # description t1041html.write("{}Adversaries may steal data by exfiltrating it over an existing command and control channel. Stolen data is encoded into the normal communications channel using the same protocol as command and control communications.".format(header)) # information t1041html.write("{}T1041</td>\n <td>".format(headings)) # id t1041html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1041html.write("Exfiltration</td>\n <td>") # tactics t1041html.write("-") # sub-techniques # indicator regex assignments t1041html.write("{}Ports: 20, 21, 25, 445, 53, 80, 443, 445".format(iocs)) # related techniques t1041html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1029 target=\"_blank\"\">T1029</td>\n <td>".format(related)) t1041html.write("Scheduled Transfer") # mitigations t1041html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1041html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary malware can be used to mitigate activity at the network level. Signatures are often for unique indicators within protocols and may be based on the specific obfuscation technique used by a particular adversary or tool, and will likely be different across various malware families and versions. Adversaries will likely change tool command and control signatures over time or construct protocols in such a way to avoid detection by common defensive tools.{}".format(footer)) with open(sd+"t1011.html", "w") as t1011html: # description t1011html.write("{}Adversaries may attempt to exfiltrate data over a different network medium than the command and control channel. If the command and control network is a wired Internet connection, the exfiltration may occur, for example, over a WiFi connection, modem, cellular data connection, Bluetooth, or another radio frequency (RF) channel.<br>".format(header)) t1011html.write("Adversaries may choose to do this if they have sufficient access or proximity, and the connection might not be secured or defended as well as the primary Internet-connected channel because it is not routed through the same enterprise network.") # information t1011html.write("{}T1011</td>\n <td>".format(headings)) # id t1011html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1011html.write("Exfiltration</td>\n <td>") # tactics t1011html.write("T1011.001: Exfiltration Over Bluetooth") # sub-techniques # indicator regex assignments t1011html.write("{}bluetooth".format(iocs)) # related techniques t1011html.write("{}-</a></td>\n <td>".format(related)) t1011html.write("-") # mitigations t1011html.write("{}Operating System Configuration</td>\n <td>".format(mitigations)) t1011html.write("Prevent the creation of new network adapters where possible.{}".format(footer)) with open(sd+"t1052.html", "w") as t1052html: # description t1052html.write("{}Adversaries may attempt to exfiltrate data via a physical medium, such as a removable drive. In certain circumstances, such as an air-gapped network compromise, exfiltration could occur via a physical medium or device introduced by a user.<br>".format(header)) t1052html.write("Such media could be an external hard drive, USB drive, cellular phone, MP3 player, or other removable storage and processing device. The physical medium or device could be used as the final exfiltration point or to hop between otherwise disconnected systems.") # information t1052html.write("{}T1052</td>\n <td>".format(headings)) # id t1052html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1052html.write("Exfiltration</td>\n <td>") # tactics t1052html.write("T1052.001: Exfiltration over USB") # sub-techniques # indicator regex assignments t1052html.write("{}DISPLAY</li>\n <li>".format(iocs)) t1052html.write("HID</li>\n <li>") t1052html.write("PCI</li>\n <li>") t1052html.write("UMB</li>\n <li>") t1052html.write("FDC</li>\n <li>") t1052html.write("SCSI</li>\n <li>") t1052html.write("STORAGE</li>\n <li>") t1052html.write("USB</li>\n <li>") t1052html.write("WpdBusEnumRoot</li>") # related techniques t1052html.write("{}-</a></td>\n <td>".format(related)) t1052html.write("-") # mitigations t1052html.write("{}Disable or Remove Feature or Program</td>\n <td>".format(mitigations)) t1052html.write("Disable Autorun if it is unnecessary. Disallow or restrict removable media at an organizational policy level if they are not required for business operations.{}".format(insert)) t1052html.write("Limit Hardware Installation</td>\n <td>") t1052html.write("Limit the use of USB devices and removable media within a network.{}".format(footer)) with open(sd+"t1567.html", "w") as t1567html: # description t1567html.write("{}Adversaries may use an existing, legitimate external Web service to exfiltrate data rather than their primary command and control channel.<br>".format(header)) t1567html.write("Popular Web services acting as an exfiltration mechanism may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to compromise.<br>") t1567html.write("Firewall rules may also already exist to permit traffic to these services.<br>") t1567html.write("Web service providers also commonly use SSL/TLS encryption, giving adversaries an added level of protection.") # information t1567html.write("{}T1567</td>\n <td>".format(headings)) # id t1567html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1567html.write("Execution</td>\n <td>") # tactics t1567html.write("T1567.001: Exfiltration to Code Repository<br>T1567.002: Exfiltration to Cloud Storage") # sub-techniques # indicator regex assignments t1567html.write("{}github</li>\n <li>".format(iocs)) t1567html.write("gitlab</li>\n <li>") t1567html.write("bitbucket</li>\n <li>") t1567html.write("dropbox</li>\n <li>") t1567html.write("onedrive</li>\n <li>") t1567html.write("4shared</li>") # related techniques t1567html.write("{}-</a></td>\n <td>".format(related)) t1567html.write("-") # mitigations t1567html.write("{}Restrict Web-Based Content</td>\n <td>".format(mitigations)) t1567html.write("Web proxies can be used to enforce an external network communication policy that prevents use of unauthorized external services.{}".format(footer)) with open(sd+"t1029.html", "w") as t1029html: # description t1029html.write("{}Adversaries may steal data by exfiltrating it over an existing command and control channel. Stolen data is encoded into the normal communications channel using the same protocol as command and control communications.".format(header)) # information t1029html.write("{}T1029</td>\n <td>".format(headings)) # id t1029html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1029html.write("Exfiltration</td>\n <td>") # tactics t1029html.write("-") # indicator regex assignments t1029html.write("{}-".format(iocs)) # related techniques t1029html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1041 target=\"_blank\"\">T1041</a></td>\n <td>".format(related)) t1029html.write("Exfiltration Over C2 Channel") t1029html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1048 target=\"_blank\"\">T1048</a></td>\n <td>".format(insert)) t1029html.write("Exfiltration Over Alternative Protocol") # mitigations t1029html.write("{}Network Intrusion Prevention</td>\n <td>".format(mitigations)) t1029html.write("Network intrusion detection and prevention systems that use network signatures to identify traffic for specific adversary command and control infrastructure and malware can be used to mitigate activity at the network level. Signatures are often for unique indicators within protocols and may be based on the specific obfuscation technique used by a particular adversary or tool, and will likely be different across various malware families and versions. Adversaries will likely change tool command and control signatures over time or construct protocols in such a way to avoid detection by common defensive tools.{}".format(footer)) with open(sd+"t1537.html", "w") as t1537html: # description t1537html.write("{}Adversaries may exfiltrate data by transferring the data, including backups of cloud environments, to another cloud account they control on the same service to avoid typical file transfers/downloads and network-based exfiltration detection.<br>".format(header)) t1537html.write("A defender who is monitoring for large transfers to outside the cloud environment through normal file transfers or over command and control channels may not be watching for data transfers to another account within the same cloud provider.<br>") t1537html.write("Such transfers may utilize existing cloud provider APIs and the internal address space of the cloud provider to blend into normal traffic or avoid data transfers over external network interfaces.<br>") t1537html.write("Incidents have been observed where adversaries have created backups of cloud instances and transferred them to separate accounts.") # information t1537html.write("{}T1537</td>\n <td>".format(headings)) # id t1537html.write("AWS, Azure, GCP</td>\n <td>") # platforms t1537html.write("Exfiltration</td>\n <td>") # tactics t1537html.write("-") # sub-techniques # indicator regex assignments t1537html.write("{}onedrive</li>\n <li>".format(iocs)) t1537html.write("1drv</li>\n <li>") t1537html.write("azure</li>\n <li>") t1537html.write("icloud</li>\n <li>") t1537html.write("cloudrive</li>\n <li>") t1537html.write("dropbox</li>\n <li>") t1537html.write("drive\\.google</li>\n <li>") t1537html.write("mediafire</li>\n <li>") t1537html.write("zippyshare</li>\n <li>") t1537html.write("megaupload</li>\n <li>") t1537html.write("4shared</li>") # related techniques t1537html.write("{}-</a></td>\n <td>".format(related)) t1537html.write("-") # mitigations t1537html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1537html.write("Implement network-based filtering restrictions to prohibit data transfers to untrusted VPCs.{}".format(insert)) t1537html.write("Password Policies</td>\n <td>") t1537html.write("Consider rotating access keys within a certain number of days to reduce the effectiveness of stolen credentials.{}".format(insert)) t1537html.write("User Account Management</td>\n <td>") t1537html.write("Limit user account and IAM policies to the least privileges required. Consider using temporary credentials for accounts that are only valid for a certain period of time to reduce the effectiveness of compromised accounts.{}".format(footer)) # Impact with open(sd+"t1531.html", "w") as t1531html: # description t1531html.write("{}Adversaries may interrupt availability of system and network resources by inhibiting access to accounts utilized by legitimate users. Accounts may be deleted, locked, or manipulated (ex: changed credentials) to remove access to accounts.<br>".format(header)) t1531html.write("Adversaries may also subsequently log off and/or reboot boxes to set malicious changes into place.") # information t1531html.write("{}T1531</td>\n <td>".format(headings)) # id t1531html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1531html.write("Impact</td>\n <td>") # tactics t1531html.write("-") # sub-techniques # indicator regex assignments t1531html.write("{}Events IDs: 4723, 4724, 4726, 4740".format(iocs)) # related techniques t1531html.write("{}-</a></td>\n <td>".format(related)) t1531html.write("-") # mitigations t1531html.write("{}-</td>\n <td>".format(mitigations)) t1531html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1485.html", "w") as t1485html: # description t1485html.write("{}Adversaries may destroy data and files on specific systems or in large numbers on a network to interrupt availability to systems, services, and network resources. Data destruction is likely to render stored data irrecoverable by forensic techniques through overwriting files or data on local and remote drives.<br>".format(header)) t1485html.write("Common operating system file deletion commands such as del and rm often only remove pointers to files without wiping the contents of the files themselves, making the files recoverable by proper forensic methodology. This behavior is distinct from Disk Content Wipe and Disk Structure Wipe because individual files are destroyed rather than sections of a storage disk or the disk's logical structure.<br>") t1485html.write("Adversaries may attempt to overwrite files and directories with randomly generated data to make it irrecoverable. In some cases politically oriented image files have been used to overwrite data.<br>") t1485html.write("To maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware designed for destroying data may have worm-like features to propagate across a network by leveraging additional techniques like Valid Accounts, OS Credential Dumping, and SMB/Windows Admin Shares.") # information t1485html.write("{}T1485</td>\n <td>".format(headings)) # id t1485html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1485html.write("Impact</td>\n <td>") # tactics t1485html.write("-") # sub-techniques # indicator regex assignments t1485html.write("{}del</li>\n <li>".format(iocs)) t1485html.write("rm</li>\n <li>") t1485html.write("/delete</li>\n <li>") t1485html.write("sdelete</li>") # related techniques t1485html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1561 target=\"_blank\"\">T1561</a></td>\n <td>".format(related)) t1485html.write("Disk Wipe: Disk Content Wipe") t1485html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1561 target=\"_blank\"\">T1561</a></td>\n <td>".format(insert)) t1485html.write("Disk Wipe: Disk Structure Wipe") t1485html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(insert)) t1485html.write("Valid Accounts") t1485html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1003 target=\"_blank\"\">T1003</a></td>\n <td>".format(insert)) t1485html.write("OS Credential Dumping") t1485html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(insert)) t1485html.write("Remote Services: SMB/Windows Admin Shares") # mitigations t1485html.write("{}Data Backup</td>\n <td>".format(mitigations)) t1485html.write("Consider implementing IT disaster recovery plans that contain procedures for taking regular data backups that can be used to restore organizational data. Ensure backups are stored off system and is protected from common methods adversaries may use to gain access and destroy the backups to prevent recovery.{}".format(footer)) with open(sd+"t1486.html", "w") as t1486html: # description t1486html.write("{}Adversaries may encrypt data on target systems or on large numbers of systems in a network to interrupt availability to system and network resources. They can attempt to render stored data inaccessible by encrypting files or data on local and remote drives and withholding access to a decryption key.<br>".format(header)) t1486html.write("This may be done in order to extract monetary compensation from a victim in exchange for decryption or a decryption key (ransomware) or to render data permanently inaccessible in cases where the key is not saved or transmitted.<br>") t1486html.write("In the case of ransomware, it is typical that common user files like Office documents, PDFs, images, videos, audio, text, and source code files will be encrypted. In some cases, adversaries may encrypt critical system files, disk partitions, and the MBR.<br>") t1486html.write("To maximize impact on the target organization, malware designed for encrypting data may have worm-like features to propagate across a network by leveraging other attack techniques like Valid Accounts, OS Credential Dumping, and SMB/Windows Admin Shares.") # information t1486html.write("{}T1486</td>\n <td>".format(headings)) # id t1486html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1486html.write("Impact</td>\n <td>") # tactics t1486html.write("-") # sub-techniques # indicator regex assignments t1486html.write("{}-".format(iocs)) # related techniques t1486html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(related)) t1486html.write("Valid Accounts") t1486html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1003 target=\"_blank\"\">T1003</a></td>\n <td>".format(insert)) t1486html.write("OS Credential Dumping") t1486html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(insert)) t1486html.write("Remote Services: SMB/Windows Admin Shares") # mitigations t1486html.write("{}Data Backup</td>\n <td>".format(mitigations)) t1486html.write("Consider implementing IT disaster recovery plans that contain procedures for regularly taking and testing data backups that can be used to restore organizational data.[48] Ensure backups are stored off system and is protected from common methods adversaries may use to gain access and destroy the backups to prevent recovery. Consider enabling versioning in cloud environments to maintain backup copies of storage objects.{}".format(footer)) with open(sd+"t1565.html", "w") as t1565html: # description t1565html.write("{}Adversaries may insert, delete, or manipulate data in order to manipulate external outcomes or hide activity. By manipulating data, adversaries may attempt to affect a business process, organizational understanding, or decision making.<br>".format(header)) t1565html.write("The type of modification and the impact it will have depends on the target application and process as well as the goals and objectives of the adversary.<br>") t1565html.write("For complex systems, an adversary would likely need special expertise and possibly access to specialized software related to the system that would typically be gained through a prolonged information gathering campaign in order to have the desired impact.") # information t1565html.write("{}T1565</td>\n <td>".format(headings)) # id t1565html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1565html.write("Impact</td>\n <td>") # tactics t1565html.write("T1565.001: Stored Data Manipulation<br>T1565.002: Transmitted Data Manipulation<br>T1565.003: Runtime Data Manipulation") # sub-techniques # indicator regex assignments t1565html.write("{}-".format(iocs)) # related techniques t1565html.write("{}-</a></td>\n <td>".format(related)) t1565html.write("-") # mitigations t1565html.write("{}Encrypt Sensitive Information</td>\n <td>".format(mitigations)) t1565html.write("Consider encrypting important information to reduce an adversary’s ability to perform tailored data modifications.{}".format(insert)) t1565html.write("Network Segmentation</td>\n <td>") t1565html.write("Identify critical business and system processes that may be targeted by adversaries and work to isolate and secure those systems against unauthorized access and tampering.{}".format(insert)) t1565html.write("Remote Data Storage</td>\n <td>") t1565html.write("Consider implementing IT disaster recovery plans that contain procedures for taking regular data backups that can be used to restore organizational data. Ensure backups are stored off system and is protected from common methods adversaries may use to gain access and manipulate backups.{}".format(insert)) t1565html.write("Restrict File and Directory Permissions</td>\n <td>") t1565html.write("Ensure least privilege principles are applied to important information resources to reduce exposure to data manipulation risk.{}".format(footer)) with open(sd+"t1491.html", "w") as t1491html: # description t1491html.write("{}Adversaries may modify visual content available internally or externally to an enterprise network. Reasons for Defacement include delivering messaging, intimidation, or claiming (possibly false) credit for an intrusion.<br>".format(header)) t1491html.write("Disturbing or offensive images may be used as a part of Defacement in order to cause user discomfort, or to pressure compliance with accompanying messages.") # information t1491html.write("{}T1491</td>\n <td>".format(headings)) # id t1491html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1491html.write("Impact</td>\n <td>") # tactics t1491html.write("T1491.001: Internal Defacement<br>T1491.002: External Defacement") # sub-techniques # indicator regex assignments t1491html.write("{}-".format(iocs)) # related techniques t1491html.write("{}-</a></td>\n <td>".format(related)) t1491html.write("-") # mitigations t1491html.write("{}Data Backup</td>\n <td>".format(mitigations)) t1491html.write("Consider implementing IT disaster recovery plans that contain procedures for taking regular data backups that can be used to restore organizational data. Ensure backups are stored off system and is protected from common methods adversaries may use to gain access and destroy the backups to prevent recovery.{}".format(footer)) with open(sd+"t1561.html", "w") as t1561html: # description t1561html.write("{}Adversaries may wipe or corrupt raw disk data on specific systems or in large numbers in a network to interrupt availability to system and network resources.<br>".format(header)) t1561html.write("With direct write access to a disk, adversaries may attempt to overwrite portions of disk data. Adversaries may opt to wipe arbitrary portions of disk data and/or wipe disk structures like the master boot record (MBR). A complete wipe of all disk sectors may be attempted.<br>") t1561html.write("To maximize impact on the target organization in operations where network-wide availability interruption is the goal, malware used for wiping disks may have worm-like features to propagate across a network by leveraging additional techniques like Valid Accounts, OS Credential Dumping, and SMB/Windows Admin Shares.") # information t1561html.write("{}T1561</td>\n <td>".format(headings)) # id t1561html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1561html.write("Impact</td>\n <td>") # tactics t1561html.write("T1561.001 Disk Content Wipe<br>T1561.002: Disk Structure Wipe") # sub-techniques # indicator regex assignments t1561html.write("{}-".format(iocs)) # related techniques t1561html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1078 target=\"_blank\"\">T1078</a></td>\n <td>".format(related)) t1561html.write("Valid Accounts") t1561html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1003 target=\"_blank\"\">T1003</a></td>\n <td>".format(insert)) t1561html.write("OS Credential Dumping") t1561html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1021 target=\"_blank\"\">T1021</a></td>\n <td>".format(insert)) t1561html.write("Remote Services: SMB/Windows Admin Shares") t1561html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1485 target=\"_blank\"\">T1485</a></td>\n <td>".format(insert)) t1561html.write("Data Destruction") # mitigations t1561html.write("{}Data Backup</td>\n <td>".format(mitigations)) t1561html.write("Consider implementing IT disaster recovery plans that contain procedures for taking regular data backups that can be used to restore organizational data.[2] Ensure backups are stored off system and is protected from common methods adversaries may use to gain access and destroy the backups to prevent recovery.{}".format(footer)) with open(sd+"t1499.html", "w") as t1499html: # description t1499html.write("{}Adversaries may perform Endpoint Denial of Service (DoS) attacks to degrade or block the availability of services to users. Endpoint DoS can be performed by exhausting the system resources those services are hosted on or exploiting the system to cause a persistent crash condition.<br>".format(header)) t1499html.write("Example services include websites, email services, DNS, and web-based applications. Adversaries have been observed conducting DoS attacks for political purposes and to support other malicious activities, including distraction, hacktivism, and extortion.<br>") t1499html.write("An Endpoint DoS denies the availability of a service without saturating the network used to provide access to the service. Adversaries can target various layers of the application stack that is hosted on the system used to provide the service.<br>") t1499html.write("These layers include the Operating Systems (OS), server applications such as web servers, DNS servers, databases, and the (typically web-based) applications that sit on top of them.<br>") t1499html.write("Attacking each layer requires different techniques that take advantage of bottlenecks that are unique to the respective components.<br>") t1499html.write("A DoS attack may be generated by a single system or multiple systems spread across the internet, which is commonly referred to as a distributed DoS (DDoS). To perform DoS attacks against endpoint resources, several aspects apply to multiple methods, including IP address spoofing and botnets. Adversaries may use the original IP address of an attacking system, or spoof the source IP address to make the attack traffic more difficult to trace back to the attacking system or to enable reflection.<br>") t1499html.write("This can increase the difficulty defenders have in defending against the attack by reducing or eliminating the effectiveness of filtering by the source address on network defense devices.<br>") t1499html.write("Botnets are commonly used to conduct DDoS attacks against networks and services. Large botnets can generate a significant amount of traffic from systems spread across the global internet.<br>") t1499html.write("Adversaries may have the resources to build out and control their own botnet infrastructure or may rent time on an existing botnet to conduct an attack.<br>") t1499html.write("In some of the worst cases for DDoS, so many systems are used to generate requests that each one only needs to send out a small amount of traffic to produce enough volume to exhaust the target's resources.<br>") t1499html.write("In such circumstances, distinguishing DDoS traffic from legitimate clients becomes exceedingly difficult. Botnets have been used in some of the most high-profile DDoS attacks, such as the 2012 series of incidents that targeted major US banks.<br>") t1499html.write("In cases where traffic manipulation is used, there may be points in the the global network (such as high traffic gateway routers) where packets can be altered and cause legitimate clients to execute code that directs network packets toward a target in high volume.<br>") t1499html.write("This type of capability was previously used for the purposes of web censorship where client HTTP traffic was modified to include a reference to JavaScript that generated the DDoS code to overwhelm target web servers. For attacks attempting to saturate the providing network, see Network Denial of Service.") # information t1499html.write("{}T1499</td>\n <td>".format(headings)) # id t1499html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1499html.write("Impact</td>\n <td>") # tactics t1499html.write("T1499.001: OS Exhaustion Flood<br> T1499.002: Service Exhaustion Flood<br> T1499.003: Application Exhaustion Flood<br> T1499.004: Application or System Exploitation") # sub-techniques # indicator regex assignments t1499html.write("{}-".format(iocs)) # related techniques t1499html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1498 target=\"_blank\"\">T1498</a></td>\n <td>".format(related)) t1499html.write("Network Denial of Service") # mitigations t1499html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1499html.write("Leverage services provided by Content Delivery Networks (CDN) or providers specializing in DoS mitigations to filter traffic upstream from services. Filter boundary traffic by blocking source addresses sourcing the attack, blocking ports that are being targeted, or blocking protocols being used for transport. To defend against SYN floods, enable SYN Cookies.{}".format(footer)) with open(sd+"t1495.html", "w") as t1495html: # description t1495html.write("{}Adversaries may overwrite or corrupt the flash memory contents of system BIOS or other firmware in devices attached to a system in order to render them inoperable or unable to boot.<br>".format(header)) t1495html.write("Firmware is software that is loaded and executed from non-volatile memory on hardware devices in order to initialize and manage device functionality.<br>") t1495html.write("These devices could include the motherboard, hard drive, or video cards.") # information t1495html.write("{}T1495</td>\n <td>".format(headings)) # id t1495html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1495html.write("Impact</td>\n <td>") # tactics t1495html.write("-") # sub-techniques # indicator regex assignments t1495html.write("{}-".format(iocs)) # related techniques t1495html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t0000 target=\"_blank\"\">T0000</a></td>\n <td>".format(related)) t1495html.write("-") # mitigations t1495html.write("{}Boot Integrity</td>\n <td>".format(mitigations)) t1495html.write("Check the integrity of the existing BIOS and device firmware to determine if it is vulnerable to modification.{}".format(insert)) t1495html.write("Privileged Account Management</td>\n <td>") t1495html.write("Prevent adversary access to privileged accounts or access necessary to replace system firmware.{}".format(insert)) t1495html.write("Update Software</td>\n <td>") t1495html.write("Patch the BIOS and other firmware as necessary to prevent successful use of known vulnerabilities.{}".format(footer)) with open(sd+"t1490.html", "w") as t1490html: # description t1490html.write("{}Adversaries may delete or remove built-in operating system data and turn off services designed to aid in the recovery of a corrupted system to prevent recovery.<br>".format(header)) t1490html.write("Operating systems may contain features that can help fix corrupted systems, such as a backup catalog, volume shadow copies, and automatic repair features.<br>") t1490html.write("Adversaries may disable or delete system recovery features to augment the effects of Data Destruction and Data Encrypted for Impact.") # information t1490html.write("{}T1490</td>\n <td>".format(headings)) # id t1490html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1490html.write("Impact</td>\n <td>") # tactics t1490html.write("-") # sub-techniques # indicator regex assignments t1490html.write("{}vssadmin</li>\n <li>".format(iocs)) t1490html.write("wbadmin</li>\n <li>") t1490html.write("shadows</li>\n <li>") t1490html.write("shadowcopy</li>") # related techniques t1490html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1485 target=\"_blank\"\">T1485</a></td>\n <td>".format(related)) t1490html.write("Data Destruction") t1490html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1486 target=\"_blank\"\">T1486</a></td>\n <td>".format(insert)) t1490html.write("Data Encrypted for Impact") t1490html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1047 target=\"_blank\"\">T1047</a></td>\n <td>".format(insert)) t1490html.write("Windows Management Instrumentation") # mitigations t1490html.write("{}Data Backup</td>\n <td>".format(mitigations)) t1490html.write("Consider implementing IT disaster recovery plans that contain procedures for taking regular data backups that can be used to restore organizational data. Ensure backups are stored off system and is protected from common methods adversaries may use to gain access and destroy the backups to prevent recovery.{}".format(insert)) t1490html.write("Operating System Configuration</td>\n <td>") t1490html.write("Consider technical controls to prevent the disabling of services or deletion of files involved in system recovery.{}".format(footer)) with open(sd+"t1498.html", "w") as t1498html: # description t1498html.write("{}Adversaries may perform Network Denial of Service (DoS) attacks to degrade or block the availability of targeted resources to users. Network DoS can be performed by exhausting the network bandwidth services rely on. Example resources include specific websites, email services, DNS, and web-based applications. Adversaries have been observed conducting network DoS attacks for political purposes and to support other malicious activities, including distraction, hacktivism, and extortion.<br>".format(header)) t1498html.write("A Network DoS will occur when the bandwidth capacity of the network connection to a system is exhausted due to the volume of malicious traffic directed at the resource or the network connections and network devices the resource relies on. For example, an adversary may send 10Gbps of traffic to a server that is hosted by a network with a 1Gbps connection to the internet. This traffic can be generated by a single system or multiple systems spread across the internet, which is commonly referred to as a distributed DoS (DDoS).<br>") t1498html.write("To perform Network DoS attacks several aspects apply to multiple methods, including IP address spoofing, and botnets.<br>") t1498html.write("Adversaries may use the original IP address of an attacking system, or spoof the source IP address to make the attack traffic more difficult to trace back to the attacking system or to enable reflection. This can increase the difficulty defenders have in defending against the attack by reducing or eliminating the effectiveness of filtering by the source address on network defense devices.<br>") t1498html.write("For DoS attacks targeting the hosting system directly, see Endpoint Denial of Service.".format(header)) # information t1498html.write("{}T1499</td>\n <td>".format(headings)) # id t1498html.write("Windows, macOS, Linux, AWS, Azure, GCP, Office 365, SaaS</td>\n <td>") # platforms t1498html.write("Impact</td>\n <td>") # tactics t1498html.write("T1498.001: Direct Network Flood<br> T1498.002: Reflection Amplification") # sub-techniques # indicator regex assignments t1498html.write("{}-".format(iocs)) # related techniques t1498html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1499 target=\"_blank\"\">T1499</a></td>\n <td>".format(related)) t1498html.write("Endpoint Denial of Service") # mitigations t1498html.write("{}Filter Network Traffic</td>\n <td>".format(mitigations)) t1498html.write("When flood volumes exceed the capacity of the network connection being targeted, it is typically necessary to intercept the incoming traffic upstream to filter out the attack traffic from the legitimate traffic. Such defenses can be provided by the hosting Internet Service Provider (ISP) or by a 3rd party such as a Content Delivery Network (CDN) or providers specializing in DoS mitigations. Depending on flood volume, on-premises filtering may be possible by blocking source addresses sourcing the attack, blocking ports that are being targeted, or blocking protocols being used for transport. As immediate response may require rapid engagement of 3rd parties, analyze the risk associated to critical resources being affected by Network DoS attacks and create a disaster recovery plan/business continuity plan to respond to incidents.{}".format(footer)) with open(sd+"t1496.html", "w") as t1496html: # description t1496html.write("{}Adversaries may leverage the resources of co-opted systems in order to solve resource intensive problems which may impact system and/or hosted service availability.<br>".format(header)) t1496html.write("One common purpose for Resource Hijacking is to validate transactions of cryptocurrency networks and earn virtual currency. Adversaries may consume enough system resources to negatively impact and/or cause affected machines to become unresponsive.<br>") t1496html.write("Servers and cloud-based systems are common targets because of the high potential for available resources, but user endpoint systems may also be compromised and used for Resource Hijacking and cryptocurrency mining.") # information t1496html.write("{}T1496</td>\n <td>".format(headings)) # id t1496html.write("Windows, macOS, Linux, AWS, Azure, GCP</td>\n <td>") # platforms t1496html.write("Impact</td>\n <td>") # tactics t1496html.write("-") # sub-techniques # indicator regex assignments t1496html.write("{}-".format(iocs)) # related techniques t1496html.write("{}-</a></td>\n <td>".format(related)) t1496html.write("-") # mitigations t1496html.write("{}-</td>\n <td>".format(mitigations)) t1496html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer)) with open(sd+"t1489.html", "w") as t1489html: # description t1489html.write("{}Adversaries may stop or disable services on a system to render those services unavailable to legitimate users. Stopping critical services can inhibit or stop response to an incident or aid in the adversary's overall objectives to cause damage to the environment.<br>".format(header)) t1489html.write("Adversaries may accomplish this by disabling individual services of high importance to an organization, such as MSExchangeIS, which will make Exchange content inaccessible. In some cases, adversaries may stop or disable many or all services to render systems unusable.<br>") t1489html.write("Services may not allow for modification of their data stores while running. Adversaries may stop services in order to conduct Data Destruction or Data Encrypted for Impact on the data stores of services like Exchange and SQL Server.") # information t1489html.write("{}T1489</td>\n <td>".format(headings)) # id t1489html.write("Windows</td>\n <td>") # platforms t1489html.write("Impact</td>\n <td>") # tactics t1489html.write("-") # sub-techniques # indicator regex assignments t1489html.write("{}services.exe</li>\n <li>".format(iocs)) t1489html.write("sc.exe</li>\n <li>") t1489html.write("kill</li>\n <li>") t1489html.write("MSExchangeIs</li>\n <li>") t1489html.write("ChangeServiceConfigW</li>\n <li>") t1489html.write("net stop</li>\n <li>") t1489html.write("net1 stop</li>") # related techniques t1489html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1485 target=\"_blank\"\">T1485</a></td>\n <td>".format(related)) t1489html.write("Data Destruction") t1489html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1486 target=\"_blank\"\">T1486</a></td>\n <td>".format(insert)) t1489html.write("Data Encrypted for Impact") # mitigations t1489html.write("{}Network Segmentation</td>\n <td>".format(mitigations)) t1489html.write("Operate intrusion detection, analysis, and response systems on a separate network from the production environment to lessen the chances that an adversary can see and interfere with critical response functions.{}".format(insert)) t1489html.write("Restrict File and Directory Permissions</td>\n <td>") t1489html.write("Ensure proper process and file permissions are in place to inhibit adversaries from disabling or interfering with critical services.{}".format(insert)) t1489html.write("Restrict Registry Permissions</td>\n <td>") t1489html.write("Ensure proper registry permissions are in place to inhibit adversaries from disabling or interfering with critical services.{}".format(insert)) t1489html.write("User Account Management</td>\n <td>") t1489html.write("Limit privileges of user accounts and groups so that only authorized administrators can interact with service changes and service configurations.{}".format(footer)) with open(sd+"t1529.html", "w") as t1529html: # description t1529html.write("{}Adversaries may shutdown/reboot systems to interrupt access to, or aid in the destruction of, those systems. Operating systems may contain commands to initiate a shutdown/reboot of a machine.<br>".format(header)) t1529html.write("In some cases, these commands may also be used to initiate a shutdown/reboot of a remote computer. Shutting down or rebooting systems may disrupt access to computer resources for legitimate users.<br>") t1529html.write("Adversaries may attempt to shutdown/reboot a system after impacting it in other ways, such as Disk Structure Wipe or Inhibit System Recovery, to hasten the intended effects on system availability.") # information t1529html.write("{}T1529</td>\n <td>".format(headings)) # id t1529html.write("Windows, macOS, Linux</td>\n <td>") # platforms t1529html.write("Impact</td>\n <td>") # tactics t1529html.write("-") # indicator regex assignments t1529html.write("{}Event IDs: 1074, 6006</li>\n <li>".format(iocs)) t1529html.write("shutdown</li>\n <li>") t1529html.write("halt</li>") # related techniques t1529html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1561 target=\"_blank\"\">T1561</a></td>\n <td>".format(related)) t1529html.write("Disk Structure Wipe") t1529html.write("{}<a href=\"http://127.0.0.1:8000/en-US/app/elrond/t1490 target=\"_blank\"\">T1490</a></td>\n <td>".format(insert)) t1529html.write("Inhibit System Recovery") # mitigations t1529html.write("{}-</td>\n <td>".format(mitigations)) t1529html.write("This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.{}".format(footer))
104.250335
1,654
0.694703
61,007
467,250
5.31657
0.064796
0.01096
0.01819
0.019942
0.425247
0.33416
0.267891
0.23177
0.200717
0.185017
0
0.059118
0.194035
467,250
4,481
1,655
104.2736
0.80216
0.043666
0
0.020419
0
0.239514
0.67913
0.021663
0
0
0
0
0
1
0.000276
false
0.030905
0.001104
0
0.00138
0.000828
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8d4d8173100125a724b5565bfb100d5b977cf3fb
108
py
Python
my_web_scraper_app/apps.py
MisterLenivec/leniva_list
fc416f1afe9886b60bf46c9152fa5eb095def5df
[ "MIT" ]
null
null
null
my_web_scraper_app/apps.py
MisterLenivec/leniva_list
fc416f1afe9886b60bf46c9152fa5eb095def5df
[ "MIT" ]
2
2020-06-07T01:38:32.000Z
2021-06-04T22:27:50.000Z
my_web_scraper_app/apps.py
MisterLenivec/leniva_list
fc416f1afe9886b60bf46c9152fa5eb095def5df
[ "MIT" ]
null
null
null
from django.apps import AppConfig class MyWebScraperAppConfig(AppConfig): name = 'my_web_scraper_app'
18
39
0.796296
13
108
6.384615
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.138889
108
5
40
21.6
0.892473
0
0
0
0
0
0.166667
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
8d70a0f7db0ac4752ba0c1b4076eda693e7ba165
820
py
Python
william/cluster.py
hzhjhh/OZ_PYTHON
0a973ec27c40ebe6d6eff05c4ce600304127a898
[ "MIT" ]
null
null
null
william/cluster.py
hzhjhh/OZ_PYTHON
0a973ec27c40ebe6d6eff05c4ce600304127a898
[ "MIT" ]
null
null
null
william/cluster.py
hzhjhh/OZ_PYTHON
0a973ec27c40ebe6d6eff05c4ce600304127a898
[ "MIT" ]
null
null
null
import rediscluster if __name__ == '__main__': try: startup_nodes = [ {"host": "192.168.23.47", "port": 7000}, {"host": "192.168.23.47", "port": 7001}, {"host": "192.168.23.47", "port": 7002}, {"host": "192.168.23.47", "port": 7003}, {"host": "192.168.23.47", "port": 7004}, {"host": "192.168.23.47", "port": 7005}, {"host": "192.168.23.47", "port": 7006}, {"host": "192.168.23.47", "port": 7007}, {"host": "192.168.23.47", "port": 7008}, ] conn = rediscluster.StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True) ret = conn.hset("name", "for", "test") print(ret) print(conn.hget("name", "for")) except Exception as e: print(e)
35.652174
98
0.492683
100
820
3.92
0.38
0.160714
0.229592
0.27551
0.413265
0.413265
0
0
0
0
0
0.216495
0.290244
820
22
99
37.272727
0.457045
0
0
0
0
0
0.262195
0
0
0
0
0
0
1
0
false
0
0.05
0
0.05
0.15
0
0
0
null
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a5d65fd89dcc3a32c0b5ae2ca30f97611fe202fd
154
py
Python
Tests/Runnable2/r_getattr3_t.py
jwilk/Pyrex
83dfbae1261788933472e3f9c501ad74c61a37c5
[ "Apache-2.0" ]
5
2019-05-26T20:48:36.000Z
2021-07-09T01:38:38.000Z
Tests/Runnable2/r_getattr3_t.py
jwilk/Pyrex
83dfbae1261788933472e3f9c501ad74c61a37c5
[ "Apache-2.0" ]
null
null
null
Tests/Runnable2/r_getattr3_t.py
jwilk/Pyrex
83dfbae1261788933472e3f9c501ad74c61a37c5
[ "Apache-2.0" ]
1
2022-02-10T07:14:58.000Z
2022-02-10T07:14:58.000Z
from r_getattr3 import test class Fred: pass fred = Fred() fred.mary = "Spam" print test(fred, "mary", "Tomato") print test(fred, "george", "Tomato")
14
36
0.681818
23
154
4.521739
0.565217
0.153846
0.25
0
0
0
0
0
0
0
0
0.007752
0.162338
154
10
37
15.4
0.79845
0
0
0
0
0
0.168831
0
0
0
0
0
0
0
null
null
0.142857
0.142857
null
null
0.285714
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
4
a5e643118ed513e280126881027bcf8f040420d4
177,668
py
Python
10_Delay_Discounting_Task/delay_discounting_task_lastrun.py
Brinks0211/cognitive_paradigms_patients
30e3f8268e5c2b5ebfffcc4ebbcb46d8e60d039e
[ "MIT" ]
2
2020-07-01T12:53:40.000Z
2020-07-01T13:30:23.000Z
10_Delay_Discounting_Task/delay_discounting_task_lastrun.py
Brinks0211/cognitive_paradigms_patients
30e3f8268e5c2b5ebfffcc4ebbcb46d8e60d039e
[ "MIT" ]
null
null
null
10_Delay_Discounting_Task/delay_discounting_task_lastrun.py
Brinks0211/cognitive_paradigms_patients
30e3f8268e5c2b5ebfffcc4ebbcb46d8e60d039e
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This experiment was created using PsychoPy3 Experiment Builder (v2020.1.3), on 六月 16, 2020, at 20:53 If you publish work using this script the most relevant publication is: Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019) PsychoPy2: Experiments in behavior made easy Behav Res 51: 195. https://doi.org/10.3758/s13428-018-01193-y """ from __future__ import absolute_import, division from psychopy import locale_setup from psychopy import prefs from psychopy import sound, gui, visual, core, data, event, logging, clock from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED, STOPPED, FINISHED, PRESSED, RELEASED, FOREVER) import numpy as np # whole numpy lib is available, prepend 'np.' from numpy import (sin, cos, tan, log, log10, pi, average, sqrt, std, deg2rad, rad2deg, linspace, asarray) from numpy.random import random, randint, normal, shuffle import os # handy system and path functions import sys # to get file system encoding from psychopy.hardware import keyboard # Ensure that relative paths start from the same directory as this script _thisDir = os.path.dirname(os.path.abspath(__file__)) os.chdir(_thisDir) # Store info about the experiment session psychopyVersion = '2020.1.3' expName = 'Delay_Discounting_Task' # from the Builder filename that created this script expInfo = {'participant': '', '姓名拼音': '', '男1/女2': '', '入院1/出院2': ''} dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName) if dlg.OK == False: core.quit() # user pressed cancel expInfo['date'] = data.getDateStr() # add a simple timestamp expInfo['expName'] = expName expInfo['psychopyVersion'] = psychopyVersion # Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date']) # An ExperimentHandler isn't essential but helps with data saving thisExp = data.ExperimentHandler(name=expName, version='', extraInfo=expInfo, runtimeInfo=None, originPath='C:\\Users\\zhang\\Desktop\\张以昊\\课题组\\10_Delay_Discounting_Task\\delay_discounting_task_lastrun.py', savePickle=True, saveWideText=True, dataFileName=filename) # save a log file for detail verbose info logFile = logging.LogFile(filename+'.log', level=logging.EXP) logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file endExpNow = False # flag for 'escape' or other condition => quit the exp frameTolerance = 0.001 # how close to onset before 'same' frame # Start Code - component code to be run before the window creation # Setup the Window win = visual.Window( size=[1536, 864], fullscr=False, screen=0, winType='pyglet', allowGUI=True, allowStencil=False, monitor='testMonitor', color=[0,0,0], colorSpace='rgb', blendMode='avg', useFBO=True, units='height') # store frame rate of monitor if we can measure it expInfo['frameRate'] = win.getActualFrameRate() if expInfo['frameRate'] != None: frameDur = 1.0 / round(expInfo['frameRate']) else: frameDur = 1.0 / 60.0 # could not measure, so guess # create a default keyboard (e.g. to check for escape) defaultKeyboard = keyboard.Keyboard() # Initialize components for Routine "instruction1" instruction1Clock = core.Clock() text0_1 = visual.TextStim(win=win, name='text0_1', text='欢迎参加测试\n\n答案没有对错之分,希望你能仔细考虑,认真回答。\n\n(继续,请按空格键)\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp0_1 = keyboard.Keyboard() # Initialize components for Routine "instruction2" instruction2Clock = core.Clock() text0_2 = visual.TextStim(win=win, name='text0_2', text='测试开始时,首先在屏幕中间会出现注视点“+“\n\n接着将成对出现两种大小不同\n并且给予时间不同的虚拟金币\n\n左边是立即可以得到的虚拟金币\n右边是需要等待一段时间才能得到的虚拟金币\n\n等待时间分一周、两周、一个月、\n六个月、一年、五年、二十五年\n\n(继续,请按空格键)', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp0_2 = keyboard.Keyboard() # Initialize components for Routine "instruction3" instruction3Clock = core.Clock() text0_3 = visual.TextStim(win=win, name='text0_3', text='如果选择左侧的虚拟金币,请按键盘的左键,\n如果选择右侧的虚拟金币,请按键盘的右键。\n\n(继续,请按空格键)', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp0_3 = keyboard.Keyboard() # Initialize components for Routine "instruction4" instruction4Clock = core.Clock() text0_4 = visual.TextStim(win=win, name='text0_4', text='在您做出选择之后,程序会反馈您的选择。\n测试结束后,这些虚拟金币最终会换成小礼物。\n\n\n(继续,请按空格键)', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp_0_4 = keyboard.Keyboard() # Initialize components for Routine "instruction5" instruction5Clock = core.Clock() text0_5 = visual.TextStim(win=win, name='text0_5', text='如果准备好了,请进入正式测试\n\n(继续,请按空格键)', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp0_5 = keyboard.Keyboard() # Initialize components for Routine "tip1" tip1Clock = core.Clock() tip_1 = visual.TextStim(win=win, name='tip_1', text='(第一阶段)\n\n即时选择的奖赏\n对比\n 的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_3 = visual.TextStim(win=win, name='text_3', text='延迟一周', font='Arial', pos=(-0.075, -0.085), height=0.05, wrapWidth=None, ori=0, color='red', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); # Initialize components for Routine "choice_week_2" choice_week_2Clock = core.Clock() concentration1 = visual.TextStim(win=win, name='concentration1', text='+', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_1_1 = visual.TextStim(win=win, name='text_1_1', text='即时选择的奖赏 延迟一周的奖赏\n', font='Arial', pos=(0,0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); text_1_2 = visual.TextStim(win=win, name='text_1_2', text='default text', font='Arial', pos=(-0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); text_1_3 = visual.TextStim(win=win, name='text_1_3', text='1000', font='Arial', pos=(0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); key_resp_1week = keyboard.Keyboard() x1=500 n1=4 z1=500 y=0 # Initialize components for Routine "feed_back1" feed_back1Clock = core.Clock() feedback1_1 = visual.TextStim(win=win, name='feedback1_1', text='default text', font='Arial', pos=(-0.1, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); feedback1_2 = visual.TextStim(win=win, name='feedback1_2', text='您的选择是', font='Arial', pos=(0, 0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); feedback1_3 = visual.TextStim(win=win, name='feedback1_3', text='default text', font='Arial', pos=(0.2, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); # Initialize components for Routine "tip2" tip2Clock = core.Clock() tip_2 = visual.TextStim(win=win, name='tip_2', text='(第二阶段)\n\n即时选择的奖赏\n对比\n 的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_4 = visual.TextStim(win=win, name='text_4', text='延迟两周', font='Arial', pos=(-0.075, -0.085), height=0.05, wrapWidth=None, ori=0, color='green', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); # Initialize components for Routine "choice_2weeks" choice_2weeksClock = core.Clock() concentration6 = visual.TextStim(win=win, name='concentration6', text='+', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text6_1 = visual.TextStim(win=win, name='text6_1', text='即时选择的奖赏 延迟两周的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); text6_2 = visual.TextStim(win=win, name='text6_2', text='default text', font='Arial', pos=(-0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); text6_3 = visual.TextStim(win=win, name='text6_3', text='1000', font='Arial', pos=(0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); key_resp_2weeks = keyboard.Keyboard() x6=500 n6=4 z5=500 # Initialize components for Routine "feed_back5" feed_back5Clock = core.Clock() feedback5_1 = visual.TextStim(win=win, name='feedback5_1', text='default text', font='Arial', pos=(-0.1, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); feedback5_2 = visual.TextStim(win=win, name='feedback5_2', text='您的选择是', font='Arial', pos=(0, 0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); feedback5_3 = visual.TextStim(win=win, name='feedback5_3', text='default text', font='Arial', pos=(0.2, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); # Initialize components for Routine "tip3" tip3Clock = core.Clock() tip_3 = visual.TextStim(win=win, name='tip_3', text='(第三阶段)\n\n即时选择的奖赏\n对比\n 的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_5 = visual.TextStim(win=win, name='text_5', text='延迟一个月', font='Arial', pos=(-0.1, -0.085), height=0.05, wrapWidth=None, ori=0, color='red', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); # Initialize components for Routine "choice_month" choice_monthClock = core.Clock() concentration3 = visual.TextStim(win=win, name='concentration3', text='+\n', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text3_1 = visual.TextStim(win=win, name='text3_1', text='即时选择的奖赏 延迟一月的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); text3_2 = visual.TextStim(win=win, name='text3_2', text='default text', font='Arial', pos=(-0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); text3_3 = visual.TextStim(win=win, name='text3_3', text='1000', font='Arial', pos=(0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); key_resp_1month = keyboard.Keyboard() x3=500 n3=4 z2=500 # Initialize components for Routine "feed_back2" feed_back2Clock = core.Clock() feedback2_1 = visual.TextStim(win=win, name='feedback2_1', text='default text', font='Arial', pos=(-0.1, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); feedback2_2 = visual.TextStim(win=win, name='feedback2_2', text='您的选择是', font='Arial', pos=(0, 0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); feedback2_3 = visual.TextStim(win=win, name='feedback2_3', text='default text', font='Arial', pos=(0.2, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); # Initialize components for Routine "tip4" tip4Clock = core.Clock() tip_4 = visual.TextStim(win=win, name='tip_4', text='(第四阶段)\n\n即时选择的奖赏\n对比\n 的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_6 = visual.TextStim(win=win, name='text_6', text='延迟六个月', font='Arial', pos=(-0.1, -0.085), height=0.05, wrapWidth=None, ori=0, color='green', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); # Initialize components for Routine "choice_months" choice_monthsClock = core.Clock() concentration4 = visual.TextStim(win=win, name='concentration4', text='+\n', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text4_1 = visual.TextStim(win=win, name='text4_1', text='即时选择的奖赏 延迟六个月的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); text4_2 = visual.TextStim(win=win, name='text4_2', text='default text', font='Arial', pos=(-0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); text4_3 = visual.TextStim(win=win, name='text4_3', text='1000\n', font='Arial', pos=(0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); key_resp_6months = keyboard.Keyboard() x4=500 n4=4 z3=500 # Initialize components for Routine "feed_back3" feed_back3Clock = core.Clock() feedback3_1 = visual.TextStim(win=win, name='feedback3_1', text='default text', font='Arial', pos=(-0.1, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); feedback3_2 = visual.TextStim(win=win, name='feedback3_2', text='您的选择是', font='Arial', pos=(0, 0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); feedback3_3 = visual.TextStim(win=win, name='feedback3_3', text='default text', font='Arial', pos=(0.2, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); # Initialize components for Routine "tip5" tip5Clock = core.Clock() tip_5 = visual.TextStim(win=win, name='tip_5', text='(第五阶段)\n\n即时选择的奖赏\n对比\n 的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_7 = visual.TextStim(win=win, name='text_7', text='延迟一年', font='Arial', pos=(-0.075, -0.085), height=0.05, wrapWidth=None, ori=0, color='red', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); # Initialize components for Routine "choice_year" choice_yearClock = core.Clock() concentration5 = visual.TextStim(win=win, name='concentration5', text='+', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text5_1 = visual.TextStim(win=win, name='text5_1', text='即时选择的奖赏 延迟一年的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); text5_2 = visual.TextStim(win=win, name='text5_2', text='default text', font='Arial', pos=(-0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); text5_3 = visual.TextStim(win=win, name='text5_3', text='1000', font='Arial', pos=(0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); key_resp_1year = keyboard.Keyboard() x5=500 n5=4 z4=500 # Initialize components for Routine "feed_back4" feed_back4Clock = core.Clock() feedback4_1 = visual.TextStim(win=win, name='feedback4_1', text='default text', font='Arial', pos=(-0.1, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); feedback4_2 = visual.TextStim(win=win, name='feedback4_2', text='您的选择是', font='Arial', pos=(0, 0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); feedback4_3 = visual.TextStim(win=win, name='feedback4_3', text='default text', font='Arial', pos=(0.2, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); # Initialize components for Routine "tip6" tip6Clock = core.Clock() text = visual.TextStim(win=win, name='text', text='(第六阶段)\n\n即时选择的奖赏\n对比\n 的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_8 = visual.TextStim(win=win, name='text_8', text='延迟五年', font='Arial', pos=(-0.075, -0.085), height=0.05, wrapWidth=None, ori=0, color='red', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); # Initialize components for Routine "choice_5years_2" choice_5years_2Clock = core.Clock() concentration8 = visual.TextStim(win=win, name='concentration8', text='+', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text8_1 = visual.TextStim(win=win, name='text8_1', text='即时选择的奖赏 延迟五年的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); text8_2 = visual.TextStim(win=win, name='text8_2', text='default text', font='Arial', pos=(-0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); text8_3 = visual.TextStim(win=win, name='text8_3', text='1000', font='Arial', pos=(0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); key_resp5years = keyboard.Keyboard() x8=500 n8=4 z6=500 # Initialize components for Routine "feed_back6" feed_back6Clock = core.Clock() feedback6_1 = visual.TextStim(win=win, name='feedback6_1', text='default text', font='Arial', pos=(-0.1, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); feedback6_2 = visual.TextStim(win=win, name='feedback6_2', text='您的选择是', font='Arial', pos=(0, 0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); feedback6_3 = visual.TextStim(win=win, name='feedback6_3', text='default text', font='Arial', pos=(0.2, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); # Initialize components for Routine "tip7" tip7Clock = core.Clock() tip_7 = visual.TextStim(win=win, name='tip_7', text='(第七阶段)\n\n即时选择的奖赏\n对比\n 的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_9 = visual.TextStim(win=win, name='text_9', text='延迟二十五年', font='Arial', pos=(-0.13, -0.085), height=0.05, wrapWidth=None, ori=0, color='red', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); # Initialize components for Routine "choice_25years" choice_25yearsClock = core.Clock() concentration9 = visual.TextStim(win=win, name='concentration9', text='+', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text9_1 = visual.TextStim(win=win, name='text9_1', text='即时选择的奖赏 延迟二十五年的奖赏\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); text9_2 = visual.TextStim(win=win, name='text9_2', text='default text', font='Arial', pos=(-0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); text9_3 = visual.TextStim(win=win, name='text9_3', text='default text', font='Arial', pos=(0.2, -0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); key_resp25years = keyboard.Keyboard() x9=500 n9=4 z7=500 # Initialize components for Routine "feedback7" feedback7Clock = core.Clock() feedback7_1 = visual.TextStim(win=win, name='feedback7_1', text='default text', font='Arial', pos=(-0.1, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); feedback7_2 = visual.TextStim(win=win, name='feedback7_2', text='您的选择是', font='Arial', pos=(0, 0.1), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); feedback7_3 = visual.TextStim(win=win, name='feedback7_3', text='default text', font='Arial', pos=(0.2, 0), height=0.05, wrapWidth=None, ori=0, color='blue', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); # Initialize components for Routine "thanks" thanksClock = core.Clock() text_2 = visual.TextStim(win=win, name='text_2', text='测试结束,谢谢您的参与', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); # Create some handy timers globalClock = core.Clock() # to track the time since experiment started routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine # ------Prepare to start Routine "instruction1"------- continueRoutine = True # update component parameters for each repeat key_resp0_1.keys = [] key_resp0_1.rt = [] _key_resp0_1_allKeys = [] # keep track of which components have finished instruction1Components = [text0_1, key_resp0_1] for thisComponent in instruction1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") instruction1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "instruction1"------- while continueRoutine: # get current time t = instruction1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=instruction1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text0_1* updates if text0_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text0_1.frameNStart = frameN # exact frame index text0_1.tStart = t # local t and not account for scr refresh text0_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text0_1, 'tStartRefresh') # time at next scr refresh text0_1.setAutoDraw(True) # *key_resp0_1* updates waitOnFlip = False if key_resp0_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp0_1.frameNStart = frameN # exact frame index key_resp0_1.tStart = t # local t and not account for scr refresh key_resp0_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp0_1, 'tStartRefresh') # time at next scr refresh key_resp0_1.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp0_1.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp0_1.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp0_1.status == STARTED and not waitOnFlip: theseKeys = key_resp0_1.getKeys(keyList=['space'], waitRelease=False) _key_resp0_1_allKeys.extend(theseKeys) if len(_key_resp0_1_allKeys): key_resp0_1.keys = _key_resp0_1_allKeys[-1].name # just the last key pressed key_resp0_1.rt = _key_resp0_1_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in instruction1Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "instruction1"------- for thisComponent in instruction1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text0_1.started', text0_1.tStartRefresh) thisExp.addData('text0_1.stopped', text0_1.tStopRefresh) # the Routine "instruction1" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "instruction2"------- continueRoutine = True # update component parameters for each repeat key_resp0_2.keys = [] key_resp0_2.rt = [] _key_resp0_2_allKeys = [] # keep track of which components have finished instruction2Components = [text0_2, key_resp0_2] for thisComponent in instruction2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") instruction2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "instruction2"------- while continueRoutine: # get current time t = instruction2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=instruction2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text0_2* updates if text0_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text0_2.frameNStart = frameN # exact frame index text0_2.tStart = t # local t and not account for scr refresh text0_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text0_2, 'tStartRefresh') # time at next scr refresh text0_2.setAutoDraw(True) # *key_resp0_2* updates waitOnFlip = False if key_resp0_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp0_2.frameNStart = frameN # exact frame index key_resp0_2.tStart = t # local t and not account for scr refresh key_resp0_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp0_2, 'tStartRefresh') # time at next scr refresh key_resp0_2.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp0_2.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp0_2.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp0_2.status == STARTED and not waitOnFlip: theseKeys = key_resp0_2.getKeys(keyList=['space'], waitRelease=False) _key_resp0_2_allKeys.extend(theseKeys) if len(_key_resp0_2_allKeys): key_resp0_2.keys = _key_resp0_2_allKeys[-1].name # just the last key pressed key_resp0_2.rt = _key_resp0_2_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in instruction2Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "instruction2"------- for thisComponent in instruction2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text0_2.started', text0_2.tStartRefresh) thisExp.addData('text0_2.stopped', text0_2.tStopRefresh) # the Routine "instruction2" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "instruction3"------- continueRoutine = True # update component parameters for each repeat key_resp0_3.keys = [] key_resp0_3.rt = [] _key_resp0_3_allKeys = [] # keep track of which components have finished instruction3Components = [text0_3, key_resp0_3] for thisComponent in instruction3Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") instruction3Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "instruction3"------- while continueRoutine: # get current time t = instruction3Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=instruction3Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text0_3* updates if text0_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text0_3.frameNStart = frameN # exact frame index text0_3.tStart = t # local t and not account for scr refresh text0_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text0_3, 'tStartRefresh') # time at next scr refresh text0_3.setAutoDraw(True) # *key_resp0_3* updates waitOnFlip = False if key_resp0_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp0_3.frameNStart = frameN # exact frame index key_resp0_3.tStart = t # local t and not account for scr refresh key_resp0_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp0_3, 'tStartRefresh') # time at next scr refresh key_resp0_3.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp0_3.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp0_3.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp0_3.status == STARTED and not waitOnFlip: theseKeys = key_resp0_3.getKeys(keyList=['space'], waitRelease=False) _key_resp0_3_allKeys.extend(theseKeys) if len(_key_resp0_3_allKeys): key_resp0_3.keys = _key_resp0_3_allKeys[-1].name # just the last key pressed key_resp0_3.rt = _key_resp0_3_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in instruction3Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "instruction3"------- for thisComponent in instruction3Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text0_3.started', text0_3.tStartRefresh) thisExp.addData('text0_3.stopped', text0_3.tStopRefresh) # check responses if key_resp0_3.keys in ['', [], None]: # No response was made key_resp0_3.keys = None thisExp.addData('key_resp0_3.keys',key_resp0_3.keys) if key_resp0_3.keys != None: # we had a response thisExp.addData('key_resp0_3.rt', key_resp0_3.rt) thisExp.addData('key_resp0_3.started', key_resp0_3.tStartRefresh) thisExp.addData('key_resp0_3.stopped', key_resp0_3.tStopRefresh) thisExp.nextEntry() # the Routine "instruction3" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "instruction4"------- continueRoutine = True # update component parameters for each repeat key_resp_0_4.keys = [] key_resp_0_4.rt = [] _key_resp_0_4_allKeys = [] # keep track of which components have finished instruction4Components = [text0_4, key_resp_0_4] for thisComponent in instruction4Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") instruction4Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "instruction4"------- while continueRoutine: # get current time t = instruction4Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=instruction4Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text0_4* updates if text0_4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text0_4.frameNStart = frameN # exact frame index text0_4.tStart = t # local t and not account for scr refresh text0_4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text0_4, 'tStartRefresh') # time at next scr refresh text0_4.setAutoDraw(True) # *key_resp_0_4* updates waitOnFlip = False if key_resp_0_4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_0_4.frameNStart = frameN # exact frame index key_resp_0_4.tStart = t # local t and not account for scr refresh key_resp_0_4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_0_4, 'tStartRefresh') # time at next scr refresh key_resp_0_4.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_0_4.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_0_4.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_0_4.status == STARTED and not waitOnFlip: theseKeys = key_resp_0_4.getKeys(keyList=['space'], waitRelease=False) _key_resp_0_4_allKeys.extend(theseKeys) if len(_key_resp_0_4_allKeys): key_resp_0_4.keys = _key_resp_0_4_allKeys[-1].name # just the last key pressed key_resp_0_4.rt = _key_resp_0_4_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in instruction4Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "instruction4"------- for thisComponent in instruction4Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text0_4.started', text0_4.tStartRefresh) thisExp.addData('text0_4.stopped', text0_4.tStopRefresh) # the Routine "instruction4" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "instruction5"------- continueRoutine = True # update component parameters for each repeat key_resp0_5.keys = [] key_resp0_5.rt = [] _key_resp0_5_allKeys = [] # keep track of which components have finished instruction5Components = [text0_5, key_resp0_5] for thisComponent in instruction5Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") instruction5Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "instruction5"------- while continueRoutine: # get current time t = instruction5Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=instruction5Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text0_5* updates if text0_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text0_5.frameNStart = frameN # exact frame index text0_5.tStart = t # local t and not account for scr refresh text0_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text0_5, 'tStartRefresh') # time at next scr refresh text0_5.setAutoDraw(True) # *key_resp0_5* updates waitOnFlip = False if key_resp0_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp0_5.frameNStart = frameN # exact frame index key_resp0_5.tStart = t # local t and not account for scr refresh key_resp0_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp0_5, 'tStartRefresh') # time at next scr refresh key_resp0_5.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp0_5.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp0_5.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp0_5.status == STARTED and not waitOnFlip: theseKeys = key_resp0_5.getKeys(keyList=['space'], waitRelease=False) _key_resp0_5_allKeys.extend(theseKeys) if len(_key_resp0_5_allKeys): key_resp0_5.keys = _key_resp0_5_allKeys[-1].name # just the last key pressed key_resp0_5.rt = _key_resp0_5_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in instruction5Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "instruction5"------- for thisComponent in instruction5Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text0_5.started', text0_5.tStartRefresh) thisExp.addData('text0_5.stopped', text0_5.tStopRefresh) # the Routine "instruction5" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "tip1"------- continueRoutine = True routineTimer.add(3.000000) # update component parameters for each repeat # keep track of which components have finished tip1Components = [tip_1, text_3] for thisComponent in tip1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip1"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = tip1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *tip_1* updates if tip_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later tip_1.frameNStart = frameN # exact frame index tip_1.tStart = t # local t and not account for scr refresh tip_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(tip_1, 'tStartRefresh') # time at next scr refresh tip_1.setAutoDraw(True) if tip_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > tip_1.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later tip_1.tStop = t # not accounting for scr refresh tip_1.frameNStop = frameN # exact frame index win.timeOnFlip(tip_1, 'tStopRefresh') # time at next scr refresh tip_1.setAutoDraw(False) # *text_3* updates if text_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_3.frameNStart = frameN # exact frame index text_3.tStart = t # local t and not account for scr refresh text_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_3, 'tStartRefresh') # time at next scr refresh text_3.setAutoDraw(True) if text_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_3.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later text_3.tStop = t # not accounting for scr refresh text_3.frameNStop = frameN # exact frame index win.timeOnFlip(text_3, 'tStopRefresh') # time at next scr refresh text_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip1Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip1"------- for thisComponent in tip1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('tip_1.started', tip_1.tStartRefresh) thisExp.addData('tip_1.stopped', tip_1.tStopRefresh) thisExp.addData('text_3.started', text_3.tStartRefresh) thisExp.addData('text_3.stopped', text_3.tStopRefresh) # set up handler to look after randomisation of conditions etc loop1 = data.TrialHandler(nReps=7, method='random', extraInfo=expInfo, originPath=-1, trialList=[None], seed=None, name='loop1') thisExp.addLoop(loop1) # add the loop to the experiment thisLoop1 = loop1.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop1.rgb) if thisLoop1 != None: for paramName in thisLoop1: exec('{} = thisLoop1[paramName]'.format(paramName)) for thisLoop1 in loop1: currentLoop = loop1 # abbreviate parameter names if possible (e.g. rgb = thisLoop1.rgb) if thisLoop1 != None: for paramName in thisLoop1: exec('{} = thisLoop1[paramName]'.format(paramName)) # ------Prepare to start Routine "choice_week_2"------- continueRoutine = True # update component parameters for each repeat text_1_2.setText(x1 ) key_resp_1week.keys = [] key_resp_1week.rt = [] _key_resp_1week_allKeys = [] # keep track of which components have finished choice_week_2Components = [concentration1, text_1_1, text_1_2, text_1_3, key_resp_1week] for thisComponent in choice_week_2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") choice_week_2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "choice_week_2"------- while continueRoutine: # get current time t = choice_week_2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=choice_week_2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration1* updates if concentration1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration1.frameNStart = frameN # exact frame index concentration1.tStart = t # local t and not account for scr refresh concentration1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration1, 'tStartRefresh') # time at next scr refresh concentration1.setAutoDraw(True) if concentration1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration1.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration1.tStop = t # not accounting for scr refresh concentration1.frameNStop = frameN # exact frame index win.timeOnFlip(concentration1, 'tStopRefresh') # time at next scr refresh concentration1.setAutoDraw(False) # *text_1_1* updates if text_1_1.status == NOT_STARTED and tThisFlip >= 1.0-frameTolerance: # keep track of start time/frame for later text_1_1.frameNStart = frameN # exact frame index text_1_1.tStart = t # local t and not account for scr refresh text_1_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_1_1, 'tStartRefresh') # time at next scr refresh text_1_1.setAutoDraw(True) # *text_1_2* updates if text_1_2.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text_1_2.frameNStart = frameN # exact frame index text_1_2.tStart = t # local t and not account for scr refresh text_1_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_1_2, 'tStartRefresh') # time at next scr refresh text_1_2.setAutoDraw(True) # *text_1_3* updates if text_1_3.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text_1_3.frameNStart = frameN # exact frame index text_1_3.tStart = t # local t and not account for scr refresh text_1_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_1_3, 'tStartRefresh') # time at next scr refresh text_1_3.setAutoDraw(True) # *key_resp_1week* updates waitOnFlip = False if key_resp_1week.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp_1week.frameNStart = frameN # exact frame index key_resp_1week.tStart = t # local t and not account for scr refresh key_resp_1week.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_1week, 'tStartRefresh') # time at next scr refresh key_resp_1week.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_1week.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_1week.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_1week.status == STARTED and not waitOnFlip: theseKeys = key_resp_1week.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp_1week_allKeys.extend(theseKeys) if len(_key_resp_1week_allKeys): key_resp_1week.keys = _key_resp_1week_allKeys[-1].name # just the last key pressed key_resp_1week.rt = _key_resp_1week_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in choice_week_2Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "choice_week_2"------- for thisComponent in choice_week_2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop1.addData('concentration1.started', concentration1.tStartRefresh) loop1.addData('concentration1.stopped', concentration1.tStopRefresh) loop1.addData('text_1_1.started', text_1_1.tStartRefresh) loop1.addData('text_1_1.stopped', text_1_1.tStopRefresh) loop1.addData('text_1_2.started', text_1_2.tStartRefresh) loop1.addData('text_1_2.stopped', text_1_2.tStopRefresh) loop1.addData('text_1_3.started', text_1_3.tStartRefresh) loop1.addData('text_1_3.stopped', text_1_3.tStopRefresh) # check responses if key_resp_1week.keys in ['', [], None]: # No response was made key_resp_1week.keys = None loop1.addData('key_resp_1week.keys',key_resp_1week.keys) if key_resp_1week.keys != None: # we had a response loop1.addData('key_resp_1week.rt', key_resp_1week.rt) loop1.addData('key_resp_1week.started', key_resp_1week.tStartRefresh) loop1.addData('key_resp_1week.stopped', key_resp_1week.tStopRefresh) if "left"in key_resp_1week.keys: z1=x1 x1-=1000/n1 n1*=2 y="即时奖励:" if 'right' in key_resp_1week.keys: x1+=1000/n1 n1*=2 z1=1000 y="一周后的奖励:" # the Routine "choice_week_2" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "feed_back1"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat feedback1_1.setText(y) feedback1_3.setText(z1) # keep track of which components have finished feed_back1Components = [feedback1_1, feedback1_2, feedback1_3] for thisComponent in feed_back1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feed_back1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feed_back1"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feed_back1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feed_back1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback1_1* updates if feedback1_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback1_1.frameNStart = frameN # exact frame index feedback1_1.tStart = t # local t and not account for scr refresh feedback1_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback1_1, 'tStartRefresh') # time at next scr refresh feedback1_1.setAutoDraw(True) if feedback1_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback1_1.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback1_1.tStop = t # not accounting for scr refresh feedback1_1.frameNStop = frameN # exact frame index win.timeOnFlip(feedback1_1, 'tStopRefresh') # time at next scr refresh feedback1_1.setAutoDraw(False) # *feedback1_2* updates if feedback1_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback1_2.frameNStart = frameN # exact frame index feedback1_2.tStart = t # local t and not account for scr refresh feedback1_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback1_2, 'tStartRefresh') # time at next scr refresh feedback1_2.setAutoDraw(True) if feedback1_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback1_2.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback1_2.tStop = t # not accounting for scr refresh feedback1_2.frameNStop = frameN # exact frame index win.timeOnFlip(feedback1_2, 'tStopRefresh') # time at next scr refresh feedback1_2.setAutoDraw(False) # *feedback1_3* updates if feedback1_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback1_3.frameNStart = frameN # exact frame index feedback1_3.tStart = t # local t and not account for scr refresh feedback1_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback1_3, 'tStartRefresh') # time at next scr refresh feedback1_3.setAutoDraw(True) if feedback1_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback1_3.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback1_3.tStop = t # not accounting for scr refresh feedback1_3.frameNStop = frameN # exact frame index win.timeOnFlip(feedback1_3, 'tStopRefresh') # time at next scr refresh feedback1_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feed_back1Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feed_back1"------- for thisComponent in feed_back1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop1.addData('feedback1_1.started', feedback1_1.tStartRefresh) loop1.addData('feedback1_1.stopped', feedback1_1.tStopRefresh) loop1.addData('feedback1_2.started', feedback1_2.tStartRefresh) loop1.addData('feedback1_2.stopped', feedback1_2.tStopRefresh) loop1.addData('feedback1_3.started', feedback1_3.tStartRefresh) loop1.addData('feedback1_3.stopped', feedback1_3.tStopRefresh) thisExp.nextEntry() # completed 7 repeats of 'loop1' # ------Prepare to start Routine "tip2"------- continueRoutine = True routineTimer.add(3.000000) # update component parameters for each repeat # keep track of which components have finished tip2Components = [tip_2, text_4] for thisComponent in tip2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip2"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = tip2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *tip_2* updates if tip_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later tip_2.frameNStart = frameN # exact frame index tip_2.tStart = t # local t and not account for scr refresh tip_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(tip_2, 'tStartRefresh') # time at next scr refresh tip_2.setAutoDraw(True) if tip_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > tip_2.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later tip_2.tStop = t # not accounting for scr refresh tip_2.frameNStop = frameN # exact frame index win.timeOnFlip(tip_2, 'tStopRefresh') # time at next scr refresh tip_2.setAutoDraw(False) # *text_4* updates if text_4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_4.frameNStart = frameN # exact frame index text_4.tStart = t # local t and not account for scr refresh text_4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_4, 'tStartRefresh') # time at next scr refresh text_4.setAutoDraw(True) if text_4.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_4.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later text_4.tStop = t # not accounting for scr refresh text_4.frameNStop = frameN # exact frame index win.timeOnFlip(text_4, 'tStopRefresh') # time at next scr refresh text_4.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip2Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip2"------- for thisComponent in tip2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('tip_2.started', tip_2.tStartRefresh) thisExp.addData('tip_2.stopped', tip_2.tStopRefresh) thisExp.addData('text_4.started', text_4.tStartRefresh) thisExp.addData('text_4.stopped', text_4.tStopRefresh) # set up handler to look after randomisation of conditions etc trials = data.TrialHandler(nReps=5, method='random', extraInfo=expInfo, originPath=-1, trialList=[None], seed=None, name='trials') thisExp.addLoop(trials) # add the loop to the experiment thisTrial = trials.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb) if thisTrial != None: for paramName in thisTrial: exec('{} = thisTrial[paramName]'.format(paramName)) for thisTrial in trials: currentLoop = trials # abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb) if thisTrial != None: for paramName in thisTrial: exec('{} = thisTrial[paramName]'.format(paramName)) # ------Prepare to start Routine "choice_2weeks"------- continueRoutine = True # update component parameters for each repeat text6_2.setText(x6 ) key_resp_2weeks.keys = [] key_resp_2weeks.rt = [] _key_resp_2weeks_allKeys = [] # keep track of which components have finished choice_2weeksComponents = [concentration6, text6_1, text6_2, text6_3, key_resp_2weeks] for thisComponent in choice_2weeksComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") choice_2weeksClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "choice_2weeks"------- while continueRoutine: # get current time t = choice_2weeksClock.getTime() tThisFlip = win.getFutureFlipTime(clock=choice_2weeksClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration6* updates if concentration6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration6.frameNStart = frameN # exact frame index concentration6.tStart = t # local t and not account for scr refresh concentration6.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration6, 'tStartRefresh') # time at next scr refresh concentration6.setAutoDraw(True) if concentration6.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration6.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration6.tStop = t # not accounting for scr refresh concentration6.frameNStop = frameN # exact frame index win.timeOnFlip(concentration6, 'tStopRefresh') # time at next scr refresh concentration6.setAutoDraw(False) # *text6_1* updates if text6_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text6_1.frameNStart = frameN # exact frame index text6_1.tStart = t # local t and not account for scr refresh text6_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text6_1, 'tStartRefresh') # time at next scr refresh text6_1.setAutoDraw(True) # *text6_2* updates if text6_2.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text6_2.frameNStart = frameN # exact frame index text6_2.tStart = t # local t and not account for scr refresh text6_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text6_2, 'tStartRefresh') # time at next scr refresh text6_2.setAutoDraw(True) # *text6_3* updates if text6_3.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text6_3.frameNStart = frameN # exact frame index text6_3.tStart = t # local t and not account for scr refresh text6_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text6_3, 'tStartRefresh') # time at next scr refresh text6_3.setAutoDraw(True) # *key_resp_2weeks* updates waitOnFlip = False if key_resp_2weeks.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp_2weeks.frameNStart = frameN # exact frame index key_resp_2weeks.tStart = t # local t and not account for scr refresh key_resp_2weeks.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_2weeks, 'tStartRefresh') # time at next scr refresh key_resp_2weeks.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_2weeks.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_2weeks.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_2weeks.status == STARTED and not waitOnFlip: theseKeys = key_resp_2weeks.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp_2weeks_allKeys.extend(theseKeys) if len(_key_resp_2weeks_allKeys): key_resp_2weeks.keys = _key_resp_2weeks_allKeys[-1].name # just the last key pressed key_resp_2weeks.rt = _key_resp_2weeks_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in choice_2weeksComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "choice_2weeks"------- for thisComponent in choice_2weeksComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) trials.addData('concentration6.started', concentration6.tStartRefresh) trials.addData('concentration6.stopped', concentration6.tStopRefresh) trials.addData('text6_1.started', text6_1.tStartRefresh) trials.addData('text6_1.stopped', text6_1.tStopRefresh) trials.addData('text6_2.started', text6_2.tStartRefresh) trials.addData('text6_2.stopped', text6_2.tStopRefresh) trials.addData('text6_3.started', text6_3.tStartRefresh) trials.addData('text6_3.stopped', text6_3.tStopRefresh) # check responses if key_resp_2weeks.keys in ['', [], None]: # No response was made key_resp_2weeks.keys = None trials.addData('key_resp_2weeks.keys',key_resp_2weeks.keys) if key_resp_2weeks.keys != None: # we had a response trials.addData('key_resp_2weeks.rt', key_resp_2weeks.rt) trials.addData('key_resp_2weeks.started', key_resp_2weeks.tStartRefresh) trials.addData('key_resp_2weeks.stopped', key_resp_2weeks.tStopRefresh) if 'left'in key_resp_2weeks.keys: z5=x6 x6-=1000/n6 n6*=2 y="即时奖励" if 'right' in key_resp_2weeks.keys: x6+=1000/n6 n6*=2 z5=1000 y="两周后的奖励" # the Routine "choice_2weeks" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "feed_back5"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat feedback5_1.setText(y) feedback5_3.setText(z5) # keep track of which components have finished feed_back5Components = [feedback5_1, feedback5_2, feedback5_3] for thisComponent in feed_back5Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feed_back5Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feed_back5"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feed_back5Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feed_back5Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback5_1* updates if feedback5_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback5_1.frameNStart = frameN # exact frame index feedback5_1.tStart = t # local t and not account for scr refresh feedback5_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback5_1, 'tStartRefresh') # time at next scr refresh feedback5_1.setAutoDraw(True) if feedback5_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback5_1.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback5_1.tStop = t # not accounting for scr refresh feedback5_1.frameNStop = frameN # exact frame index win.timeOnFlip(feedback5_1, 'tStopRefresh') # time at next scr refresh feedback5_1.setAutoDraw(False) # *feedback5_2* updates if feedback5_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback5_2.frameNStart = frameN # exact frame index feedback5_2.tStart = t # local t and not account for scr refresh feedback5_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback5_2, 'tStartRefresh') # time at next scr refresh feedback5_2.setAutoDraw(True) if feedback5_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback5_2.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback5_2.tStop = t # not accounting for scr refresh feedback5_2.frameNStop = frameN # exact frame index win.timeOnFlip(feedback5_2, 'tStopRefresh') # time at next scr refresh feedback5_2.setAutoDraw(False) # *feedback5_3* updates if feedback5_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback5_3.frameNStart = frameN # exact frame index feedback5_3.tStart = t # local t and not account for scr refresh feedback5_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback5_3, 'tStartRefresh') # time at next scr refresh feedback5_3.setAutoDraw(True) if feedback5_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback5_3.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback5_3.tStop = t # not accounting for scr refresh feedback5_3.frameNStop = frameN # exact frame index win.timeOnFlip(feedback5_3, 'tStopRefresh') # time at next scr refresh feedback5_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feed_back5Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feed_back5"------- for thisComponent in feed_back5Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) trials.addData('feedback5_1.started', feedback5_1.tStartRefresh) trials.addData('feedback5_1.stopped', feedback5_1.tStopRefresh) trials.addData('feedback5_2.started', feedback5_2.tStartRefresh) trials.addData('feedback5_2.stopped', feedback5_2.tStopRefresh) trials.addData('feedback5_3.started', feedback5_3.tStartRefresh) trials.addData('feedback5_3.stopped', feedback5_3.tStopRefresh) thisExp.nextEntry() # completed 5 repeats of 'trials' # ------Prepare to start Routine "tip3"------- continueRoutine = True routineTimer.add(3.000000) # update component parameters for each repeat # keep track of which components have finished tip3Components = [tip_3, text_5] for thisComponent in tip3Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip3Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip3"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = tip3Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip3Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *tip_3* updates if tip_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later tip_3.frameNStart = frameN # exact frame index tip_3.tStart = t # local t and not account for scr refresh tip_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(tip_3, 'tStartRefresh') # time at next scr refresh tip_3.setAutoDraw(True) if tip_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > tip_3.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later tip_3.tStop = t # not accounting for scr refresh tip_3.frameNStop = frameN # exact frame index win.timeOnFlip(tip_3, 'tStopRefresh') # time at next scr refresh tip_3.setAutoDraw(False) # *text_5* updates if text_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_5.frameNStart = frameN # exact frame index text_5.tStart = t # local t and not account for scr refresh text_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_5, 'tStartRefresh') # time at next scr refresh text_5.setAutoDraw(True) if text_5.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_5.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later text_5.tStop = t # not accounting for scr refresh text_5.frameNStop = frameN # exact frame index win.timeOnFlip(text_5, 'tStopRefresh') # time at next scr refresh text_5.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip3Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip3"------- for thisComponent in tip3Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('tip_3.started', tip_3.tStartRefresh) thisExp.addData('tip_3.stopped', tip_3.tStopRefresh) thisExp.addData('text_5.started', text_5.tStartRefresh) thisExp.addData('text_5.stopped', text_5.tStopRefresh) # set up handler to look after randomisation of conditions etc loop3 = data.TrialHandler(nReps=7, method='random', extraInfo=expInfo, originPath=-1, trialList=[None], seed=None, name='loop3') thisExp.addLoop(loop3) # add the loop to the experiment thisLoop3 = loop3.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop3.rgb) if thisLoop3 != None: for paramName in thisLoop3: exec('{} = thisLoop3[paramName]'.format(paramName)) for thisLoop3 in loop3: currentLoop = loop3 # abbreviate parameter names if possible (e.g. rgb = thisLoop3.rgb) if thisLoop3 != None: for paramName in thisLoop3: exec('{} = thisLoop3[paramName]'.format(paramName)) # ------Prepare to start Routine "choice_month"------- continueRoutine = True # update component parameters for each repeat text3_2.setText(x3) key_resp_1month.keys = [] key_resp_1month.rt = [] _key_resp_1month_allKeys = [] # keep track of which components have finished choice_monthComponents = [concentration3, text3_1, text3_2, text3_3, key_resp_1month] for thisComponent in choice_monthComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") choice_monthClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "choice_month"------- while continueRoutine: # get current time t = choice_monthClock.getTime() tThisFlip = win.getFutureFlipTime(clock=choice_monthClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration3* updates if concentration3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration3.frameNStart = frameN # exact frame index concentration3.tStart = t # local t and not account for scr refresh concentration3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration3, 'tStartRefresh') # time at next scr refresh concentration3.setAutoDraw(True) if concentration3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration3.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration3.tStop = t # not accounting for scr refresh concentration3.frameNStop = frameN # exact frame index win.timeOnFlip(concentration3, 'tStopRefresh') # time at next scr refresh concentration3.setAutoDraw(False) # *text3_1* updates if text3_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text3_1.frameNStart = frameN # exact frame index text3_1.tStart = t # local t and not account for scr refresh text3_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text3_1, 'tStartRefresh') # time at next scr refresh text3_1.setAutoDraw(True) # *text3_2* updates if text3_2.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text3_2.frameNStart = frameN # exact frame index text3_2.tStart = t # local t and not account for scr refresh text3_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text3_2, 'tStartRefresh') # time at next scr refresh text3_2.setAutoDraw(True) # *text3_3* updates if text3_3.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text3_3.frameNStart = frameN # exact frame index text3_3.tStart = t # local t and not account for scr refresh text3_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text3_3, 'tStartRefresh') # time at next scr refresh text3_3.setAutoDraw(True) # *key_resp_1month* updates waitOnFlip = False if key_resp_1month.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp_1month.frameNStart = frameN # exact frame index key_resp_1month.tStart = t # local t and not account for scr refresh key_resp_1month.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_1month, 'tStartRefresh') # time at next scr refresh key_resp_1month.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_1month.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_1month.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_1month.status == STARTED and not waitOnFlip: theseKeys = key_resp_1month.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp_1month_allKeys.extend(theseKeys) if len(_key_resp_1month_allKeys): key_resp_1month.keys = _key_resp_1month_allKeys[-1].name # just the last key pressed key_resp_1month.rt = _key_resp_1month_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in choice_monthComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "choice_month"------- for thisComponent in choice_monthComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop3.addData('concentration3.started', concentration3.tStartRefresh) loop3.addData('concentration3.stopped', concentration3.tStopRefresh) loop3.addData('text3_1.started', text3_1.tStartRefresh) loop3.addData('text3_1.stopped', text3_1.tStopRefresh) loop3.addData('text3_2.started', text3_2.tStartRefresh) loop3.addData('text3_2.stopped', text3_2.tStopRefresh) loop3.addData('text3_3.started', text3_3.tStartRefresh) loop3.addData('text3_3.stopped', text3_3.tStopRefresh) # check responses if key_resp_1month.keys in ['', [], None]: # No response was made key_resp_1month.keys = None loop3.addData('key_resp_1month.keys',key_resp_1month.keys) if key_resp_1month.keys != None: # we had a response loop3.addData('key_resp_1month.rt', key_resp_1month.rt) loop3.addData('key_resp_1month.started', key_resp_1month.tStartRefresh) loop3.addData('key_resp_1month.stopped', key_resp_1month.tStopRefresh) if 'left'in key_resp_1month.keys: z2=x3 x3-=1000/n3 n3*=2 y="即时奖励" if 'right' in key_resp_1month.keys: x3+=1000/n3 n3*=2 z2=1000 y="一个月后的奖励" # the Routine "choice_month" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "feed_back2"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat feedback2_1.setText(y) feedback2_3.setText(z2) # keep track of which components have finished feed_back2Components = [feedback2_1, feedback2_2, feedback2_3] for thisComponent in feed_back2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feed_back2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feed_back2"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feed_back2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feed_back2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback2_1* updates if feedback2_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback2_1.frameNStart = frameN # exact frame index feedback2_1.tStart = t # local t and not account for scr refresh feedback2_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback2_1, 'tStartRefresh') # time at next scr refresh feedback2_1.setAutoDraw(True) if feedback2_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback2_1.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback2_1.tStop = t # not accounting for scr refresh feedback2_1.frameNStop = frameN # exact frame index win.timeOnFlip(feedback2_1, 'tStopRefresh') # time at next scr refresh feedback2_1.setAutoDraw(False) # *feedback2_2* updates if feedback2_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback2_2.frameNStart = frameN # exact frame index feedback2_2.tStart = t # local t and not account for scr refresh feedback2_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback2_2, 'tStartRefresh') # time at next scr refresh feedback2_2.setAutoDraw(True) if feedback2_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback2_2.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback2_2.tStop = t # not accounting for scr refresh feedback2_2.frameNStop = frameN # exact frame index win.timeOnFlip(feedback2_2, 'tStopRefresh') # time at next scr refresh feedback2_2.setAutoDraw(False) # *feedback2_3* updates if feedback2_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback2_3.frameNStart = frameN # exact frame index feedback2_3.tStart = t # local t and not account for scr refresh feedback2_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback2_3, 'tStartRefresh') # time at next scr refresh feedback2_3.setAutoDraw(True) if feedback2_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback2_3.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback2_3.tStop = t # not accounting for scr refresh feedback2_3.frameNStop = frameN # exact frame index win.timeOnFlip(feedback2_3, 'tStopRefresh') # time at next scr refresh feedback2_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feed_back2Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feed_back2"------- for thisComponent in feed_back2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop3.addData('feedback2_1.started', feedback2_1.tStartRefresh) loop3.addData('feedback2_1.stopped', feedback2_1.tStopRefresh) loop3.addData('feedback2_2.started', feedback2_2.tStartRefresh) loop3.addData('feedback2_2.stopped', feedback2_2.tStopRefresh) loop3.addData('feedback2_3.started', feedback2_3.tStartRefresh) loop3.addData('feedback2_3.stopped', feedback2_3.tStopRefresh) thisExp.nextEntry() # completed 7 repeats of 'loop3' # ------Prepare to start Routine "tip4"------- continueRoutine = True routineTimer.add(3.000000) # update component parameters for each repeat # keep track of which components have finished tip4Components = [tip_4, text_6] for thisComponent in tip4Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip4Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip4"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = tip4Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip4Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *tip_4* updates if tip_4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later tip_4.frameNStart = frameN # exact frame index tip_4.tStart = t # local t and not account for scr refresh tip_4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(tip_4, 'tStartRefresh') # time at next scr refresh tip_4.setAutoDraw(True) if tip_4.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > tip_4.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later tip_4.tStop = t # not accounting for scr refresh tip_4.frameNStop = frameN # exact frame index win.timeOnFlip(tip_4, 'tStopRefresh') # time at next scr refresh tip_4.setAutoDraw(False) # *text_6* updates if text_6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_6.frameNStart = frameN # exact frame index text_6.tStart = t # local t and not account for scr refresh text_6.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_6, 'tStartRefresh') # time at next scr refresh text_6.setAutoDraw(True) if text_6.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_6.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later text_6.tStop = t # not accounting for scr refresh text_6.frameNStop = frameN # exact frame index win.timeOnFlip(text_6, 'tStopRefresh') # time at next scr refresh text_6.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip4Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip4"------- for thisComponent in tip4Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('tip_4.started', tip_4.tStartRefresh) thisExp.addData('tip_4.stopped', tip_4.tStopRefresh) thisExp.addData('text_6.started', text_6.tStartRefresh) thisExp.addData('text_6.stopped', text_6.tStopRefresh) # set up handler to look after randomisation of conditions etc loop4 = data.TrialHandler(nReps=7, method='random', extraInfo=expInfo, originPath=-1, trialList=[None], seed=None, name='loop4') thisExp.addLoop(loop4) # add the loop to the experiment thisLoop4 = loop4.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop4.rgb) if thisLoop4 != None: for paramName in thisLoop4: exec('{} = thisLoop4[paramName]'.format(paramName)) for thisLoop4 in loop4: currentLoop = loop4 # abbreviate parameter names if possible (e.g. rgb = thisLoop4.rgb) if thisLoop4 != None: for paramName in thisLoop4: exec('{} = thisLoop4[paramName]'.format(paramName)) # ------Prepare to start Routine "choice_months"------- continueRoutine = True # update component parameters for each repeat text4_2.setText(x4) key_resp_6months.keys = [] key_resp_6months.rt = [] _key_resp_6months_allKeys = [] # keep track of which components have finished choice_monthsComponents = [concentration4, text4_1, text4_2, text4_3, key_resp_6months] for thisComponent in choice_monthsComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") choice_monthsClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "choice_months"------- while continueRoutine: # get current time t = choice_monthsClock.getTime() tThisFlip = win.getFutureFlipTime(clock=choice_monthsClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration4* updates if concentration4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration4.frameNStart = frameN # exact frame index concentration4.tStart = t # local t and not account for scr refresh concentration4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration4, 'tStartRefresh') # time at next scr refresh concentration4.setAutoDraw(True) if concentration4.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration4.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration4.tStop = t # not accounting for scr refresh concentration4.frameNStop = frameN # exact frame index win.timeOnFlip(concentration4, 'tStopRefresh') # time at next scr refresh concentration4.setAutoDraw(False) # *text4_1* updates if text4_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text4_1.frameNStart = frameN # exact frame index text4_1.tStart = t # local t and not account for scr refresh text4_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text4_1, 'tStartRefresh') # time at next scr refresh text4_1.setAutoDraw(True) # *text4_2* updates if text4_2.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text4_2.frameNStart = frameN # exact frame index text4_2.tStart = t # local t and not account for scr refresh text4_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text4_2, 'tStartRefresh') # time at next scr refresh text4_2.setAutoDraw(True) # *text4_3* updates if text4_3.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text4_3.frameNStart = frameN # exact frame index text4_3.tStart = t # local t and not account for scr refresh text4_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text4_3, 'tStartRefresh') # time at next scr refresh text4_3.setAutoDraw(True) # *key_resp_6months* updates waitOnFlip = False if key_resp_6months.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp_6months.frameNStart = frameN # exact frame index key_resp_6months.tStart = t # local t and not account for scr refresh key_resp_6months.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_6months, 'tStartRefresh') # time at next scr refresh key_resp_6months.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_6months.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_6months.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_6months.status == STARTED and not waitOnFlip: theseKeys = key_resp_6months.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp_6months_allKeys.extend(theseKeys) if len(_key_resp_6months_allKeys): key_resp_6months.keys = _key_resp_6months_allKeys[-1].name # just the last key pressed key_resp_6months.rt = _key_resp_6months_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in choice_monthsComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "choice_months"------- for thisComponent in choice_monthsComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop4.addData('concentration4.started', concentration4.tStartRefresh) loop4.addData('concentration4.stopped', concentration4.tStopRefresh) loop4.addData('text4_1.started', text4_1.tStartRefresh) loop4.addData('text4_1.stopped', text4_1.tStopRefresh) loop4.addData('text4_2.started', text4_2.tStartRefresh) loop4.addData('text4_2.stopped', text4_2.tStopRefresh) loop4.addData('text4_3.started', text4_3.tStartRefresh) loop4.addData('text4_3.stopped', text4_3.tStopRefresh) # check responses if key_resp_6months.keys in ['', [], None]: # No response was made key_resp_6months.keys = None loop4.addData('key_resp_6months.keys',key_resp_6months.keys) if key_resp_6months.keys != None: # we had a response loop4.addData('key_resp_6months.rt', key_resp_6months.rt) loop4.addData('key_resp_6months.started', key_resp_6months.tStartRefresh) loop4.addData('key_resp_6months.stopped', key_resp_6months.tStopRefresh) if 'left'in key_resp_6months.keys: z3=x4 x4-=1000/n4 n4*=2 y="即时奖励" if 'right' in key_resp_6months.keys: x4+=1000/n4 n4*=2 z3=1000 y="六个月后的奖励" # the Routine "choice_months" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "feed_back3"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat feedback3_1.setText(y) feedback3_3.setText(z3) # keep track of which components have finished feed_back3Components = [feedback3_1, feedback3_2, feedback3_3] for thisComponent in feed_back3Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feed_back3Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feed_back3"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feed_back3Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feed_back3Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback3_1* updates if feedback3_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback3_1.frameNStart = frameN # exact frame index feedback3_1.tStart = t # local t and not account for scr refresh feedback3_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback3_1, 'tStartRefresh') # time at next scr refresh feedback3_1.setAutoDraw(True) if feedback3_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback3_1.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback3_1.tStop = t # not accounting for scr refresh feedback3_1.frameNStop = frameN # exact frame index win.timeOnFlip(feedback3_1, 'tStopRefresh') # time at next scr refresh feedback3_1.setAutoDraw(False) # *feedback3_2* updates if feedback3_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback3_2.frameNStart = frameN # exact frame index feedback3_2.tStart = t # local t and not account for scr refresh feedback3_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback3_2, 'tStartRefresh') # time at next scr refresh feedback3_2.setAutoDraw(True) if feedback3_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback3_2.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback3_2.tStop = t # not accounting for scr refresh feedback3_2.frameNStop = frameN # exact frame index win.timeOnFlip(feedback3_2, 'tStopRefresh') # time at next scr refresh feedback3_2.setAutoDraw(False) # *feedback3_3* updates if feedback3_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback3_3.frameNStart = frameN # exact frame index feedback3_3.tStart = t # local t and not account for scr refresh feedback3_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback3_3, 'tStartRefresh') # time at next scr refresh feedback3_3.setAutoDraw(True) if feedback3_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback3_3.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback3_3.tStop = t # not accounting for scr refresh feedback3_3.frameNStop = frameN # exact frame index win.timeOnFlip(feedback3_3, 'tStopRefresh') # time at next scr refresh feedback3_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feed_back3Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feed_back3"------- for thisComponent in feed_back3Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop4.addData('feedback3_1.started', feedback3_1.tStartRefresh) loop4.addData('feedback3_1.stopped', feedback3_1.tStopRefresh) loop4.addData('feedback3_2.started', feedback3_2.tStartRefresh) loop4.addData('feedback3_2.stopped', feedback3_2.tStopRefresh) loop4.addData('feedback3_3.started', feedback3_3.tStartRefresh) loop4.addData('feedback3_3.stopped', feedback3_3.tStopRefresh) thisExp.nextEntry() # completed 7 repeats of 'loop4' # ------Prepare to start Routine "tip5"------- continueRoutine = True routineTimer.add(3.000000) # update component parameters for each repeat # keep track of which components have finished tip5Components = [tip_5, text_7] for thisComponent in tip5Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip5Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip5"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = tip5Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip5Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *tip_5* updates if tip_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later tip_5.frameNStart = frameN # exact frame index tip_5.tStart = t # local t and not account for scr refresh tip_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(tip_5, 'tStartRefresh') # time at next scr refresh tip_5.setAutoDraw(True) if tip_5.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > tip_5.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later tip_5.tStop = t # not accounting for scr refresh tip_5.frameNStop = frameN # exact frame index win.timeOnFlip(tip_5, 'tStopRefresh') # time at next scr refresh tip_5.setAutoDraw(False) # *text_7* updates if text_7.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_7.frameNStart = frameN # exact frame index text_7.tStart = t # local t and not account for scr refresh text_7.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_7, 'tStartRefresh') # time at next scr refresh text_7.setAutoDraw(True) if text_7.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_7.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later text_7.tStop = t # not accounting for scr refresh text_7.frameNStop = frameN # exact frame index win.timeOnFlip(text_7, 'tStopRefresh') # time at next scr refresh text_7.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip5Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip5"------- for thisComponent in tip5Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('tip_5.started', tip_5.tStartRefresh) thisExp.addData('tip_5.stopped', tip_5.tStopRefresh) thisExp.addData('text_7.started', text_7.tStartRefresh) thisExp.addData('text_7.stopped', text_7.tStopRefresh) # set up handler to look after randomisation of conditions etc loop5 = data.TrialHandler(nReps=7, method='random', extraInfo=expInfo, originPath=-1, trialList=[None], seed=None, name='loop5') thisExp.addLoop(loop5) # add the loop to the experiment thisLoop5 = loop5.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop5.rgb) if thisLoop5 != None: for paramName in thisLoop5: exec('{} = thisLoop5[paramName]'.format(paramName)) for thisLoop5 in loop5: currentLoop = loop5 # abbreviate parameter names if possible (e.g. rgb = thisLoop5.rgb) if thisLoop5 != None: for paramName in thisLoop5: exec('{} = thisLoop5[paramName]'.format(paramName)) # ------Prepare to start Routine "choice_year"------- continueRoutine = True # update component parameters for each repeat text5_2.setText(x5 ) key_resp_1year.keys = [] key_resp_1year.rt = [] _key_resp_1year_allKeys = [] # keep track of which components have finished choice_yearComponents = [concentration5, text5_1, text5_2, text5_3, key_resp_1year] for thisComponent in choice_yearComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") choice_yearClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "choice_year"------- while continueRoutine: # get current time t = choice_yearClock.getTime() tThisFlip = win.getFutureFlipTime(clock=choice_yearClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration5* updates if concentration5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration5.frameNStart = frameN # exact frame index concentration5.tStart = t # local t and not account for scr refresh concentration5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration5, 'tStartRefresh') # time at next scr refresh concentration5.setAutoDraw(True) if concentration5.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration5.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration5.tStop = t # not accounting for scr refresh concentration5.frameNStop = frameN # exact frame index win.timeOnFlip(concentration5, 'tStopRefresh') # time at next scr refresh concentration5.setAutoDraw(False) # *text5_1* updates if text5_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text5_1.frameNStart = frameN # exact frame index text5_1.tStart = t # local t and not account for scr refresh text5_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text5_1, 'tStartRefresh') # time at next scr refresh text5_1.setAutoDraw(True) # *text5_2* updates if text5_2.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text5_2.frameNStart = frameN # exact frame index text5_2.tStart = t # local t and not account for scr refresh text5_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text5_2, 'tStartRefresh') # time at next scr refresh text5_2.setAutoDraw(True) # *text5_3* updates if text5_3.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text5_3.frameNStart = frameN # exact frame index text5_3.tStart = t # local t and not account for scr refresh text5_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text5_3, 'tStartRefresh') # time at next scr refresh text5_3.setAutoDraw(True) # *key_resp_1year* updates waitOnFlip = False if key_resp_1year.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp_1year.frameNStart = frameN # exact frame index key_resp_1year.tStart = t # local t and not account for scr refresh key_resp_1year.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_1year, 'tStartRefresh') # time at next scr refresh key_resp_1year.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_1year.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_1year.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_1year.status == STARTED and not waitOnFlip: theseKeys = key_resp_1year.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp_1year_allKeys.extend(theseKeys) if len(_key_resp_1year_allKeys): key_resp_1year.keys = _key_resp_1year_allKeys[-1].name # just the last key pressed key_resp_1year.rt = _key_resp_1year_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in choice_yearComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "choice_year"------- for thisComponent in choice_yearComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop5.addData('concentration5.started', concentration5.tStartRefresh) loop5.addData('concentration5.stopped', concentration5.tStopRefresh) loop5.addData('text5_1.started', text5_1.tStartRefresh) loop5.addData('text5_1.stopped', text5_1.tStopRefresh) loop5.addData('text5_2.started', text5_2.tStartRefresh) loop5.addData('text5_2.stopped', text5_2.tStopRefresh) loop5.addData('text5_3.started', text5_3.tStartRefresh) loop5.addData('text5_3.stopped', text5_3.tStopRefresh) # check responses if key_resp_1year.keys in ['', [], None]: # No response was made key_resp_1year.keys = None loop5.addData('key_resp_1year.keys',key_resp_1year.keys) if key_resp_1year.keys != None: # we had a response loop5.addData('key_resp_1year.rt', key_resp_1year.rt) loop5.addData('key_resp_1year.started', key_resp_1year.tStartRefresh) loop5.addData('key_resp_1year.stopped', key_resp_1year.tStopRefresh) if 'left'in key_resp_1year.keys: z4=x5 x5-=1000/n5 n5*=2 y="即时奖励" if 'right' in key_resp_1year.keys: x5+=1000/n5 n5*=2 z4=1000 y="一年后的奖励" # the Routine "choice_year" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "feed_back4"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat feedback4_1.setText(y) feedback4_3.setText(z4) # keep track of which components have finished feed_back4Components = [feedback4_1, feedback4_2, feedback4_3] for thisComponent in feed_back4Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feed_back4Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feed_back4"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feed_back4Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feed_back4Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback4_1* updates if feedback4_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback4_1.frameNStart = frameN # exact frame index feedback4_1.tStart = t # local t and not account for scr refresh feedback4_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback4_1, 'tStartRefresh') # time at next scr refresh feedback4_1.setAutoDraw(True) if feedback4_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback4_1.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback4_1.tStop = t # not accounting for scr refresh feedback4_1.frameNStop = frameN # exact frame index win.timeOnFlip(feedback4_1, 'tStopRefresh') # time at next scr refresh feedback4_1.setAutoDraw(False) # *feedback4_2* updates if feedback4_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback4_2.frameNStart = frameN # exact frame index feedback4_2.tStart = t # local t and not account for scr refresh feedback4_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback4_2, 'tStartRefresh') # time at next scr refresh feedback4_2.setAutoDraw(True) if feedback4_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback4_2.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback4_2.tStop = t # not accounting for scr refresh feedback4_2.frameNStop = frameN # exact frame index win.timeOnFlip(feedback4_2, 'tStopRefresh') # time at next scr refresh feedback4_2.setAutoDraw(False) # *feedback4_3* updates if feedback4_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback4_3.frameNStart = frameN # exact frame index feedback4_3.tStart = t # local t and not account for scr refresh feedback4_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback4_3, 'tStartRefresh') # time at next scr refresh feedback4_3.setAutoDraw(True) if feedback4_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback4_3.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback4_3.tStop = t # not accounting for scr refresh feedback4_3.frameNStop = frameN # exact frame index win.timeOnFlip(feedback4_3, 'tStopRefresh') # time at next scr refresh feedback4_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feed_back4Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feed_back4"------- for thisComponent in feed_back4Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop5.addData('feedback4_1.started', feedback4_1.tStartRefresh) loop5.addData('feedback4_1.stopped', feedback4_1.tStopRefresh) loop5.addData('feedback4_2.started', feedback4_2.tStartRefresh) loop5.addData('feedback4_2.stopped', feedback4_2.tStopRefresh) loop5.addData('feedback4_3.started', feedback4_3.tStartRefresh) loop5.addData('feedback4_3.stopped', feedback4_3.tStopRefresh) thisExp.nextEntry() # completed 7 repeats of 'loop5' # ------Prepare to start Routine "tip6"------- continueRoutine = True routineTimer.add(3.000000) # update component parameters for each repeat # keep track of which components have finished tip6Components = [text, text_8] for thisComponent in tip6Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip6Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip6"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = tip6Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip6Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text* updates if text.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text.frameNStart = frameN # exact frame index text.tStart = t # local t and not account for scr refresh text.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text, 'tStartRefresh') # time at next scr refresh text.setAutoDraw(True) if text.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later text.tStop = t # not accounting for scr refresh text.frameNStop = frameN # exact frame index win.timeOnFlip(text, 'tStopRefresh') # time at next scr refresh text.setAutoDraw(False) # *text_8* updates if text_8.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_8.frameNStart = frameN # exact frame index text_8.tStart = t # local t and not account for scr refresh text_8.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_8, 'tStartRefresh') # time at next scr refresh text_8.setAutoDraw(True) if text_8.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_8.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later text_8.tStop = t # not accounting for scr refresh text_8.frameNStop = frameN # exact frame index win.timeOnFlip(text_8, 'tStopRefresh') # time at next scr refresh text_8.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip6Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip6"------- for thisComponent in tip6Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text.started', text.tStartRefresh) thisExp.addData('text.stopped', text.tStopRefresh) thisExp.addData('text_8.started', text_8.tStartRefresh) thisExp.addData('text_8.stopped', text_8.tStopRefresh) # set up handler to look after randomisation of conditions etc loop8 = data.TrialHandler(nReps=7, method='random', extraInfo=expInfo, originPath=-1, trialList=[None], seed=None, name='loop8') thisExp.addLoop(loop8) # add the loop to the experiment thisLoop8 = loop8.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop8.rgb) if thisLoop8 != None: for paramName in thisLoop8: exec('{} = thisLoop8[paramName]'.format(paramName)) for thisLoop8 in loop8: currentLoop = loop8 # abbreviate parameter names if possible (e.g. rgb = thisLoop8.rgb) if thisLoop8 != None: for paramName in thisLoop8: exec('{} = thisLoop8[paramName]'.format(paramName)) # ------Prepare to start Routine "choice_5years_2"------- continueRoutine = True # update component parameters for each repeat text8_2.setText(x8) key_resp5years.keys = [] key_resp5years.rt = [] _key_resp5years_allKeys = [] # keep track of which components have finished choice_5years_2Components = [concentration8, text8_1, text8_2, text8_3, key_resp5years] for thisComponent in choice_5years_2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") choice_5years_2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "choice_5years_2"------- while continueRoutine: # get current time t = choice_5years_2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=choice_5years_2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration8* updates if concentration8.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration8.frameNStart = frameN # exact frame index concentration8.tStart = t # local t and not account for scr refresh concentration8.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration8, 'tStartRefresh') # time at next scr refresh concentration8.setAutoDraw(True) if concentration8.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration8.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration8.tStop = t # not accounting for scr refresh concentration8.frameNStop = frameN # exact frame index win.timeOnFlip(concentration8, 'tStopRefresh') # time at next scr refresh concentration8.setAutoDraw(False) # *text8_1* updates if text8_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text8_1.frameNStart = frameN # exact frame index text8_1.tStart = t # local t and not account for scr refresh text8_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text8_1, 'tStartRefresh') # time at next scr refresh text8_1.setAutoDraw(True) # *text8_2* updates if text8_2.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text8_2.frameNStart = frameN # exact frame index text8_2.tStart = t # local t and not account for scr refresh text8_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text8_2, 'tStartRefresh') # time at next scr refresh text8_2.setAutoDraw(True) # *text8_3* updates if text8_3.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text8_3.frameNStart = frameN # exact frame index text8_3.tStart = t # local t and not account for scr refresh text8_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text8_3, 'tStartRefresh') # time at next scr refresh text8_3.setAutoDraw(True) # *key_resp5years* updates waitOnFlip = False if key_resp5years.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp5years.frameNStart = frameN # exact frame index key_resp5years.tStart = t # local t and not account for scr refresh key_resp5years.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp5years, 'tStartRefresh') # time at next scr refresh key_resp5years.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp5years.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp5years.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp5years.status == STARTED and not waitOnFlip: theseKeys = key_resp5years.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp5years_allKeys.extend(theseKeys) if len(_key_resp5years_allKeys): key_resp5years.keys = _key_resp5years_allKeys[-1].name # just the last key pressed key_resp5years.rt = _key_resp5years_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in choice_5years_2Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "choice_5years_2"------- for thisComponent in choice_5years_2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop8.addData('concentration8.started', concentration8.tStartRefresh) loop8.addData('concentration8.stopped', concentration8.tStopRefresh) loop8.addData('text8_1.started', text8_1.tStartRefresh) loop8.addData('text8_1.stopped', text8_1.tStopRefresh) loop8.addData('text8_2.started', text8_2.tStartRefresh) loop8.addData('text8_2.stopped', text8_2.tStopRefresh) loop8.addData('text8_3.started', text8_3.tStartRefresh) loop8.addData('text8_3.stopped', text8_3.tStopRefresh) # check responses if key_resp5years.keys in ['', [], None]: # No response was made key_resp5years.keys = None loop8.addData('key_resp5years.keys',key_resp5years.keys) if key_resp5years.keys != None: # we had a response loop8.addData('key_resp5years.rt', key_resp5years.rt) loop8.addData('key_resp5years.started', key_resp5years.tStartRefresh) loop8.addData('key_resp5years.stopped', key_resp5years.tStopRefresh) if 'left'in key_resp5years.keys: z6=x8 x8-=1000/n8 n8*=2 y="即时奖励" if 'right' in key_resp5years.keys: x8+=1000/n8 n8*=2 z6=1000 y="五年后的奖励" # the Routine "choice_5years_2" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "feed_back6"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat feedback6_1.setText(y) feedback6_3.setText(z6) # keep track of which components have finished feed_back6Components = [feedback6_1, feedback6_2, feedback6_3] for thisComponent in feed_back6Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feed_back6Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feed_back6"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feed_back6Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feed_back6Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback6_1* updates if feedback6_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback6_1.frameNStart = frameN # exact frame index feedback6_1.tStart = t # local t and not account for scr refresh feedback6_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback6_1, 'tStartRefresh') # time at next scr refresh feedback6_1.setAutoDraw(True) if feedback6_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback6_1.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback6_1.tStop = t # not accounting for scr refresh feedback6_1.frameNStop = frameN # exact frame index win.timeOnFlip(feedback6_1, 'tStopRefresh') # time at next scr refresh feedback6_1.setAutoDraw(False) # *feedback6_2* updates if feedback6_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback6_2.frameNStart = frameN # exact frame index feedback6_2.tStart = t # local t and not account for scr refresh feedback6_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback6_2, 'tStartRefresh') # time at next scr refresh feedback6_2.setAutoDraw(True) if feedback6_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback6_2.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback6_2.tStop = t # not accounting for scr refresh feedback6_2.frameNStop = frameN # exact frame index win.timeOnFlip(feedback6_2, 'tStopRefresh') # time at next scr refresh feedback6_2.setAutoDraw(False) # *feedback6_3* updates if feedback6_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback6_3.frameNStart = frameN # exact frame index feedback6_3.tStart = t # local t and not account for scr refresh feedback6_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback6_3, 'tStartRefresh') # time at next scr refresh feedback6_3.setAutoDraw(True) if feedback6_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback6_3.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback6_3.tStop = t # not accounting for scr refresh feedback6_3.frameNStop = frameN # exact frame index win.timeOnFlip(feedback6_3, 'tStopRefresh') # time at next scr refresh feedback6_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feed_back6Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feed_back6"------- for thisComponent in feed_back6Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop8.addData('feedback6_1.started', feedback6_1.tStartRefresh) loop8.addData('feedback6_1.stopped', feedback6_1.tStopRefresh) loop8.addData('feedback6_2.started', feedback6_2.tStartRefresh) loop8.addData('feedback6_2.stopped', feedback6_2.tStopRefresh) loop8.addData('feedback6_3.started', feedback6_3.tStartRefresh) loop8.addData('feedback6_3.stopped', feedback6_3.tStopRefresh) thisExp.nextEntry() # completed 7 repeats of 'loop8' # ------Prepare to start Routine "tip7"------- continueRoutine = True routineTimer.add(3.000000) # update component parameters for each repeat # keep track of which components have finished tip7Components = [tip_7, text_9] for thisComponent in tip7Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip7Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip7"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = tip7Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip7Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *tip_7* updates if tip_7.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later tip_7.frameNStart = frameN # exact frame index tip_7.tStart = t # local t and not account for scr refresh tip_7.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(tip_7, 'tStartRefresh') # time at next scr refresh tip_7.setAutoDraw(True) if tip_7.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > tip_7.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later tip_7.tStop = t # not accounting for scr refresh tip_7.frameNStop = frameN # exact frame index win.timeOnFlip(tip_7, 'tStopRefresh') # time at next scr refresh tip_7.setAutoDraw(False) # *text_9* updates if text_9.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_9.frameNStart = frameN # exact frame index text_9.tStart = t # local t and not account for scr refresh text_9.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_9, 'tStartRefresh') # time at next scr refresh text_9.setAutoDraw(True) if text_9.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_9.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later text_9.tStop = t # not accounting for scr refresh text_9.frameNStop = frameN # exact frame index win.timeOnFlip(text_9, 'tStopRefresh') # time at next scr refresh text_9.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip7Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip7"------- for thisComponent in tip7Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('tip_7.started', tip_7.tStartRefresh) thisExp.addData('tip_7.stopped', tip_7.tStopRefresh) thisExp.addData('text_9.started', text_9.tStartRefresh) thisExp.addData('text_9.stopped', text_9.tStopRefresh) # set up handler to look after randomisation of conditions etc loop9 = data.TrialHandler(nReps=7, method='random', extraInfo=expInfo, originPath=-1, trialList=[None], seed=None, name='loop9') thisExp.addLoop(loop9) # add the loop to the experiment thisLoop9 = loop9.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop9.rgb) if thisLoop9 != None: for paramName in thisLoop9: exec('{} = thisLoop9[paramName]'.format(paramName)) for thisLoop9 in loop9: currentLoop = loop9 # abbreviate parameter names if possible (e.g. rgb = thisLoop9.rgb) if thisLoop9 != None: for paramName in thisLoop9: exec('{} = thisLoop9[paramName]'.format(paramName)) # ------Prepare to start Routine "choice_25years"------- continueRoutine = True # update component parameters for each repeat text9_2.setText(x9) text9_3.setText('1000\n') key_resp25years.keys = [] key_resp25years.rt = [] _key_resp25years_allKeys = [] # keep track of which components have finished choice_25yearsComponents = [concentration9, text9_1, text9_2, text9_3, key_resp25years] for thisComponent in choice_25yearsComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") choice_25yearsClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "choice_25years"------- while continueRoutine: # get current time t = choice_25yearsClock.getTime() tThisFlip = win.getFutureFlipTime(clock=choice_25yearsClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration9* updates if concentration9.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration9.frameNStart = frameN # exact frame index concentration9.tStart = t # local t and not account for scr refresh concentration9.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration9, 'tStartRefresh') # time at next scr refresh concentration9.setAutoDraw(True) if concentration9.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration9.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration9.tStop = t # not accounting for scr refresh concentration9.frameNStop = frameN # exact frame index win.timeOnFlip(concentration9, 'tStopRefresh') # time at next scr refresh concentration9.setAutoDraw(False) # *text9_1* updates if text9_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text9_1.frameNStart = frameN # exact frame index text9_1.tStart = t # local t and not account for scr refresh text9_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text9_1, 'tStartRefresh') # time at next scr refresh text9_1.setAutoDraw(True) # *text9_2* updates if text9_2.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text9_2.frameNStart = frameN # exact frame index text9_2.tStart = t # local t and not account for scr refresh text9_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text9_2, 'tStartRefresh') # time at next scr refresh text9_2.setAutoDraw(True) # *text9_3* updates if text9_3.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text9_3.frameNStart = frameN # exact frame index text9_3.tStart = t # local t and not account for scr refresh text9_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text9_3, 'tStartRefresh') # time at next scr refresh text9_3.setAutoDraw(True) # *key_resp25years* updates waitOnFlip = False if key_resp25years.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp25years.frameNStart = frameN # exact frame index key_resp25years.tStart = t # local t and not account for scr refresh key_resp25years.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp25years, 'tStartRefresh') # time at next scr refresh key_resp25years.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp25years.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp25years.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp25years.status == STARTED and not waitOnFlip: theseKeys = key_resp25years.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp25years_allKeys.extend(theseKeys) if len(_key_resp25years_allKeys): key_resp25years.keys = _key_resp25years_allKeys[-1].name # just the last key pressed key_resp25years.rt = _key_resp25years_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in choice_25yearsComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "choice_25years"------- for thisComponent in choice_25yearsComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop9.addData('concentration9.started', concentration9.tStartRefresh) loop9.addData('concentration9.stopped', concentration9.tStopRefresh) loop9.addData('text9_1.started', text9_1.tStartRefresh) loop9.addData('text9_1.stopped', text9_1.tStopRefresh) loop9.addData('text9_2.started', text9_2.tStartRefresh) loop9.addData('text9_2.stopped', text9_2.tStopRefresh) loop9.addData('text9_3.started', text9_3.tStartRefresh) loop9.addData('text9_3.stopped', text9_3.tStopRefresh) # check responses if key_resp25years.keys in ['', [], None]: # No response was made key_resp25years.keys = None loop9.addData('key_resp25years.keys',key_resp25years.keys) if key_resp25years.keys != None: # we had a response loop9.addData('key_resp25years.rt', key_resp25years.rt) loop9.addData('key_resp25years.started', key_resp25years.tStartRefresh) loop9.addData('key_resp25years.stopped', key_resp25years.tStopRefresh) if 'left'in key_resp25years.keys: z7=x9 x9-=1000/n9 n9*=2 y="即时奖励" if 'right' in key_resp25years.keys: x9+=1000/n9 n9*=2 z7=1000 y="二十五年后的奖励" # the Routine "choice_25years" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "feedback7"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat feedback7_1.setText(y) feedback7_3.setText(z7) # keep track of which components have finished feedback7Components = [feedback7_1, feedback7_2, feedback7_3] for thisComponent in feedback7Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feedback7Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feedback7"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feedback7Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feedback7Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback7_1* updates if feedback7_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback7_1.frameNStart = frameN # exact frame index feedback7_1.tStart = t # local t and not account for scr refresh feedback7_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback7_1, 'tStartRefresh') # time at next scr refresh feedback7_1.setAutoDraw(True) if feedback7_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback7_1.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback7_1.tStop = t # not accounting for scr refresh feedback7_1.frameNStop = frameN # exact frame index win.timeOnFlip(feedback7_1, 'tStopRefresh') # time at next scr refresh feedback7_1.setAutoDraw(False) # *feedback7_2* updates if feedback7_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback7_2.frameNStart = frameN # exact frame index feedback7_2.tStart = t # local t and not account for scr refresh feedback7_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback7_2, 'tStartRefresh') # time at next scr refresh feedback7_2.setAutoDraw(True) if feedback7_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback7_2.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback7_2.tStop = t # not accounting for scr refresh feedback7_2.frameNStop = frameN # exact frame index win.timeOnFlip(feedback7_2, 'tStopRefresh') # time at next scr refresh feedback7_2.setAutoDraw(False) # *feedback7_3* updates if feedback7_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback7_3.frameNStart = frameN # exact frame index feedback7_3.tStart = t # local t and not account for scr refresh feedback7_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback7_3, 'tStartRefresh') # time at next scr refresh feedback7_3.setAutoDraw(True) if feedback7_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback7_3.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later feedback7_3.tStop = t # not accounting for scr refresh feedback7_3.frameNStop = frameN # exact frame index win.timeOnFlip(feedback7_3, 'tStopRefresh') # time at next scr refresh feedback7_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feedback7Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feedback7"------- for thisComponent in feedback7Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop9.addData('feedback7_1.started', feedback7_1.tStartRefresh) loop9.addData('feedback7_1.stopped', feedback7_1.tStopRefresh) loop9.addData('feedback7_2.started', feedback7_2.tStartRefresh) loop9.addData('feedback7_2.stopped', feedback7_2.tStopRefresh) loop9.addData('feedback7_3.started', feedback7_3.tStartRefresh) loop9.addData('feedback7_3.stopped', feedback7_3.tStopRefresh) thisExp.nextEntry() # completed 7 repeats of 'loop9' # ------Prepare to start Routine "thanks"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat # keep track of which components have finished thanksComponents = [text_2] for thisComponent in thanksComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") thanksClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "thanks"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = thanksClock.getTime() tThisFlip = win.getFutureFlipTime(clock=thanksClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text_2* updates if text_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_2.frameNStart = frameN # exact frame index text_2.tStart = t # local t and not account for scr refresh text_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_2, 'tStartRefresh') # time at next scr refresh text_2.setAutoDraw(True) if text_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_2.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later text_2.tStop = t # not accounting for scr refresh text_2.frameNStop = frameN # exact frame index win.timeOnFlip(text_2, 'tStopRefresh') # time at next scr refresh text_2.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in thanksComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "thanks"------- for thisComponent in thanksComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text_2.started', text_2.tStartRefresh) thisExp.addData('text_2.stopped', text_2.tStopRefresh) # Flip one final time so any remaining win.callOnFlip() # and win.timeOnFlip() tasks get executed before quitting win.flip() # these shouldn't be strictly necessary (should auto-save) thisExp.saveAsWideText(filename+'.csv') thisExp.saveAsPickle(filename) logging.flush() # make sure everything is closed down thisExp.abort() # or data files will save again on exit win.close() core.quit()
46.964843
156
0.651243
21,436
177,668
5.290073
0.032189
0.02187
0.014648
0.027337
0.82475
0.794943
0.736556
0.675488
0.56016
0.535195
0
0.035208
0.258561
177,668
3,782
157
46.977261
0.825621
0.263542
0
0.461566
0
0.000358
0.074073
0.010064
0
0
0
0
0
0
null
null
0
0.003933
null
null
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
5710ba6ce61848d2e2c72a408fe84ed3498211b7
582
py
Python
tests/system/test_system.py
MShaffar19/python-spanner-django
62c22b113b470776cddacbab92c4428c6581c551
[ "BSD-3-Clause" ]
null
null
null
tests/system/test_system.py
MShaffar19/python-spanner-django
62c22b113b470776cddacbab92c4428c6581c551
[ "BSD-3-Clause" ]
null
null
null
tests/system/test_system.py
MShaffar19/python-spanner-django
62c22b113b470776cddacbab92c4428c6581c551
[ "BSD-3-Clause" ]
1
2020-10-04T10:04:55.000Z
2020-10-04T10:04:55.000Z
# Copyright 2020 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd import unittest class TestSpannerDjangoDBAPI(unittest.TestCase): def setUp(self): # TODO: Implement this method pass def tearDown(self): # TODO: Implement this method pass def test_api(self): # An dummy stub to avoid `exit code 5` errors # TODO: Replace this with an actual system test method self.assertTrue(True)
25.304348
62
0.678694
81
582
4.864198
0.728395
0.040609
0.086294
0.106599
0.172589
0.172589
0.172589
0
0
0
0
0.011494
0.252577
582
22
63
26.454545
0.894253
0.57732
0
0.25
0
0
0
0
0
0
0
0.045455
0.125
1
0.375
false
0.25
0.125
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
1
0
0
1
0
0
4
571e11fb6f9c6796aa910a47b03da024dcbc9f48
93
py
Python
Assistant/apps.py
gauravdhingra99/English_Grammer_Asssitant
8d4d870ac72cd1c276a45d6348207e2ac22eaf86
[ "MIT" ]
null
null
null
Assistant/apps.py
gauravdhingra99/English_Grammer_Asssitant
8d4d870ac72cd1c276a45d6348207e2ac22eaf86
[ "MIT" ]
7
2020-06-05T20:02:18.000Z
2021-09-22T18:05:11.000Z
Assistant/apps.py
gauravdhingra99/English_Grammer_Asssitant
8d4d870ac72cd1c276a45d6348207e2ac22eaf86
[ "MIT" ]
2
2019-12-04T10:19:38.000Z
2020-11-06T06:32:52.000Z
from django.apps import AppConfig class AssistantConfig(AppConfig): name = 'Assistant'
15.5
33
0.763441
10
93
7.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.16129
93
5
34
18.6
0.910256
0
0
0
0
0
0.096774
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
93953094b486a3a4aa608b58ff9068f17dbe49b1
200
py
Python
service/service_management/doctype/workshop/test_workshop.py
jcbangquilcpa/service
22f232da44c8fbe0c61d6eb31ebfeae70e8aa195
[ "MIT" ]
4
2016-09-07T05:23:33.000Z
2016-12-07T14:09:28.000Z
service/service_management/doctype/workshop/test_workshop.py
osstechnolab/service
22f232da44c8fbe0c61d6eb31ebfeae70e8aa195
[ "MIT" ]
9
2016-09-03T05:15:29.000Z
2016-10-01T02:21:11.000Z
service/service_management/doctype/workshop/test_workshop.py
osslabph/service
22f232da44c8fbe0c61d6eb31ebfeae70e8aa195
[ "MIT" ]
5
2017-04-15T00:19:20.000Z
2018-02-08T14:27:15.000Z
# Copyright (c) 2013, www.ossph.com and Contributors # See license.txt import frappe import unittest test_records = frappe.get_test_records('Workshop') class TestWorkshop(unittest.TestCase): pass
18.181818
52
0.79
27
200
5.740741
0.814815
0.141935
0
0
0
0
0
0
0
0
0
0.022727
0.12
200
10
53
20
0.857955
0.33
0
0
0
0
0.061069
0
0
0
0
0
0
1
0
false
0.2
0.4
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
4
93c13a5ea7ab139cc2a965c7adbf97f985ec98fd
158
py
Python
app/api.py
pvamshi/pandas-web
86d2cbd4f64ebdf2afa611114afdd7c3f93501d6
[ "Apache-2.0" ]
null
null
null
app/api.py
pvamshi/pandas-web
86d2cbd4f64ebdf2afa611114afdd7c3f93501d6
[ "Apache-2.0" ]
1
2018-08-19T05:13:26.000Z
2018-12-24T07:11:55.000Z
app/api.py
pvamshi/pandas-web
86d2cbd4f64ebdf2afa611114afdd7c3f93501d6
[ "Apache-2.0" ]
null
null
null
from flask_restplus import Api api = Api(version='1.0', title='My Blog API', description='A simple demonstration of a Flask RestPlus powered API')
31.6
79
0.71519
24
158
4.666667
0.708333
0.232143
0
0
0
0
0
0
0
0
0
0.015625
0.189873
158
4
80
39.5
0.859375
0
0
0
0
0
0.43038
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
93cd9dc5ed553b5a78d90e5ed25a172c39c5c008
980
py
Python
armi/bookkeeping/tests/__init__.py
keckler/armi
b5f95b4795aa21e00fd6786f6994862a4bdccb16
[ "Apache-2.0" ]
162
2019-11-01T17:35:58.000Z
2022-03-18T04:22:39.000Z
armi/bookkeeping/tests/__init__.py
keckler/armi
b5f95b4795aa21e00fd6786f6994862a4bdccb16
[ "Apache-2.0" ]
315
2019-11-01T17:32:05.000Z
2022-03-30T03:51:42.000Z
armi/bookkeeping/tests/__init__.py
keckler/armi
b5f95b4795aa21e00fd6786f6994862a4bdccb16
[ "Apache-2.0" ]
55
2019-11-01T16:59:59.000Z
2022-03-25T18:19:06.000Z
# Copyright 2019 TerraPower, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Bookkeeping test package. This may seem a little bit over-engineered, but the jupyter notebooks that get run by the test_historyTracker are also used in the documentation system, so providing a list of related files from this package is useful. Also, these are organized like this to prevent having to import the world just to get something like a list of strings. """ from ._constants import *
40.833333
86
0.77449
156
980
4.852564
0.647436
0.07926
0.034346
0.042272
0
0
0
0
0
0
0
0.009852
0.171429
980
23
87
42.608696
0.922414
0.937755
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
93cf163a28cd5b6a299a834c6f313ebdff01989b
108
py
Python
dmm/controllers/v86d/__init__.py
tienlocnguyen/dmm
e7e2b9f959543990f851cea0b7a83a805d3913a5
[ "MIT" ]
null
null
null
dmm/controllers/v86d/__init__.py
tienlocnguyen/dmm
e7e2b9f959543990f851cea0b7a83a805d3913a5
[ "MIT" ]
null
null
null
dmm/controllers/v86d/__init__.py
tienlocnguyen/dmm
e7e2b9f959543990f851cea0b7a83a805d3913a5
[ "MIT" ]
null
null
null
__all__ = ["V86DController", "V86DData"] from .controller import V86DController from .data import V86DData
21.6
40
0.787037
11
108
7.363636
0.636364
0
0
0
0
0
0
0
0
0
0
0.084211
0.12037
108
4
41
27
0.768421
0
0
0
0
0
0.203704
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
93d009d8af897aee753c3ba46a825df3a76d78a7
193
py
Python
tests/test_functions.py
PanDaHeXu/lambdata-pandahexu3.1.2
b1761ef874cfe68f7fb0ef07775e8b667d1485e5
[ "MIT" ]
null
null
null
tests/test_functions.py
PanDaHeXu/lambdata-pandahexu3.1.2
b1761ef874cfe68f7fb0ef07775e8b667d1485e5
[ "MIT" ]
null
null
null
tests/test_functions.py
PanDaHeXu/lambdata-pandahexu3.1.2
b1761ef874cfe68f7fb0ef07775e8b667d1485e5
[ "MIT" ]
null
null
null
import pytest from helper_functions.functions import ListFunction def test_df_length(list_to_add, df): list_to_add = test_list df = test_df assert(len(list_to_add) == df.shape[0])
24.125
51
0.756477
32
193
4.21875
0.53125
0.133333
0.2
0.162963
0
0
0
0
0
0
0
0.006173
0.160622
193
7
52
27.571429
0.82716
0
0
0
0
0
0
0
0
0
0
0
0.166667
1
0.166667
false
0
0.333333
0
0.5
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
93d5152b6f319fa8b08cd87b192491e7c5788e34
66
py
Python
lambda.py
luaneyed/bus
22cbf6f3d5eb0d10eebb71b99c660d2a589bba1d
[ "MIT" ]
1
2018-04-15T13:29:35.000Z
2018-04-15T13:29:35.000Z
lambda.py
luaneyed/bus
22cbf6f3d5eb0d10eebb71b99c660d2a589bba1d
[ "MIT" ]
1
2018-04-18T13:10:48.000Z
2018-04-18T13:10:48.000Z
lambda.py
luaneyed/bus
22cbf6f3d5eb0d10eebb71b99c660d2a589bba1d
[ "MIT" ]
null
null
null
from app import run def handler(event, context): run(False)
11
28
0.69697
10
66
4.6
0.9
0
0
0
0
0
0
0
0
0
0
0
0.212121
66
5
29
13.2
0.884615
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
0
0
0
4
93f75c676d55f945e66e26f7508eebde837f3493
193
py
Python
pytwitter/__init__.py
MerleLiuKun/python-twitter
b3f7d93e006945cbc7baa5852e90ca2b4c93eac4
[ "MIT" ]
null
null
null
pytwitter/__init__.py
MerleLiuKun/python-twitter
b3f7d93e006945cbc7baa5852e90ca2b4c93eac4
[ "MIT" ]
null
null
null
pytwitter/__init__.py
MerleLiuKun/python-twitter
b3f7d93e006945cbc7baa5852e90ca2b4c93eac4
[ "MIT" ]
null
null
null
__version__ = "0.7.1" from .api import Api from .streaming import StreamApi from .rate_limit import RateLimit, RateLimitData from .error import PyTwitterError, PythonTwitterDeprecationWarning
27.571429
66
0.829016
23
193
6.73913
0.695652
0
0
0
0
0
0
0
0
0
0
0.017544
0.11399
193
6
67
32.166667
0.888889
0
0
0
0
0
0.025907
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
93fd88d96b5a80bc0f999fff43b90006f1ad5c78
54
py
Python
hvplot/dask.py
dhermes/hvplot
884313d03438568f007984223a0cc33ecf1f2659
[ "BSD-3-Clause" ]
null
null
null
hvplot/dask.py
dhermes/hvplot
884313d03438568f007984223a0cc33ecf1f2659
[ "BSD-3-Clause" ]
null
null
null
hvplot/dask.py
dhermes/hvplot
884313d03438568f007984223a0cc33ecf1f2659
[ "BSD-3-Clause" ]
1
2020-06-09T16:30:21.000Z
2020-06-09T16:30:21.000Z
from . import patch patch('dask', extension='bokeh')
13.5
32
0.703704
7
54
5.428571
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.12963
54
3
33
18
0.808511
0
0
0
0
0
0.166667
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
f51e6221f6a83a383912ab7bfa560dfa6ce6215c
44
py
Python
python/origen/origen/utility/__init__.py
Origen-SDK/o2
5b0f9a6d113ddebc73c7ee224931e8b2d0301794
[ "MIT" ]
null
null
null
python/origen/origen/utility/__init__.py
Origen-SDK/o2
5b0f9a6d113ddebc73c7ee224931e8b2d0301794
[ "MIT" ]
127
2019-11-23T17:09:35.000Z
2021-09-02T11:06:20.000Z
python/origen/origen/utility/__init__.py
Origen-SDK/o2
5b0f9a6d113ddebc73c7ee224931e8b2d0301794
[ "MIT" ]
null
null
null
import _origen exec = _origen.utility.exec
11
27
0.795455
6
44
5.5
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.136364
44
3
28
14.666667
0.868421
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
f594a32c1304c9522e17a9969949434d2e31464a
68
py
Python
py/source/__init__.py
paste-lib/paste-template
4531a3c8ea28411324281ab2f223ddcc10e1744c
[ "MIT" ]
1
2020-02-05T04:55:10.000Z
2020-02-05T04:55:10.000Z
py/source/__init__.py
paste-lib/paste-template
4531a3c8ea28411324281ab2f223ddcc10e1744c
[ "MIT" ]
null
null
null
py/source/__init__.py
paste-lib/paste-template
4531a3c8ea28411324281ab2f223ddcc10e1744c
[ "MIT" ]
null
null
null
from . import PasteJinjaExtension __all__ = ['PasteJinjaExtension']
22.666667
33
0.808824
5
68
10.2
0.8
0
0
0
0
0
0
0
0
0
0
0
0.102941
68
3
34
22.666667
0.836066
0
0
0
0
0
0.275362
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
191b58ec5a7a10caf5a0c579d005d3defd2394ff
143
py
Python
functions/Grey.py
tylerrussin/Road-Line_Detection
c2214907f47a2389c9cc4618962f308ad4309823
[ "MIT" ]
null
null
null
functions/Grey.py
tylerrussin/Road-Line_Detection
c2214907f47a2389c9cc4618962f308ad4309823
[ "MIT" ]
null
null
null
functions/Grey.py
tylerrussin/Road-Line_Detection
c2214907f47a2389c9cc4618962f308ad4309823
[ "MIT" ]
null
null
null
import cv2 def grey(image): # Processing to Grayscale (simpiler data) image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) return image
23.833333
51
0.72028
19
143
5.368421
0.736842
0.156863
0
0
0
0
0
0
0
0
0
0.034783
0.195804
143
6
52
23.833333
0.852174
0.272727
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
197517b9b33e02d1acc3fd354cf01ae655c13b9a
142
py
Python
gui/__init__.py
Tingerlink/peak_detection
6a540f68b1ae057ff5d89cfcf7dd0d497f6c494c
[ "MIT" ]
1
2021-12-22T12:53:29.000Z
2021-12-22T12:53:29.000Z
gui/__init__.py
Tingerlink/peak_detection
6a540f68b1ae057ff5d89cfcf7dd0d497f6c494c
[ "MIT" ]
null
null
null
gui/__init__.py
Tingerlink/peak_detection
6a540f68b1ae057ff5d89cfcf7dd0d497f6c494c
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Module '__init__.py' of the project 'qt' # :date_create: 17.12.2017.4:46 # :author: Tingerlink # :description:
23.666667
43
0.626761
20
142
4.2
1
0
0
0
0
0
0
0
0
0
0
0.102564
0.176056
142
5
44
28.4
0.615385
0.887324
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
19a1d2823df8e3039066637a204707c3cb416d8c
70
py
Python
system/ccs/python/start.py
showkeyjar/TruckCamper
6c1838648885dc5cc17b9ca3b16cd15c24e85dba
[ "MIT" ]
1
2018-01-02T14:19:35.000Z
2018-01-02T14:19:35.000Z
system/ccs/python/start.py
showkeyjar/TruckCamper
6c1838648885dc5cc17b9ca3b16cd15c24e85dba
[ "MIT" ]
null
null
null
system/ccs/python/start.py
showkeyjar/TruckCamper
6c1838648885dc5cc17b9ca3b16cd15c24e85dba
[ "MIT" ]
null
null
null
# extend homeassistant # https://home-assistant.io/getting-started/
14
44
0.757143
8
70
6.625
1
0
0
0
0
0
0
0
0
0
0
0
0.1
70
4
45
17.5
0.84127
0.9
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
2705d5a9cfd3f1e93c240b208fe74066eb150f10
148
py
Python
sorting/insertion_sort.py
isaiahnields/algorithms
065b95a007dab3f5e375e73a681e7a6e344b41f1
[ "MIT" ]
null
null
null
sorting/insertion_sort.py
isaiahnields/algorithms
065b95a007dab3f5e375e73a681e7a6e344b41f1
[ "MIT" ]
null
null
null
sorting/insertion_sort.py
isaiahnields/algorithms
065b95a007dab3f5e375e73a681e7a6e344b41f1
[ "MIT" ]
null
null
null
from generate import list def insertion_sort(l): for i in range(len(l)): t = l[i] j = 0 while j < i: pass
14.8
27
0.47973
23
148
3.043478
0.782609
0
0
0
0
0
0
0
0
0
0
0.011765
0.425676
148
9
28
16.444444
0.811765
0
0
0
1
0
0
0
0
0
0
0
0
1
0.142857
false
0.142857
0.142857
0
0.285714
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
27216a15c94f93b079142970fcbdf5259898d461
98
py
Python
gym-game2048/setup.py
gingkg/paly_2048_gym_by_RL
3e5043169e637818ecae8f83688ffe52897e860f
[ "Apache-2.0" ]
1
2020-07-25T11:53:12.000Z
2020-07-25T11:53:12.000Z
gym-game2048/setup.py
gingkg/paly_2048_gym_by_RL
3e5043169e637818ecae8f83688ffe52897e860f
[ "Apache-2.0" ]
null
null
null
gym-game2048/setup.py
gingkg/paly_2048_gym_by_RL
3e5043169e637818ecae8f83688ffe52897e860f
[ "Apache-2.0" ]
1
2021-11-30T13:12:41.000Z
2021-11-30T13:12:41.000Z
from setuptools import setup setup(name="gym_game2048", version="0.1", install_requires=["gym"])
24.5
67
0.755102
14
98
5.142857
0.857143
0
0
0
0
0
0
0
0
0
0
0.066667
0.081633
98
3
68
32.666667
0.733333
0
0
0
0
0
0.183673
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
274d6d28fd81e2d78e2d02787156b9a9dc5a4ddc
185
py
Python
synthetizer/__init__.py
arkhn/okapy
bc7ceab169ce0da0fce5c84ca8e1559a8bac7e05
[ "Apache-2.0" ]
null
null
null
synthetizer/__init__.py
arkhn/okapy
bc7ceab169ce0da0fce5c84ca8e1559a8bac7e05
[ "Apache-2.0" ]
10
2021-11-03T12:52:55.000Z
2021-11-17T16:02:54.000Z
synthetizer/__init__.py
arkhn/okapy
bc7ceab169ce0da0fce5c84ca8e1559a8bac7e05
[ "Apache-2.0" ]
null
null
null
from .anonymize import anonymize from .fetch import fetch from .main import anonymization_pipeline from .metadata import RESOURCE_NAMES from .preprocess import preprocess_sampling_data
30.833333
48
0.864865
24
185
6.5
0.541667
0
0
0
0
0
0
0
0
0
0
0
0.108108
185
5
49
37
0.945455
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
27bf966a59280298c9ddbf9a250a67b006146789
133
py
Python
events/events.py
AJTopisano/pHbot
ecedcbf4e4ae87187562ca915da128220bdb7131
[ "MIT" ]
1
2021-01-12T09:03:05.000Z
2021-01-12T09:03:05.000Z
events/events.py
AJTopisano/pHbot
ecedcbf4e4ae87187562ca915da128220bdb7131
[ "MIT" ]
4
2021-01-12T10:53:32.000Z
2021-01-13T06:43:17.000Z
events/events.py
AJTopisano/pHbot
ecedcbf4e4ae87187562ca915da128220bdb7131
[ "MIT" ]
null
null
null
from loguru import logger from client import client as client @client.event async def on_ready(): logger.info("PyBot is ready")
19
35
0.759398
21
133
4.761905
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.165414
133
7
36
19
0.900901
0
0
0
0
0
0.104478
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
27c44a64c19b420f0a7e0fa57266b60c9404ca78
237
py
Python
commontail/apps.py
einsfr/commontail
a7421b7aac89dead7e4f7e0da0dff317157c3fea
[ "MIT" ]
null
null
null
commontail/apps.py
einsfr/commontail
a7421b7aac89dead7e4f7e0da0dff317157c3fea
[ "MIT" ]
null
null
null
commontail/apps.py
einsfr/commontail
a7421b7aac89dead7e4f7e0da0dff317157c3fea
[ "MIT" ]
null
null
null
from django.apps import AppConfig class CommonConfig(AppConfig): name = 'commontail' def ready(self): from commontail.signals import register_cache_aware_signal_handlers register_cache_aware_signal_handlers()
21.545455
75
0.759494
27
237
6.37037
0.666667
0.151163
0.209302
0.27907
0.372093
0
0
0
0
0
0
0
0.185654
237
10
76
23.7
0.891192
0
0
0
0
0
0.042194
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.833333
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
7e06defd34591318b21c3e3b2661496d73416928
5,062
py
Python
ooobuild/cssdyn/animations/__init__.py
Amourspirit/ooo_uno_tmpl
64e0c86fd68f24794acc22d63d8d32ae05dd12b8
[ "Apache-2.0" ]
null
null
null
ooobuild/cssdyn/animations/__init__.py
Amourspirit/ooo_uno_tmpl
64e0c86fd68f24794acc22d63d8d32ae05dd12b8
[ "Apache-2.0" ]
null
null
null
ooobuild/cssdyn/animations/__init__.py
Amourspirit/ooo_uno_tmpl
64e0c86fd68f24794acc22d63d8d32ae05dd12b8
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http: // www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from ...dyn.animations.animate_color import AnimateColor as AnimateColor from ...dyn.animations.animate_motion import AnimateMotion as AnimateMotion from ...dyn.animations.animate_physics import AnimatePhysics as AnimatePhysics from ...dyn.animations.animate_set import AnimateSet as AnimateSet from ...dyn.animations.animation_additive_mode import AnimationAdditiveMode as AnimationAdditiveMode from ...dyn.animations.animation_additive_mode import AnimationAdditiveModeEnum as AnimationAdditiveModeEnum from ...dyn.animations.animation_calc_mode import AnimationCalcMode as AnimationCalcMode from ...dyn.animations.animation_calc_mode import AnimationCalcModeEnum as AnimationCalcModeEnum from ...dyn.animations.animation_color_space import AnimationColorSpace as AnimationColorSpace from ...dyn.animations.animation_color_space import AnimationColorSpaceEnum as AnimationColorSpaceEnum from ...dyn.animations.animation_end_sync import AnimationEndSync as AnimationEndSync from ...dyn.animations.animation_end_sync import AnimationEndSyncEnum as AnimationEndSyncEnum from ...dyn.animations.animation_fill import AnimationFill as AnimationFill from ...dyn.animations.animation_fill import AnimationFillEnum as AnimationFillEnum from ...dyn.animations.animation_node_type import AnimationNodeType as AnimationNodeType from ...dyn.animations.animation_node_type import AnimationNodeTypeEnum as AnimationNodeTypeEnum from ...dyn.animations.animation_restart import AnimationRestart as AnimationRestart from ...dyn.animations.animation_restart import AnimationRestartEnum as AnimationRestartEnum from ...dyn.animations.animation_transform_type import AnimationTransformType as AnimationTransformType from ...dyn.animations.animation_transform_type import AnimationTransformTypeEnum as AnimationTransformTypeEnum from ...dyn.animations.animation_value_type import AnimationValueType as AnimationValueType from ...dyn.animations.animation_value_type import AnimationValueTypeEnum as AnimationValueTypeEnum from ...dyn.animations.audio import Audio as Audio from ...dyn.animations.command import Command as Command from ...dyn.animations.event import Event as Event from ...dyn.animations.event_trigger import EventTrigger as EventTrigger from ...dyn.animations.event_trigger import EventTriggerEnum as EventTriggerEnum from ...dyn.animations.iterate_container import IterateContainer as IterateContainer from ...dyn.animations.parallel_time_container import ParallelTimeContainer as ParallelTimeContainer from ...dyn.animations.sequence_time_container import SequenceTimeContainer as SequenceTimeContainer from ...dyn.animations.target_properties import TargetProperties as TargetProperties from ...dyn.animations.time_filter_pair import TimeFilterPair as TimeFilterPair from ...dyn.animations.timing import Timing as Timing from ...dyn.animations.transition_sub_type import TransitionSubType as TransitionSubType from ...dyn.animations.transition_sub_type import TransitionSubTypeEnum as TransitionSubTypeEnum from ...dyn.animations.transition_type import TransitionType as TransitionType from ...dyn.animations.transition_type import TransitionTypeEnum as TransitionTypeEnum from ...dyn.animations.value_pair import ValuePair as ValuePair from ...dyn.animations.x_animate import XAnimate as XAnimate from ...dyn.animations.x_animate_color import XAnimateColor as XAnimateColor from ...dyn.animations.x_animate_motion import XAnimateMotion as XAnimateMotion from ...dyn.animations.x_animate_physics import XAnimatePhysics as XAnimatePhysics from ...dyn.animations.x_animate_set import XAnimateSet as XAnimateSet from ...dyn.animations.x_animate_transform import XAnimateTransform as XAnimateTransform from ...dyn.animations.x_animation_listener import XAnimationListener as XAnimationListener from ...dyn.animations.x_animation_node import XAnimationNode as XAnimationNode from ...dyn.animations.x_animation_node_supplier import XAnimationNodeSupplier as XAnimationNodeSupplier from ...dyn.animations.x_audio import XAudio as XAudio from ...dyn.animations.x_command import XCommand as XCommand from ...dyn.animations.x_iterate_container import XIterateContainer as XIterateContainer from ...dyn.animations.x_parallel_time_container import XParallelTimeContainer as XParallelTimeContainer from ...dyn.animations.x_time_container import XTimeContainer as XTimeContainer from ...dyn.animations.x_transition_filter import XTransitionFilter as XTransitionFilter
72.314286
111
0.854998
601
5,062
7.064892
0.262895
0.087376
0.2122
0.110221
0.281441
0.239755
0.155911
0
0
0
0
0.00194
0.083761
5,062
69
112
73.362319
0.91354
0.113789
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
fd7cd9fffdcf73730805e6ab9ec06948e128e49d
81
py
Python
app.py
MrKangs/Live_Music_Lyrics_Translator
dc06d4b1798133a6050335d6508165c60381cca8
[ "MIT" ]
null
null
null
app.py
MrKangs/Live_Music_Lyrics_Translator
dc06d4b1798133a6050335d6508165c60381cca8
[ "MIT" ]
null
null
null
app.py
MrKangs/Live_Music_Lyrics_Translator
dc06d4b1798133a6050335d6508165c60381cca8
[ "MIT" ]
1
2021-11-23T00:18:38.000Z
2021-11-23T00:18:38.000Z
import subprocess subprocess.call("python src\Selection_Screen.py", shell=True)
20.25
61
0.814815
11
81
5.909091
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.074074
81
3
62
27
0.866667
0
0
0
0
0
0.37037
0.283951
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
fd7f3df7eb6cc79e627a98c474754ee50825a45b
69
py
Python
venv/Lib/site-packages/altair/vegalite/schema.py
ajayiagbebaku/NFL-Model
afcc67a85ca7138c58c3334d45988ada2da158ed
[ "MIT" ]
6,831
2016-09-23T19:35:19.000Z
2022-03-31T13:29:39.000Z
venv/Lib/site-packages/altair/vegalite/schema.py
ajayiagbebaku/NFL-Model
afcc67a85ca7138c58c3334d45988ada2da158ed
[ "MIT" ]
2,068
2016-09-23T14:53:23.000Z
2022-03-31T01:43:15.000Z
venv/Lib/site-packages/altair/vegalite/schema.py
ajayiagbebaku/NFL-Model
afcc67a85ca7138c58c3334d45988ada2da158ed
[ "MIT" ]
711
2016-09-26T16:59:18.000Z
2022-03-24T11:32:40.000Z
"""Altair schema wrappers""" # flake8: noqa from .v4.schema import *
17.25
28
0.695652
9
69
5.333333
0.888889
0
0
0
0
0
0
0
0
0
0
0.033898
0.144928
69
3
29
23
0.779661
0.521739
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
fd965fd38eda25dea0db52065454e42b311f6177
23,025
py
Python
tensorflow_checkpoint_reader/pb/tensorflow/core/protobuf/autotuning_pb2.py
shawwn/tensorflow-checkpoint-reader
f0e65548411e3bd66a07e36bb1850907a05952d0
[ "MIT" ]
1
2021-12-02T15:06:09.000Z
2021-12-02T15:06:09.000Z
tensorflow_checkpoint_reader/pb/tensorflow/core/protobuf/autotuning_pb2.py
shawwn/tensorflow-checkpoint-reader
f0e65548411e3bd66a07e36bb1850907a05952d0
[ "MIT" ]
null
null
null
tensorflow_checkpoint_reader/pb/tensorflow/core/protobuf/autotuning_pb2.py
shawwn/tensorflow-checkpoint-reader
f0e65548411e3bd66a07e36bb1850907a05952d0
[ "MIT" ]
null
null
null
'Generated protocol buffer code.' from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database _sym_db = _symbol_database.Default() from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 DESCRIPTOR = _descriptor.FileDescriptor(name='tensorflow/core/protobuf/autotuning.proto', package='tensorflow', syntax='proto3', serialized_options=b'ZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto', create_key=_descriptor._internal_create_key, serialized_pb=b'\n)tensorflow/core/protobuf/autotuning.proto\x12\ntensorflow\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto";\n\x0cCudnnVersion\x12\r\n\x05major\x18\x01 \x01(\x05\x12\r\n\x05minor\x18\x02 \x01(\x05\x12\r\n\x05patch\x18\x03 \x01(\x05"1\n\x11ComputeCapability\x12\r\n\x05major\x18\x01 \x01(\x05\x12\r\n\x05minor\x18\x02 \x01(\x05"\xc9\x06\n\x0eAutotuneResult\x12\x15\n\rscratch_bytes\x18\x08 \x01(\x03\x12+\n\x08run_time\x18\t \x01(\x0b2\x19.google.protobuf.Duration\x129\n\x07failure\x18\x07 \x01(\x0b2(.tensorflow.AutotuneResult.FailureResult\x122\n\x04conv\x18\x05 \x01(\x0b2".tensorflow.AutotuneResult.ConvKeyH\x00\x122\n\x04gemm\x18\x06 \x01(\x0b2".tensorflow.AutotuneResult.GemmKeyH\x00\x12D\n\x0ecuda_conv_plan\x18\x0f \x01(\x0b2*.tensorflow.AutotuneResult.CudaConvPlanKeyH\x00\x1a\xbd\x02\n\rFailureResult\x124\n\x04kind\x18\x01 \x01(\x0e2&.tensorflow.AutotuneResult.FailureKind\x12\x0b\n\x03msg\x18\x02 \x01(\t\x12<\n\x0ereference_conv\x18\x0b \x01(\x0b2".tensorflow.AutotuneResult.ConvKeyH\x00\x12<\n\x0ereference_gemm\x18\x0c \x01(\x0b2".tensorflow.AutotuneResult.GemmKeyH\x00\x12N\n\x18reference_cuda_conv_plan\x18\x0e \x01(\x0b2*.tensorflow.AutotuneResult.CudaConvPlanKeyH\x00\x12\x16\n\x0ebuffer_address\x18\r \x01(\x03B\x05\n\x03key\x1a8\n\x07ConvKey\x12\x11\n\talgorithm\x18\x01 \x01(\x03\x12\x1a\n\x12tensor_ops_enabled\x18\x02 \x01(\x08\x1a\x1c\n\x07GemmKey\x12\x11\n\talgorithm\x18\x01 \x01(\x03\x1a\'\n\x0fCudaConvPlanKey\x12\x14\n\x0cexec_plan_id\x18\x01 \x01(\t"B\n\x0bFailureKind\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x14\n\x10REDZONE_MODIFIED\x10\x01\x12\x10\n\x0cWRONG_RESULT\x10\x02B\x05\n\x03key"\xfe\x01\n\rAutotuningLog\x12#\n\x05instr\x18\x01 \x01(\x0b2\x14.google.protobuf.Any\x12+\n\x07results\x18\x02 \x03(\x0b2\x1a.tensorflow.AutotuneResult\x12/\n\rcudnn_version\x18\x03 \x01(\x0b2\x18.tensorflow.CudnnVersion\x129\n\x12compute_capability\x18\x04 \x01(\x0b2\x1d.tensorflow.ComputeCapability\x12\x19\n\x11device_pci_bus_id\x18\x05 \x01(\t\x12\x14\n\x0cblas_version\x18\x06 \x01(\tBWZUgithub.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_protob\x06proto3', dependencies=[google_dot_protobuf_dot_any__pb2.DESCRIPTOR, google_dot_protobuf_dot_duration__pb2.DESCRIPTOR]) _AUTOTUNERESULT_FAILUREKIND = _descriptor.EnumDescriptor(name='FailureKind', full_name='tensorflow.AutotuneResult.FailureKind', filename=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key, values=[_descriptor.EnumValueDescriptor(name='UNKNOWN', index=0, number=0, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor(name='REDZONE_MODIFIED', index=1, number=1, serialized_options=None, type=None, create_key=_descriptor._internal_create_key), _descriptor.EnumValueDescriptor(name='WRONG_RESULT', index=2, number=2, serialized_options=None, type=None, create_key=_descriptor._internal_create_key)], containing_type=None, serialized_options=None, serialized_start=997, serialized_end=1063) _sym_db.RegisterEnumDescriptor(_AUTOTUNERESULT_FAILUREKIND) _CUDNNVERSION = _descriptor.Descriptor(name='CudnnVersion', full_name='tensorflow.CudnnVersion', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='major', full_name='tensorflow.CudnnVersion.major', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='minor', full_name='tensorflow.CudnnVersion.minor', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='patch', full_name='tensorflow.CudnnVersion.patch', index=2, number=3, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[], serialized_start=116, serialized_end=175) _COMPUTECAPABILITY = _descriptor.Descriptor(name='ComputeCapability', full_name='tensorflow.ComputeCapability', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='major', full_name='tensorflow.ComputeCapability.major', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='minor', full_name='tensorflow.ComputeCapability.minor', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[], serialized_start=177, serialized_end=226) _AUTOTUNERESULT_FAILURERESULT = _descriptor.Descriptor(name='FailureResult', full_name='tensorflow.AutotuneResult.FailureResult', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='kind', full_name='tensorflow.AutotuneResult.FailureResult.kind', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='msg', full_name='tensorflow.AutotuneResult.FailureResult.msg', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b''.decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='reference_conv', full_name='tensorflow.AutotuneResult.FailureResult.reference_conv', index=2, number=11, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='reference_gemm', full_name='tensorflow.AutotuneResult.FailureResult.reference_gemm', index=3, number=12, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='reference_cuda_conv_plan', full_name='tensorflow.AutotuneResult.FailureResult.reference_cuda_conv_plan', index=4, number=14, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='buffer_address', full_name='tensorflow.AutotuneResult.FailureResult.buffer_address', index=5, number=13, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[_descriptor.OneofDescriptor(name='key', full_name='tensorflow.AutotuneResult.FailureResult.key', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[])], serialized_start=549, serialized_end=866) _AUTOTUNERESULT_CONVKEY = _descriptor.Descriptor(name='ConvKey', full_name='tensorflow.AutotuneResult.ConvKey', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='algorithm', full_name='tensorflow.AutotuneResult.ConvKey.algorithm', index=0, number=1, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='tensor_ops_enabled', full_name='tensorflow.AutotuneResult.ConvKey.tensor_ops_enabled', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[], serialized_start=868, serialized_end=924) _AUTOTUNERESULT_GEMMKEY = _descriptor.Descriptor(name='GemmKey', full_name='tensorflow.AutotuneResult.GemmKey', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='algorithm', full_name='tensorflow.AutotuneResult.GemmKey.algorithm', index=0, number=1, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[], serialized_start=926, serialized_end=954) _AUTOTUNERESULT_CUDACONVPLANKEY = _descriptor.Descriptor(name='CudaConvPlanKey', full_name='tensorflow.AutotuneResult.CudaConvPlanKey', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='exec_plan_id', full_name='tensorflow.AutotuneResult.CudaConvPlanKey.exec_plan_id', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b''.decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[], serialized_start=956, serialized_end=995) _AUTOTUNERESULT = _descriptor.Descriptor(name='AutotuneResult', full_name='tensorflow.AutotuneResult', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='scratch_bytes', full_name='tensorflow.AutotuneResult.scratch_bytes', index=0, number=8, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='run_time', full_name='tensorflow.AutotuneResult.run_time', index=1, number=9, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='failure', full_name='tensorflow.AutotuneResult.failure', index=2, number=7, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='conv', full_name='tensorflow.AutotuneResult.conv', index=3, number=5, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='gemm', full_name='tensorflow.AutotuneResult.gemm', index=4, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='cuda_conv_plan', full_name='tensorflow.AutotuneResult.cuda_conv_plan', index=5, number=15, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[_AUTOTUNERESULT_FAILURERESULT, _AUTOTUNERESULT_CONVKEY, _AUTOTUNERESULT_GEMMKEY, _AUTOTUNERESULT_CUDACONVPLANKEY], enum_types=[_AUTOTUNERESULT_FAILUREKIND], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[_descriptor.OneofDescriptor(name='key', full_name='tensorflow.AutotuneResult.key', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[])], serialized_start=229, serialized_end=1070) _AUTOTUNINGLOG = _descriptor.Descriptor(name='AutotuningLog', full_name='tensorflow.AutotuningLog', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='instr', full_name='tensorflow.AutotuningLog.instr', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='results', full_name='tensorflow.AutotuningLog.results', index=1, number=2, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='cudnn_version', full_name='tensorflow.AutotuningLog.cudnn_version', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='compute_capability', full_name='tensorflow.AutotuningLog.compute_capability', index=3, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='device_pci_bus_id', full_name='tensorflow.AutotuningLog.device_pci_bus_id', index=4, number=5, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b''.decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='blas_version', full_name='tensorflow.AutotuningLog.blas_version', index=5, number=6, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b''.decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[], serialized_start=1073, serialized_end=1327) _AUTOTUNERESULT_FAILURERESULT.fields_by_name['kind'].enum_type = _AUTOTUNERESULT_FAILUREKIND _AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_conv'].message_type = _AUTOTUNERESULT_CONVKEY _AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_gemm'].message_type = _AUTOTUNERESULT_GEMMKEY _AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_cuda_conv_plan'].message_type = _AUTOTUNERESULT_CUDACONVPLANKEY _AUTOTUNERESULT_FAILURERESULT.containing_type = _AUTOTUNERESULT _AUTOTUNERESULT_FAILURERESULT.oneofs_by_name['key'].fields.append(_AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_conv']) _AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_conv'].containing_oneof = _AUTOTUNERESULT_FAILURERESULT.oneofs_by_name['key'] _AUTOTUNERESULT_FAILURERESULT.oneofs_by_name['key'].fields.append(_AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_gemm']) _AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_gemm'].containing_oneof = _AUTOTUNERESULT_FAILURERESULT.oneofs_by_name['key'] _AUTOTUNERESULT_FAILURERESULT.oneofs_by_name['key'].fields.append(_AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_cuda_conv_plan']) _AUTOTUNERESULT_FAILURERESULT.fields_by_name['reference_cuda_conv_plan'].containing_oneof = _AUTOTUNERESULT_FAILURERESULT.oneofs_by_name['key'] _AUTOTUNERESULT_CONVKEY.containing_type = _AUTOTUNERESULT _AUTOTUNERESULT_GEMMKEY.containing_type = _AUTOTUNERESULT _AUTOTUNERESULT_CUDACONVPLANKEY.containing_type = _AUTOTUNERESULT _AUTOTUNERESULT.fields_by_name['run_time'].message_type = google_dot_protobuf_dot_duration__pb2._DURATION _AUTOTUNERESULT.fields_by_name['failure'].message_type = _AUTOTUNERESULT_FAILURERESULT _AUTOTUNERESULT.fields_by_name['conv'].message_type = _AUTOTUNERESULT_CONVKEY _AUTOTUNERESULT.fields_by_name['gemm'].message_type = _AUTOTUNERESULT_GEMMKEY _AUTOTUNERESULT.fields_by_name['cuda_conv_plan'].message_type = _AUTOTUNERESULT_CUDACONVPLANKEY _AUTOTUNERESULT_FAILUREKIND.containing_type = _AUTOTUNERESULT _AUTOTUNERESULT.oneofs_by_name['key'].fields.append(_AUTOTUNERESULT.fields_by_name['conv']) _AUTOTUNERESULT.fields_by_name['conv'].containing_oneof = _AUTOTUNERESULT.oneofs_by_name['key'] _AUTOTUNERESULT.oneofs_by_name['key'].fields.append(_AUTOTUNERESULT.fields_by_name['gemm']) _AUTOTUNERESULT.fields_by_name['gemm'].containing_oneof = _AUTOTUNERESULT.oneofs_by_name['key'] _AUTOTUNERESULT.oneofs_by_name['key'].fields.append(_AUTOTUNERESULT.fields_by_name['cuda_conv_plan']) _AUTOTUNERESULT.fields_by_name['cuda_conv_plan'].containing_oneof = _AUTOTUNERESULT.oneofs_by_name['key'] _AUTOTUNINGLOG.fields_by_name['instr'].message_type = google_dot_protobuf_dot_any__pb2._ANY _AUTOTUNINGLOG.fields_by_name['results'].message_type = _AUTOTUNERESULT _AUTOTUNINGLOG.fields_by_name['cudnn_version'].message_type = _CUDNNVERSION _AUTOTUNINGLOG.fields_by_name['compute_capability'].message_type = _COMPUTECAPABILITY DESCRIPTOR.message_types_by_name['CudnnVersion'] = _CUDNNVERSION DESCRIPTOR.message_types_by_name['ComputeCapability'] = _COMPUTECAPABILITY DESCRIPTOR.message_types_by_name['AutotuneResult'] = _AUTOTUNERESULT DESCRIPTOR.message_types_by_name['AutotuningLog'] = _AUTOTUNINGLOG _sym_db.RegisterFileDescriptor(DESCRIPTOR) CudnnVersion = _reflection.GeneratedProtocolMessageType('CudnnVersion', (_message.Message,), {'DESCRIPTOR': _CUDNNVERSION, '__module__': 'tensorflow.core.protobuf.autotuning_pb2'}) _sym_db.RegisterMessage(CudnnVersion) ComputeCapability = _reflection.GeneratedProtocolMessageType('ComputeCapability', (_message.Message,), {'DESCRIPTOR': _COMPUTECAPABILITY, '__module__': 'tensorflow.core.protobuf.autotuning_pb2'}) _sym_db.RegisterMessage(ComputeCapability) AutotuneResult = _reflection.GeneratedProtocolMessageType('AutotuneResult', (_message.Message,), {'FailureResult': _reflection.GeneratedProtocolMessageType('FailureResult', (_message.Message,), {'DESCRIPTOR': _AUTOTUNERESULT_FAILURERESULT, '__module__': 'tensorflow.core.protobuf.autotuning_pb2'}), 'ConvKey': _reflection.GeneratedProtocolMessageType('ConvKey', (_message.Message,), {'DESCRIPTOR': _AUTOTUNERESULT_CONVKEY, '__module__': 'tensorflow.core.protobuf.autotuning_pb2'}), 'GemmKey': _reflection.GeneratedProtocolMessageType('GemmKey', (_message.Message,), {'DESCRIPTOR': _AUTOTUNERESULT_GEMMKEY, '__module__': 'tensorflow.core.protobuf.autotuning_pb2'}), 'CudaConvPlanKey': _reflection.GeneratedProtocolMessageType('CudaConvPlanKey', (_message.Message,), {'DESCRIPTOR': _AUTOTUNERESULT_CUDACONVPLANKEY, '__module__': 'tensorflow.core.protobuf.autotuning_pb2'}), 'DESCRIPTOR': _AUTOTUNERESULT, '__module__': 'tensorflow.core.protobuf.autotuning_pb2'}) _sym_db.RegisterMessage(AutotuneResult) _sym_db.RegisterMessage(AutotuneResult.FailureResult) _sym_db.RegisterMessage(AutotuneResult.ConvKey) _sym_db.RegisterMessage(AutotuneResult.GemmKey) _sym_db.RegisterMessage(AutotuneResult.CudaConvPlanKey) AutotuningLog = _reflection.GeneratedProtocolMessageType('AutotuningLog', (_message.Message,), {'DESCRIPTOR': _AUTOTUNINGLOG, '__module__': 'tensorflow.core.protobuf.autotuning_pb2'}) _sym_db.RegisterMessage(AutotuningLog) DESCRIPTOR._options = None
333.695652
2,996
0.84
3,007
23,025
6.067177
0.082807
0.041658
0.065611
0.062157
0.702642
0.649693
0.593181
0.565446
0.553607
0.526146
0
0.030493
0.03861
23,025
68
2,997
338.602941
0.793685
0.001346
0
0
1
0.701493
0.202658
0.152841
0
0
0
0
0
1
0
false
0
0.089552
0
0.089552
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
fdc989f597aab7818b2163a80b0b19d2212deccf
149
py
Python
apps/documents/apps.py
LopsanAMO/Despacho
0c6be0289caa9eab851fd5fa9077a82c81ddbd95
[ "MIT" ]
null
null
null
apps/documents/apps.py
LopsanAMO/Despacho
0c6be0289caa9eab851fd5fa9077a82c81ddbd95
[ "MIT" ]
4
2020-06-05T17:33:16.000Z
2021-06-01T21:56:31.000Z
apps/documents/apps.py
LopsanAMO/Despacho
0c6be0289caa9eab851fd5fa9077a82c81ddbd95
[ "MIT" ]
null
null
null
from django.apps import AppConfig class DocumentsConfig(AppConfig): name = 'documents' # def ready(self): # from . import signals
16.555556
33
0.671141
16
149
6.25
0.8125
0
0
0
0
0
0
0
0
0
0
0
0.241611
149
8
34
18.625
0.884956
0.281879
0
0
0
0
0.086538
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
fdfae3d7bb669a2d58ddf1b8f861d93769c4145a
393
py
Python
tests/test_user_validations.py
blairt001/StackOverflow-lite
3a8af2af5be0d800d08246d2924f38a878aadebe
[ "MIT" ]
1
2018-12-26T21:13:03.000Z
2018-12-26T21:13:03.000Z
tests/test_user_validations.py
blairt001/StackOverflow-lite
3a8af2af5be0d800d08246d2924f38a878aadebe
[ "MIT" ]
null
null
null
tests/test_user_validations.py
blairt001/StackOverflow-lite
3a8af2af5be0d800d08246d2924f38a878aadebe
[ "MIT" ]
null
null
null
from .base import BaseTestCase from app.auth.validations import validate_user_details class TestUserTestCase(BaseTestCase): def test_auth_user_validation(self): """ Validate user details """ data = {"email": "blairtony2014@gmail.com", 'password': 'codingmadefun2019', 'username' : 'tonyman'} user = validate_user_details(data) self.assertEqual(user, {})
32.75
108
0.704835
41
393
6.585366
0.634146
0.133333
0.211111
0.17037
0
0
0
0
0
0
0
0.024768
0.178117
393
11
109
35.727273
0.811146
0.053435
0
0
0
0
0.186813
0.063187
0
0
0
0
0.142857
1
0.142857
false
0.142857
0.285714
0
0.571429
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
e30611499db5593e12a358983b80ebe919e63721
527
py
Python
server.py
littlebenlittle/visual
0d2e71965f95ad4d560498a003636cfcff220d5a
[ "MIT" ]
null
null
null
server.py
littlebenlittle/visual
0d2e71965f95ad4d560498a003636cfcff220d5a
[ "MIT" ]
null
null
null
server.py
littlebenlittle/visual
0d2e71965f95ad4d560498a003636cfcff220d5a
[ "MIT" ]
null
null
null
from flask import Flask, render_template, send_file app = Flask(__name__) @app.route('/') def index(): return render_template('index.html'), 200, {'Access-Control-Allow-Origin': '*'} @app.route('/rotation.js') def rotation(): return render_template('rotation.js'), 200, {'Access-Control-Allow-Origin': '*'} @app.route('/assets/markcastle/uvmap.png') def uvmap(): return send_file('assets/markcastle/uvmap.png'), 200, {'Access-Control-Allow-Origin': '*'} if __name__ == '__main__': app.run(debug=True)
21.958333
94
0.681214
68
527
5.029412
0.441176
0.122807
0.140351
0.184211
0.283626
0.204678
0.204678
0
0
0
0
0.019438
0.121442
527
23
95
22.913043
0.719222
0
0
0
0
0
0.344106
0.258555
0
0
0
0
0
1
0.230769
false
0
0.076923
0.230769
0.538462
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
e31e1c1abc1ccd51758a7c3078d57a4e6651af30
189
py
Python
src/simulator/services/event_manager/events/state_initialised_event.py
ed741/PathBench
50fe138eb1f824f49fe1a862705e435a1c3ec3ae
[ "BSD-3-Clause" ]
46
2020-12-25T04:09:15.000Z
2022-03-25T12:32:42.000Z
src/simulator/services/event_manager/events/state_initialised_event.py
ed741/PathBench
50fe138eb1f824f49fe1a862705e435a1c3ec3ae
[ "BSD-3-Clause" ]
36
2020-12-21T16:10:02.000Z
2022-01-03T01:42:01.000Z
src/simulator/services/event_manager/events/state_initialised_event.py
judicaelclair/PathBenchURO
101e67674efdfa8e27e1cf7787dac9fdf99552fe
[ "BSD-3-Clause" ]
11
2021-01-06T23:34:12.000Z
2022-03-21T17:21:47.000Z
from simulator.services.event_manager.events.event import Event class StateInitialisedEvent(Event): def __init__(self) -> None: super().__init__("SetInitialised event", True)
27
63
0.751323
21
189
6.333333
0.761905
0
0
0
0
0
0
0
0
0
0
0
0.142857
189
6
64
31.5
0.820988
0
0
0
0
0
0.10582
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
e340b0ac06f51294ca09ece689bfd1d8c333d02a
69
py
Python
Software/Backend/exceptions/EmailNotFoundException.py
FinTechNJU/CIti-FinBrain
942ed46e9799839d3e84c6fb15703db64ae18505
[ "MIT" ]
4
2020-08-11T08:40:25.000Z
2021-05-27T09:55:41.000Z
Software/Backend/exceptions/EmailNotFoundException.py
FinTechNJU/CIti-FinBrain
942ed46e9799839d3e84c6fb15703db64ae18505
[ "MIT" ]
null
null
null
Software/Backend/exceptions/EmailNotFoundException.py
FinTechNJU/CIti-FinBrain
942ed46e9799839d3e84c6fb15703db64ae18505
[ "MIT" ]
2
2020-06-27T04:49:36.000Z
2020-07-15T21:08:18.000Z
class EmailNotFoundException(Exception): print("email not found")
34.5
40
0.782609
7
69
7.714286
1
0
0
0
0
0
0
0
0
0
0
0
0.115942
69
2
41
34.5
0.885246
0
0
0
0
0
0.214286
0
0
0
0
0
0
1
0
true
0
0
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
e341c92cfcb404a09986e5d075560c93c9bb113f
514
py
Python
onirim/card/_utils.py
cwahbong/onirim-py
d1110c4280d54e3b8b2d1dcef31ee433f32cb7e3
[ "MIT" ]
null
null
null
onirim/card/_utils.py
cwahbong/onirim-py
d1110c4280d54e3b8b2d1dcef31ee433f32cb7e3
[ "MIT" ]
null
null
null
onirim/card/_utils.py
cwahbong/onirim-py
d1110c4280d54e3b8b2d1dcef31ee433f32cb7e3
[ "MIT" ]
null
null
null
""" Inner module for card utilities. """ def is_location(card): """ Return true if `card` is a location card, false otherwise. """ return card.kind is not None and card.color is not None def is_door(card): """ Return true if `card` is a door card, false otherwise. """ return card.kind is None and card.color is not None def is_nightmare(card): """ Return true if `card` is a nightmare card, false otherwise. """ return card.kind is None and card.color is None
21.416667
63
0.64786
80
514
4.125
0.2625
0.045455
0.127273
0.145455
0.754545
0.754545
0.754545
0.442424
0.442424
0.315152
0
0
0.250973
514
23
64
22.347826
0.857143
0.400778
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0
1
0
0
0
0
null
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
e36c9a2594b1e150a1e869ea999bb4aeeba6a524
779
py
Python
backend/worker/intake_catalog_generation/intake_catalog_generator.py
climate-v/nc2zarr-webapp
2aaa0c9819d71c15806adc8393b0d5598c56a05b
[ "MIT" ]
null
null
null
backend/worker/intake_catalog_generation/intake_catalog_generator.py
climate-v/nc2zarr-webapp
2aaa0c9819d71c15806adc8393b0d5598c56a05b
[ "MIT" ]
null
null
null
backend/worker/intake_catalog_generation/intake_catalog_generator.py
climate-v/nc2zarr-webapp
2aaa0c9819d71c15806adc8393b0d5598c56a05b
[ "MIT" ]
null
null
null
import os.path import intake def generate_intake_catalog_for_zarr(relative_input_path, file_name): relative_input_path = build_relative_input_path(relative_input_path) path = os.path.join(relative_input_path, file_name + ".zarr") source = intake.open_zarr(path, decode_times=False) source.discover() with open(build_relative_intake_catalog_path(f'{file_name}.yaml'), 'w') as f: f.write(source.yaml()) def build_relative_intake_catalog_path(path: str) -> str: return build_relative_path(path, 'intake-catalogs') def build_relative_input_path(path: str) -> str: return build_relative_path(path, 'output') def build_relative_path(path: str, folder_name: str) -> str: return os.path.join("..", folder_name, path).replace("\\", "/")
28.851852
81
0.738126
112
779
4.785714
0.294643
0.169776
0.190299
0.117537
0.350746
0.152985
0.152985
0.152985
0.152985
0
0
0
0.136072
779
26
82
29.961538
0.796434
0
0
0
1
0
0.061617
0
0
0
0
0
0
1
0.266667
false
0
0.133333
0.2
0.6
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
8b4e32b54ea4b39630bde0911b570ec6a7c3b331
1,902
py
Python
python/problem0008.py
rado0x54/project-euler
cf3b128784922d19f17e940aa4be727752b29bf2
[ "MIT" ]
null
null
null
python/problem0008.py
rado0x54/project-euler
cf3b128784922d19f17e940aa4be727752b29bf2
[ "MIT" ]
null
null
null
python/problem0008.py
rado0x54/project-euler
cf3b128784922d19f17e940aa4be727752b29bf2
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 """Project Euler - Problem 8 Module""" from collections import deque from functools import reduce def problem8(number, cons_digits): """Problem 8 - Largest product in a series""" nr_digits = len(number) d = deque() for j in range(0,cons_digits): d.append(int(number[j:j+1])) result = reduce(lambda x, y: x*y, d) i = cons_digits while i < nr_digits: a = int(number[i:i+1]) d.popleft() d.append(a) product = reduce(lambda x, y: x*y, d) if product > result: result = product i += 1 return result NUMBER = \ "73167176531330624919225119674426574742355349194934" + \ "96983520312774506326239578318016984801869478851843" + \ "85861560789112949495459501737958331952853208805511" + \ "12540698747158523863050715693290963295227443043557" + \ "66896648950445244523161731856403098711121722383113" + \ "62229893423380308135336276614282806444486645238749" + \ "30358907296290491560440772390713810515859307960866" + \ "70172427121883998797908792274921901699720888093776" + \ "65727333001053367881220235421809751254540594752243" + \ "52584907711670556013604839586446706324415722155397" + \ "53697817977846174064955149290862569321978468622482" + \ "83972241375657056057490261407972968652414535100474" + \ "82166370484403199890008895243450658541227588666881" + \ "16427171479924442928230863465674813919123162824586" + \ "17866458359124566529476545682848912883142607690042" + \ "24219022671055626321111109370544217506941658960408" + \ "07198403850962455444362981230987879927244284909188" + \ "84580156166097919133875499200524063689912560717606" + \ "05886116467109405077541002256983155200055935729725" + \ "71636269561882670428252483600823257530420752963450" def run(): """Default Run Method""" return problem8(NUMBER, 13) if __name__ == '__main__': print("Result: ", run())
32.793103
56
0.759727
128
1,902
11.1875
0.554688
0.005587
0.018156
0.019553
0.023743
0.023743
0.023743
0
0
0
0
0.621389
0.144585
1,902
57
57
33.368421
0.258758
0.059411
0
0
0
0
0.57304
0.564016
0
0
0
0
0
1
0.046512
false
0
0.046512
0
0.139535
0.023256
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8b6adfccc257dedb62b2ea6c55304ff3d293ed7f
141
py
Python
notebooks/munging.py
jesserobertson/02-getting-to-know-the-tools
7d9c5d720e47736f487aac891645c3c1d444ca10
[ "MIT" ]
null
null
null
notebooks/munging.py
jesserobertson/02-getting-to-know-the-tools
7d9c5d720e47736f487aac891645c3c1d444ca10
[ "MIT" ]
1
2018-09-25T03:32:55.000Z
2018-09-25T03:32:55.000Z
notebooks/munging.py
jesserobertson/02-getting-to-know-the-tools
7d9c5d720e47736f487aac891645c3c1d444ca10
[ "MIT" ]
null
null
null
import pandas as pd import os from os import path def load_data (path_to_data): ATCO_CSV = pd.read_csv(path_to_data) return ATCO_CSV
20.142857
40
0.765957
27
141
3.703704
0.555556
0.12
0.2
0
0
0
0
0
0
0
0
0
0.184397
141
7
41
20.142857
0.869565
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.5
0
0.833333
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
8b6b332cc28771480a7cea434048bd1411b1e652
95
py
Python
crmManager/apps.py
shakyasaijal/businessAnalytics
9312bae79709387c6eadd50f87f6be85bd52c396
[ "BSD-3-Clause" ]
null
null
null
crmManager/apps.py
shakyasaijal/businessAnalytics
9312bae79709387c6eadd50f87f6be85bd52c396
[ "BSD-3-Clause" ]
8
2021-03-30T13:03:11.000Z
2022-03-12T00:20:13.000Z
crmManager/apps.py
shakyasaijal/businessAnalytics
9312bae79709387c6eadd50f87f6be85bd52c396
[ "BSD-3-Clause" ]
null
null
null
from django.apps import AppConfig class CrmmanagerConfig(AppConfig): name = 'crmManager'
15.833333
34
0.768421
10
95
7.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.157895
95
5
35
19
0.9125
0
0
0
0
0
0.105263
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
8b6fb8ebd1c0d1c111d457190fac8859c8b8eb80
59
py
Python
conftest.py
uncleguanghui/guang_toolkit
925137d119a684d7bc916ae334066284fe0af113
[ "MIT" ]
4
2020-11-17T08:44:42.000Z
2022-03-10T03:50:53.000Z
conftest.py
uncleguanghui/guang_toolkit
925137d119a684d7bc916ae334066284fe0af113
[ "MIT" ]
null
null
null
conftest.py
uncleguanghui/guang_toolkit
925137d119a684d7bc916ae334066284fe0af113
[ "MIT" ]
1
2021-01-11T04:31:17.000Z
2021-01-11T04:31:17.000Z
# 将该文件所在的目录加入到 sys.path 中,使得 import guang_toolkit 可以正常work
29.5
58
0.830508
9
59
5.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.118644
59
1
59
59
0.923077
0.949153
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
8ba67a641535a6e7f534099f16f565c933760403
66
py
Python
tabular_to_image/src/autogluon/tabular_to_image/img_sore/__init__.py
engsarah2050/autogluon
a77d462924dac8f8763635518eadcc523a23e18f
[ "Apache-2.0" ]
null
null
null
tabular_to_image/src/autogluon/tabular_to_image/img_sore/__init__.py
engsarah2050/autogluon
a77d462924dac8f8763635518eadcc523a23e18f
[ "Apache-2.0" ]
null
null
null
tabular_to_image/src/autogluon/tabular_to_image/img_sore/__init__.py
engsarah2050/autogluon
a77d462924dac8f8763635518eadcc523a23e18f
[ "Apache-2.0" ]
null
null
null
from autogluon.tabular_to_image.img_sore.images_store import Store
66
66
0.909091
11
66
5.090909
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.045455
66
1
66
66
0.888889
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
4742d16986e46b3995e3a71a0d326f4526de7e3c
617
py
Python
05 - Modules/00 - imports - import key usage/2 - multiple imports/mainfile.py
python-demo-codes/basics
2a151bbff4b528cefd52978829c632fd087c8f20
[ "DOC" ]
2
2019-08-23T06:05:55.000Z
2019-08-26T03:56:07.000Z
05 - Modules/00 - imports - import key usage/2 - multiple imports/mainfile.py
python-lang-codes/basics
2a151bbff4b528cefd52978829c632fd087c8f20
[ "DOC" ]
null
null
null
05 - Modules/00 - imports - import key usage/2 - multiple imports/mainfile.py
python-lang-codes/basics
2a151bbff4b528cefd52978829c632fd087c8f20
[ "DOC" ]
4
2020-10-01T07:16:07.000Z
2021-07-17T07:55:08.000Z
# HEAD # Modules - Creating Modules and Using __init__.py # DESCRIPTION # Describes the suage of package init.py file along with other module # Using __init__.py and scoping # file modules inside a module # Exports prints.py and inputs.py using __input__.py # RESOURCES # # Allowing import of all modules by allowing the namespace availability # This will not import all the modules, they have to be imported specifically from mod import * # Explicit import of file modules # from mod import inputs, prints # Trying to access the following objects will throw object inputs.inputprinter() prints.printer()
28.045455
77
0.773096
90
617
5.166667
0.577778
0.03871
0.047312
0
0
0
0
0
0
0
0
0
0.178282
617
21
78
29.380952
0.91716
0.854133
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0.666667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
4
477cff728310038e5226e732649eca2a23892ae5
270
py
Python
scripts/startup.py
7HAL32/robolab-startup.service
965e5284c52d05c14ddcb7f38a91434a6808aaf5
[ "MIT" ]
1
2017-03-08T06:52:54.000Z
2017-03-08T06:52:54.000Z
scripts/startup.py
7HAL32/robolab-startup.service
965e5284c52d05c14ddcb7f38a91434a6808aaf5
[ "MIT" ]
3
2017-03-04T23:08:48.000Z
2017-03-04T23:11:06.000Z
scripts/startup.py
7HAL32/ev3-robolab-startup
965e5284c52d05c14ddcb7f38a91434a6808aaf5
[ "MIT" ]
null
null
null
import ev3dev.ev3 as ev3 import reloader reloader.enable(blacklist=['ev3dev.ev3', 'ev3dev', 'ev3']) import os print("ev3-robolab-startup v.1.0") print("Working directory is:", os.getcwd()) print("Beginning with execution") print("-------------------------") import main
27
58
0.67037
36
270
5.027778
0.611111
0.149171
0
0
0
0
0
0
0
0
0
0.040486
0.085185
270
9
59
30
0.692308
0
0
0
0
0
0.422222
0.092593
0
0
0
0
0
1
0
true
0
0.444444
0
0.444444
0.444444
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
4
4780d045e7ff9443d0bd747a13f3cfba95d368e3
50
py
Python
examples/_tests_scripts/rl_utils.py
rhololkeolke/catalyst-rl
ec18ff4a58b6d00652f772231db8de86debb4b3d
[ "Apache-2.0" ]
46
2020-03-27T20:12:32.000Z
2021-11-21T19:08:51.000Z
examples/_tests_scripts/rl_utils.py
rhololkeolke/catalyst-rl
ec18ff4a58b6d00652f772231db8de86debb4b3d
[ "Apache-2.0" ]
2
2020-04-06T10:43:04.000Z
2020-07-01T18:26:10.000Z
examples/_tests_scripts/rl_utils.py
rhololkeolke/catalyst-rl
ec18ff4a58b6d00652f772231db8de86debb4b3d
[ "Apache-2.0" ]
5
2020-04-17T14:09:53.000Z
2021-05-10T08:58:29.000Z
# flake8: noqa from catalyst_rl.rl.utils import *
16.666667
34
0.76
8
50
4.625
0.875
0
0
0
0
0
0
0
0
0
0
0.023256
0.14
50
2
35
25
0.837209
0.24
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
47c0c690efcebf6752f8b36a372ad9a504baaf1c
528
py
Python
director/cli.py
ministicraft/celery-director
e88afe1f1b8a77a4cab68b25a84a6b44714255be
[ "BSD-3-Clause" ]
null
null
null
director/cli.py
ministicraft/celery-director
e88afe1f1b8a77a4cab68b25a84a6b44714255be
[ "BSD-3-Clause" ]
null
null
null
director/cli.py
ministicraft/celery-director
e88afe1f1b8a77a4cab68b25a84a6b44714255be
[ "BSD-3-Clause" ]
null
null
null
import click from director.commands.assets import dlassets from director.commands.celery import celery from director.commands.db import upgradedb from director.commands.init import init from director.commands.webserver import webserver from director.commands.workflows import workflow @click.group() def cli(): """Celery Director - Command Line Interface""" pass cli.add_command(webserver) cli.add_command(celery) cli.add_command(workflow) cli.add_command(upgradedb) cli.add_command(dlassets) cli.add_command(init)
22.956522
50
0.8125
72
528
5.875
0.305556
0.170213
0.283688
0
0
0
0
0
0
0
0
0
0.104167
528
22
51
24
0.894292
0.075758
0
0
0
0
0
0
0
0
0
0
0
1
0.0625
true
0.0625
0.4375
0
0.5
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
4
47e2d05f7bfd625f47c9d99b4ac817dbdc0463d9
1,107
py
Python
pymagnitude/third_party/allennlp/modules/seq2seq_encoders/pass_through_encoder.py
tpeng/magnitude
aec98628b5547773ca8c4114ec6d1ad51e21b230
[ "MIT" ]
1,520
2018-03-01T13:37:49.000Z
2022-03-25T11:40:20.000Z
pymagnitude/third_party/allennlp/modules/seq2seq_encoders/pass_through_encoder.py
tpeng/magnitude
aec98628b5547773ca8c4114ec6d1ad51e21b230
[ "MIT" ]
87
2018-03-03T15:12:50.000Z
2022-02-21T15:24:12.000Z
pymagnitude/third_party/allennlp/modules/seq2seq_encoders/pass_through_encoder.py
tpeng/magnitude
aec98628b5547773ca8c4114ec6d1ad51e21b230
[ "MIT" ]
121
2018-03-03T08:40:53.000Z
2022-03-16T05:19:38.000Z
from __future__ import absolute_import #overrides import torch from allennlp.modules.seq2seq_encoders.seq2seq_encoder import Seq2SeqEncoder class PassThroughEncoder(Seq2SeqEncoder): u""" This class allows you to specify skipping a ``Seq2SeqEncoder`` just by changing a configuration file. This is useful for ablations and measuring the impact of different elements of your model. """ def __init__(self, input_dim ) : super(PassThroughEncoder, self).__init__() self._input_dim = input_dim #overrides def get_input_dim(self) : return self._input_dim #overrides def get_output_dim(self) : return self._input_dim #overrides def is_bidirectional(self): return False #overrides def forward(self, # pylint: disable=arguments-differ inputs , mask = None) : # pylint: disable=unused-argument return inputs PassThroughEncoder = Seq2SeqEncoder.register(u"pass_through")(PassThroughEncoder)
28.384615
81
0.649503
116
1,107
5.948276
0.551724
0.069565
0.069565
0.086957
0.144928
0.107246
0.107246
0.107246
0
0
0
0.007624
0.28907
1,107
38
82
29.131579
0.869123
0.273713
0
0.105263
0
0
0.015524
0
0
0
0
0
0
1
0.263158
false
0.157895
0.157895
0.210526
0.684211
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
9a049324cb26c51b477e21f864b47bde46bd744f
205
py
Python
src/apps/menu/apps.py
yrrodriguezb/django_menu
9323243cdd43ab48b54ca21a698169942c6e1a3e
[ "MIT" ]
null
null
null
src/apps/menu/apps.py
yrrodriguezb/django_menu
9323243cdd43ab48b54ca21a698169942c6e1a3e
[ "MIT" ]
null
null
null
src/apps/menu/apps.py
yrrodriguezb/django_menu
9323243cdd43ab48b54ca21a698169942c6e1a3e
[ "MIT" ]
null
null
null
from django.apps import AppConfig class MenuConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'apps.menu' verbose_name = 'Menu' verbose_name_plural = 'Menus'
22.777778
56
0.726829
25
205
5.76
0.72
0.152778
0.208333
0
0
0
0
0
0
0
0
0
0.17561
205
8
57
25.625
0.852071
0
0
0
0
0
0.229268
0.141463
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
9a3632e619ff10ca4cc285d6cbd8f393fd5b2b6e
1,555
py
Python
perm_hmm/policies/__init__.py
usnistgov/perm_hmm
b57b3cca51d0d91bde438a62f26c0b0123c26aa5
[ "Apache-2.0" ]
null
null
null
perm_hmm/policies/__init__.py
usnistgov/perm_hmm
b57b3cca51d0d91bde438a62f26c0b0123c26aa5
[ "Apache-2.0" ]
null
null
null
perm_hmm/policies/__init__.py
usnistgov/perm_hmm
b57b3cca51d0d91bde438a62f26c0b0123c26aa5
[ "Apache-2.0" ]
null
null
null
r""" This module contains classes that select permutations for the HMM. The base class is :py:class:`~perm_hmm.policies.policy.PermPolicy`, which should be subclassed to make a custom policy. A simple example of a policy is given in :py:class:`~perm_hmm.policies.rotator_policy.RotatorPolicy`. The :py:class:`~perm_hmm.policies.belief.BeliefStatePolicy` is a more complex subclass of policy that uses the :py:class:`~perm_hmm.belief.HMMBeliefState` to select the next permutation. A different subclass that uses the :py:class:`~perm_hmm.belief.HMMBeliefState` is the :py:class:`~perm_hmm.policies.min_tree.MinTreePolicy`, which computes the next permutation by looking ahead some number of steps, and choosing the one that minimizes the expected cost. The :py:class:`~perm_hmm.policies.exhaustive.ExhaustivePolicy` is a policy that chooses the optimal permutation by exhaustive search. This is generically extremely expensive, costing O((n*p)**t) time, where n is the number of outcomes, p is the number of permutations, and t is the number of steps. The :py:class:`~perm_hmm.policies.min_ent.MinEntropyPolicy` is a policy that chooses the next permutation by minimizing the expected posterior entropy of the initial state, based on one step look-ahead. It is a subclass of the :py:class:`~perm_hmm.policies.min_tree.MinTreePolicy`. Finally, the submodule :py:mod:`~perm_hmm.tree_strategy_funcs` contains utility functions used by the policies based on tree-based strategies. """ from .policy import PermPolicy from .belief import BeliefStatePolicy
45.735294
79
0.801286
247
1,555
4.979757
0.40081
0.056911
0.080488
0.102439
0.282927
0.247154
0.169106
0.146341
0.146341
0
0
0
0.120257
1,555
33
80
47.121212
0.899123
0.948553
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
9a3f7cd73afc549691db1d62639cf90b4f31737b
171
py
Python
Problems/Leap Year/task.py
Answerman/Coffee-Machine
035df5a89c681eb5a6e4100a71f5b0e7da7bf9b9
[ "MIT" ]
null
null
null
Problems/Leap Year/task.py
Answerman/Coffee-Machine
035df5a89c681eb5a6e4100a71f5b0e7da7bf9b9
[ "MIT" ]
null
null
null
Problems/Leap Year/task.py
Answerman/Coffee-Machine
035df5a89c681eb5a6e4100a71f5b0e7da7bf9b9
[ "MIT" ]
null
null
null
year = int(input()) if year % 4 == 0 and not (year % 100 == 0): print("Leap") else: if year % 400 == 0: print("Leap") else: print("Ordinary")
17.1
43
0.48538
24
171
3.458333
0.583333
0.144578
0.240964
0.337349
0
0
0
0
0
0
0
0.086957
0.327485
171
9
44
19
0.634783
0
0
0.5
0
0
0.093567
0
0
0
0
0
0
1
0
false
0
0
0
0
0.375
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
9a71049560c0f19c68fde7596592398d45058dd3
45
py
Python
dtool/__init__.py
jic-dtool/dtool
78b259dc01bb6b01c9be0d5d1764b89980db6aaf
[ "MIT" ]
14
2018-02-03T19:16:33.000Z
2022-02-25T14:21:59.000Z
dtool/__init__.py
jic-dtool/dtool
78b259dc01bb6b01c9be0d5d1764b89980db6aaf
[ "MIT" ]
3
2018-05-04T09:13:09.000Z
2021-06-23T00:25:31.000Z
dtool/__init__.py
jic-dtool/dtool
78b259dc01bb6b01c9be0d5d1764b89980db6aaf
[ "MIT" ]
2
2018-01-18T15:59:25.000Z
2021-06-21T16:28:42.000Z
"""dtool package.""" __version__ = "3.26.1"
11.25
22
0.6
6
45
3.833333
1
0
0
0
0
0
0
0
0
0
0
0.102564
0.133333
45
3
23
15
0.487179
0.311111
0
0
0
0
0.24
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
d00fcb373405bcfe04ab0ab7f1bc9466d22659fa
217
py
Python
exergen/__init__.py
martinrsturm/ExerciseGenerator
bda0f7b648debef46cb26f01d0a1ebbc7def9eb5
[ "MIT" ]
null
null
null
exergen/__init__.py
martinrsturm/ExerciseGenerator
bda0f7b648debef46cb26f01d0a1ebbc7def9eb5
[ "MIT" ]
null
null
null
exergen/__init__.py
martinrsturm/ExerciseGenerator
bda0f7b648debef46cb26f01d0a1ebbc7def9eb5
[ "MIT" ]
null
null
null
"""The exergen package""" from .document import Document from .exercise import Exercise from .mainWindow import MainWindow from .fractionPG import FractionProblemGenerator from .problemGeneratorCatalog import *
31
49
0.81106
22
217
8
0.5
0
0
0
0
0
0
0
0
0
0
0
0.133641
217
6
50
36.166667
0.93617
0.087558
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
d01ac1a99105bc3df2984d1e61570e61ae8dd372
258
py
Python
PyFSM/pyfsm/exceptions/__init__.py
wafec/wafec-py-fsm
444b7b797411daa3186cf812535a660404951d00
[ "MIT" ]
null
null
null
PyFSM/pyfsm/exceptions/__init__.py
wafec/wafec-py-fsm
444b7b797411daa3186cf812535a660404951d00
[ "MIT" ]
null
null
null
PyFSM/pyfsm/exceptions/__init__.py
wafec/wafec-py-fsm
444b7b797411daa3186cf812535a660404951d00
[ "MIT" ]
null
null
null
from .illegal_state_exception import IllegalStateException from .invalid_element_exception import InvalidElementException from .null_exception import NullException __all__ = [ 'IllegalStateException', 'InvalidElementException', 'NullException' ]
28.666667
62
0.825581
21
258
9.714286
0.571429
0.220588
0
0
0
0
0
0
0
0
0
0
0.120155
258
9
63
28.666667
0.898678
0
0
0
0
0
0.220077
0.169884
0
0
0
0
0
1
0
false
0
0.375
0
0.375
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
d02491cbf901471e5b0b118592ddcc00ca07c0cb
28
py
Python
[ATI] Misfenterest/Frontend/venv/lib/python2.6/locale.py
Conflei/ATI
b6aa9d449242525c8cf63039d304e69da2794f71
[ "MIT" ]
1
2016-07-06T13:00:53.000Z
2016-07-06T13:00:53.000Z
.virtualenv/lib/python2.6/locale.py
ngokevin/cyder
8bc0e4aea9ec4b7ac9260b083839bbb1174441d3
[ "BSD-3-Clause" ]
null
null
null
.virtualenv/lib/python2.6/locale.py
ngokevin/cyder
8bc0e4aea9ec4b7ac9260b083839bbb1174441d3
[ "BSD-3-Clause" ]
null
null
null
/usr/lib/python2.6/locale.py
28
28
0.785714
6
28
3.666667
1
0
0
0
0
0
0
0
0
0
0
0.071429
0
28
1
28
28
0.714286
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
d02f63c0ed246030f1a7297f7a3f30e8d09fecfb
427
py
Python
earthquake_visualizer/models.py
ivanjedovnicki/dza
0e2df613f5e12eef65b9094312b40af96c11cab2
[ "MIT" ]
null
null
null
earthquake_visualizer/models.py
ivanjedovnicki/dza
0e2df613f5e12eef65b9094312b40af96c11cab2
[ "MIT" ]
null
null
null
earthquake_visualizer/models.py
ivanjedovnicki/dza
0e2df613f5e12eef65b9094312b40af96c11cab2
[ "MIT" ]
null
null
null
from django.db import models class EarthQuakeFeed(models.Model): title = models.CharField(max_length=50) latitude = models.DecimalField(max_digits=4, decimal_places=2) longitude = models.DecimalField(max_digits=4, decimal_places=2) magnitude = models.DecimalField(max_digits=2, decimal_places=1) time = models.DateTimeField() def __str__(self): return f'ID = {self.id}, TITLE = {self.title}'
32.846154
67
0.725995
56
427
5.339286
0.553571
0.180602
0.210702
0.270903
0.280936
0.280936
0.280936
0.280936
0
0
0
0.022284
0.159251
427
12
68
35.583333
0.810585
0
0
0
0
0
0.084309
0
0
0
0
0
0
1
0.111111
false
0
0.111111
0.111111
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
d055cc8ddd0e2661063c6abbfed7ab465f394ac0
107
py
Python
lab03/book_registry/app_book_registry/apps.py
Boris-Barboris/rsoi
30b03f50549f7977d5ecb7788b8e22b789f8859f
[ "MIT" ]
null
null
null
lab03/book_registry/app_book_registry/apps.py
Boris-Barboris/rsoi
30b03f50549f7977d5ecb7788b8e22b789f8859f
[ "MIT" ]
null
null
null
lab03/book_registry/app_book_registry/apps.py
Boris-Barboris/rsoi
30b03f50549f7977d5ecb7788b8e22b789f8859f
[ "MIT" ]
null
null
null
from django.apps import AppConfig class AppBookRegistryConfig(AppConfig): name = 'app_book_registry'
17.833333
39
0.794393
12
107
6.916667
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.140187
107
5
40
21.4
0.902174
0
0
0
0
0
0.158879
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
d064e74c20b6a931febf875c278f4580e56abad3
726
py
Python
src/autocrosswalk/matching/context_matching.py
muhlbach/autocrosswalk
f62d55cf8e6239ecdf10e03fe68013b567ad428b
[ "MIT" ]
1
2022-02-16T21:30:41.000Z
2022-02-16T21:30:41.000Z
src/autocrosswalk/matching/context_matching.py
muhlbach/autocrosswalk
f62d55cf8e6239ecdf10e03fe68013b567ad428b
[ "MIT" ]
null
null
null
src/autocrosswalk/matching/context_matching.py
muhlbach/autocrosswalk
f62d55cf8e6239ecdf10e03fe68013b567ad428b
[ "MIT" ]
null
null
null
#------------------------------------------------------------------------------ # Libraries #------------------------------------------------------------------------------ from econnlp.embedding.docs import DocumentEmbedder #------------------------------------------------------------------------------ # Main #------------------------------------------------------------------------------ class ContextMatcher(DocumentEmbedder): """ Match context """ # ------------------------------------------------------------------------- # Constructor function # ------------------------------------------------------------------------- def __init__(self, **kwargs): super().__init__(**kwargs)
42.705882
79
0.227273
22
726
7.136364
0.863636
0
0
0
0
0
0
0
0
0
0
0
0.096419
726
17
80
42.705882
0.239329
0.702479
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
d06e6ae8a1edf3619d939baf592f79ee631de40d
283
py
Python
exercicio9.py
DrokaGit/-infosatc-lp-avaliativo-02
6bb78ce84ac325c866201ff538f426d6e7a72ab5
[ "MIT" ]
null
null
null
exercicio9.py
DrokaGit/-infosatc-lp-avaliativo-02
6bb78ce84ac325c866201ff538f426d6e7a72ab5
[ "MIT" ]
null
null
null
exercicio9.py
DrokaGit/-infosatc-lp-avaliativo-02
6bb78ce84ac325c866201ff538f426d6e7a72ab5
[ "MIT" ]
null
null
null
nume1 = (input("Digite um numero")) nume2 = (input("Digite um numero")) nume3 = (input("Digite um numero")) nume4 = (input("Digite um numero")) nume5 = (input("Digite um numero")) lista_nova =[nume1,nume2,nume3,nume4,nume5] print("Sua lista ordenada numérica: ", sorted(lista_nova))
35.375
58
0.706714
40
283
4.95
0.4
0.277778
0.328283
0.479798
0
0
0
0
0
0
0
0.04
0.116608
283
7
59
40.428571
0.752
0
0
0
0
0
0.385159
0
0
0
0
0
0
1
0
false
0
0
0
0
0.142857
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4