content
stringlengths
7
1.05M
lines = open('input','r').readlines() size_linea = 12 unos = [0,0,0,0,0,0,0,0,0,0,0,0] for line in lines: for i in range(size_linea): if (line[i] == '1'): unos[i] += 1 media = len(lines)/2 gamma = 0 epsilon = 0 for i in range(size_linea): if (unos[i] > media): gamma += 2**(size_linea - (i+1)) else: epsilon += 2**(size_linea - (i+1)) print(gamma) print(epsilon) print(gamma*epsilon)
# Using flag prompt = "\nTell me your name, and I will reprint your name: " prompt += "\nEnter 'quit' to end the program." active = True while active: message = input(prompt) if message == 'quit': active = False else: print(message)
# coding=utf-8 # # @lc app=leetcode id=1122 lang=python # # [1122] Relative Sort Array # # https://leetcode.com/problems/relative-sort-array/description/ # # algorithms # Easy (66.81%) # Likes: 147 # Dislikes: 12 # Total Accepted: 14.6K # Total Submissions: 21.9K # Testcase Example: '[2,3,1,3,2,4,6,7,9,2,19]\n[2,1,4,3,9,6]' # # Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all # elements in arr2 are also in arr1. # # Sort the elements of arr1 such that the relative ordering of items in arr1 # are the same as in arr2.  Elements that don't appear in arr2 should be placed # at the end of arr1 in ascending order. # # # Example 1: # Input: arr1 = [2,3,1,3,2,4,6,7,9,2,19], arr2 = [2,1,4,3,9,6] # Output: [2,2,2,1,4,3,3,9,6,7,19] # # # Constraints: # # # arr1.length, arr2.length <= 1000 # 0 <= arr1[i], arr2[i] <= 1000 # Each arr2[i] is distinct. # Each arr2[i] is in arr1. # # # class Solution(object): def relativeSortArray(self, arr1, arr2): """ :type arr1: List[int] :type arr2: List[int] :rtype: List[int] """ result = [] frequency = {} exclude = [] for arr in arr1: if arr in arr2: frequency[arr] = frequency.get(arr, 0) + 1 else: exclude.append(arr) for arr in arr2: result += [arr]*frequency[arr] return result + sorted(exclude)
print('Numeros pares!!!') print('=-=' * 15) for c in range(2, 52, 2): print(c) print('=-=' * 15) print('ACABOU.')
class medicamento: def __init__(self, id, nombre, precio, descripcion, cantidad, rol): self.id = id self.nombre = nombre self.precio = precio self.descripcion = descripcion self.cantidad = cantidad self.rol = rol def actualizar_datos(self, id, nombre, precio, descripcion, cantidad, rol): self.id = id self.nombre = nombre self.precio = precio self.descripcion = descripcion self.cantidad = cantidad self.rol = rol def dump(self): return { 'id': self.id, 'nombre': self.nombre, 'precio': self.precio, 'cantidad': self.cantidad, 'rol': self.rol } def __str__(self): return f"Medicamento: [ id: {self.id}, nombre: {self.nombre}, precio: {self.precio}, cantidad: {self.cantidad}, rol: {self.rol}]"
def test_it(binbb, groups_cfg): for account, accgrp_cfg in groups_cfg.items(): bbcmd = ["groups", "--account", account] res = binbb.sysexec(*bbcmd) # very simple test of group names and member names being seen in output for group_name, members in accgrp_cfg.items(): assert group_name in res for member_name in members: assert member_name in res
def pattern_eighten(steps): ''' Pattern eighteen 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 9 8 7 6 5 4 9 8 7 6 5 9 8 7 6 9 8 7 9 8 9 ''' get_range = [str(i) for i in range(1, steps + 1)][::-1] for i in range(len(get_range), 0, -1): join = ' '.join(get_range[:i]) print(join) if __name__ == '__main__': try: pattern_eighten(9) except NameError: print('Integer was expected')
#!/usr/bin/env python3 class Album: """ Class representing an album """ def __init__(self, title): self.title = str(title) self.tracks = [] self.coverFile = None def add(self, track): self.tracks.append(track)
""" 5565 : 영수증 URL : https://www.acmicpc.net/problem/5565 Input : 9850 1050 800 420 380 600 820 2400 1800 980 Output : 600 """ total_price = int(input()) prices = [] for _ in range(9): prices.append(int(input())) print(total_price - sum(prices))
""" Prácticas de Redes de comunicaciones 2 Autores: Miguel Arconada Manteca Mario García Pascual """ DS_ADDR = ('vega.ii.uam.es', 8000) BUFSIZE = 1048576 UDP_SLEEP = 0.05 LISTEN_TIMEOUT = 0.1 LISTEN_SLEEP = 0.1 CONNECT_TIMEOUT = 5 REPLY_TIMEOUT = 5 CONTROL_TIMEOUT = 0.1 CONTROL_SLEEP = 0.1
# -*- coding: utf-8 -*- title = "Edwin's photos" source = 'pictures' theme = 'galleria' author = 'Edwin Steele' # ---------------- # Image processing (ignored if use_orig = True) # ---------------- img_size = (1600, 1200) show_map = True keep_orig = True # If True, EXIF data from the original image is copied to the resized image copy_exif_data = True autorotate_images = False jpg_options = {'quality': 100, 'progressive': True} ignore_directories = [] ignore_files = [] use_assets_cdn = False links = [('Wordspeak', 'https://www.wordspeak.org'),] files_to_copy = (('extra/favicon.ico', 'favicon.ico'), ('extra/robots.txt', 'robots.txt')) #leaflet_provider = 'Stamen.Terrain' #leaflet_provider = 'Stamen.TonerLite' # -------- # Plugins # -------- # List of plugins to use. The values must be a path than can be imported. # Another option is to import the plugin and put the module in the list, but # this will break with the multiprocessing feature (the settings dict obtained # from this file must be serializable). # plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright', # 'sigal.plugins.upload_s3', 'sigal.plugins.media_page'] # Add a copyright text on the image (default: '') # copyright = "© An example copyright message"
# -*- coding: utf-8 -*- """ abide.registry ~~~~~~~~~~~~~~ """ class PropertyDoesNotExist(AttributeError): pass class AbidePropertyRegistry(): """ Contains the properties that have been registered for persistence. When a Class is created, the """ def __init__(self, *args, **kwargs): self._property_references = {} self._property_instances = {} def __iter__(self): yield from self._property_references def __contains__(self, prop_name): return prop_name in self._property_references def __len__(self): return len(self._property_references) def items(self): yield from self._property_references.items() def set_property(self, prop): self._property_references[prop.name] = prop def get_property(self, prop_name): try: return self._property_references[prop_name] except KeyError: raise PropertyDoesNotExist(prop_name) def remove_property(self, prop_name): try: del self._property_references[prop_name] except KeyError: raise PropertyDoesNotExist(prop_name) def has_property(self, prop_name): return prop_name in self._property_references def create_instance(self, prop_name): pass def merge(self, registry): """ Merge an existing AbideRegistry into this one, keeping properties already present in this one and only merging properties that don't yet exist. """ for property_name, property_item in registry.items(): if property_name not in self: self.set_property(property_item)
# puck_properties_consts.py # # ~~~~~~~~~~~~ # # pyHand Constants File # # ~~~~~~~~~~~~ # # ------------------------------------------------------------------ # Authors : Chloe Eghtebas, # Brendan Ritter, # Pravina Samaratunga, # Jason Schwartz # # Last change: 08.08.2013 # # Language: Python 2.7 # ------------------------------------------------------------------ # # This version of pyHand is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation. # #PuckID FINGER1 = 11 FINGER2 = 12 FINGER3 = 13 SPREAD = 14 ALL_FINGERS=(FINGER1,FINGER2,FINGER3,SPREAD) GRASP=(FINGER1,FINGER2,FINGER3) #Property = ID ACCEL = 82 ADDR = 6 ANA0 = 18 ANA1 = 19 BAUD = 12 CMD = 29 CMD_LOAD=0 CMD_SAVE=1 CMD_RESET=2 CMD_DEF=3 CMD_GET=4 CMD_FIND=5 CMD_SET=6 CMD_HOME=7 CMD_KEEP=8 CMD_LOOP=9 CMD_PASS=10 CMD_VERS=11 CMD_ERR=12 CMD_HI=13 CMD_IC=14 CMD_IO=15 CMD_TC=16 CMD_TO=17 CMD_CLOSE=18 CMD_MOVE=19 CMD_OPEN=20 CMD_TERM=21 CMD_HELP=22 CMD_PPSINIT=23 CMD_TESTEE=24 CT = 56 CT2 = 57 CTS = 68 CTS2 = 69 DEF = 32 DIG0 = 14 DIG1 = 15 DP = 50 DP2 = 51 DS = 60 E = 52 E2 = 53 ECMAX = 101 ECMIN = 102 EN = 94 EN2 = 95 ERROR = 4 FET0 = 16 FET1 = 17 FIND = 33 GRPA = 26 GRPB = 27 GRPC = 28 HALLH = 88 HALLH2 = 89 HALLS = 87 HOLD = 77 HSG = 71 ID = 3 IHIT = 108 IKCOR = 93 IKI = 92 IKP = 91 ILOGIC = 24 IMOTOR = 22 IOFF = 74 IOFF2 = 75 IOFST = 62 IPNM = 86 IVEL = 73 JIDX = 85 JOFST = 98 JOFST2 = 99 JP = 96 JP2 = 97 KD = 80 KI = 81 KP = 79 LCTC = 104 LCVC = 105 LFLAGS = 103 LOAD = 31 LOCK = 13 LSG = 72 M = 58 M2 = 59 MAX_ENCODER_TICKS=195000.0 MAX_SPREAD_TICKS=36000.0 MAX_FINGERTIP_TICKS=78000.0 MCV = 46 MDS = 65 MECH = 66 MECH2 = 67 MODE = 8 MODE_IDLE=0 MODE_TORQUE=2 MODE_PID=3 MODE_VEL=4 MODE_TRAP=5 MOFST = 61 MOV = 47 MPE = 76 MT = 43 MV = 45 OD = 64 OT = 54 OT2 = 55 OTEMP = 11 P = 48 P2 = 49 PIDX = 70 POLES = 90 PTEMP = 10 ROLE = 1 SAVE = 30 SG = 25 SN = 2 STAT = 5 T = 42 TACT = 106 TACT_FULL=2 TACT_10=1 TACTID = 107 TACTID = 107 TEMP = 9 TENSO = 84 TENST = 83 THERM = 20 TIE = 100 TSTOP = 78 UPSECS = 63 V = 44 VALUE = 7 VBUS = 21 VERS = 0 VLOGIC = 23 X0 = 34 X1 = 35 X2 = 36 X3 = 37 X4 = 38 X5 = 39 X6 = 40 X7 = 41 FTS = 8 FTS_SG1 = 42 FTS_SG2 = 43 FTS_SG3 = 44 FTS_SG4 = 45 FTS_SG5 = 46 FTS_SG6 = 47 FTS_FX = 48 FTS_FY = 49 FTS_FZ = 50 FTS_TX = 51 FTS_TY = 52 FTS_TZ = 53 FTS_FT = 54 FTS_AX = 55 FTS_AY = 56 FTS_AZ = 57 FTS_GM = 58 FTS_OV = 59 FTS_LED = 60 FTS_T1 = 61 FTS_T2 = 62 FTS_T3 = 63 FTS_A = 64 NO_WRITE_PROPERTIES = [ANA0, ANA1, CT2, DP2, E2, EN2, ERROR, HALLH2, ILOGIC, IMOTOR, IOFF2, JOFST2, JP2, M2, MECH, MECH2, OT2, P2, SG, TEMP, THERM, VBUS, VLOGIC] NO_READ_PROPERTIES = [CMD, CT2, DEF, DP2, E2, EN2, FIND, HALLH2, IOFF2, JOFST2, JP2, LOAD, LOCK, M, M2, MECH2, OT2, P2, SAVE] LOCKED_PROPERTIES = [DIG0, DIG1, FET0, FET1, HALLH, HALLS, OD, PTEMP, ROLE, SN]
# # @lc app=leetcode id=680 lang=python3 # # [680] Valid Palindrome II # # https://leetcode.com/problems/valid-palindrome-ii/description/ # # algorithms # Easy (37.22%) # Total Accepted: 275.1K # Total Submissions: 737.9K # Testcase Example: '"aba"' # # Given a string s, return true if the s can be palindrome after deleting at # most one character from it. # # # Example 1: # # # Input: s = "aba" # Output: true # # # Example 2: # # # Input: s = "abca" # Output: true # Explanation: You could delete the character 'c'. # # # Example 3: # # # Input: s = "abc" # Output: false # # # # Constraints: # # # 1 <= s.length <= 10^5 # s consists of lowercase English letters. # # # class Solution: def validPalindrome(self, s: str) -> bool: head = 0 tail = len(s) - 1 while head < tail: if s[head] == s[tail]: head += 1 tail -= 1 else: return self.isPalindrome(s[head+1:tail+1]) or self.isPalindrome(s[head:tail]) return True def isPalindrome(self, s: str) -> bool: head = 0 tail = len(s) - 1 while head < tail: if s[head] == s[tail]: head += 1 tail -= 1 else: return False return True
''' 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
def mask_out(sentence, banned, substitutes): # write your answer between #start and #end #start return '' #end print('Test 1') print('Expected:abcd#') print('Actual :' + mask_out('abcde', 'e', '#')) print() print('Test 2') print('Expected:#$solute') print('Actual :' + mask_out('absolute', 'ab', '#$')) print() print('Test 3') print('Expected:121hon') print('Actual :' + mask_out('python', 'pyt', '12')) print()
def linear_search_recursive(arr, value, start, end): if start >= end: return -1 if arr[start] == value: return start if arr[end] == value: return end else: return linear_search_recursive(arr, value, start+1, end-1) test_list = [1,3,9,11,15,19,29] print(linear_search_recursive(test_list, 15, 0, len(test_list)-1)) #prints 4 print(linear_search_recursive(test_list, 29, 0, len(test_list)-1)) #prints 4 print(linear_search_recursive(test_list, 25, 0, len(test_list)-1)) #prints -1
''' Joe Walter difficulty: 5% run time: 0:20 answer: 40730 *** 034 Digit Factorials 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as 1! = 1 and 2! = 2 are not sums they are not included. *** Observations After 1999999, numbers n are too large to be expressed as sum_fact_digits(n) ''' max = 19_999_999 f = {'0':1, '1':1, '2':2, '3':6, '4':24, '5':120, '6':720, '7':5040, '8':40320, '9':362880} # faster than a list def sum_fact_digits(n): return sum(f[d] for d in str(n)) def solve(): ans = 0 for n in range(10, max): if n == sum_fact_digits(n): ans += n return ans print(solve())
class Config: """ :ivar endpoint: url path for docs :ivar filename: openapi spec file name :ivar openapi_version: openapi spec version :ivar title: document title :ivar version: service version :ivar ui: ui theme, choose 'redoc' or 'swagger' :ivar mode: mode for route. **normal** includes undecorated routes and routes decorated by this instance. **strict** only includes routes decorated by this instance. **greedy** includes all the routes. Flaskerk configuration. """ def __init__(self): self.name = 'docs' self.endpoint = '/docs/' self.url_prefix = None self.template_folder = 'templates' self.filename = 'openapi.json' self.mode = 'normal' self.openapi_veresion = '3.0.2' self.title = 'Service Documents' self.version = 'latest' self.ui = 'redoc' self._support_ui = {'redoc', 'swagger'} self._support_mode = {'normal', 'greedy', 'strict'}
config = { "bootstrap_servers": 'localhost:9092', "async_produce": False, "models": [ { "module_name": "image_classification.predict", "class_name": "ModelPredictor", } ] }
# -*- coding: utf-8 -*- """As the name suggests, this file contains (almost?) all the constants we need: - The tablenames and their web urls - The county sets - Column names for all the tables """ url_prefix = 'http://www.cdss.ca.gov/inforesources/' table_url_map = { 'tbl_cf296': url_prefix + 'Research-and-Data/CalFresh-Data-Tables/CF296', 'tbl_churn_data': url_prefix + 'CalFresh-Resource-Center/Data', 'tbl_data_dashboard': url_prefix + 'Data-Portal/Research-and-Data/CalFresh-Data-Dashboard', 'tbl_dfa256': url_prefix + 'Research-and-Data/CalFresh-Data-Tables/DFA256', 'tbl_dfa296x': url_prefix + 'Research-and-Data/CalFresh-Data-Tables/DFA296x', 'tbl_dfa358f': url_prefix + 'Research-and-Data/CalFresh-Data-Tables/DFA358F', 'tbl_dfa358s': url_prefix + 'Research-and-Data/CalFresh-Data-Tables/DFA358S', 'tbl_stat47': url_prefix + 'Research-and-Data/CalFresh-Data-Tables/STAT-47', } # county_dict has keys stripped of all whitespace for use in the cleanCounties function # in the file_factory module county_dict = { 'Statewide': 'Statewide', 'California': 'California', 'Alameda': 'Alameda', 'Alpine': 'Alpine', 'Amador': 'Amador', 'Butte': 'Butte', 'Calaveras': 'Calaveras', 'Colusa': 'Colusa', 'ContraCosta': 'Contra Costa', 'DelNorte': 'Del Norte', 'ElDorado': 'El Dorado', 'Fresno': 'Fresno', 'Glenn': 'Glenn', 'Humboldt': 'Humboldt', 'Imperial': 'Imperial', 'Inyo': 'Inyo', 'Kern': 'Kern', 'Kings': 'Kings', 'Lake': 'Lake', 'Lassen': 'Lassen', 'LosAngeles': 'Los Angeles', 'Madera': 'Madera', 'Marin': 'Marin', 'Mariposa': 'Mariposa', 'Mendocino': 'Mendocino', 'Merced': 'Merced', 'Modoc': 'Modoc', 'Mono': 'Mono', 'Monterey': 'Monterey', 'Napa': 'Napa', 'Nevada': 'Nevada', 'Orange': 'Orange', 'Placer': 'Placer', 'Plumas': 'Plumas', 'Riverside': 'Riverside', 'Sacramento': 'Sacramento', 'SanBenito': 'San Benito', 'SanBernardino': 'San Bernardino', 'SanDiego': 'San Diego', 'SanFrancisco': 'San Francisco', 'SanJoaquin': 'San Joaquin', 'SanLuisObispo': 'San Luis Obispo', 'SanMateo': 'San Mateo', 'SantaBarbara': 'Santa Barbara', 'SantaClara': 'Santa Clara', 'SantaCruz': 'Santa Cruz', 'Shasta': 'Shasta', 'Sierra': 'Sierra', 'Siskiyou': 'Siskiyou', 'Solano': 'Solano', 'Sonoma': 'Sonoma', 'Stanislaus': 'Stanislaus', 'Sutter': 'Sutter', 'Tehama': 'Tehama', 'Trinity': 'Trinity', 'Tulare': 'Tulare', 'Tuolumne': 'Tuolumne', 'Ventura': 'Ventura', 'Yolo': 'Yolo', 'Yuba': 'Yuba', } county_set = set([ 'Statewide', 'California', 'Alameda', 'Alpine', 'Amador', 'Butte', 'Calaveras', 'Colusa', 'Contra Costa', 'Del Norte', 'El Dorado', 'Fresno', 'Glenn', 'Humboldt', 'Imperial', 'Inyo', 'Kern', 'Kings', 'Lake', 'Lassen', 'Los Angeles', 'Madera', 'Marin', 'Mariposa', 'Mendocino', 'Merced', 'Modoc', 'Mono', 'Monterey', 'Napa', 'Nevada', 'Orange', 'Placer', 'Plumas', 'Riverside', 'Sacramento', 'San Benito', 'San Bernardino', 'San Diego', 'San Francisco', 'San Joaquin', 'San Luis Obispo', 'San Mateo', 'Santa Barbara', 'Santa Clara', 'Santa Cruz', 'Shasta', 'Sierra', 'Siskiyou', 'Solano', 'Sonoma', 'Stanislaus', 'Sutter', 'Tehama', 'Trinity', 'Tulare', 'Tuolumne', 'Ventura', 'Yolo', 'Yuba', ]) CF296Columns = [ 'county', 'apps_rcvd_during_month', 'online_apps_rcvd_during_month', 'apps_disposed_during_month', 'apps_approved', 'pacf_apps_approved_over_30d', 'nacf_apps_approved_over_30d', 'total_apps_approved_over_30d', 'pacf_apps_denied', 'nacf_apps_denied', 'total_apps_denied', 'pacf_apps_denied_because_ineligible', 'nacf_apps_denied_because_ineligible', 'total_apps_denied_because_ineligible', 'pacf_apps_denied_procedural_reasons', 'nacf_apps_denied_procedural_reasons', 'total_apps_denied_procedural_reasons', 'pacf_apps_denied_over_30d', 'nacf_apps_denied_over_30d', 'total_apps_denied_over_30d', 'pacf_apps_withdrawn', 'nacf_apps_withdrawn', 'total_apps_withdrawn', 'pacf_apps_processed_under_ES_disposed_during_month', 'nacf_apps_processed_under_ES_disposed_during_month', 'total_apps_processed_under_ES_disposed_during_month', 'pacf_found_entitled_to_ES', 'nacf_found_entitled_to_ES', 'total_found_entitled_to_ES', 'pacf_benefits_issued_1_to_3d', 'nacf_benefits_issued_1_to_3d', 'total_benefits_issued_1_to_3d', 'pacf_benefits_issued_4_to_7d', 'nacf_benefits_issued_4_to_7d', 'total_benefits_issued_4_to_7d', 'pacf_benefits_issued_over_7d', 'nacf_benefits_issued_over_7d', 'total_benefits_issued_over_7d', 'pacf_found_not_entitled_to_ES', 'nacf_found_not_entitled_to_ES', 'total_found_not_entitled_to_ES', 'pacf_cases_brought_from_begin_month', 'nacf_cases_brought_from_begin_month', 'total_cases_brought_from_begin_month', 'pacf_item_8_from_last_month_report', 'nacf_item_8_from_last_month_report', 'total_item_8_from_last_month_report', 'pacf_adjustment', 'nacf_adjustment', 'total_adjustment', 'pacf_cases_added_during_month', 'nacf_cases_added_during_month', 'total_cases_added_during_month', 'pacf_federal_apps_approved', 'pacf_fed_st_apps_approved', 'pacf_state_apps_approved', 'nacf_federal_apps_approved', 'nacf_fed_st_apps_approved', 'nacf_state_apps_approved', 'pacf_apps_approved', 'nacf_apps_approved', 'total_apps_approved', 'pacf_change_assist_status_PACF_or_NACF', 'nacf_change_assist_status_PACF_or_NACF', 'total_change_assist_status_PACF_or_NACF', 'pacf_intercounty_transfers', 'nacf_intercounty_transfers', 'total_intercounty_transfers', 'pacf_cases_reinstated_benefits_prorated_during_month', 'nacf_cases_reinstated_benefits_prorated_during_month', 'total_cases_reinstated_benefits_prorated_during_month', 'pacf_other_approvals', 'nacf_other_approvals', 'total_other_approvals', 'pacf_total_cases_open_during_month', 'nacf_total_cases_open_during_month', 'total_total_cases_open_during_month', 'pacf_pure_federal_cases', 'nacf_pure_federal_cases', 'total_pure_federal_cases', 'federal_persons_in_6A_and_6B', 'state_persons_single_fed_st_combined_cases', 'state_persons_families_fed_st_combined_cases', 'pacf_fed_st_combined_cases', 'nacf_fed_st_combined_cases', 'total_fed_st_combined_cases', 'state_persons_single_pure_state_cases', 'state_persons_families_pure_state_cases', 'pacf_pure_state_cases', 'nacf_pure_state_cases', 'total_pure_state_cases', 'pacf_cases_discontinued_during_month', 'nacf_cases_discontinued_during_month', 'total_cases_discontinued_during_month', 'pacf_household_discontinued_failed_to_complete_app', 'nacf_household_discontinued_failed_to_complete_app', 'total_household_discontinued_failed_to_complete_app', 'pacf_cases_brought_forward_at_end_month', 'nacf_cases_brought_forward_at_end_month', 'total_cases_brought_forward_at_end_month', 'pacf_recertification_disposed_during_month', 'nacf_recertification_disposed_during_month', 'total_recertification_disposed_during_month', 'pacf_federal_determined_continuing_eligible', 'pacf_fed_st_determined_continuing_eligible', 'pacf_state_determined_continuing_eligible', 'nacf_federal_determined_continuing_eligible', 'nacf_fed_st_determined_continuing_eligible', 'nacf_state_determined_continuing_eligible', 'pacf_determined_continuing_eligible', 'nacf_determined_continuing_eligible', 'total_determined_continuing_eligible', 'pacf_federal_determined_ineligible', 'pacf_fed_st_determined_ineligible', 'pacf_state_determined_ineligible', 'nacf_federal_determined_ineligible', 'nacf_fed_st_determined_ineligible', 'nacf_state_determined_ineligible', 'pacf_determined_ineligible', 'nacf_determined_ineligible', 'total_determined_ineligible', 'pacf_overdue_recertifications_during_month', 'nacf_overdue_recertifications_during_month', 'total_overdue_recertifications_during_month', 'year', 'month', ] ChurnDataColumns = [ 'county', 'snap_apps_rcvd', 'init_apps', 'apps_rcvd_bene_prev_30d', 'apps_rcvd_bene_prev_60d', 'apps_rcvd_bene_prev_90d', 'apps_rcvd_bene_over_90d', 'ave_days_apprv_bene', 'cases_sched_recert', 'recert_rcvd_snap_follow_mth', 'recert_not_rcvd_snap_follow_mth', 'incomp_recert_no_bene_reapp', 'incomp_recert_no_bene_reapp_30d', 'incomp_recert_no_bene_reapp_60d', 'incomp_recert_no_bene_reapp_90d', 'avg_days_btw_notice_recert', 'pct_reapps_churning', 'pct_reapps_churning_in_30d', 'pct_recerts_churning', 'pct_recerts_churning_in_30d', 'year', 'month', ] ChurnDataPercentColumns = [ 'pct_reapps_churning', 'pct_reapps_churning_in_30d', 'pct_recerts_churning', 'pct_recerts_churning_in_30d', ] DataDashboardPercentColumns = [ 'unemployment_pct', 'qtr_timeliness_exp_pct', 'qtr_30d_churn_reapps_pct', 'qtr_90d_churn_reapps_pct', 'qtr_30d_churn_recerts_pct', 'qtr_90d_churn_recerts_pct', 'mth_timeliness_30d_pct', 'mth_timeliness_exp_pct', 'mth_active_error_rate_pct', 'qtr_medical_rcv_calfresh_pct', 'qtr_calfresh_persons_rcv_medical_pct', 'pri_us_census_est_pct', ] DataDashboardAnnualColumns = [ 'county', 'consortium', 'year', 'state_fiscal_year', 'ann_calfresh_hh_sfy_avg', 'ann_calfresh_hh_cy_avg', 'ann_calfresh_persons_sfy_avg', 'ann_calfresh_persons_cy_avg', 'ann_elderly', 'ann_children', 'ann_child_only_hh', 'ann_esl', 'ann_wic_calfresh_reachable', 'ann_calfresh_in_wic', 'ann_tot_pop', 'ann_elderly_over60', 'ann_children_under18', 'ann_tot_esl_over5', 'ann_tot_ssi_recipients', 'unemployment_pct', 'ann_calfresh_eligibles', 'month', ] DataDashboardQuarterlyColumns = [ 'county', 'consortium', 'quarter', 'year', 'federal_fiscal_year', 'state_fiscal_year', 'qtr_timeliness_exp_pct', 'qtr_30d_churn_reapps_pct', 'qtr_90d_churn_reapps_pct', 'qtr_30d_churn_recerts_pct', 'qtr_90d_churn_recerts_pct', ] DataDashboardMonthlyColumns = [ 'county', 'consortium', 'month', 'year', 'federal_fiscal_year', 'state_fiscal_year', 'mth_calfresh_hh', 'mth_calfresh_persons', 'mth_medical_enrollment', 'mth_timeliness_30d_pct', 'mth_timeliness_exp_pct', 'mth_negative_error_completed_cases', 'mth_negative_error_pct', 'mth_active_error_rate_pct', ] DataDashboard3MthColumns = [ 'county', 'consortium', 'month', 'year', 'federal_fiscal_year', 'state_fiscal_year', 'qtr_medical_rcv_calfresh_pct', 'qtr_calfresh_persons_rcv_medical', 'qtr_calfresh_persons_rcv_medical_pct', ] DataDashboardPRIRawColumns = [ 'county', 'consortium', 'year', 'pri_est_frequency', 'calfresh_persons_cy_avg', 'calfresh_eligibles', 'five_yr_est_range', 'pri_us_census_est_pct', 'month', ] DFA256Columns1 = [ 'county', 'num_hh_pub_asst_fed', 'num_hh_pub_asst_fed_st', 'num_hh_pub_asst_st', 'num_hh_nonpub_asst_fed', 'num_hh_nonpub_asst_fed_st', 'num_hh_nonpub_asst_st', 'num_hh_both_fed', 'num_hh_both_fed_st', 'num_hh_both_st', 'num_pers_fedonly_pub_asst', 'num_pers_fedonly_nonpub_asst', 'num_pers_fedonly_both', 'num_pers_fed_st_pub_asst_fed', 'num_pers_fed_st_pub_asst_st', 'num_pers_fed_st_nonpub_asst_fed', 'num_pers_fed_st_nonpub_asst_st', 'num_pers_fed_st_both_fed', 'num_pers_fed_st_both_st', 'num_pers_stonly_pub_asst', 'num_pers_stonly_nonpub_asst', 'num_pers_stonly_both', 'issuances_mail', 'issuances_contract_otc', 'issuances_other_otc', 'issuances_total', 'val_issuances_fed_only', 'val_issuances_fed_st_fed', 'val_issuances_fed_st_st', 'val_issuences_st_only', 'val_issuances_tot_fed', 'val_issuances_tot_st', 'val_issuances_tot_all', 'year', 'month', ] DFA256Columns2 = [ 'county', 'num_hh_pub_asst_fed', 'num_hh_pub_asst_fed_st', 'num_hh_pub_asst_st', 'num_hh_nonpub_asst_fed', 'num_hh_nonpub_asst_fed_st', 'num_hh_nonpub_asst_st', 'num_hh_both_fed', 'num_hh_both_fed_st', 'num_hh_both_st', 'num_pers_fedonly_pub_asst', 'num_pers_fedonly_nonpub_asst', 'num_pers_fedonly_both', 'num_pers_fed_st_pub_asst_fed', 'num_pers_fed_st_pub_asst_st', 'num_pers_fed_st_nonpub_asst_fed', 'num_pers_fed_st_nonpub_asst_st', 'num_pers_fed_st_both_fed', 'num_pers_fed_st_both_st', 'num_pers_stonly_pub_asst', 'num_pers_stonly_nonpub_asst', 'num_pers_stonly_both', 'issuances_mail_ebt', 'issuances_contract_otc', 'issuances_other_otc', 'issuances_total', 'val_issuances_fed_only', 'val_issuances_fed_st_fed', 'val_issuances_fed_st_st', 'val_issuences_st_only', 'val_issuances_tot_fed', 'val_issuances_tot_st', 'val_issuances_tot_all', 'year', 'month', ] DFA256Columns3 = [ 'county', 'num_hh_pub_asst_fed', 'num_hh_pub_asst_fed_st', 'num_hh_pub_asst_st', 'num_hh_nonpub_asst_fed', 'num_hh_nonpub_asst_fed_st', 'num_hh_nonpub_asst_st', 'num_hh_both_fed', 'num_hh_both_fed_st', 'num_hh_both_st', 'num_pers_fedonly_pub_asst', 'num_pers_fedonly_nonpub_asst', 'num_pers_fedonly_both', 'num_pers_fed_st_pub_asst_fed', 'num_pers_fed_st_pub_asst_st', 'num_pers_fed_st_nonpub_asst_fed', 'num_pers_fed_st_nonpub_asst_st', 'num_pers_fed_st_both_fed', 'num_pers_fed_st_both_st', 'num_pers_stonly_pub_asst', 'num_pers_stonly_nonpub_asst', 'num_pers_stonly_both', 'issuances_mail', 'issuances_contract_otc', 'issuances_other_otc', 'issuances_ebt', 'issuances_total', 'issuances_ebt_conv_coupon', 'val_issuances_fed_only', 'val_issuences_st_only', 'val_issuances_tot_all', 'year', 'month', ] DFA296XColumns1 = [ 'county', 'req_exped_service_adjustment', 'req_exped_service_pend_prev_qtr', 'req_exped_service_rcv_this_qtr', 'req_exped_service_tot_this_qtr', 'req_exped_service_tot_disposed_this_qtr', 'req_exped_service_tot_disposed_entitled_to_exped_service', 'req_exped_service_disposed_entitled_pacf_1_to_3_days', 'req_exped_service_disposed_entitled_pacf_4_to_5_days', 'req_exped_service_disposed_entitled_pacf_over_5_days', 'req_exped_service_disposed_entitled_nacf_1_to_3_days', 'req_exped_service_disposed_entitled_nacf_4_to_5_days', 'req_exped_service_disposed_entitled_nacf_over_5_days', 'req_exped_service_disposed_tot_not_entitled', 'req_exped_service_disposed_pacf_not_entitled', 'req_exped_service_disposed_nacf_not_entitled', 'req_exped_service_disposed_pending_end_qtr', 'app_compliance_info_tot_hh_fail_complete_app_process', 'app_compliance_info_pacf_fail_complete_app_process', 'app_compliance_info_nacf_fail_complete_app_process', 'year', 'month', ] DFA296XColumns2 = [ 'county', 'req_exped_service_pend_prev_qtr', 'req_exped_service_reported_pending_end_prev_qtr', 'req_exped_service_adjustment', 'req_exped_service_rcv_this_qtr', 'req_exped_service_tot_this_qtr', 'req_exped_service_tot_pacf_disposed_this_qtr', 'req_exped_service_tot_disposed_pacf_entitled_to_exped_service', 'req_exped_service_disposed_entitled_pacf_1_to_3_days', 'req_exped_service_disposed_entitled_pacf_4_to_7_days', 'req_exped_service_disposed_entitled_pacf_over_7_days', 'req_exped_service_tot_nacf_disposed_this_qtr', 'req_exped_service_tot_disposed_nacf_entitled_to_exped_service', 'req_exped_service_disposed_entitled_nacf_1_to_3_days', 'req_exped_service_disposed_entitled_nacf_4_to_7_days', 'req_exped_service_disposed_entitled_nacf_over_7_days', 'req_exped_service_tot_disposed_this_qtr', 'req_exped_service_tot_disposed_entitled_to_exped_service', 'req_exped_service_disposed_entitled_tot_1_to_3_days', 'req_exped_service_disposed_entitled_tot_4_to_7_days', 'req_exped_service_disposed_entitled_tot_over_7_days', 'req_exped_service_disposed_pacf_not_entitled', 'req_exped_service_disposed_nacf_not_entitled', 'req_exped_service_disposed_tot_not_entitled', 'req_exped_service_disposed_pending_end_qtr', 'app_compliance_info_pacf_fail_complete_app_process', 'app_compliance_info_nacf_fail_complete_app_process', 'app_compliance_info_tot_hh_fail_complete_app_process', 'year', 'month', ] DFA296XColumns3 = [ 'county', 'req_exped_service_pend_prev_qtr', 'req_exped_service_reported_pending_end_prev_qtr', 'req_exped_service_adjustment', 'req_exped_service_rcv_this_qtr', 'req_exped_service_tot_this_qtr', 'req_exped_service_tot_pacf_disposed_this_qtr', 'req_exped_service_tot_disposed_pacf_entitled_to_exped_service', 'req_exped_service_disposed_entitled_pacf_1_to_3_days', 'req_exped_service_disposed_entitled_pacf_4_to_7_days', 'req_exped_service_pacf_4_to_7_days_client_delay', 'req_exped_service_pacf_4_to_7_days_county_delay', 'req_exped_service_disposed_entitled_pacf_over_7_days', 'req_exped_service_pacf_over_7_days_client_delay', 'req_exped_service_pacf_over_7_days_county_delay', 'req_exped_service_tot_nacf_disposed_this_qtr', 'req_exped_service_tot_disposed_nacf_entitled_to_exped_service', 'req_exped_service_disposed_entitled_nacf_1_to_3_days', 'req_exped_service_disposed_entitled_nacf_4_to_7_days', 'req_exped_service_nacf_4_to_7_days_client_delay', 'req_exped_service_nacf_4_to_7_days_county_delay', 'req_exped_service_disposed_entitled_nacf_over_7_days', 'req_exped_service_nacf_over_7_days_client_delay', 'req_exped_service_nacf_over_7_days_county_delay', 'req_exped_service_tot_disposed_this_qtr', 'req_exped_service_tot_disposed_entitled_to_exped_service', 'req_exped_service_disposed_entitled_tot_1_to_3_days', 'req_exped_service_disposed_entitled_tot_4_to_7_days', 'req_exped_service_tot_4_to_7_days_client_delay', 'req_exped_service_tot_4_to_7_days_county_delay', 'req_exped_service_disposed_entitled_tot_over_7_days', 'req_exped_service_tot_over_7_days_client_delay', 'req_exped_service_tot_over_7_days_county_delay', 'req_exped_service_disposed_pacf_not_entitled', 'req_exped_service_disposed_nacf_not_entitled', 'req_exped_service_disposed_tot_not_entitled', 'req_exped_service_disposed_pending_end_qtr', 'app_compliance_info_pacf_fail_complete_app_process', 'app_compliance_info_nacf_fail_complete_app_process', 'app_compliance_info_tot_hh_fail_complete_app_process', 'year', 'month', ] DFA358Columns1 = [ 'county', 'black_pa', 'black_na', 'black_tot', 'hispanic_pa', 'hispanic_na', 'hispanic_tot', 'asian_pac_islander_pa', 'asian_pac_islander_na', 'asian_pac_islander_tot', 'am_indian_alaskan_nat_pa', 'am_indian_alaskan_nat_na', 'am_indian_alaskan_nat_tot', 'white_pa', 'white_na', 'white_tot', 'filipino_pa', 'filipino_na', 'filipino_tot', 'other_pa', 'other_na', 'other_tot', 'total_pa', 'total_na', 'total_tot', 'chinese_pa', 'chinese_na', 'chinese_tot', 'cambodian_pa', 'cambodian_na', 'cambodian_tot', 'japanese_pa', 'japanese_na', 'japanese_tot', 'korean_pa', 'korean_na', 'korean_tot', 'samoan_pa', 'samoan_na', 'samoan_tot', 'asian_indian_pa', 'asian_indian_na', 'asian_indian_tot', 'hawaiian_pa', 'hawaiian_na', 'hawaiian_tot', 'guamanian_pa', 'guamanian_na', 'guamanian_tot', 'laotian_pa', 'laotian_na', 'laotian_tot', 'vietnamese_pa', 'vietnamese_na', 'vietnamese_tot', 'asian_pac_islander_other_pa', 'asian_pac_islander_other_na', 'asian_pac_islander_other_tot', 'asian_pac_islander_total_pa', 'asian_pac_islander_total_na', 'asian_pac_islander_total_tot', 'year', 'month', ] DFA358Columns2 = [ 'county', 'am_indian_alaskan_nat_pa', 'am_indian_alaskan_nat_na', 'am_indian_alaskan_nat_tot', 'tot_asian_pa', 'tot_asian_na', 'tot_asian_tot', 'asian_indian_pa', 'asian_indian_na', 'asian_indian_tot', 'cambodian_pa', 'cambodian_na', 'cambodian_tot', 'chinese_pa', 'chinese_na', 'chinese_tot', 'japanese_pa', 'japanese_na', 'japanese_tot', 'filipino_pa', 'filipino_na', 'filipino_tot', 'korean_pa', 'korean_na', 'korean_tot', 'laotian_pa', 'laotian_na', 'laotian_tot', 'vietnamese_pa', 'vietnamese_na', 'vietnamese_tot', 'other_asian_pa', 'other_asian_na', 'other_asian_tot', 'more_than_one_asian_pa', 'more_than_one_asian_na', 'more_than_one_asian_tot', 'black_pa', 'black_na', 'black_tot', 'tot_hawaiian_or_other_pa', 'tot_hawaiian_or_other_na', 'tot_hawaiian_or_other_tot', 'hawaiian_pa', 'hawaiian_na', 'hawaiian_tot', 'guamanian_pa', 'guamanian_na', 'guamanian_tot', 'samoan_pa', 'samoan_na', 'samoan_tot', 'other_pac_island_pa', 'other_pac_island_na', 'other_pac_island_tot', 'more_than_one_hawaiian_pac_island_pa', 'more_than_one_hawaiian_pac_island_na', 'more_than_one_hawaiian_pac_island_tot', 'white_pa', 'white_na', 'white_tot', 'two_races_am_indian_alaska_nat_white_pa', 'two_races_am_indian_alaska_nat_white_na', 'two_races_am_indian_alaska_nat_white_tot', 'two_races_asian_white_pa', 'two_races_asian_white_na', 'two_races_asian_white_tot', 'two_races_black_white_pa', 'two_races_black_white_na', 'two_races_black_white_tot', 'two_races_am_indian_alaska_nat_black_pa', 'two_races_am_indian_alaska_nat_black_na', 'two_races_am_indian_alaska_nat_black_tot', 'reported_races_not_incl_pa', 'reported_races_not_incl_na', 'reported_races_not_incl_tot', 'nonreporting_worker_undecided_pa', 'nonreporting_worker_undecided_na', 'nonreporting_worker_undecided_tot', 'total_pa', 'total_na', 'total_tot', 'hispanic_am_indian_alaska_nat_pa', 'hispanic_am_indian_alaska_nat_na', 'hispanic_am_indian_alaska_nat_tot', 'hispanic_tot_asian_pa', 'hispanic_tot_asian_na', 'hispanic_tot_asian_tot', 'hispanic_asian_indian_pa', 'hispanic_asian_indian_na', 'hispanic_asian_indian_tot', 'hispanic_cambodian_pa', 'hispanic_cambodian_na', 'hispanic_cambodian_tot', 'hispanic_chinese_pa', 'hispanic_chinese_na', 'hispanic_chinese_tot', 'hispanic_japanese_pa', 'hispanic_japanese_na', 'hispanic_japanese_tot', 'hispanic_filipino_pa', 'hispanic_filipino_na', 'hispanic_filipino_tot', 'hispanic_korean_pa', 'hispanic_korean_na', 'hispanic_korean_tot', 'hispanic_laotian_pa', 'hispanic_laotian_na', 'hispanic_laotian_tot', 'hispanic_vietnamese_pa', 'hispanic_vietnamese_na', 'hispanic_vietnamese_tot', 'hispanic_other_asian_pa', 'hispanic_other_asian_na', 'hispanic_other_asian_tot', 'hispanic_more_than_one_asian_pa', 'hispanic_more_than_one_asian_na', 'hispanic_more_than_one_asian_tot', 'hispanic_black_pa', 'hispanic_black_na', 'hispanic_black_tot', 'hispanic_tot_hawaiian_other_pac_island_pa', 'hispanic_tot_hawaiian_other_pac_island_na', 'hispanic_tot_hawaiian_other_pac_island_tot', 'hispanic_hawaiian_pa', 'hispanic_hawaiian_na', 'hispanic_hawaiian_tot', 'hispanic_guamanian_pa', 'hispanic_guamanian_na', 'hispanic_guamanian_tot', 'hispanic_samoan_pa', 'hispanic_samoan_na', 'hispanic_samoan_tot', 'hispanic_other_pac_island_pa', 'hispanic_other_pac_island_na', 'hispanic_other_pac_island_tot', 'hispanic_more_than_one_hawaiian_pac_island_pa', 'hispanic_more_than_one_hawaiian_pac_island_na', 'hispanic_more_than_one_hawaiian_pac_island_tot', 'hispanic_white_pa', 'hispanic_white_na', 'hispanic_white_tot', 'hispanic_two_races_am_indian_alaska_nat_white_pa', 'hispanic_two_races_am_indian_alaska_nat_white_na', 'hispanic_two_races_am_indian_alaska_nat_white_tot', 'hispanic_two_races_asian_white_pa', 'hispanic_two_races_asian_white_na', 'hispanic_two_races_asian_white_tot', 'hispanic_two_races_black_white_pa', 'hispanic_two_races_black_white_na', 'hispanic_two_races_black_white_tot', 'hispanic_two_races_am_indian_alaska_nat_black_pa', 'hispanic_two_races_am_indian_alaska_nat_black_na', 'hispanic_two_races_am_indian_alaska_nat_black_tot', 'hispanic_reported_races_not_incl_pa', 'hispanic_reported_races_not_incl_na', 'hispanic_reported_races_not_incl_tot', 'hispanic_nonreporting_worker_undecided_pa', 'hispanic_nonreporting_worker_undecided_na', 'hispanic_nonreporting_worker_undecided_tot', 'hispanic_tot_pa', 'hispanic_tot_na', 'hispanic_tot_tot', 'year', 'month', ] Stat47Columns1 = [ 'county', 'registrant_abawd_undup_new_registrants_month1', 'registrant_abawd_undup_new_registrants_month2', 'registrant_abawd_undup_new_registrants_month3', 'registrant_abawd_undup_new_registrants_qtr_total', 'registrant_abawd_undup_new_abawds_month1', 'registrant_abawd_undup_new_abawds_month2', 'registrant_abawd_undup_new_abawds_month3', 'registrant_abawd_undup_new_abawds_qtr_total', 'registrant_abawd_abawds_exempt_month1', 'registrant_abawd_abawds_exempt_month2', 'registrant_abawd_abawds_exempt_month3', 'registrant_abawd_abawds_exempt_qtr_total', 'new_et_participants_new_et_individuals_month1', 'new_et_participants_new_et_individuals_month2', 'new_et_participants_new_et_individuals_month3', 'new_et_participants_new_et_individuals_qtr_total', 'new_et_participants_new_et_undup_abawds_month1', 'new_et_participants_new_et_undup_abawds_month2', 'new_et_participants_new_et_undup_abawds_month3', 'new_et_participants_new_et_undup_abawds_qtr_total', 'new_et_participants_new_et_undup_nonabawds_month1', 'new_et_participants_new_et_undup_nonabawds_month2', 'new_et_participants_new_et_undup_nonabawds_month3', 'new_et_participants_new_et_undup_nonabawds_qtr_total', 'new_et_component_new_job_placements_month1', 'new_et_component_new_job_placements_month2', 'new_et_component_new_job_placements_month3', 'new_et_component_new_job_placements_qtr_total', 'new_et_component_new_job_abawd_placements_month1', 'new_et_component_new_job_abawd_placements_month2', 'new_et_component_new_job_abawd_placements_month3', 'new_et_component_new_job_abawd_placements_qtr_total', 'new_et_component_new_job_nonabawd_placements_month1', 'new_et_component_new_job_nonabawd_placements_month2', 'new_et_component_new_job_nonabawd_placements_month3', 'new_et_component_new_job_nonabawd_placements_qtr_total', 'new_et_component_new_job_club_placements_month1', 'new_et_component_new_job_club_placements_month2', 'new_et_component_new_job_club_placements_month3', 'new_et_component_new_job_club_placements_qtr_total', 'new_et_component_job_club_abawd_placements_month1', 'new_et_component_job_club_abawd_placements_month2', 'new_et_component_job_club_abawd_placements_month3', 'new_et_component_job_club_abawd_placements_qtr_total', 'new_et_component_job_club_nonabawd_placements_month1', 'new_et_component_job_club_nonabawd_placements_month2', 'new_et_component_job_club_nonabawd_placements_month3', 'new_et_component_job_club_nonabawd_placements_qtr_total', 'new_et_component_workfare_placements_month1', 'new_et_component_workfare_placements_month2', 'new_et_component_workfare_placements_month3', 'new_et_component_workfare_placements_qtr_total', 'new_et_component_workfare_abawd_placements_month1', 'new_et_component_workfare_abawd_placements_month2', 'new_et_component_workfare_abawd_placements_month3', 'new_et_component_workfare_abawd_placements_qtr_total', 'new_et_component_workfare_nonabawd_placements_month1', 'new_et_component_workfare_nonabawd_placements_month2', 'new_et_component_workfare_nonabawd_placements_month3', 'new_et_component_workfare_nonabawd_placements_qtr_total', 'new_et_component_selfinitiated_placements_month1', 'new_et_component_selfinitiated_placements_month2', 'new_et_component_selfinitiated_placements_month3', 'new_et_component_selfinitiated_placements_qtr_total', 'new_et_component_selfinitiated_abawd_placements_month1', 'new_et_component_selfinitiated_abawd_placements_month2', 'new_et_component_selfinitiated_abawd_placements_month3', 'new_et_component_selfinitiated_abawd_placements_qtr_total', 'new_et_component_selfinitiated_nonabawd_placements_month1', 'new_et_component_selfinitiated_nonabawd_placements_month2', 'new_et_component_selfinitiated_nonabawd_placements_month3', 'new_et_component_selfinitiated_nonabawd_placements_qtr_total', 'new_et_component_work_exp_placements_month1', 'new_et_component_work_exp_placements_month2', 'new_et_component_work_exp_placements_month3', 'new_et_component_work_exp_placements_qtr_total', 'new_et_component_work_exp_abawd_placements_month1', 'new_et_component_work_exp_abawd_placements_month2', 'new_et_component_work_exp_abawd_placements_month3', 'new_et_component_work_exp_abawd_placements_qtr_total', 'new_et_component_work_exp_nonabawd_placements_month1', 'new_et_component_work_exp_nonabawd_placements_month2', 'new_et_component_work_exp_nonabawd_placements_month3', 'new_et_component_work_exp_nonabawd_placements_qtr_total', 'new_et_component_vocation_placements_month1', 'new_et_component_vocation_placements_month2', 'new_et_component_vocation_placements_month3', 'new_et_component_vocation_placements_qtr_total', 'new_et_component_vocation_abawd_placements_month1', 'new_et_component_vocation_abawd_placements_month2', 'new_et_component_vocation_abawd_placements_month3', 'new_et_component_vocation_abawd_placements_qtr_total', 'new_et_component_vocation_nonabawd_placements_month1', 'new_et_component_vocation_nonabawd_placements_month2', 'new_et_component_vocation_nonabawd_placements_month3', 'new_et_component_vocation_nonabawd_placements_qtr_total', 'new_et_component_education_placements_month1', 'new_et_component_education_placements_month2', 'new_et_component_education_placements_month3', 'new_et_component_education_placements_qtr_total', 'new_et_component_education_abawd_placements_month1', 'new_et_component_education_abawd_placements_month2', 'new_et_component_education_abawd_placements_month3', 'new_et_component_education_abawd_placements_qtr_total', 'new_et_component_education_nonabawd_placements_month1', 'new_et_component_education_nonabawd_placements_month2', 'new_et_component_education_nonabawd_placements_month3', 'new_et_component_education_nonabawd_placements_qtr_total', 'new_et_component_retention_placements_month1', 'new_et_component_retention_placements_month2', 'new_et_component_retention_placements_month3', 'new_et_component_retention_placements_qtr_total', 'new_et_component_retention_abawd_placements_month1', 'new_et_component_retention_abawd_placements_month2', 'new_et_component_retention_abawd_placements_month3', 'new_et_component_retention_abawd_placements_qtr_total', 'new_et_component_retention_nonabawd_placements_month1', 'new_et_component_retention_nonabawd_placements_month2', 'new_et_component_retention_nonabawd_placements_month3', 'new_et_component_retention_nonabawd_placements_qtr_total', 'new_et_component_other_placements_month1', 'new_et_component_other_placements_month2', 'new_et_component_other_placements_month3', 'new_et_component_other_placements_qtr_total', 'new_et_component_other_abawd_placements_month1', 'new_et_component_other_abawd_placements_month2', 'new_et_component_other_abawd_placements_month3', 'new_et_component_other_abawd_placements_qtr_total', 'new_et_component_other_nonabawd_placements_month1', 'new_et_component_other_nonabawd_placements_month2', 'new_et_component_other_nonabawd_placements_month3', 'new_et_component_other_nonabawd_placements_qtr_total', 'new_et_component_all_placements_month1', 'new_et_component_all_placements_month2', 'new_et_component_all_placements_month3', 'new_et_component_all_placements_qtr_total', 'new_et_component_all_abawd_placements_month1', 'new_et_component_all_abawd_placements_month2', 'new_et_component_all_abawd_placements_month3', 'new_et_component_all_abawd_placements_qtr_total', 'new_et_component_all_nonabawd_placements_month1', 'new_et_component_all_nonabawd_placements_month2', 'new_et_component_all_nonabawd_placements_month3', 'new_et_component_all_nonabawd_placements_qtr_total', 'year', 'month', ] Stat47Columns2 = [ 'county', 'new_contin_job_search_participants_month1', 'new_contin_job_search_participants_month2', 'new_contin_job_search_participants_month3', 'new_contin_job_search_participants_qtr_total', 'new_contin_job_search_abawd_participants_month1', 'new_contin_job_search_abawd_participants_month2', 'new_contin_job_search_abawd_participants_month3', 'new_contin_job_search_abawd_participants_qtr_total', 'new_contin_job_search_nonabawd_participants_month1', 'new_contin_job_search_nonabawd_participants_month2', 'new_contin_job_search_nonabawd_participants_month3', 'new_contin_job_search_nonabawd_participants_qtr_total', 'new_contin_job_club_participants_month1', 'new_contin_job_club_participants_month2', 'new_contin_job_club_participants_month3', 'new_contin_job_club_participants_qtr_total', 'new_contin_job_club_abawd_participants_month1', 'new_contin_job_club_abawd_participants_month2', 'new_contin_job_club_abawd_participants_month3', 'new_contin_job_club_abawd_participants_qtr_total', 'new_contin_job_club_nonabawd_participants_month1', 'new_contin_job_club_nonabawd_participants_month2', 'new_contin_job_club_nonabawd_participants_month3', 'new_contin_job_club_nonabawd_participants_qtr_total', 'new_contin_workfare_participants_month1', 'new_contin_workfare_participants_month2', 'new_contin_workfare_participants_month3', 'new_contin_workfare_participants_qtr_total', 'new_contin_workfare_abawd_participants_month1', 'new_contin_workfare_abawd_participants_month2', 'new_contin_workfare_abawd_participants_month3', 'new_contin_workfare_abawd_participants_qtr_total', 'new_contin_workfare_nonabawd_participants_month1', 'new_contin_workfare_nonabawd_participants_month2', 'new_contin_workfare_nonabawd_participants_month3', 'new_contin_workfare_nonabawd_participants_qtr_total', 'new_contin_selfinitiated_participants_month1', 'new_contin_selfinitiated_participants_month2', 'new_contin_selfinitiated_participants_month3', 'new_contin_selfinitiated_participants_qtr_total', 'new_contin_selfinitiated_abawd_participants_month1', 'new_contin_selfinitiated_abawd_participants_month2', 'new_contin_selfinitiated_abawd_participants_month3', 'new_contin_selfinitiated_abawd_participants_qtr_total', 'new_contin_selfinitiated_nonabawd_participants_month1', 'new_contin_selfinitiated_nonabawd_participants_month2', 'new_contin_selfinitiated_nonabawd_participants_month3', 'new_contin_selfinitiated_nonabawd_participants_qtr_total', 'new_contin_workexp_participants_month1', 'new_contin_workexp_participants_month2', 'new_contin_workexp_participants_month3', 'new_contin_workexp_participants_qtr_total', 'new_contin_workexp_abawd_participants_month1', 'new_contin_workexp_abawd_participants_month2', 'new_contin_workexp_abawd_participants_month3', 'new_contin_workexp_abawd_participants_qtr_total', 'new_contin_workexp_nonabawd_participants_month1', 'new_contin_workexp_nonabawd_participants_month2', 'new_contin_workexp_nonabawd_participants_month3', 'new_contin_workexp_nonabawd_participants_qtr_total', 'new_contin_vocational_participants_month1', 'new_contin_vocational_participants_month2', 'new_contin_vocational_participants_month3', 'new_contin_vocational_participants_qtr_total', 'new_contin_vocational_abawd_participants_month1', 'new_contin_vocational_abawd_participants_month2', 'new_contin_vocational_abawd_participants_month3', 'new_contin_vocational_abawd_participants_qtr_total', 'new_contin_vocational_nonabawd_participants_month1', 'new_contin_vocational_nonabawd_participants_month2', 'new_contin_vocational_nonabawd_participants_month3', 'new_contin_vocational_nonabawd_participants_qtr_total', 'new_contin_education_participants_month1', 'new_contin_education_participants_month2', 'new_contin_education_participants_month3', 'new_contin_education_participants_qtr_total', 'new_contin_education_abawd_participants_month1', 'new_contin_education_abawd_participants_month2', 'new_contin_education_abawd_participants_month3', 'new_contin_education_abawd_participants_qtr_total', 'new_contin_education_nonabawd_participants_month1', 'new_contin_education_nonabawd_participants_month2', 'new_contin_education_nonabawd_participants_month3', 'new_contin_education_nonabawd_participants_qtr_total', 'new_contin_retention_participants_month1', 'new_contin_retention_participants_month2', 'new_contin_retention_participants_month3', 'new_contin_retention_participants_qtr_total', 'new_contin_retention_abawd_participants_month1', 'new_contin_retention_abawd_participants_month2', 'new_contin_retention_abawd_participants_month3', 'new_contin_retention_abawd_participants_qtr_total', 'new_contin_retention_nonabawd_participants_month1', 'new_contin_retention_nonabawd_participants_month2', 'new_contin_retention_nonabawd_participants_month3', 'new_contin_retention_nonabawd_participants_qtr_total', 'new_contin_other_participants_month1', 'new_contin_other_participants_month2', 'new_contin_other_participants_month3', 'new_contin_other_participants_qtr_total', 'new_contin_other_abawd_participants_month1', 'new_contin_other_abawd_participants_month2', 'new_contin_other_abawd_participants_month3', 'new_contin_other_abawd_participants_qtr_total', 'new_contin_other_nonabawd_participants_month1', 'new_contin_other_nonabawd_participants_month2', 'new_contin_other_nonabawd_participants_month3', 'new_contin_other_nonabawd_participants_qtr_total', 'et_totals_fns583_abawds_in_qualifying_et_month1', 'et_totals_fns583_abawds_in_qualifying_et_month2', 'et_totals_fns583_abawds_in_qualifying_et_month3', 'et_totals_fns583_abawds_in_qualifying_et_qtr_total', 'et_totals_fns583_abawds_in_nonqualifying_et_month1', 'et_totals_fns583_abawds_in_nonqualifying_et_month2', 'et_totals_fns583_abawds_in_nonqualifying_et_month3', 'et_totals_fns583_abawds_in_nonqualifying_et_qtr_total', 'et_totals_fns583_nonabawds_in_et_month1', 'et_totals_fns583_nonabawds_in_et_month2', 'et_totals_fns583_nonabawds_in_et_month3', 'et_totals_fns583_nonabawds_in_et_qtr_total', 'point_in_time_et_participants_nonabawd_month1', 'point_in_time_et_participants_nonabawd_month2', 'point_in_time_et_participants_nonabawd_month3', 'point_in_time_et_participants_nonabawd_qtr_total', 'point_in_time_work_registrants_qtr_start', 'point_in_time_abawds_qtr_start', 'year', 'month', ]
''' Have the function SimpleMode(arr) take the array of numbers stored in arr and return the number that appears most frequently (the mode). For example: if arr contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode return the one that appeared in the array first (ie. [5, 10, 10, 6, 5] should return 5 because it appeared first). If there is no mode return -1. The array will not be empty. ''' def SimpleMode(arr): # dictionary that will store values from input array counter = {} # loop to count occurences of numbers in array for i in range(len(arr)): nr = arr[i] if nr in counter: counter[nr] += 1 else: counter[nr] = 1 # dictionary that will store mode of input array ans = {"number": '', "count": 1} # loop through counter dictionary to find first mode of input array for x in counter: if (counter[x] > ans["count"]): ans["count"] = counter[x] ans["number"] = x # if there are no duplicates return -1, else return first mode that appeard in input array if ans["count"] == 1: return -1 else: return ans["number"] test = [2,5,10,10,6,5] print(SimpleMode(test))
class Solution: """ @param nums: A list of integers @param k: An integer @return: The median of the element inside the window at each moving """ def medianSlidingWindow(self, nums, k): # write your code here pass
class Pipe(object): def __init__(self, *args): self.functions = args self.state = {'error': '', 'result': None} def __call__(self, value): if not value: raise "Not any value for running" self.state['result'] = self.data_pipe(value) return self.state def _bind(self, value, function): try: if value: return function(value) else: return None except Exception as e: self.state['error'] = e def data_pipe(self, value): c_value = value for function in self.functions: c_value = self._bind(c_value, function) return c_value
#code class Node : def __init__(self,data): self.data = data self.next = None class LinkedList : def __init__(self): self.head = None def Push(self,new_data): if(self.head== None): self.head = Node(new_data) else: new_node = Node(new_data) new_node.next = None temp = self.head while temp.next: temp = temp.next temp.next = new_node def PrintList(self): temp = self.head while temp: print(temp.data,end=" ") temp = temp.next print('') def DeleteLinkedList(self): temp = self.head while(temp): next = temp.next del temp.data temp = next print("Linked list deleted") if __name__ == '__main__': t = int(input()) for i in range(t): list1 = LinkedList() n = int(input()) #5 values = list(map(int, input().strip().split())) # 8 2 3 1 7 for i in values: list1.Push(i) k = int(input()) #any works for all list1.PrintList() list1.DeleteLinkedList()
NONE = 0 HALT = 1 << 0 FAULT = 1 << 1 BREAK = 1 << 2
""" check if 2 strings are anagrams """ def anagrams(string1, string2): if sorted(string1) == sorted(string2): return True else: return False
# Pascal's Triangle # @author unobatbayar # Input website link and download to a directory # @author unobatbayar just for comments not whole code this time # @program 10 # date 27-10-2018 print("Welcome to Pascal's Triangle!" + "\n") row = int(input('Please input a row number to which you want to see the triangle to' + '\n')) a=[] for i in range(row): a.append([]) a[i].append(1) #append(object) - Updates the list by adding an object to the list. append(): It is basically used in Python to add one element. #basically the 1's surrounding the triangle for j in range(1,i): a[i].append(a[i-1][j-1]+a[i-1][j]) #add what's in the headspace if(row!=0): a[i].append(1) #add another value if row doesn't equal to 0 for i in range(row): print(" "*(row-i),end=" ",sep=" ") for j in range(0,i+1): print('{0:6}'.format(a[i][j]),end=" ",sep=" ") print() ## REFERENCE: # Thanks to Sanfoundry for providing the main code, I initially tried to create it # on my own, however, my code was bad and wasn't working quite right. # link to the website: https://www.sanfoundry.com/python-program-print-pascal-triangle/
class StorageDriverError(Exception): pass class ObjectDoesNotExistError(StorageDriverError): def __init__(self, driver, bucket, object_name): super().__init__( f"Bucket {bucket} does not contain {object_name} (driver={driver})" ) class AssetsManagerError(Exception): pass class AssetAlreadyExistsError(AssetsManagerError): def __init__(self, name): super().__init__(f"Asset {name} already exists, you should update it.") class AssetDoesNotExistError(AssetsManagerError): def __init__(self, name): super().__init__( f"Asset {name} does not exist" "Use `push_new_asset` to create it." ) class AssetMajorVersionDoesNotExistError(AssetsManagerError): def __init__(self, name, major): super().__init__( f"Asset major version `{major}` for `{name}` does not exist." "Use `push_new_asset` to push a new major version of an asset." ) class InvalidAssetSpecError(AssetsManagerError): def __init__(self, spec): super().__init__(f"Invalid asset spec `{spec}`") class InvalidVersionError(InvalidAssetSpecError): def __init__(self, version): super().__init__(f"Asset version `{version}` is not valid.") class InvalidNameError(InvalidAssetSpecError): def __init__(self, name): super().__init__(f"Asset name `{name}` is not valid.") class LocalAssetDoesNotExistError(AssetsManagerError): def __init__(self, name, version, local_versions): super().__init__( f"Asset version `{version}` for `{name}` does not exist locally. " f"Available asset versions: " + ", ".join(local_versions) ) class UnknownAssetsVersioningSystemError(AssetsManagerError): pass
class Solution: def maximizeSweetness(self, sweetness: List[int], K: int) -> int: low, high = 1, sum(sweetness) // (K + 1) while low < high: mid = (low + high + 1) // 2 count = curr = 0 for s in sweetness: curr += s if curr >= mid: count += 1 if count >= K + 1: break curr = 0 if count >= K + 1: low = mid else: high = mid - 1 return low
""" good explanation from discussion my solution is like this: using two pointers, one of them one step at a time. Another pointer each take two steps. Suppose the first meet at step k,the length of the Cycle is r. so..2k-k=nr,k=nr Now, the distance between the start node of list and the start node of cycle is s. The distance between the start of list and the first meeting node is k(the pointer which wake one step at a time waked k steps). Distance between the start node of cycle and the first meeting node is m, so...s=k-m, s=nr-m=(n-1)r+(r-m),here we takes n = 1..so, using one pointer start from the start node of list, another pointer start from the first meeting node, all of them wake one step at a time, the first time they meeting each other is the start of the cycle. """ # # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def detectCycle(self, head): """ :type head: ListNode :rtype: bool """ slow = fast = head while fast: slow = slow.next fast = fast.next if not fast: return None fast = fast.next if slow == fast: slow = head while slow != fast: slow = slow.next fast = fast.next return slow return None
taggable_resources = [ # API Gateway "aws_api_gateway_stage", # ACM "aws_acm_certificate", "aws_acmpca_certificate_authority", # CloudFront "aws_cloudfront_distribution", # CloudTrail "aws_cloudtrail", # AppSync "aws_appsync_graphql_api", # Backup "aws_backup_plan", "aws_backup_vault", # CloudFormation "aws_cloudformation_stack", "aws_cloudformation_stack_set", # Batch Compute "aws_batch_compute_environment", # CloudWatch "aws_cloudwatch_metric_alarm" "aws_cloudwatch_event_rule", "aws_cloudwatch_log_group", # CodeBuild "aws_codebuild_project", # CloudHSM "aws_cloudhsm_v2_cluster", # Cognito "aws_cognito_identity_pool", "aws_cognito_user_pool", # DirectoryServer "aws_directory_service_directory", # DirectConnect "aws_dx_connection", "aws_dx_lag", # IAM "aws_iam_user", "aws_iam_role", # AWS Config "aws_config_config_rule", # AWS Database Migration Service "aws_dms_certificate", "aws_dms_endpoint", "aws_dms_replication_instance", "aws_dms_replication_subnet_group", "aws_dms_replication_task", # DynamoDB "aws_dynamodb_table", # AWS Elastic Beanstalk "aws_elastic_beanstalk_application", "aws_elastic_beanstalk_application_version", "aws_elastic_beanstalk_configuration_template", "aws_elastic_beanstalk_environment" # Amazon Elastic Compute Cloud (Amazon EC2) "aws_ec2_capacity_reservation", "aws_eip", "aws_ami", "aws_instance", "aws_launch_template", "aws_ebs_volume", "aws_ebs_snapshot", "aws_ebs_snapshot_copy", "aws_ec2_client_vpn_endpoint", "aws_ami_copy", "aws_ec2_fleet", "aws_ec2_transit_gateway", "aws_ec2_transit_gateway_route_table", "aws_ec2_transit_gateway_vpc_attachment", "aws_ec2_transit_gateway_vpc_attachment_accepter", "aws_spot_fleet_request", "aws_spot_instance_request", "aws_volume_attachment" # Amazon Elastic Container Registry "aws_ecr_repository", # ECS "aws_ecs_cluster", "aws_ecs_service", "aws_ecs_task_definition", # EFS "aws_efs_file_system", # ElastiCache "aws_elasticache_cluster", "aws_elasticache_replication_group", # EMR "aws_emr_cluster", # Elasticsearch "aws_elasticsearch_domain", # Glacier "aws_glacier_vault", # Glue # Inspector "aws_inspector_resource_group", # IOT # KMS "aws_kms_external_key", "aws_kms_key", # Kinesis "aws_kinesis_analytics_application", "aws_kinesis_stream", "aws_kinesis_firehose_delivery_stream", # Lambda "aws_lambda_function", # Kafka "aws_msk_cluster", # MQ "aws_mq_broker", # Opsworks "aws_opsworks_stack", # Resource Access Manager (RAM) "aws_ram_resource_share", # RDS "aws_db_event_subscription", "aws_db_instance", "aws_db_option_group", "aws_db_parameter_group", "db_security_group", "aws_db_snapshot", "aws_db_subnet_group", "aws_rds_cluster", "aws_rds_cluster_instance", "aws_rds_cluster_parameter_group", # Redshift "aws_redshift_cluster", "aws_redshift_event_subscription", "aws_redshift_parameter_group", "aws_redshift_snapshot_copy_grant", "aws_redshift_subnet_group", # Resource Groups # RoboMaker "aws_route53_health_check", "aws_route53_zone", "aws_route53_resolver_endpoint", "aws_route53_resolver_rule", # Load Balancing "aws_elb", "aws_lb", "aws_lb_target_group", # SageMaker "aws_sagemaker_endpoint", "aws_sagemaker_endpoint_configuration", "aws_sagemaker_model", "aws_sagemaker_notebook_instance", # Service Catelog "aws_servicecatalog_portfolio", # S3 "aws_s3_bucket", "aws_s3_bucket_metric", "aws_s3_bucket_object", # Neptune "aws_neptune_parameter_group", "aws_neptune_subnet_group", "aws_neptune_cluster_parameter_group", "aws_neptune_cluster", "aws_neptune_cluster_instance", "aws_neptune_event_subscription", # Secrets Manager "aws_secretsmanager_secret", # VPC "aws_customer_gateway", "aws_default_network_acl", "aws_default_route_table", "aws_default_security_group", "aws_default_subnet", "aws_default_vpc", "aws_default_vpc_dhcp_options", "aws_vpc_endpoint", "aws_vpc_endpoint_service", "aws_vpc_peering_connection", "aws_vpc_peering_connection_accepter", "aws_vpn_connection", "aws_vpn_gateway", "aws_nat_gateway", "aws_network_acl", "aws_network_interface", "aws_route_table", "aws_security_group", "aws_subnet", "aws_vpc", "aws_vpc_dhcp_options", ]
print('\033[31m-=' * 22) print('\033[37;1manalisador de lados para formar um triangulo\033[m ') print('\033[31m-=\033[m' * 22) a = float(input('primeira reta: ')) b = float(input('segunda reta: ')) c = float(input('terceira reta: ')) if a < b + c and b < a + c and c < a + b: print('\033[32mpod-se formar triangulo com estes segmentos\033[m ') if a == b == c: print('o triangulo é equilatero') elif a != b != c != a: print('O tiangulo é escaleno') else: print('O triangulo é Isósceles') else: print('\033[31mñ se pode formar triangulo com estes segmentos\033[m ')
CREATE_VENV__CMD = b'UkVNIE5lY2Vzc2FyeSBGaWxlczoNClJFTSAtIHByZV9zZXR1cF9zY3JpcHRzLnR4dA0KUkVNIC0gcmVxdWlyZWRfcGVyc29uYWxfcGFja2FnZXMudHh0DQpSRU0gLSByZXF1aXJlZF9taXNjLnR4dA0KUkVNIC0gcmVxdWlyZWRfUXQudHh0DQpSRU0gLSByZXF1aXJlZF9mcm9tX2dpdGh1Yi50eHQNClJFTSAtIHJlcXVpcmVkX3Rlc3QudHh0DQpSRU0gLSByZXF1aXJlZF9kZXYudHh0DQpSRU0gLSBwb3N0X3NldHVwX3NjcmlwdHMudHh0DQpSRU0gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpARUNITyBPRkYNClNFVExPQ0FMIEVOQUJMRUVYVEVOU0lPTlMNCg0KDQoNCg0KU0VUIFBST0pFQ1RfTkFNRT0tUExFQVNFX1NFVF9USElTLQ0KDQpTRVQgT0xESE9NRV9GT0xERVI9JX5kcDANCg0KUkVNIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KU0VUIF9kYXRlPSVEQVRFOi89LSUNClNFVCBfdGltZT0lVElNRTo6PSUNClNFVCBfdGltZT0lX3RpbWU6ID0wJQ0KUkVNIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KUkVNIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KU0VUIF9kZWNhZGVzPSVfZGF0ZTp+LTIlDQpTRVQgX3llYXJzPSVfZGF0ZTp+LTQlDQpTRVQgX21vbnRocz0lX2RhdGU6fjMsMiUNClNFVCBfZGF5cz0lX2RhdGU6fjAsMiUNClJFTSAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NClNFVCBfaG91cnM9JV90aW1lOn4wLDIlDQpTRVQgX21pbnV0ZXM9JV90aW1lOn4yLDIlDQpTRVQgX3NlY29uZHM9JV90aW1lOn40LDIlDQpSRU0gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQpTRVQgVElNRUJMT0NLPSVfeWVhcnMlLSVfbW9udGhzJS0lX2RheXMlXyVfaG91cnMlLSVfbWludXRlcyUtJV9zZWNvbmRzJQ0KDQpFQ0hPICoqKioqKioqKioqKioqKioqIEN1cnJlbnQgdGltZSBpcyAqKioqKioqKioqKioqKioqKg0KRUNITyAgICAgICAgICAgICAgICAgICAgICVUSU1FQkxPQ0slDQoNCkVDSE8gIyMjIyMjIyMjIyMjIyMjIyMgY2hhbmdpbmcgZGlyZWN0b3J5IHRvICVPTERIT01FX0ZPTERFUiUNCkNEICVPTERIT01FX0ZPTERFUiUNCkVDSE8uDQoNCkVDSE8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gUFJFLVNFVFVQIFNDUklQVFMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCkVDSE8uDQpGT1IgL0YgInRva2Vucz0xLDIgZGVsaW1zPSwiICUlQSBpbiAoLlx2ZW52X3NldHVwX3NldHRpbmdzXHByZV9zZXR1cF9zY3JpcHRzLnR4dCkgZG8gKA0KRUNITy4NCkVDSE8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gQ2FsbGluZyAlJUEgd2l0aCAlJUIgLS0tLS0tLS0tLS0tLS1ePg0KQ0FMTCAlJUEgJSVCDQpFQ0hPLg0KKQ0KDQoNCg0KRUNITyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSBCQVNJQyBWRU5WIFNFVFVQIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQpFQ0hPLg0KDQpFQ0hPICMjIyMjIyMjIyMjIyMjIyMjIHN1c3BlbmRpbmcgRHJvcGJveA0KQ0FMTCBwc2tpbGw2NCBEcm9wYm94DQpFQ0hPLg0KDQpFQ0hPICMjIyMjIyMjIyMjIyMjIyMjIFJlbW92aW5nIG9sZCB2ZW52IGZvbGRlcg0KUkQgL1MgL1EgLi5cLnZlbnYNCkVDSE8uDQoNCkVDSE8gIyMjIyMjIyMjIyMjIyMjIyMgY3JlYXRpbmcgbmV3IHZlbnYgZm9sZGVyDQpta2RpciAuLlwudmVudg0KRUNITy4NCg0KRUNITyAjIyMjIyMjIyMjIyMjIyMjIyBDYWxsaW5nIHZlbnYgbW9kdWxlIHRvIGluaXRpYWxpemUgbmV3IHZlbnYNCnB5dGhvbiAtbSB2ZW52IC4uXC52ZW52DQpFQ0hPLg0KDQpFQ0hPICMjIyMjIyMjIyMjIyMjIyMjIGNoYW5naW5nIGRpcmVjdG9yeSB0byAuLlwudmVudg0KQ0QgLi5cLnZlbnYNCkVDSE8uDQoNCkVDSE8gIyMjIyMjIyMjIyMjIyMjIyMgYWN0aXZhdGluZyB2ZW52IGZvciBwYWNrYWdlIGluc3RhbGxhdGlvbg0KQ0FMTCAuXFNjcmlwdHNcYWN0aXZhdGUuYmF0DQpFQ0hPLg0KDQpFQ0hPICMjIyMjIyMjIyMjIyMjIyMjIHVwZ3JhZGluZyBwaXAgdG8gZ2V0IHJpZCBvZiBzdHVwaWQgd2FybmluZw0KQ0FMTCAlT0xESE9NRV9GT0xERVIlZ2V0LXBpcC5weQ0KRUNITy4NCg0KRUNITy4NCkVDSE8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KRUNITyArKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKyBJTlNUQUxMSU5HIFBBQ0tBR0VTICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrDQpFQ0hPIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCkVDSE8uDQpFQ0hPLg0KDQpDRCAlT0xESE9NRV9GT0xERVIlDQoNCkVDSE8gKysrKysrKysrKysrKysrKysrKysrKysrKysrKysgU3RhbmRhcmQgUGFja2FnZXMgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysNCkVDSE8uDQpFQ0hPLg0KDQpFQ0hPICMjIyMjIyMjIyMjIyMjIyMjIEluc3RhbGxpbmcgU2V0dXB0b29scw0KQ0FMTCBwaXAgaW5zdGFsbCAtLXVwZ3JhZGUgLS1wcmUgc2V0dXB0b29scw0KRUNITy4NCg0KRUNITyAjIyMjIyMjIyMjIyMjIyMjIyBJbnN0YWxsaW5nIHdoZWVsDQpDQUxMIHBpcCBpbnN0YWxsIC0tdXBncmFkZSAtLXByZSB3aGVlbA0KRUNITy4NCg0KRUNITyAjIyMjIyMjIyMjIyMjIyMjIyBJbnN0YWxsaW5nIHB5dGhvbi1kb3RlbnYNCkNBTEwgcGlwIGluc3RhbGwgLS11cGdyYWRlIC0tcHJlIHB5dGhvbi1kb3RlbnYNCkVDSE8uDQoNCg0KDQpFQ0hPICMjIyMjIyMjIyMjIyMjIyMjIEluc3RhbGxpbmcgZmxpdA0KQ0FMTCBwaXAgaW5zdGFsbCAtLWZvcmNlLXJlaW5zdGFsbCAtLW5vLWNhY2hlLWRpciAtLXVwZ3JhZGUgLS1wcmUgZmxpdA0KRUNITy4NCg0KRUNITy4NCkVDSE8uDQoNCkVDSE8gKysrKysrKysrKysrKysrKysrKysrKysrKysrKysgR2lkIFBhY2thZ2VzICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrDQpFQ0hPLg0KRUNITy4NCg0KRk9SIC9GICJ0b2tlbnM9MSwyIGRlbGltcz0sIiAlJUEgaW4gKC5cdmVudl9zZXR1cF9zZXR0aW5nc1xyZXF1aXJlZF9wZXJzb25hbF9wYWNrYWdlcy50eHQpIGRvICgNCkVDSE8uDQpFQ0hPIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIEluc3RhbGxpbmcgJSVCIC0tLS0tLS0tLS0tLS0tXj4NCkVDSE8uDQpQVVNIRCAlJUENCkNBTEwgZmxpdCBpbnN0YWxsIC1zDQpQT1BEDQpFQ0hPLg0KKQ0KDQpFQ0hPLg0KRUNITy4NCg0KRWNobyArKysrKysrKysrKysrKysrKysrKysrKysrKysrKyBNaXNjIFBhY2thZ2VzICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrDQpFQ0hPLg0KRk9SIC9GICJ0b2tlbnM9MSBkZWxpbXM9LCIgJSVBIGluICguXHZlbnZfc2V0dXBfc2V0dGluZ3NccmVxdWlyZWRfbWlzYy50eHQpIGRvICgNCkVDSE8uDQpFQ0hPIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIEluc3RhbGxpbmcgJSVBIC0tLS0tLS0tLS0tLS0tXj4NCkVDSE8uDQpDQUxMIHBpcCBpbnN0YWxsIC0tdXBncmFkZSAlJUENCkVDSE8uDQopDQoNCkVDSE8uDQpFQ0hPLg0KDQpFY2hvICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrIFF0IFBhY2thZ2VzICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrDQpFQ0hPLg0KRk9SIC9GICJ0b2tlbnM9MSBkZWxpbXM9LCIgJSVBIGluICguXHZlbnZfc2V0dXBfc2V0dGluZ3NccmVxdWlyZWRfUXQudHh0KSBkbyAoDQpFQ0hPLg0KRUNITyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSBJbnN0YWxsaW5nICUlQSAtLS0tLS0tLS0tLS0tLV4+DQpFQ0hPLg0KQ0FMTCBwaXAgaW5zdGFsbCAtLXVwZ3JhZGUgJSVBDQpFQ0hPLg0KKQ0KDQpFQ0hPLg0KRUNITy4NCg0KRWNobyArKysrKysrKysrKysrKysrKysrKysrKysrKysrKyBQYWNrYWdlcyBGcm9tIEdpdGh1YiArKysrKysrKysrKysrKysrKysrKysrKysrKysrKw0KRUNITy4NCkZPUiAvRiAidG9rZW5zPTEgZGVsaW1zPSwiICUlQSBpbiAoLlx2ZW52X3NldHVwX3NldHRpbmdzXHJlcXVpcmVkX2Zyb21fZ2l0aHViLnR4dCkgZG8gKA0KRUNITy4NCkVDSE8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gSW5zdGFsbGluZyAlJUEgLS0tLS0tLS0tLS0tLS1ePg0KRUNITy4NCkNBTEwgY2FsbCBwaXAgaW5zdGFsbCAtLXVwZ3JhZGUgZ2l0KyUlQQ0KRUNITy4NCikNCg0KRUNITy4NCkVDSE8uDQoNCkVjaG8gKysrKysrKysrKysrKysrKysrKysrKysrKysrKysgVGVzdCBQYWNrYWdlcyArKysrKysrKysrKysrKysrKysrKysrKysrKysrKw0KRUNITy4NCkZPUiAvRiAidG9rZW5zPTEgZGVsaW1zPSwiICUlQSBpbiAoLlx2ZW52X3NldHVwX3NldHRpbmdzXHJlcXVpcmVkX3Rlc3QudHh0KSBkbyAoDQpFQ0hPLg0KRUNITyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSBJbnN0YWxsaW5nICUlQSAtLS0tLS0tLS0tLS0tLV4+DQpFQ0hPLg0KQ0FMTCBwaXAgaW5zdGFsbCAtLXVwZ3JhZGUgJSVBDQpFQ0hPLg0KKQ0KDQpFQ0hPLg0KRUNITy4NCg0KRWNobyArKysrKysrKysrKysrKysrKysrKysrKysrKysrKyBEZXYgUGFja2FnZXMgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysNCkVDSE8uDQpGT1IgL0YgInRva2Vucz0xIGRlbGltcz0sIiAlJUEgaW4gKC5cdmVudl9zZXR1cF9zZXR0aW5nc1xyZXF1aXJlZF9kZXYudHh0KSBkbyAoDQpFQ0hPLg0KRUNITyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSBJbnN0YWxsaW5nICUlQSAtLS0tLS0tLS0tLS0tLV4+DQpFQ0hPLg0KQ0FMTCBwaXAgaW5zdGFsbCAtLW5vLWNhY2hlLWRpciAtLXVwZ3JhZGUgLS1wcmUgJSVBDQpFQ0hPLg0KKQ0KDQpFQ0hPLg0KRUNITy4NCg0KDQpFQ0hPIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIElOU1RBTEwgVEhFIFBST0pFQ1QgSVRTRUxGIEFTIC1ERVYgUEFDS0FHRSAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KY2QgLi5cDQpyZW0gY2FsbCBwaXAgaW5zdGFsbCAtZSAuDQpjYWxsIGZsaXQgaW5zdGFsbCAtcw0KRUNITy4NCg0KRUNITy4NCkVDSE8uDQoNCkNEICVPTERIT01FX0ZPTERFUiUNCg0KRUNITyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSBQT1NULVNFVFVQIFNDUklQVFMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCkVDSE8uDQpGT1IgL0YgInRva2Vucz0xLDIgZGVsaW1zPSwiICUlQSBpbiAoLlx2ZW52X3NldHVwX3NldHRpbmdzXHBvc3Rfc2V0dXBfc2NyaXB0cy50eHQpIGRvICgNCkVDSE8uDQpFQ0hPIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIENhbGxpbmcgJSVBIHdpdGggJSVCIC0tLS0tLS0tLS0tLS0tXj4NCkNBTEwgJSVBICUlQg0KRUNITy4NCikNCg0KRUNITy4NCkVDSE8uDQoNCkVDSE8uDQpFQ0hPICMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMNCkVDSE8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KRUNITyAjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjDQpFQ0hPLg0KRUNITyArKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKyBGSU5JU0hFRCArKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrDQpFQ0hPLg0KRUNITyAjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjDQpFQ0hPIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCkVDSE8gIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIw0KRUNITy4=' CREATE_VENV_EXTRA_ENVVARS__PY = b'aW1wb3J0IG9zDQppbXBvcnQgc3lzDQoNCm9zLmNoZGlyKHN5cy5hcmd2WzFdKQ0KUFJPSkVDVF9OQU1FID0gc3lzLmFyZ3ZbMl0NClJFTF9BQ1RJVkFURV9TQ1JJUFRfUEFUSCA9ICcuLy52ZW52L1NjcmlwdHMvYWN0aXZhdGUuYmF0Jw0KUkVQTEFDRU1FTlQgPSByIiIiQGVjaG8gb2ZmDQoNCnNldCBGSUxFRk9MREVSPSV+ZHAwDQoNCnB1c2hkICVGSUxFRk9MREVSJQ0KcmVtIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCmNkIC4uXC4uXHRvb2xzDQplY2hvICMjIyMjIyMjIyMjIyMjIyMjIyMjIyBzZXR0aW5nIHZhcnMgZnJvbSAlY2QlXF9wcm9qZWN0X21ldGEuZW52DQpmb3IgL2YgJSVpIGluIChfcHJvamVjdF9tZXRhLmVudikgZG8gc2V0ICUlaSAmJiBlY2hvICUlaQ0KcmVtIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCnBvcGQNCiIiIg0KDQoNCmRlZiBjcmVhdGVfcHJvamVjdF9tZXRhX2Vudl9maWxlKCk6DQogICAgb3MuY2hkaXIoJy4uLycpDQogICAgX3dvcmtzcGFjZWRpcmJhdGNoID0gb3MuZ2V0Y3dkKCkNCiAgICBfdG9wbGV2ZWxtb2R1bGUgPSBvcy5wYXRoLmpvaW4oX3dvcmtzcGFjZWRpcmJhdGNoLCBQUk9KRUNUX05BTUUpDQogICAgX21haW5fc2NyaXB0X2ZpbGUgPSBvcy5wYXRoLmpvaW4oX3RvcGxldmVsbW9kdWxlLCAnX19tYWluX18ucHknKQ0KICAgIHdpdGggb3BlbigiX3Byb2plY3RfbWV0YS5lbnYiLCAndycpIGFzIGVudmZpbGU6DQogICAgICAgIGVudmZpbGUud3JpdGUoZidXT1JLU1BBQ0VESVI9e193b3Jrc3BhY2VkaXJiYXRjaH1cbicpDQogICAgICAgIGVudmZpbGUud3JpdGUoZidUT1BMRVZFTE1PRFVMRT17X3RvcGxldmVsbW9kdWxlfVxuJykNCiAgICAgICAgZW52ZmlsZS53cml0ZShmJ01BSU5fU0NSSVBUX0ZJTEU9e19tYWluX3NjcmlwdF9maWxlfVxuJykNCiAgICAgICAgZW52ZmlsZS53cml0ZShmJ1BST0pFQ1RfTkFNRT17UFJPSkVDVF9OQU1FfVxuJykNCg0KDQpkZWYgbW9kaWZ5X2FjdGl2YXRlX2JhdCgpOg0KDQogICAgd2l0aCBvcGVuKFJFTF9BQ1RJVkFURV9TQ1JJUFRfUEFUSCwgJ3InKSBhcyBvcmlnYmF0Og0KICAgICAgICBfY29udGVudCA9IG9yaWdiYXQucmVhZCgpDQogICAgaWYgUkVQTEFDRU1FTlQgbm90IGluIF9jb250ZW50Og0KICAgICAgICBfbmV3X2NvbnRlbnQgPSBfY29udGVudC5yZXBsYWNlKHInQGVjaG8gb2ZmJywgUkVQTEFDRU1FTlQpDQogICAgICAgIHdpdGggb3BlbihSRUxfQUNUSVZBVEVfU0NSSVBUX1BBVEgsICd3JykgYXMgbmV3YmF0Og0KICAgICAgICAgICAgbmV3YmF0LndyaXRlKF9uZXdfY29udGVudCkNCg0KDQppZiBfX25hbWVfXyA9PSAnX19tYWluX18nOg0KICAgIGNyZWF0ZV9wcm9qZWN0X21ldGFfZW52X2ZpbGUoKQ0KICAgIG1vZGlmeV9hY3RpdmF0ZV9iYXQoKQ0K' POST_SETUP_SCRIPTS__TXT = b'Li5cLnZlbnZcU2NyaXB0c1xweXF0NXRvb2xzaW5zdGFsbHVpYy5leGUNCiVPTERIT01FX0ZPTERFUiVjcmVhdGVfdmVudl9leHRyYV9lbnZ2YXJzLnB5LCVPTERIT01FX0ZPTERFUiUgJVBST0pFQ1RfTkFNRSU=' PRE_SETUP_SCRIPTS__TXT = b'IkM6XFByb2dyYW0gRmlsZXMgKHg4NilcTWljcm9zb2Z0IFZpc3VhbCBTdHVkaW9cMjAxOVxDb21tdW5pdHlcVkNcQXV4aWxpYXJ5XEJ1aWxkXHZjdmFyc2FsbC5iYXQiLGFtZDY0DQpwc2tpbGw2NCxEcm9wYm94' REQUIRED_DEV__TXT = b'aHR0cHM6Ly9naXRodWIuY29tL3B5aW5zdGFsbGVyL3B5aW5zdGFsbGVyL3RhcmJhbGwvZGV2ZWxvcA0KcGVwNTE3DQpudWl0a2ENCm1lbW9yeS1wcm9maWxlcg0KbWF0cGxvdGxpYg0KaW1wb3J0LXByb2ZpbGVyDQpvYmplY3RncmFwaA0KcGlwcmVxcw0KcHlkZXBzDQpudW1weT09MS4xOS4z' REQUIRED_FROM_GITHUB__TXT = b'aHR0cHM6Ly9naXRodWIuY29tL292ZXJmbDAvQXJtYWNsYXNzLmdpdA==' REQUIRED_MISC__TXT = b'SmluamEyDQpweXBlcmNsaXANCnJlcXVlc3RzDQpuYXRzb3J0DQpiZWF1dGlmdWxzb3VwNA0KcGRma2l0DQpjaGVja3N1bWRpcg0KY2xpY2sNCm1hcnNobWFsbG93DQpyZWdleA0KcGFyY2UNCmpzb25waWNrbGUNCmZ1enp5d3V6enkNCmZ1enp5c2VhcmNoDQpweXRob24tTGV2ZW5zaHRlaW4NCg==' REQUIRED_PERSONAL_PACKAGES__TXT = b'RDpcRHJvcGJveFxob2JieVxNb2RkaW5nXFByb2dyYW1zXEdpdGh1YlxNeV9SZXBvc1xnaWR0b29sc191dGlscyxnaWR0b29scw0KRDpcRHJvcGJveFxob2JieVxNb2RkaW5nXFByb2dyYW1zXEdpdGh1YlxNeV9SZXBvc1xnaWRxdHV0aWxzLGdpZHF0dXRpbHMNCkQ6XERyb3Bib3hcaG9iYnlcTW9kZGluZ1xQcm9ncmFtc1xHaXRodWJcTXlfUmVwb3NcZ2lkbG9nZ2VyX3JlcCxnaWRsb2dnZXINCkQ6XERyb3Bib3hcaG9iYnlcTW9kZGluZ1xQcm9ncmFtc1xHaXRodWJcTXlfUmVwb3NcR2lkX1ZzY29kZV9XcmFwcGVyLGdpZF92c2NvZGVfd3JhcHBlcg0KRDpcRHJvcGJveFxob2JieVxNb2RkaW5nXFByb2dyYW1zXEdpdGh1YlxNeV9SZXBvc1xHaWRfVmlld19tb2RlbHMsZ2lkX3ZpZXdfbW9kZWxzDQpEOlxEcm9wYm94XGhvYmJ5XE1vZGRpbmdcUHJvZ3JhbXNcR2l0aHViXE15X1JlcG9zXEdpZGNvbmZpZyxnaWRjb25maWc=' REQUIRED_QT__TXT = b'UHlRdDUNCnB5b3BlbmdsDQpQeVF0M0QNClB5UXRDaGFydA0KUHlRdERhdGFWaXN1YWxpemF0aW9uDQpQeVF0V2ViRW5naW5lDQpRU2NpbnRpbGxhDQpweXF0Z3JhcGgNCnBhcmNlcXQNClB5UXRkb2MNCnB5cXQ1LXRvb2xzDQpQeVF0NS1zdHVicw0KcHlxdGRlcGxveQ==' REQUIRED_TEST__TXT = b'cHl0ZXN0DQpweXRlc3QtcXQ=' root_folder_data = {'create_venv.cmd': CREATE_VENV__CMD, 'create_venv_extra_envvars.py': CREATE_VENV_EXTRA_ENVVARS__PY, } venv_setup_settings_folder_data = {'post_setup_scripts.txt': POST_SETUP_SCRIPTS__TXT, 'pre_setup_scripts.txt': PRE_SETUP_SCRIPTS__TXT, 'required_dev.txt': REQUIRED_DEV__TXT, 'required_from_github.txt': REQUIRED_FROM_GITHUB__TXT, 'required_misc.txt': REQUIRED_MISC__TXT, 'required_personal_packages.txt': REQUIRED_PERSONAL_PACKAGES__TXT, 'required_qt.txt': REQUIRED_QT__TXT, 'required_test.txt': REQUIRED_TEST__TXT, }
n1 = int(input ('Digite a nota1: ')) n2 = int(input ('Digite a nota2: ')) t = (n1 + n2) / 2 #m = t / 2 print ('A média é {}'.format(t))
veiculos = ['Fusca', 'Palio', 'UNO', 'Ferrari', 'HB20'] consumo_carros = [] for i in range(5): print("Veiculo n°", i + 1, "\nNome: ", veiculos[i]) km_litro = float(input("Km por litro: ")) consumo_carros.append(km_litro) print("\nRelatório final: ") for i in range(5): print(i+1, " - ", veiculos[i], " - ", consumo_carros[i], " - ", round(1000 / consumo_carros[i], 2), " - R$", round(1000 / consumo_carros[i] * 2.25, 2)) indice_menor_consumo = consumo_carros.index(max(consumo_carros)) print("O menor consumo é o do ", veiculos[indice_menor_consumo])
""" SOURCE: TODO; link github code snippet """ class meta: length = 0 # def __init__(self): # print self.process("schmidt") def isSlavoGermanic(self, str): for each in ["W", "K", "CZ", "WITZ"]: if (each in str): return 1; return 0; def isVowel(self, word, start): return self.sub(word, start, 1, ['A', 'E', 'I', 'O', 'U', 'Y']) def sub(self, word, start, count, arr): if (start < 0 or start >= len(word)): return 0 if (word[start:start + count] in arr): return 1 return 0 def process(self, word): primary, secondary = "", "" word = word.upper() self.length = len(word) current, last = 0, self.length - 1 word += " " if (word[0:2] in ['GN', 'KN', 'PN', 'WR', 'PS']): current += 1 if (word[0] == 'X'): primary += "S" secondary += "S" current += 1 while ((len(primary) < 4 or len(secondary) < 4) and current < self.length): symbol = word[current] if (symbol in ['A', 'E', 'I', 'O', 'U', 'Y']): if (current == 0): primary += "A" secondary += "A" current += 1 continue elif (symbol == "B"): primary += "P" secondary += "P" if (self.sub(word, current + 1, 1, ["B"])): current += 2 else: current += 1 continue elif (symbol == 'C'): if (current > 1 \ and not self.isVowel(word, current - 2) \ and self.sub(word, current - 1, 3, ["ACH"]) \ and (not self.sub(word, current + 2, 1, ['I']) \ and (not self.sub(word, current + 2, 1, ['E']) \ or self.sub(word, current - 2, 6, ['BACHER', 'MACHER'])))): primary += 'K' secondary += 'K' current += 2 continue # special case 'caesar' elif (current == 0 and self.sub(word, current, 6, ["CAESAR"])): primary += "S" secondary += "S" current += 2 continue # italian 'chianti' elif (self.sub(word, current, 4, ["CHIA"])): primary += "K" secondary += "K" current += 2 continue elif (self.sub(word, current, 2, ["CH"])): # find 'michael' if (current > 0 and self.sub(word, current, 4, ["CHAE"])): primary += "K" secondary += "X" current += 2 continue # greek roots e.g. 'chemistry', 'chorus' if (current == 0 and \ (self.sub(word, current + 1, 5, ["HARAC", "HARIS"]) or \ self.sub(word, current + 1, 3, ["HOR", "HYM", "HIA", "HEM"])) and not self.sub(word, 0, 5, ["CHORE"])): primary += "K" secondary += "K" current += 2 continue # germanic, greek, or otherwise 'ch' for 'kh' sound # print self.sub(word,current-1,1,["A","O","U","E"]) # print self.sub(word,current+2,1,["L","R","N","M","B","H","F","V","W","$"]) # print "#"+word[current+2:current+3]+"#" if ((self.sub(word, 0, 4, ["VAN ", "VON "]) or \ self.sub(word, 0, 3, ["SCH"])) \ or self.sub(word, current - 2, 6, ["ORCHES", "ARCHIT", "ORCHID"]) or self.sub(word, current + 2, 1, ["T", "S"]) \ or ((self.sub(word, current - 1, 1, ["A", "O", "U", "E"]) or current == 0) \ and self.sub(word, current + 2, 1, ["L", "R", "N", "M", "B", "H", "F", "V", "W", " "]))): primary += "K" secondary += "K" else: # print symbol if (current > 0): if (self.sub(word, 0, 2, ["MC"])): primary += "K" secondary += "K" else: primary += "X" secondary += "K" else: primary += "X" secondary += "X" current += 2 continue # e.g. 'czerny' if (self.sub(word, current, 2, ["CZ"]) and \ not self.sub(word, current - 2, 4, ["WICZ"])): primary += "S" secondary += "X" current += 2 continue # e.g. 'focaccia' if (self.sub(word, current + 1, 3, ["CIA"])): primary += "X" secondary += "X" current += 3 continue # double 'C', but not McClellan' if (self.sub(word, current, 2, ["CC"]) \ and not (current == 1 \ and self.sub(word, 0, 1, ["M"]))): if (self.sub(word, current + 2, 1, ["I", "E", "H"]) \ and not self.sub(word, current + 2, 2, ["HU"])): if ((current == 1 and self.sub(word, current - 1, 1, ["A"])) \ or self.sub(word, current - 1, 5, ["UCCEE", "UCCES"])): primary += "KS" secondary += "KS" else: primary += "X" secondary += "X" current += 3 continue else: # Pierce's rule primary += "K" secondary += "K" current += 2 continue if (self.sub(word, current, 2, ["CK", "CG", "CQ"])): primary += "K" secondary += "K" current += 2 continue if (self.sub(word, current, 2, ["CI", "CE", "CY"])): if (self.sub(word, current, 3, ["CIO", "CIE", "CIA"])): primary += "S" secondary += "X" else: primary += "S" secondary += "S" current += 2 continue primary += "K" secondary += "K" if (self.sub(word, current + 1, 2, [" C", " Q", " G"])): current += 3 else: if (self.sub(word, current + 1, 1, ["C", "K", "Q"]) \ and not self.sub(word, current + 1, 2, ["CE", "CI"])): current += 2 else: current += 1 continue elif (symbol == "D"): if (self.sub(word, current, 2, ['DG'])): if (self.sub(word, current + 2, 1, ['I', 'E', 'Y'])): primary += 'J' secondary += 'J' current += 3 continue else: primary += "TK" secondary += "TK" current += 2 continue elif (self.sub(word, current, 2, ['DT', 'DD'])): primary += "T" secondary += "T" current += 2 continue else: primary += "T" secondary += "T" current += 1 continue elif (symbol == "F"): if (self.sub(word, current + 1, 1, ["F"])): current += 2 else: current += 1 primary += "F" secondary += "F" continue elif (symbol == "G"): if (self.sub(word, current + 1, 1, ['H'])): if (current > 0 and not self.isVowel(word, current - 1)): primary += "K" secondary += "K" current += 2 continue elif (current < 3): if (current == 0): if (self.sub(word, current + 2, 1, ['I'])): primary += "J" secondary += "J" else: primary += "K" secondary += "K" current += 2 continue if ((current > 1 and self.sub(word, current - 2, 1, ['B', 'H', 'D'])) \ or (current > 2 and self.sub(word, current - 3, 1, ['B', 'H', 'D'])) \ or (current > 3 and self.sub(word, current - 4, 1, ['B', 'H']))): current += 2 continue else: if (current > 2 and self.sub(word, current - 1, 1, ['U']) \ and self.sub(word, current - 3, 1, ['C', 'G', 'L', 'R', 'T'])): primary += "F" secondary += "F" elif (current > 0 and word[current - 1] != "I"): primary += "K" secondary += "K" current += 2 continue elif (self.sub(word, current + 1, 1, ['N'])): if (current == 1 and self.isVowel(word, 0) \ and not self.isSlavoGermanic(word)): primary += "KN" secondary += "N" else: if (not self.sub(word, current + 2, 2, ['EY']) \ and not self.sub(word, current + 1, 1, ['Y']) \ and not self.isSlavoGermanic(word)): primary += "N" secondary += "KN" else: primary += "KN" secondary += "KN" current += 2 continue elif (self.sub(word, current + 1, 2, ['LI']) and not self.isSlavoGermanic(word)): primary += "KL" secondary += "L" current += 2 continue elif (current == 0 \ and (self.sub(word, current + 1, 1, ['Y']) \ or self.sub(word, current + 1, 2, ["ES", "EP", "EB", "EL", "EY", "IB", "IL", "IN", "IE", "EI", "ER"]))): primary += "K" secondary += "J" current += 2 continue elif ((self.sub(word, current + 1, 2, ["ER"]) \ or (self.sub(word, current + 1, 1, ["Y"]))) and \ not self.sub(word, 0, 6, ["DANGER", "RANGER", "MANGER"]) \ and not self.sub(word, current - 1, 1, ["E", "I"]) and \ not self.sub(word, current - 1, 3, ["RGY", "OGY"])): primary += "K" secondary += "J" current += 2 continue elif (self.sub(word, current + 1, 1, ["E", "I", "Y"]) \ or self.sub(word, current - 1, 4, ["AGGI", "OGGI"])): if (self.sub(word, 0, 4, ["VAN", "VON"]) or \ self.sub(word, 0, 3, ["SCH"]) or \ self.sub(word, current + 1, 2, ["ET"])): primary += "K" secondary += "K" else: if (self.sub(word, current + 1, 4, ["IER "])): primary += "J" secondary += "J" else: primary += "J" secondary += "K" current += 2 continue if (self.sub(word, current + 1, 1, ["G"])): current += 2 else: current += 1 primary += "K" secondary += "K" continue elif (symbol == "H"): if ((current == 0 or self.isVowel(word, current - 1)) \ and self.isVowel(word, current + 1)): primary += "H" secondary += "H" current += 2 else: current += 1 continue elif (symbol == "J"): if (self.sub(word, current, 4, ["JOSE"]) or \ self.sub(word, 0, 4, ["SAN "])): if (current == 0 and self.sub(word, current + 4, 1, [' ']) or \ self.sub(word, 0, 4, ["SAN "])): primary += "H" secondary += "H" else: primary += "J" secondary += "H" current += 1 continue if ((current == 0 and not self.sub(word, current, 4, ["JOSE"]))): primary += "J" secondary += "A" else: if (self.isVowel(word, current - 1) \ and not self.isSlavoGermanic(word) and \ (self.sub(word, current + 1, 1, ["A"]) or \ self.sub(word, current + 1, 1, ["O"]))): primary += "J" secondary += "H" else: if (current == last): primary += "J" else: if (not self.sub(word, current + 1, 1, ["L", "T", "K", "S", "N", "M", "B", "Z"]) \ and not self.sub(word, current - 1, 1, ["S", "K", "L"])): primary += "J" secondary += "J" if (self.sub(word, current + 1, 1, ["J"])): current += 2 else: current += 1 continue elif (symbol == "K"): if (self.sub(word, current + 1, 1, ["K"])): current += 2 else: current += 1 primary += "K" secondary += "K" continue elif (symbol == "L"): if (self.sub(word, current + 1, 1, ["L"])): if ((current == self.length - 3 and self.sub(word, current - 1, 4, ["ILLO", "ILLA", "ALLE"])) \ or ((self.sub(word, last - 1, 2, ["AS", "OS"]) or self.sub(word, last, 1, ["A", "O"])) \ and self.sub(word, current - 1, 4, ["ALLE"]))): primary += "L" current += 2 continue; else: current += 2 else: current += 1 primary += "L" secondary += "L" continue elif (symbol == "M"): if ((self.sub(word, current - 1, 3, ["UMB"]) and \ (current + 1 == last or self.sub(word, current + 2, 2, ["ER"]))) or \ self.sub(word, current + 1, 1, ["M"])): current += 2 else: current += 1 primary += "M" secondary += "M" continue elif (symbol == "N"): if (self.sub(word, current + 1, 1, ["N"])): current += 2 else: current += 1 primary += "N" secondary += "N" continue elif (symbol == "P"): if (self.sub(word, current + 1, 1, ["H"])): current += 2 primary += "F" secondary += "F" continue if (self.sub(word, current + 1, 1, ["P", "B"])): current += 2 else: current += 1 primary += "P" secondary += "P" continue elif (symbol == "Q"): if (self.sub(word, current + 1, 1, ["Q"])): current += 2 else: current += 1 primary += "K" secondary += "K" continue elif (symbol == "R"): if (current == last and not self.isSlavoGermanic(word) \ and self.sub(word, current - 2, 2, ["IE"]) and \ not self.sub(word, current - 4, 2, ["ME", "MA"])): secondary += "R" else: primary += "R" secondary += "R" if (self.sub(word, current + 1, 1, ["R"])): current += 2 else: current += 1 continue elif (symbol == "S"): if (self.sub(word, current - 1, 3, ["ISL", "YSL"])): current += 1 continue if (current == 0 and self.sub(word, current, 5, ["SUGAR"])): primary += "X" secondary += "S" current += 1 continue if (self.sub(word, current, 2, ["SH"])): if (self.sub(word, current + 1, 4, ["HEIM", "HOEK", "HOLM", "HOLZ"])): primary += "S" secondary += "S" else: primary += "X" secondary += "X" current += 2 continue if (self.sub(word, current, 3, ["SIO", "SIA"]) \ or self.sub(word, current, 4, ["SIAN"])): if (not self.isSlavoGermanic(word)): primary += "S" secondary += "X" else: primary += "S" secondary += "S" current += 3 continue if ((current == 0 and self.sub(word, current + 1, 1, ["M", "N", "L", "W"])) \ or self.sub(word, current + 1, 1, ["Z"])): primary += "S" secondary += "X" if (self.sub(word, current + 1, 1, ["Z"])): current += 2 else: current += 1 continue if (self.sub(word, current, 2, ["SC"])): if (self.sub(word, current + 2, 1, ["H"])): if (self.sub(word, current + 3, 2, ["OO", "ER", "EN", "UY", "ED", "EM"])): if (self.sub(word, current + 3, 2, ["ER", "EN"])): primary += "X" secondary += "SK" else: primary += "SK" secondary += "SK" current += 3 continue else: if (current == 0 and not (self.isVowel(word, 3)) \ and not self.sub(word, current + 3, 1, ["W"])): primary += "X" secondary += "S" else: primary += "X" secondary += "X" current += 3 continue if (self.sub(word, current + 2, 1, ["I", "E", "Y"])): primary += "S" secondary += "S" current += 3 continue primary += "SK" secondary += "SK" current += 3 continue if (current == last and self.sub(word, current - 2, 2, ["AI", "OI"])): primary += "" secondary += "S" else: primary += "S" secondary += "S" if (self.sub(word, current + 1, 1, ["S", "Z"])): current += 2 else: current += 1 continue elif (symbol == "T"): if (self.sub(word, current, 4, ["TION"])): primary += "X" secondary += "X" current += 3 continue if (self.sub(word, current, 3, ["TIA", "TCH"])): primary += "X" secondary += "X" current += 3 continue if (self.sub(word, current, 2, ["TH"]) or \ self.sub(word, current, 3, ["TTH"])): if (self.sub(word, current + 2, 2, ["OM", "AM"]) or \ self.sub(word, 0, 4, ["VAN ", "VON "]) or \ self.sub(word, 0, 3, ["SCH"])): primary += "T" secondary += "T" else: primary += "0" # its a zero here represents TH secondary += "T" current += 2 continue if (self.sub(word, current + 1, 1, ["T", "D"])): current += 2 else: current += 1 primary += "T" secondary += "T" continue elif (symbol == "V"): if (self.sub(word, current + 1, 1, ["V"])): current += 2 else: current += 1 primary += "F" secondary += "F" continue elif (symbol == "W"): if (self.sub(word, current, 2, ["WR"])): primary += "R" secondary += "R" current += 2 continue if (current == 0 and \ ((self.isVowel(word, current + 1)) \ or self.sub(word, current, 2, ["WH"]))): if (self.isVowel(word, current + 1)): primary += "A" secondary += "F" else: primary += "A" secondary += "A" if ((current == last and self.isVowel(word, current - 1)) or \ self.sub(word, current - 1, 5, ["EWSKI", "EWSKY", "OWSKI", "OWSKY"]) or \ self.sub(word, 0, 3, ["SCH"])): secondary += "F" current += 1 continue if (self.sub(word, current, 4, ["WICZ", "WITZ"])): primary += "TS" secondary += "FX" current += 4 continue current += 1 continue elif (symbol == "X"): if (not (current == last and \ (self.sub(word, current - 3, 3, ["IAU", "EAU"]) or \ self.sub(word, current - 2, 2, ["AU", "OU"])))): primary += "KS" secondary += "KS" else: # do nothing primary += "" if (self.sub(word, current + 1, 1, ["C", "X"])): current += 2 else: current += 1 continue elif (symbol == "Z"): if (self.sub(word, current + 1, 1, ["H"])): primary += "J" secondary += "J" current += 2 continue elif (self.sub(word, current + 1, 2, ["ZO", "ZI", "ZA"]) or (self.isSlavoGermanic(word) and \ (current > 0 and word[current - 1] != 'T'))): primary += "S" secondary += "TS" else: primary += "S" secondary += "S" if (self.sub(word, current + 1, 1, ['Z'])): current += 2 else: current += 1 continue else: current += 1 primary = primary[0:4] secondary = secondary[0:4] return primary, secondary
# Escreva um programa para aprovar o empréstimo bancário para a compra de uma casa. Pergunte o valor da casa, o salário do comprador e em quantos anos ele vai pagar. A prestação mensal não pode exceder 30% do salário ou então o empréstimo será negado. casa = float(input('Valor da casa: ')) salario = float(input('Salário: ')) duracao = int(input('Duração do pagamento: ')) if casa / (12 * duracao) < (salario * 30) / 100: print(f'A prestação mensal é de R${casa / (12 * duracao):.2f}') else: print('Você não pode comprar essa casa.')
n = int(input()) def sum_input(): _sum = 0 for i in range(n): _sum += int(input()) return _sum left_sum = sum_input() right_sum = sum_input() if left_sum == right_sum: print("Yes, sum =", left_sum) else: print("No, diff =", abs(left_sum - right_sum))
class Monitor(object): """ 发送文件打印器 """ def __init__(self, *parameter_list): """ TODO """ pass def monitor(self, ditc_info): """ iter:可迭代字典 """ for k, v in ditc_info.items(): if k == "DATA": print("{:10}: {}".format(k, v)) else: print("{:10}: {:02X}".format(k, v))
#!/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))
a = int(input()) while(a): counti = 0 counte = 0 b = input() for i in b: if(i=='1'): counti+=1 elif(i=='2'): counte+=1 elif(i=='0'): counte+=1 counti+=1 if(counti>counte): print("INDIA") elif(counte>counti): print("ENGLAND") else: print("DRAW") a-=1
text = input('Enter the text:\n') if ('make a lot of money' in text): spam = True elif ('buy now' in text): spam = True elif ('watch this' in text): spam = True elif ('click this' in text): spam = True elif ('subscribe this' in text): spam = True else: spam = False if (spam): print ('This text is spam.') else: print ('This text is not spam.')
a=input() b=int(len(a)) for i in range(b): print(a[i])
""" @author: karthikrao Test the Polish Expression for its Balloting and Normalized properties. """ def test_ballot(exp, index): """ Parameters ---------- exp : list Polish Expression to be tested for its balloting property. index : int End point of the Polish Expression to be tested for its balloting property. Returns ------- bool True indicates the Polish Expression satisfies the balloting property. """ temp = exp[:index+1] operators=0 for i in temp: if i=='V' or i=='H': operators+=1 if 2*operators<(index): return True return False def test_normalized(exp): """ Parameters ---------- exp : list Polish Expression to be tested for its normalized property. Returns ------- bool True if the given Polish Expression is normalized. """ for i in range(len(exp)-1): if exp[i]==exp[i+1]: return False return True
print("{:=^60}".format(' Super Progressão Aritmetíca v3.0 ')) termo = int(input('Primeiro Termo: ')) razão = int(input('Razão da PA: ')) #termo = primeiro n = 1 mais = 1 total = 0 mais = 10 while mais != 0: total += mais while n <= total: print(termo, end=' - ') termo += razão n += 1 print('PAUSA') mais = int(input('Quer que mostre mais quantos termos? ')) print(f'Progressão finalizada com {total} termos')
def second_largest(mylist): largest = None second_largest = None for num in mylist: if largest is None: largest = num elif num > largest: second_largest = largest largest = num elif second_largest is None: second_largest = num elif num > second_largest: second_largest = num return second_largest print(second_largest([1,3,4,5,0,2])) print(second_largest([-2,-1])) print(second_largest([2])) print(second_largest([]))
# =========== # BoE # =========== class HP_IMDB_BOE: batch_size = 64 learning_rate = 1e-3 learning_rate_dpsgd = 1e-3 patience = 5 tgt_class = 1 sequence_length = 512 class HP_DBPedia_BOE: batch_size = 256 learning_rate = 1e-3 learning_rate_dpsgd = 1e-3 patience = 2 tgt_class = 1 # start from 0 sequence_length = 256 class HP_Trec50_BOE: batch_size = 128 learning_rate = 5e-4 learning_rate_dpsgd = 5e-4 patience = 10 tgt_class = 32 # start from 0 sequence_length = 128 class HP_Trec6_BOE: batch_size = 16 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 10 tgt_class = 1 # start from 0 sequence_length = 128 # =========== # CNN # =========== class HP_IMDB_CNN: batch_size = 64 learning_rate = 1e-3 learning_rate_dpsgd = 1e-3 patience = 5 tgt_class = 1 sequence_length = 512 class HP_DBPedia_CNN: batch_size = 32 learning_rate = 1e-3 learning_rate_dpsgd = 1e-3 patience = 2 tgt_class = 1 # start from 0 sequence_length = 256 class HP_Trec50_CNN: batch_size = 128 learning_rate = 5e-4 learning_rate_dpsgd = 5e-4 patience = 10 tgt_class = 32 # start from 0 sequence_length = 128 class HP_Trec6_CNN: batch_size = 16 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 10 tgt_class = 1 # start from 0 sequence_length = 128 # =========== # BERT # =========== class HP_IMDB_BERT: batch_size = 32 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 2 tgt_class = 1 sequence_length = 512 class HP_DBPedia_BERT: batch_size = 32 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 1 tgt_class = 1 # start from 0 sequence_length = 256 class HP_Trec50_BERT: batch_size = 128 learning_rate = 5e-4 learning_rate_dpsgd = 5e-4 patience = 10 tgt_class = 32 # start from 0 sequence_length = 128 class HP_Trec6_BERT: batch_size = 16 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 5 tgt_class = 1 # start from 0 sequence_length = 128
def get_azure_config(provider_config): config_dict = {} azure_storage_type = provider_config.get("azure_cloud_storage", {}).get("azure.storage.type") if azure_storage_type: config_dict["AZURE_STORAGE_TYPE"] = azure_storage_type azure_storage_account = provider_config.get("azure_cloud_storage", {}).get("azure.storage.account") if azure_storage_account: config_dict["AZURE_STORAGE_ACCOUNT"] = azure_storage_account azure_container = provider_config.get("azure_cloud_storage", {}).get( "azure.container") if azure_container: config_dict["AZURE_CONTAINER"] = azure_container azure_account_key = provider_config.get("azure_cloud_storage", {}).get( "azure.account.key") if azure_account_key: config_dict["AZURE_ACCOUNT_KEY"] = azure_account_key return config_dict def _get_node_info(node): node_info = {"node_id": node["name"].split("-")[-1], "instance_type": node["vm_size"], "private_ip": node["internal_ip"], "public_ip": node["external_ip"], "instance_status": node["status"]} node_info.update(node["tags"]) return node_info
""" Blog app for the CDH website. Similar to the built-in grappelli blog, but allows multiple authors (other than the current user) to be associated with a post. """ default_app_config = "cdhweb.blog.apps.BlogConfig"
backslashes_test_text_001 = ''' string = 'string' ''' backslashes_test_text_002 = ''' string = 'string_start \\ string end' ''' backslashes_test_text_003 = ''' if arg_one is not None \\ and arg_two is None: pass ''' backslashes_test_text_004 = ''' string = \'\'\' text \\\\ text \'\'\' '''
# 1 def front_two_back_two(input_string): return '' if len(input_string) < 2 else input_string[:2] + input_string[-2:] # 2 def kelvin_to_celsius(k): return k - 273.15 # 2 def kelvin_to_fahrenheit(k): return kelvin_to_celsius(k) * 9.0 / 5.0 + 32.0 # 4 def min_max_sum(input_list): return [min(input_list), max(input_list), sum(input_list)] # 5 def print_square(): squares_map = {base: base * base for base in range(1, 16)} print(squares_map)
class Data: def __init__(self, dia, mes, ano): self.dia = dia self.mes = mes self.ano = ano print(self) @classmethod def de_string(cls, data_string): dia, mes, ano = map(int, data_string.split('-')) data = cls(dia, mes, ano) return data @staticmethod def is_date_valid(data_string): dia, mes, ano = map(int, data_string.split('-')) return dia <= 31 and mes <= 12 and ano <= 2020 data = Data(31, 7, 1996) data1 = Data.de_string('31-07-1996') print(data1) print(data1.is_date_valid('31-07-1996'))
# Задача 6 # # Найти сумму цифр числа. number=1029384756 sum=0 while number>0: sum+=number%10 number=number//10 print(sum)
# author: Fei Gao # # Evaluate Reverse Polish Notation # # Evaluate the value of an arithmetic expression in Reverse Polish Notation. # Valid operators are +, -, *, /. Each operand may be an integer or another expression. # Some examples: # ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 # ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6 class Solution: # @param tokens, a list of string # @return an integer def evalRPN(self, tokens): if not tokens: return None op = {'+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: int(float(x) / y)} # note that python handle div differently! # py2, py3, and C/C++/Java may get all distinct results queue = list() for val in tokens: if isinstance(val, list): queue.append(self.evalRPN(val)) elif val in op: o2 = queue.pop() o1 = queue.pop() queue.append(op[val](o1, o2)) else: queue.append(int(val)) return queue[-1] def main(): solver = Solution() tests = [["2", "1", "+", "3", "*"], ["4", "13", "5", "/", "+"], [["2", "1", "+", "3", "*"], "13", "5", "/", "+"], ["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"]] # 22 for test in tests: print(test) result = solver.evalRPN(test) print(' ->') print(result) print('~' * 10) pass if __name__ == '__main__': main() pass
ROUTE_MIDDLEWARE = { 'test': 'app.http.middleware.MiddlewareTest.MiddlewareTest', 'middleware.test': [ 'app.http.middleware.MiddlewareTest.MiddlewareTest', 'app.http.middleware.AddAttributeMiddleware.AddAttributeMiddleware' ] }
'''首先获取当前目录下所有文件,然后做如下处理: 01 文件名去重复 02 选出文件大于10m的 03 获取到文件的md5值,然后利用这个md5值对文件名进行重命名(其中md5代表一个文件属性) 04 打印出最后的符合条件的所有文件名''' # import os,hashlib # class get_file(): # def __init__(self,path): # self.path=path # """path 通过传入制定路径,获取路径下的所有文件名字返回一个1维列表""" # self.file_name=[] # for (dirpath, dirnames, filenames) in os.walk(self.path): # if filenames: # self.file_name.append(filenames) # self.old_file_name=[] # for i in self.file_name: # for j in i: # self.old_file_name.append(j) # self.old_file_name # print("old_file ",self.old_file_name) # def count_file(self,filename): # count=0 # for i in self.old_file_name: # if filename ==i: # count=count+1 # return count # def getBigFileMD5(self,filepath): # """获取文件的md5值,防止因为文件过大而发生读取错误,采用分段读取""" # if os.path.isfile(filepath): # file_md5 = hashlib.md5() # maxbuf = 8192 #设置每次读取的字节数 # f = open(filepath,'rb') # while True: # buf = f.read(maxbuf) # if not buf: # break #每次读取设置的字节数大小,直到读完后跳出循环 # file_md5.update(buf) #用数据中的字节更新哈希对象,重复调用相当于链接起来 # f.close() # hash = file_md5.hexdigest() # return str(hash).upper() # return None # def unique_absfile(self): # """判断文件名在所有文件的列表中出现的次数,大于1则更改文件名字为md5值,并且保留后缀名字, # 方法返回处理后的文件名字(绝对路径)的列表""" # pathname=[] # for (dirpath, dirnames, filenames) in os.walk(self.path): # for filename in filenames: # if self.count_file(filename)>1: #判断文件名字是否重复 # file_first_name=filename.split(".")[0] # file_last_name=filename.split(".")[1] # path_name=os.path.join(dirpath, filename) #获取重复文件名字的绝对路径 # new_filename=self.getBigFileMD5(path_name)+"."+file_last_name#保证改名后,文件的后缀名字不变 # os.path.join(dirpath, new_filename) # new_pathname=os.rename(path_name,new_pathname) # pathname=pathname+[new_pathname ] # else: # pathname=pathname+[os.path.join(dirpath, filename)] # return pathname # def file_size(self,condition=10): # """调用内部方法self.unique_absfile(),获得去重后的文件名字列表(文件名是绝对路径)""" # """获取文件大小,以M为单位""" # all_file=self.unique_absfile() # file_name=[] # for i in all_file: # size = float((os.path.getsize(i)/1024)) # if size>condition: # if "\\" in i: # file_name.append(i.split("\\")[-1]) # else: # file_name.append(i.split("/")[-1]) # return file_name # 镜像星星金字塔 # def mirror_star_pyramid(n): #     i = 1# 给定初始值 #     star_list1 = []# 存正金字塔每一层元素 #     star_list2 = []# 存倒金字塔每一层元素 #     while i <= n: #         star_list1.append(' '*((n-i)//2) + '*'*i + ' '*((n-i)//2)) #         # n的奇偶性将决定倒金字塔的元素是跟正金字塔一样还是比正金字塔少一层 #         if n % 2: #             star_list2.append(' '*((i+1)//2) + '*'*(n-i-1) + ' '*((i+1)//2)) #         else: #             star_list2 = star_list1[::-1] #         i += 2 #     for each in star_list1:print(each) #     for each in star_list2:print(each) # if __name__ == '__main__': #     mirror_star_pyramid(5) #     mirror_star_pyramid(6)
""" * how to use: to be used you must declare how many parity bits (sizePari) you want to include in the message. it is desired (for test purposes) to select a bit to be set as an error. This serves to check whether the code is working correctly. Lastly, the variable of the message/word that must be desired to be encoded (text). * how this work: declaration of variables (sizePari, be, text) converts the message/word (text) to binary using the text_to_bits function encodes the message using the rules of hamming encoding decodes the message using the rules of hamming encoding print the original message, the encoded message and the decoded message forces an error in the coded text variable decodes the message that was forced the error print the original message, the encoded message, the bit changed message and the decoded message. * All """
# file creation myfile1 = open("truncate.txt", "w") # writing data to the file myfile1.write("Python is a user-friendly language for beginners") # file truncating to 30 bytes myfile1.truncate(30) # file is getting closed myfile1.close() # file reading and displaying the text myfile2 = open("truncate.txt", "r") print(myfile2.read()) # closing the file myfile2.close()
"""Load dependencies needed to compile the protobuf library as a 3rd-party consumer.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def protobuf_deps(): """Loads common dependencies needed to compile the protobuf library.""" if not native.existing_rule("zlib"): http_archive( name = "zlib", build_file = "@com_google_protobuf//:third_party/zlib.BUILD", sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", strip_prefix = "zlib-1.2.11", urls = ["https://zlib.net/zlib-1.2.11.tar.gz"], ) if not native.existing_rule("six"): http_archive( name = "six", build_file = "@//:six.BUILD", sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", urls = ["https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55"], ) if not native.existing_rule("rules_cc"): http_archive( name = "rules_cc", sha256 = "29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec", strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e", urls = ["https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz"], ) if not native.existing_rule("rules_java"): http_archive( name = "rules_java", sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3", strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd", urls = ["https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz"], ) if not native.existing_rule("rules_proto"): http_archive( name = "rules_proto", sha256 = "88b0a90433866b44bb4450d4c30bc5738b8c4f9c9ba14e9661deb123f56a833d", strip_prefix = "rules_proto-b0cc14be5da05168b01db282fe93bdf17aa2b9f4", urls = ["https://github.com/bazelbuild/rules_proto/archive/b0cc14be5da05168b01db282fe93bdf17aa2b9f4.tar.gz"], )
# Copyright 2013 - Mirantis, Inc. # Copyright 2015 - StackStorm, Inc. # # 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. class MistralError(Exception): """Mistral specific error. Reserved for situations that can't automatically handled. When it occurs it signals that there is a major environmental problem like invalid startup configuration or implementation problem (e.g. some code doesn't take care of certain corner cases). From architectural perspective it's pointless to try to handle this type of problems except doing some finalization work like transaction rollback, deleting temporary files etc. """ def __init__(self, message=None): super(MistralError, self).__init__(message) class MistralException(Exception): """Mistral specific exception. Reserved for situations that are not critical for program continuation. It is possible to recover from this type of problems automatically and continue program execution. Such problems may be related with invalid user input (such as invalid syntax) or temporary environmental problems. In case if an instance of a certain exception type bubbles up to API layer then this type of exception it must be associated with an http code so it's clear how to represent it for a client. To correctly use this class, inherit from it and define a 'message' and 'http_code' properties. """ message = "An unknown exception occurred" http_code = 500 @property def code(self): """This is here for webob to read. https://github.com/Pylons/webob/blob/master/webob/exc.py """ return self.http_code def __str__(self): return self.message def __init__(self, message=None): if message is not None: self.message = message super(MistralException, self).__init__( '%d: %s' % (self.http_code, self.message)) # Database exceptions. class DBException(MistralException): http_code = 400 class DBDuplicateEntryException(DBException): http_code = 409 message = "Database object already exists" class DBQueryEntryException(DBException): http_code = 400 class DBEntityNotFoundException(DBException): http_code = 404 message = "Object not found" # DSL exceptions. class DSLParsingException(MistralException): http_code = 400 class YaqlGrammarException(DSLParsingException): http_code = 400 message = "Invalid grammar of YAQL expression" class InvalidModelException(DSLParsingException): http_code = 400 message = "Wrong entity definition" # Various common exceptions. class YaqlEvaluationException(MistralException): http_code = 400 message = "Can not evaluate YAQL expression" class DataAccessException(MistralException): http_code = 400 class ActionException(MistralException): http_code = 400 class InvalidActionException(MistralException): http_code = 400 class ActionRegistrationException(MistralException): message = "Failed to register action" class EngineException(MistralException): http_code = 500 class WorkflowException(MistralException): http_code = 400 class InputException(MistralException): http_code = 400 class ApplicationContextNotFoundException(MistralException): http_code = 400 message = "Application context not found" class InvalidResultException(MistralException): http_code = 400 message = "Unable to parse result" class SizeLimitExceededException(MistralException): http_code = 400 def __init__(self, field_name, size_kb, size_limit_kb): super(SizeLimitExceededException, self).__init__( "Size of '%s' is %dKB which exceeds the limit of %dKB" % (field_name, size_kb, size_limit_kb)) class CoordinationException(MistralException): http_code = 500 class NotAllowedException(MistralException): http_code = 403 message = "Operation not allowed"
class Solution: def generate(self, numRows): """ :type numRows: int :rtype: List[List[int]] """ if numRows == 0: return [] ret = [[1]] for i in range(1, numRows): tmp = [] for j in range(i + 1): if j == 0: tmp.append(ret[i - 1][j]) elif j == i: tmp.append(ret[i - 1][j - 1]) else: tmp.append(ret[i - 1][j] + ret[i - 1][j - 1]) ret.append(tmp) return ret
# open( filePath , mode ) # filePath:路径 可以绝对路径和相对路径 # mode: w 可写 r 可读 a 追加 r 读取数据 f = open('file/test.txt', 'w') # write( 内容 ) f.write('hello world\n') # close() 文件的进程关闭 不然会一直存在内存 f.close() # mode: a 追加数据 fa = open('file/test.txt', 'a') fa.write('i am append data\n' * 5) fa.close() # read() 读取文件类容 fr = open('file/test.txt', 'r') content = fr.read() print(content)
class NamingUtils(object): ''' Utilities related to object naming ''' @classmethod def createUniqueMnemonic(cls, mnem, unitMap): """ If mnemonic exists in dict appends a _x where x is an int """ result = mnem if mnem in unitMap: suffix = 1 while (mnem + "_" + str(suffix)) in unitMap: suffix += 1 result = mnem + "_" + str(suffix) return result
a = {'C', 'C++', 'Java'} b = {'C++', 'Java', 'Python'} c = {'java', 'Python', 'C', 'pascal'} # who known all three subject u = a.union(b).union(c) print("Union", u) # find subject known to A and not to B i = a.intersection(b) print("Intersection", i) diff1 = a.difference(b) print(a, b, "C-F", diff1) #find a subject who only know only one student studentswhoknowonlypascal=[] if "pascal " in a: studentswhoknowonlypascal.append("A") if "pascal" in b: studentswhoknowonlypascal.append("B") if "pascal" in c: studentswhoknowonlypascal.append("C") print(studentswhoknowonlypascal) # find a student who only know Python studentswhoknowpython=[] if "Python" in a: studentswhoknowpython.append("A") if "Python" in b: studentswhoknowpython.append("B") if "Python" in c: studentswhoknowpython.append("C") print(studentswhoknowpython) #find subject who known all three i = a.intersection(b).intersection(c) diff1 = a.difference(b).difference(c) print("C-F", diff1)
nk = input().split() n = int(nk[0]) k = int(nk[1]) r = int(input()) c = int(input()) o = [] z=0 for _ in range(k): o.append(list(map(int, input().rstrip().split()))) l=[] p=[] a=[] for i in range(n): l=l+[0] for i in range(n): l[i]=[0]*n l[r-1][c-1]=1 for i in range(len(o)): l[o[i][0]-1][o[i][1]-1]=2 print(l) for i in range(n): for j in range(n): if(l[i][j]==2): a.append(abs(r-i)) p.append(abs(c-j)) print(a) print(p) for i in a: if(i>1): for j in range(i): z=z+j print(z) for i in p: if(i>1): for j in range(i): z=z+j print(z) print(z)
name = "generators" """ The generators module """
def eig(a): # TODO(beam2d): Implement it raise NotImplementedError def eigh(a, UPLO='L'): # TODO(beam2d): Implement it raise NotImplementedError def eigvals(a): # TODO(beam2d): Implement it raise NotImplementedError def eigvalsh(a, UPLO='L'): # TODO(beam2d): Implement it raise NotImplementedError
# ex1116 Dividindo x por y n = int(input()) for c in range(1, n + 1): x, y = map(float, input().split()) if x > y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) elif x > y and y == 0: print('divisao impossivel') if x < y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) elif x == y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) if x < y and y == 0: print('divisao impossivel')
# Description: Class, Instances, Constructor, Self in Python """ ### Note * Class - A template for creating objects. - All objects created using the same class will have the same characteristics. * Object - An instance of a class. * Instantiate - Create an instance of a class. * Method - A function defined in a class. * Attribute - A variable bound to an instance of a class. * Class Variables - Each object gets its own copy of class variables and is different from Java static fields. """ # Class class Book(object): # Class Variables count = 0 # Constructor def __init__(self, title, author, price): self.title = title self.author = author self.price = price self.available = False def make_available(self): self.available = True if __name__ == '__main__': # Create Instance maths = Book("What is Mathematics, Really?", "Reuben Hersh", 694) print("Book 1: {} by {} for {}".format(maths.title, maths.author, maths.price)) # Modify Instance maths.price = 800 print("Book 1: New Price is {}".format(maths.price)) # Modify instance maths.make_available() print("Availability: ", maths.available) # Create another object fermat = Book("Fermat’s Last Theorem", "Simon Singh", 233) # Print Details print("Books: {} by {} for {}, {} by {} for {}".format(maths.title, maths.author, maths.price, fermat.title, fermat.author, fermat.price)) print("Books: {0.title} by {0.author} for {0.price}, {1.title} by {1.author} for {1.price}".format(maths, fermat)) # Print class variables print("Book Count: {0.count} ".format(Book)) print("Book Object Count: {0.count}, {1.count}".format(maths, fermat)) maths.count = 1 fermat.count = 2 print("New Book Count: {0.count} ".format(Book)) print("New Book Object Count: {0.count}, {1.count}".format(maths, fermat)) # Print Definitions print(Book.__dict__) print(maths.__dict__) print(fermat.__dict__)
# https://leetcode.com/problems/valid-perfect-square class Solution: def isPerfectSquare(self, num): if num == 1: return True l, r = 1, num while l <= r: mid = (l + r) // 2 if mid ** 2 == num: return True elif mid ** 2 < num: l = mid + 1 else: r = mid - 1 return False
''' Color Pallette ''' # Generic Stuff BLACK = ( 0, 0, 0) WHITE = (255, 255, 255) # Pane Colors PANE1 = (236, 236, 236) PANE2 = (255, 255, 255) PANE3 = (236, 236, 236) # Player Color PLAYER_COLOR = BLACK # Reds RED_POMEGRANATE = (242, 38, 19) RED_THUNDERBIRD = (217, 30, 24) RED_FLAMINGO = (239, 72, 54) RED_RAZZMATAZZ = (219, 10, 91) RED_RADICALRED = (246, 36, 89) RED_ECSTASY = (249, 105, 14) RED_RYANRILEY = ( 15, 1, 12) RED = [ RED_POMEGRANATE, RED_THUNDERBIRD, RED_FLAMINGO, RED_RAZZMATAZZ, RED_RADICALRED, RED_ECSTASY, RED_RYANRILEY ] # Blues BLUE_REBECCAPURPLE = (102, 51, 153) BLUE_MEDIUMPURPLE = (191, 85, 236) BLUE_STUDIO = (142, 68, 173) BLUE_PICTONBLUE = ( 34, 167, 240) BLUE_EBONYCLUE = ( 34, 49, 63) BLUE_JELLYBEAN = ( 37, 116, 169) BLUE_JORDYBLUE = (137, 196, 244) BLUE_KELLYRIVERS = ( 0, 15, 112) BLUE = [ BLUE_REBECCAPURPLE, BLUE_MEDIUMPURPLE, BLUE_STUDIO, BLUE_PICTONBLUE, BLUE_EBONYCLUE, BLUE_JELLYBEAN, BLUE_JORDYBLUE, BLUE_KELLYRIVERS, ] # Greens GREEN_MALACHITE = ( 0, 230, 64) GREEN_TURQUOISE = ( 78, 205, 196) GREEN_EUCALYPTUS = ( 38, 166, 91) GREEN_MOUNTAIN = ( 27, 188, 155) GREEN_SHAMROCK = ( 46, 204, 113) GREEN_SALEM = ( 30, 130, 76) GREEN = [ GREEN_MALACHITE, GREEN_TURQUOISE, GREEN_EUCALYPTUS, GREEN_MOUNTAIN, GREEN_SHAMROCK, GREEN_SALEM ] COLORS = RED + BLUE + GREEN
lista = list() vezesInput = 0 while vezesInput < 6: valor = float(input()) if valor > 0: lista.append(valor) vezesInput += 1 print(f'{len(lista)} valores positivos')
class Node(object): def __init__(self, symbol, offset, token=None): self.symbol = symbol self.offset = offset self.token = token self.children = [] self.parent = None def append(self, node): if node.symbol is None or node.symbol.drop: return if node.symbol.flatten: for child in node.children: self.append(child) else: self.children.append(node) node.parent = self def remove(self, node): try: self.children.remove(node) except ValueError: pass def discard(self): if self.parent: self.parent.remove(self) def __bool__(self): return bool(self.token or self.children) def transform(self): return self.symbol.apply_transform(self) def __len__(self): return len(self.children) def __iter__(self): return iter(self.children) def __getitem__(self, index): return self.children[index] def __repr__(self): name = '{0}='.format(self.symbol.name) if self.symbol.name else '' return '<{0} {1}{2}>'.format(self.__class__.__name__, name, repr(self.token)) def __str__(self): if self.token: return '{0} {1}'.format(self.symbol, repr(self.token.lexeme)) return str(self.symbol) def tuple_tree(self): if self.token: return (self.symbol.name, self.token.lexeme) return (self.symbol.name, [node.tuple_tree() for node in self]) def print_tree(self): # FIXME: try to use box drawing characters: ┕, ━, ┣, ┃ def lines(node, indent): for i, child in enumerate(node): yield '{0}|--- {1}'.format(indent, child) next_indent = ' ' if i == len(node) - 1 else '| ' yield from lines(child, indent + next_indent) print(str(self) + "\n" + "\n".join(lines(self, '')))
# -*- coding: utf-8 -*- # This file is generated from NI Switch Executive API metadata version 19.1.0d1 enums = { 'ExpandAction': { 'values': [ { 'documentation': { 'description': 'Expand to routes' }, 'name': 'NISE_VAL_EXPAND_TO_ROUTES', 'value': 0 }, { 'documentation': { 'description': 'Expand to paths' }, 'name': 'NISE_VAL_EXPAND_TO_PATHS', 'value': 1 } ] }, 'MulticonnectMode': { 'values': [ { 'documentation': { 'description': 'Default' }, 'name': 'NISE_VAL_DEFAULT', 'value': -1 }, { 'documentation': { 'description': 'No multiconnect' }, 'name': 'NISE_VAL_NO_MULTICONNECT', 'value': 0 }, { 'documentation': { 'description': 'Multiconnect' }, 'name': 'NISE_VAL_MULTICONNECT', 'value': 1 } ] }, 'OperationOrder': { 'values': [ { 'documentation': { 'description': 'Break before make' }, 'name': 'NISE_VAL_BREAK_BEFORE_MAKE', 'value': 1 }, { 'documentation': { 'description': 'Break after make' }, 'name': 'NISE_VAL_BREAK_AFTER_MAKE', 'value': 2 } ] }, 'PathCapability': { 'values': [ { 'documentation': { 'description': 'Path needs hardwire' }, 'name': 'NISE_VAL_PATH_NEEDS_HARDWIRE', 'value': -2 }, { 'documentation': { 'description': 'Path needs config channel' }, 'name': 'NISE_VAL_PATH_NEEDS_CONFIG_CHANNEL', 'value': -1 }, { 'documentation': { 'description': 'Path available' }, 'name': 'NISE_VAL_PATH_AVAILABLE', 'value': 1 }, { 'documentation': { 'description': 'Path exists' }, 'name': 'NISE_VAL_PATH_EXISTS', 'value': 2 }, { 'documentation': { 'description': 'Path Unsupported' }, 'name': 'NISE_VAL_PATH_UNSUPPORTED', 'value': 3 }, { 'documentation': { 'description': 'Resource in use' }, 'name': 'NISE_VAL_RESOURCE_IN_USE', 'value': 4 }, { 'documentation': { 'description': 'Exclusion conflict' }, 'name': 'NISE_VAL_EXCLUSION_CONFLICT', 'value': 5 }, { 'documentation': { 'description': 'Channel not available' }, 'name': 'NISE_VAL_CHANNEL_NOT_AVAILABLE', 'value': 6 }, { 'documentation': { 'description': 'Channels hardwired' }, 'name': 'NISE_VAL_CHANNELS_HARDWIRED', 'value': 7 } ] } }
"""Utility functions.""" def generate_query_string(query_params): """Generate a query string given kwargs dictionary.""" query_frags = [ str(key) + "=" + str(value) for key, value in query_params.items() ] query_str = "&".join(query_frags) return query_str
defterolepta = int(input('Δώσε τον αριθμό των δευτερολέπτων: ')) if defterolepta < 60: print('Δευτερόλεπτα: ', float(defterolepta), sep='') elif defterolepta >= 60 and defterolepta < 3600: lepta = (defterolepta // 60) % 60 defterolepta = defterolepta % 60 print('Λεπτά: ', float(lepta), '\nΔευτερόλεπτα: ', float(defterolepta), sep='') elif defterolepta >= 3600 and defterolepta < 86400: ores = defterolepta // 3600 lepta = (defterolepta // 60) % 60 defterolepta = defterolepta % 60 print('Ώρες: ', float(ores), '\nΛεπτά: ', float(lepta), '\nΔευτερόλεπτα: ', float(defterolepta), sep='') else: # Το 90000 είναι το αποτέλεσμα του 86400 + 3600 και το κάνουμε έτσι ώστε # στην δεύτερη 'else' να εμφανίζει μόνο τις ημέρες, τα λεπτά και τα # δευτερόλεπτα και όχι τις ώρες. if defterolepta >= 90000: imeres = (defterolepta // 3600) % 60 imeres = imeres // 24 ores = defterolepta - 86400 ores = ores // 3600 lepta = (defterolepta // 60) % 60 defterolepta = defterolepta % 60 print('Ημέρες: ', float(imeres), '\nΏρες: ', float(ores), '\nΛεπτά: ', float(lepta), '\nΔευτερόλεπτα: ', float(defterolepta), sep='') else: imeres = (defterolepta // 3600) % 60 imeres = imeres // 24 lepta = (defterolepta // 60) % 60 defterolepta = defterolepta % 60 print('Ημέρες: ', float(imeres), '\nΛεπτά: ', float(lepta), '\nΔευτερόλεπτα: ', float(defterolepta), sep='')
# Click trackpad of first controller by "C" key alvr.buttons[0][alvr.Id("trackpad_click")] = keyboard.getKeyDown(Key.C) alvr.buttons[0][alvr.Id("trackpad_touch")] = keyboard.getKeyDown(Key.C) # Move trackpad position by arrow keys if keyboard.getKeyDown(Key.LeftArrow): alvr.trackpad[0][0] = -1.0 alvr.trackpad[0][1] = 0.0 elif keyboard.getKeyDown(Key.UpArrow): alvr.trackpad[0][0] = 0.0 alvr.trackpad[0][1] = 1.0 elif keyboard.getKeyDown(Key.RightArrow): alvr.trackpad[0][0] = 1.0 alvr.trackpad[0][1] = 0.0 elif keyboard.getKeyDown(Key.DownArrow): alvr.trackpad[0][0] = 0.0 alvr.trackpad[0][1] = -1.0
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def flatten(root: TreeNode) -> None: """ Do not return anything, modify root in-place instead. """ if not root: return stack = [root] pre = None while stack: node = stack.pop() if pre: pre.left = None pre.right = node if node.right: stack.append(node.right) if node.left: stack.append(node.left) pre = node if __name__ == "__main__" : root = TreeNode(1) root.left = TreeNode(2) root.right = TreeNode(5) root.left.left = TreeNode(3) root.left.right = TreeNode(4) root.right.right = TreeNode(6) flatten(root)
""" In Python, there are three different numeric types. These are "int", "float" and "complex". Documentation - https://www.w3schools.com/python/python_numbers.asp Below we will look at all three different types. """ """ "int", or integer, is a whole number, positive or negative, without decimals and has an unlimited length. Below are a few examples of integers """ int_1 = 1 int_2 = 3248092309348023743 int_3 = -1232 print(type(int_1), type(int_2), type(int_3)) # This will log - <class 'int'> <class 'int'> <class 'int'> """ "float", or "floating point number" is a number, positive or negative, that contains one or more decimals. A "float" can also be scientific numbers with an "e" to indicate the power of 10 Below are a few examples of this. """ float_1 = 1.12342340 float_2 = 1.0 float_3 = -35.59 float_4 = 35e3 # 35000.0 float_5 = 12E4 # 120000.0 float_6 = -87.7e100 # -8.77e+101 # This will log - <class 'float'> <class 'float'> <class 'float'> <class 'float'> <class 'float'> <class 'float'> print(type(float_1), type(float_2), type(float_3), type(float_4), type(float_5), type(float_6)) """ "complex" numbers are written with a "j" as the imaginary part. """
class Solution: def checkInclusion(self, s1: str, s2: str) -> bool: ''' T: O(n2 * n1 log n1); can be reduced to O(n2 * n1) by using char counter S: O(n1); can be reduced to O(26) = O(1) by using character counting array ''' n1, n2 = len(s1), len(s2) s1 = sorted(s1) for i in range(n2 - n1 + 1): if s1 == sorted(s2[i:i+n1]): return True return False
#!/usr/bin/env python3 # MIT License # Copyright (c) 2020 pixelbubble # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # based on https://github.com/pixelbubble/ProtOSINT/blob/main/protosint.py def generate_accounts(): firstName = input("First name: ").lower() lastName = input("Last name: ").lower() yearOfBirth = input("Year of birth: ") pseudo = input("Username (optional): ").lower() zipCode = input("Zip code (optional): ") results_list = [] results_list.append(firstName+lastName) results_list.append(lastName+firstName) results_list.append(firstName[0]+lastName) results_list.append(lastName) results_list.append(firstName+lastName+yearOfBirth) results_list.append(firstName[0]+lastName+yearOfBirth) results_list.append(lastName+firstName+yearOfBirth) results_list.append(firstName+lastName+yearOfBirth[-2:]) results_list.append(firstName+lastName+yearOfBirth[-2:]) results_list.append(firstName[0]+lastName+yearOfBirth[-2:]) results_list.append(lastName+firstName+yearOfBirth[-2:]) results_list.append(firstName+lastName+zipCode) results_list.append(firstName[0]+lastName+zipCode) results_list.append(lastName+firstName+zipCode) results_list.append(firstName+lastName+zipCode[:2]) results_list.append(firstName[0]+lastName+zipCode[:2]) results_list.append(lastName+firstName+zipCode[:2]) if pseudo: results_list.append(pseudo) results_list.append(pseudo+zipCode) results_list.append(pseudo+zipCode[:2]) results_list.append(pseudo+yearOfBirth) results_list.append(pseudo+yearOfBirth[-2:]) results_list = list(set(results_list)) return results_list if __name__ == '__main__': results = generate_accounts() print('\n'.join(results))
# MYSQL_CONFIG = { # 'host': '10.70.14.244', # 'port': 33044, # 'user': 'view', # 'password': '!@View123', # 'database': 'yjyg' # } MYSQL_CONFIG = { 'host': '127.0.0.1', 'port': 33004, 'user': 'root', 'password': 'q1w2e3r4', 'database': 'yjyg' }
"""iCE entities.""" # # Base entity class # class Entity(object): """Generic entity. :type id: str :type created: datetime.datetime :type update: datetime.datetime :type etag: str """ def __init__(self, **kwargs): # MongoDB stuff self.id = kwargs.get('_id', None) self.created = kwargs.get('_created', None) self.updated = kwargs.get('_updated', None) # ETag self.etag = kwargs.get('_etag', None) def to_dict(self): """Converts the entity to dictionary. :rtype: dict :return: A Python dictionary with the attributes of the entity. """ _dict = {} for key, value in self.__dict__.items(): if value is None: continue if key.startswith('_'): continue if key in ['id', 'created', 'updated', 'etag']: # TODO continue _dict[key] = value return _dict # # Session class # class Session(Entity): """Represents an experimentation session. :type client_ip_addr: str """ def __init__(self, **kwargs): super(Session, self).__init__(**kwargs) # Attributes self.client_ip_addr = kwargs['client_ip_addr'] # # Instance class # class Instance(Entity): """Represents a cloud instance. :type session_id: str :type networks: list :type public_ip_addr: str :type public_reverse_dns: str :type ssh_username: str :type ssh_port: int :type ssh_authorized_fingerprint: str :type tags: dict """ # # Constructor # def __init__(self, **kwargs): super(Instance, self).__init__(**kwargs) # Session self.session_id = kwargs['session_id'] # Networking self.networks = [] for net in kwargs.get('networks', []): my_net = { 'addr': net['addr'] } if 'iface' in net: my_net['iface'] = net['iface'] if 'bcast_addr' in net: my_net['bcast_addr'] = net['bcast_addr'] self.networks.append(my_net) # Public network self.public_ip_addr = kwargs['public_ip_addr'] self.public_reverse_dns = kwargs.get('public_reverse_dns', '') # SSH options self.ssh_port = int(kwargs.get('ssh_port', 22)) self.ssh_username = kwargs.get('ssh_username', '') self.ssh_authorized_fingerprint = kwargs.get( 'ssh_authorized_fingerprint', '' ) # Tags self.tags = kwargs.get('tags', {}) # # Setters # def add_network(self, addr, iface=None, bcast_addr=None): """Adds network in the instance. :param str addr: The address and mask of the network (e.g.: 192.168.1.112/24). :param str iface: The interface of the network (e.g.: eth0). :param str bcast_addr: The broadcast address of the network. """ my_net = { 'addr': addr } if iface is not None: my_net['iface'] = iface if bcast_addr is not None: my_net['bcast_addr'] = bcast_addr self.networks.append(my_net)
AUX={ "す,_":"せ:し:す:する:すれ:せよ", "ず,_":"ざら:ずし:ず:ざる:ざれ:ざれ", "なり,_":"なら:なり:なり:なる:なれ:なれ", "不,v,副詞,否定,無界":"ざら:ずし:ず:ざる:ざれ:ざれ", "且,v,副詞,時相,将来":"んとせ:んとし:んとす:んとする:んとすれ:んとせよ", "也,p,助詞,句末,*":"なら:なり:なり:なる:なれ:なれ", "也,p,助詞,提示,*":"なら:なり:なり:なる:なれ:なれ", "儀,v,助動詞,必要,*":"べから:べく:べし:べき:べけれ:べけれ", "勿,v,副詞,否定,禁止":"なから:なく:なかれ:なき:なけれ:なかれ", "可,v,助動詞,可能,*":"べから:べく:べし:べき:べけれ:べけれ", "宜,v,助動詞,必要,*":"べから:べく:べし:べき:べけれ:べけれ", "將,v,副詞,時相,将来":"んとせ:んとし:んとす:んとする:んとすれ:んとせよ", "弗,v,副詞,否定,無界":"ざら:ずし:ず:ざる:ざれ:ざれ", "得,v,助動詞,可能,*":"得:得:得る:得る:得れ:得よ", "敢,v,助動詞,願望,*":"敢へてせ:敢へ:敢へてす:敢へてする:敢へてすれ:敢へてせよ", "欲,v,助動詞,願望,*":"欲さ:欲し:欲す:欲する:欲せ:欲せよ", "毋,v,副詞,否定,禁止":"なから:なく:なかれ:なき:なけれ:なかれ", "肯,v,助動詞,願望,*":"肯へてせ:肯へ:肯へてす:肯へてする:肯へてすれ:肯へてせよ", "能,v,助動詞,可能,*":"能は:能ひ:能ふ:能ふる:能へ:能へよ", "莫,v,副詞,否定,禁止":"なから:なく:なかれ:なき:なけれ:なかれ", "被,v,助動詞,受動,*":"られ:られ:らる:らるる:られ:られよ", "見,v,助動詞,受動,*":"られ:られ:らる:らるる:られ:られよ", "足,v,助動詞,可能,*":"足ら:足り:足る:足る:足れ:足れ", "非,v,副詞,否定,体言否定":"非ざら:非ずし:非ず:非ざる:非ざれ:非ざれ", "須,v,助動詞,必要,*":"べから:べく:べし:べき:べけれ:べけれ", }
def cheapest_flour(input1,output1): a=[] b=[] with open(input1,"r") as input_file: number1=0 for i in input_file.readlines(): a.append(i.split()) b.append(int(a[number1][0])/int(a[number1][1])) number1+=1 b=sorted(b,reverse=True) with open(output1,"w") as output_file: for i in b: output_file.write(str(i)+"\n")
""" Cross-validation sampling ------------------------- This module contains the functions used to crete a a cross validation division for the data. TODO ---- Create a class structure to create samplings Create a class which is able to create a cv object """ class Categorical_Sampler: def __init__(self, points_cat, weights, precomputed=False, repetition=False): if precomputed: len(points_cat) == len(weights) self.points_cat = points_cat self.weights = weights self.repetition = repetition def sample(self, n, fixed=True): if self.repetition and fixed: pass elif self.repetition and not fixed: pass elif not self.repetition and fixed: pass elif not self.repetition and not fixed: pass def generate_cv_sampling(self): pass class Spatial_Sampler: def __init__(self, points_com, com_stats): self.points_com = points_com self.com_stats = com_stats self.n_com = len(self.com_stats) def sample(self, n): pass def retrieve_icom(self, icom): if type(self.points_com) == np.ndarray: indices = np.where(self.points_com == icom)[0] else: indices = np.zeros(len(self.points_com)).astype(bool) for i in xrange(len(self.points_com)): indices[i] = icom in self.points_com[i] indices = np.where(indices)[0] return indices def retrieve_non_icom(self, icom): if type(self.points_com) == np.ndarray: indices = np.where(self.points_com != icom)[0] else: indices = np.zeros(len(self.points_com)).astype(bool) for i in xrange(len(self.points_com)): indices[i] = icom not in self.points_com[i] indices = np.where(indices)[0] return indices def generate_cv_sampling(self): for icom in self.com_stats: r_type = self.retrieve_icom(icom) non_r_type = self.retrieve_non_icom(icom) yield r_type, non_r_type class CV_sampler: """Sampler for creating CV partitions.""" def __init__(self, f, m): pass def generate_cv(self): pass
__author__ = "Dimi Balaouras" __copyright__ = "Copyright 2016, Stek.io" __license__ = "Apache License 2.0, see LICENSE for more details." # Do not modify the following __default_feature_name__ = "DO_NOT_MODIFY" class AppContext(object): """ App Context based on Service Locator Pattern """ def __init__(self, allow_replace=False): """ :param allow_replace: Allow replace of the feature """ self.providers = {} self.allow_replace = allow_replace def register(self, feature, provider, *args, **kwargs): if not self.allow_replace: assert not self.providers.has_key(feature), "Duplicate feature: %r" % feature if callable(provider): def call(): return provider(*args, **kwargs) else: def call(): return provider self.providers[feature] = call def __getitem__(self, feature): try: provider = self.providers[feature] except KeyError: raise KeyError("Unknown feature named %r" % feature) return provider() def get(self, feature, default=__default_feature_name__): """ Wrapper of __getitem__ method :param feature: The Feature registered within the WebHawk Context :param default: Default return value :return: The reference to the implementation of the requested feature; None otherwise """ feature_impl = default if default == __default_feature_name__: # Will raise an exception if feature is not implemented feature_impl = self.__getitem__(feature) else: try: feature_impl = self.__getitem__(feature) except KeyError: pass return feature_impl
# config.py SEED = 42 EXTENSION = ".png" IMAGE_H = 28 IMAGE_W = 28 CHANNELS = 3 BATCH_SIZE = 30 EPOCHS = 400 LEARNING_RATE = 0.001 CIRCLES = "../input/shapes/circles/" SQUARES = "../input/shapes/squares/" TRIANGLES = "../input/shapes/triangles/" INPUT_FOLD = "../input/" OUTPUT_FOLD = "../output/" TRAIN_DATA = "../input/train_dataset.csv" VALID_DATA = "../input/valid_dataset.csv" ACCURACIES = "../output/accuracies.csv" LOSSES = "../output/losses.csv"
# In one of the Chinese provinces, it was decided to build a series of machines to protect the # population against the coronavirus. The province can be visualized as an array of values 1 and 0, # which arr[i] = 1 means that in city [i] it is possible to build a machine and value 0 that it can't. # There is also a number k, which means that if we put the machine in the city [i], then the cities with # indices [j] such that that abs(i-j) < k are through it protected. Find the minimum number of machines # are needed to provide security in each city, or -1 if that is impossible. def machines_saving_people(T, k): count = 0 distance = -1 protected = distance + k while distance + k < len(T): if protected > len(T) - 1: protected = len(T) - 1 while T[protected] == 0 and protected >= distance + 1: protected -= 1 if protected == distance: return -1 else: distance = protected protected += 2 * k - 1 count += 1 return count T = [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0] k = 4 print(machines_saving_people(T, k))
m = 5 n = 0.000001 # rule-id: use-float-numbers assert(1.0000 == 1.000000) # rule-id: use-float-numbers assert(1.0000 == m) # rule-id: use-float-numbers assert(m == 1.0000) # rule-id: use-float-numbers assert(m == n)
while True: password = input("Password") print(password) if password == "stop": break print("the while loop has stopped")
# wczytanie slow i szyfrow with open('../dane/sz.txt') as f: cyphers = [] for word in f.readlines(): cyphers.append(word[:-1]) with open('../dane/klucze2.txt') as f: keys = [] for word in f.readlines(): keys.append(word[:-1]) # zbior odszyfrowanych slow words = [] # przejscie po slowach i kluczach for cypher, key in zip(cyphers, keys): # zaszyfrowane slowo word = '' for i, char in enumerate(cypher): # odjecie ich kodow ascii plus 64 by uzyskac numer alfabetu klucza # klucz zawijam na wypadek krotszego klucza od szyfrowanego slowa currAscii = ord(char) - ord(key[i % len(key)]) + 64 # jezeli przekroczylo dolna granice, zawijam if currAscii < 65: currAscii += 26 word += chr(currAscii) words.append(word) # wyswietlenie odpowiedzi nl = '\n' answer = f'4 b) Odszyfrowane slowa: {nl}{nl.join(words)}' print(answer)
def graph_pred_vs_actual(actual,pred,data_type): plt.scatter(actual,pred,alpha=.3) plt.plot(np.linspace(int(min(pred)),int(max(pred)),int(max(pred))), np.linspace(int(min(pred)),int(max(pred)),int(max(pred)))) plt.title('Actual vs Pred ({} Data)'.format(data_type)) plt.xlabel('Actual') plt.ylabel('Pred') plt.show() def graph_residual(actual,residual,data_type): plt.scatter(actual,residual,alpha=.3) plt.plot(np.linspace(int(min(actual)),int(max(actual)),int(max(actual))),np.linspace(0,0,int(max(actual)))) plt.title('Actual vs Residual ({} Data)'.format(data_type)) plt.xlabel('Actual') plt.ylabel('Residual') plt.show() def scrape_weather_url(url): # weather data holder to be inserted to pandas dataframe high_low, weather_desc, humidity_barometer, wind, date_time = [], [], [], [], [] # open url driver.get(url) soup = BeautifulSoup(driver.page_source, "lxml") days_chain = [x.find_all('a') for x in soup.find_all(class_='weatherLinks')] time.sleep(5) # Load Entire Page by Scrolling to charts driver.execute_script("window.scrollTo(0, document.body.scrollHeight/3.5);") # Scroll down to bottom # First load of each month takes extra long time. Therefore 'counter' variable is used to run else block first counter = 0 for ix,link in enumerate(days_chain[0]): ''' Bottom section tries to solve loading issue by implementing wait feature Refer : https://selenium-python.readthedocs.io/waits.html ''' wait = WebDriverWait(driver, 10) if counter!=0: delay = 3 # seconds try: myElem = wait.until(EC.presence_of_element_located((By.CLASS_NAME, 'weatherLinks'))) except TimeoutException: print("Loading took too much time!" ) day_link = driver.find_element_by_xpath("//div[@class='weatherLinks']/a[{}]".format(ix+1)) wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='weatherLinks']/a[{}]".format(ix+1)))) day_link.click() else: delay = 5 # seconds try: myElem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.CLASS_NAME, 'weatherLinks'))) except TimeoutException: print("Loading took too much time!" ) day_link = driver.find_element_by_xpath("//div[@class='weatherLinks']/a[{}]".format(ix+1)) wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='weatherLinks']/a[{}]".format(ix+1)))) time.sleep(4) day_link.click() time.sleep(3) counter+=1 # Wait a bit for the Javascript to fully load data to be scraped time.sleep(2.5) # Scrape weather data high_low.insert(0,driver.find_elements_by_xpath("//div[@class='temp']")[-1].text) #notice elements, s at the end. This returns a list, and I can index it. weather_desc.insert(0,driver.find_element_by_xpath("//div[@class='wdesc']").text) humidity_barometer.insert(0,driver.find_element_by_xpath("//div[@class='mid__block']").text) wind.insert(0,driver.find_element_by_xpath("//div[@class='right__block']").text) date_time.insert(0,driver.find_elements_by_xpath("//div[@class='date']")[-1].text) return high_low, weather_desc, humidity_barometer, wind, date_time
# https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list # Python """ Insert Node at the end of a linked list head pointer input could be None as well for empty list Node is defined as class Node(object): def __init__(self, data=None, next_node=None): self.data = data self.next = next_node return back the head of the linked list in the below method """ def Insert(head, data): if head is None: return Node(data=data) else: current = head while hasattr(current, 'next') and current.next is not None: current = current.next current.next = Node(data=data) return head
# # PySNMP MIB module DC-OPT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DC-OPT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:21:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Counter64, Counter32, ObjectIdentity, IpAddress, MibIdentifier, enterprises, Integer32, TimeTicks, NotificationType, ModuleIdentity, Gauge32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Counter64", "Counter32", "ObjectIdentity", "IpAddress", "MibIdentifier", "enterprises", "Integer32", "TimeTicks", "NotificationType", "ModuleIdentity", "Gauge32", "iso") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") codex = MibIdentifier((1, 3, 6, 1, 4, 1, 449)) cdxProductSpecific = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2)) cdx6500 = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1)) cdx6500Statistics = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3)) cdx6500StatOtherStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2)) cdx6500Controls = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4)) class DisplayString(OctetString): pass cdx6500DCStatTable = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10)) cdx6500DCGenStatTable = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1)) cdx6500DCGenStatTableEntry = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1)) cdx6500DCGenStatDSPStatus = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("down", 1), ("up", 2), ("missing", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatDSPStatus.setStatus('mandatory') cdx6500DCGenStatHndlrSWRev = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatHndlrSWRev.setStatus('mandatory') cdx6500DCGenStatFnctnSWRev = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatFnctnSWRev.setStatus('mandatory') cdx6500DCGenStatMaxChannels = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatMaxChannels.setStatus('mandatory') cdx6500DCGenStatChanInUse = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatChanInUse.setStatus('mandatory') cdx6500DCGenStatMaxSmltChanUse = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatMaxSmltChanUse.setStatus('mandatory') cdx6500DCGenStatRejectConn = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatRejectConn.setStatus('mandatory') cdx6500DCGenStatAggCRatio = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatAggCRatio.setStatus('mandatory') cdx6500DCGenStatCurrEncQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatCurrEncQDepth.setStatus('mandatory') cdx6500DCGenStatMaxEncQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatMaxEncQDepth.setStatus('mandatory') cdx6500DCGenStatTmOfMaxEncQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 11), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatTmOfMaxEncQDepth.setStatus('mandatory') cdx6500DCGenStatCurrDecQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatCurrDecQDepth.setStatus('mandatory') cdx6500DCGenStatMaxDecQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatMaxDecQDepth.setStatus('mandatory') cdx6500DCGenStatTmOfMaxDecQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 14), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCGenStatTmOfMaxDecQDepth.setStatus('mandatory') cdx6500DCChanStatTable = MibTable((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2), ) if mibBuilder.loadTexts: cdx6500DCChanStatTable.setStatus('mandatory') cdx6500DCChanStatTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1), ).setIndexNames((0, "DC-OPT-MIB", "cdx6500DCChanStatChanNum")) if mibBuilder.loadTexts: cdx6500DCChanStatTableEntry.setStatus('mandatory') cdx6500DCChanStatChanNum = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatChanNum.setStatus('mandatory') cdx6500DCChanStatTmOfLastStatRst = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatTmOfLastStatRst.setStatus('mandatory') cdx6500DCChanStatChanState = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=NamedValues(("dspDown", 1), ("idle", 2), ("negotiating", 3), ("dataPassing", 4), ("flushingData", 5), ("flushingDCRing", 6), ("apClearing", 7), ("npClearing", 8), ("clearingCall", 9), ("flushingOnClr", 10), ("clearing", 11)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatChanState.setStatus('mandatory') cdx6500DCChanStatSourceChan = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatSourceChan.setStatus('mandatory') cdx6500DCChanStatDestChan = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatDestChan.setStatus('mandatory') cdx6500DCChanStatXmitCRatio = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatXmitCRatio.setStatus('mandatory') cdx6500DCChanStatNumOfEncFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatNumOfEncFrames.setStatus('mandatory') cdx6500DCChanStatNumOfCharInToEnc = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatNumOfCharInToEnc.setStatus('mandatory') cdx6500DCChanStatNumOfCharOutOfEnc = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatNumOfCharOutOfEnc.setStatus('mandatory') cdx6500DCChanStatNumOfDecFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatNumOfDecFrames.setStatus('mandatory') cdx6500DCChanStatNumOfCharInToDec = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatNumOfCharInToDec.setStatus('mandatory') cdx6500DCChanStatNumOfCharOutOfDec = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatNumOfCharOutOfDec.setStatus('mandatory') cdx6500DCChanStatEncAETrnstnCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatEncAETrnstnCnt.setStatus('mandatory') cdx6500DCChanStatEncAEFrameCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatEncAEFrameCnt.setStatus('mandatory') cdx6500DCChanStatEncAEModeStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatEncAEModeStatus.setStatus('mandatory') cdx6500DCChanStatDecAETrnstnCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatDecAETrnstnCnt.setStatus('mandatory') cdx6500DCChanStatDecAEFrameCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatDecAEFrameCnt.setStatus('mandatory') cdx6500DCChanStatDecAEModeStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatDecAEModeStatus.setStatus('mandatory') cdx6500DCChanStatDSWithBadFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatDSWithBadFrames.setStatus('mandatory') cdx6500DCChanStatDSWithBadHeaders = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatDSWithBadHeaders.setStatus('mandatory') cdx6500DCChanStatDSDueToRstOrCng = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500DCChanStatDSDueToRstOrCng.setStatus('mandatory') cdx6500ContDC = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9)) cdx6500ContResetAllDCStats = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("reset", 1), ("noreset", 2)))).setMaxAccess("writeonly") if mibBuilder.loadTexts: cdx6500ContResetAllDCStats.setStatus('mandatory') cdx6500ContDCTable = MibTable((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2), ) if mibBuilder.loadTexts: cdx6500ContDCTable.setStatus('mandatory') cdx6500ContDCTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1), ).setIndexNames((0, "DC-OPT-MIB", "cdx6500ContDCChanNum")) if mibBuilder.loadTexts: cdx6500ContDCTableEntry.setStatus('mandatory') cdx6500ContDCChanNum = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500ContDCChanNum.setStatus('mandatory') cdx6500ContResetDCChanStats = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("reset", 1), ("noreset", 2)))).setMaxAccess("writeonly") if mibBuilder.loadTexts: cdx6500ContResetDCChanStats.setStatus('mandatory') cdx6500ContResetDCChanVocab = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("reset", 1), ("noreset", 2)))).setMaxAccess("writeonly") if mibBuilder.loadTexts: cdx6500ContResetDCChanVocab.setStatus('mandatory') mibBuilder.exportSymbols("DC-OPT-MIB", cdx6500DCGenStatCurrDecQDepth=cdx6500DCGenStatCurrDecQDepth, cdx6500DCChanStatDecAEFrameCnt=cdx6500DCChanStatDecAEFrameCnt, cdx6500DCGenStatMaxEncQDepth=cdx6500DCGenStatMaxEncQDepth, cdx6500DCGenStatMaxDecQDepth=cdx6500DCGenStatMaxDecQDepth, cdx6500DCChanStatNumOfCharOutOfEnc=cdx6500DCChanStatNumOfCharOutOfEnc, cdx6500DCChanStatTmOfLastStatRst=cdx6500DCChanStatTmOfLastStatRst, cdx6500DCGenStatDSPStatus=cdx6500DCGenStatDSPStatus, cdx6500DCGenStatFnctnSWRev=cdx6500DCGenStatFnctnSWRev, cdx6500DCGenStatTmOfMaxDecQDepth=cdx6500DCGenStatTmOfMaxDecQDepth, cdx6500DCChanStatDSWithBadHeaders=cdx6500DCChanStatDSWithBadHeaders, cdx6500ContResetDCChanStats=cdx6500ContResetDCChanStats, cdx6500DCGenStatTable=cdx6500DCGenStatTable, cdx6500DCChanStatEncAEModeStatus=cdx6500DCChanStatEncAEModeStatus, cdx6500DCGenStatMaxSmltChanUse=cdx6500DCGenStatMaxSmltChanUse, cdx6500DCChanStatNumOfCharOutOfDec=cdx6500DCChanStatNumOfCharOutOfDec, cdx6500DCChanStatNumOfCharInToEnc=cdx6500DCChanStatNumOfCharInToEnc, cdx6500DCGenStatHndlrSWRev=cdx6500DCGenStatHndlrSWRev, codex=codex, cdx6500DCStatTable=cdx6500DCStatTable, cdx6500DCChanStatNumOfDecFrames=cdx6500DCChanStatNumOfDecFrames, cdx6500ContDCTableEntry=cdx6500ContDCTableEntry, cdx6500DCChanStatDSDueToRstOrCng=cdx6500DCChanStatDSDueToRstOrCng, cdx6500DCGenStatTmOfMaxEncQDepth=cdx6500DCGenStatTmOfMaxEncQDepth, cdx6500DCChanStatDecAETrnstnCnt=cdx6500DCChanStatDecAETrnstnCnt, cdx6500DCChanStatNumOfCharInToDec=cdx6500DCChanStatNumOfCharInToDec, cdx6500DCChanStatXmitCRatio=cdx6500DCChanStatXmitCRatio, cdx6500DCChanStatDestChan=cdx6500DCChanStatDestChan, cdx6500DCChanStatDSWithBadFrames=cdx6500DCChanStatDSWithBadFrames, cdx6500DCChanStatChanState=cdx6500DCChanStatChanState, cdx6500DCGenStatTableEntry=cdx6500DCGenStatTableEntry, cdx6500DCGenStatAggCRatio=cdx6500DCGenStatAggCRatio, DisplayString=DisplayString, cdxProductSpecific=cdxProductSpecific, cdx6500DCGenStatCurrEncQDepth=cdx6500DCGenStatCurrEncQDepth, cdx6500DCChanStatNumOfEncFrames=cdx6500DCChanStatNumOfEncFrames, cdx6500DCChanStatEncAEFrameCnt=cdx6500DCChanStatEncAEFrameCnt, cdx6500DCGenStatRejectConn=cdx6500DCGenStatRejectConn, cdx6500Statistics=cdx6500Statistics, cdx6500DCGenStatMaxChannels=cdx6500DCGenStatMaxChannels, cdx6500DCChanStatDecAEModeStatus=cdx6500DCChanStatDecAEModeStatus, cdx6500Controls=cdx6500Controls, cdx6500ContDCTable=cdx6500ContDCTable, cdx6500=cdx6500, cdx6500DCChanStatChanNum=cdx6500DCChanStatChanNum, cdx6500DCChanStatEncAETrnstnCnt=cdx6500DCChanStatEncAETrnstnCnt, cdx6500ContDC=cdx6500ContDC, cdx6500DCChanStatTableEntry=cdx6500DCChanStatTableEntry, cdx6500DCGenStatChanInUse=cdx6500DCGenStatChanInUse, cdx6500ContResetAllDCStats=cdx6500ContResetAllDCStats, cdx6500ContDCChanNum=cdx6500ContDCChanNum, cdx6500ContResetDCChanVocab=cdx6500ContResetDCChanVocab, cdx6500DCChanStatSourceChan=cdx6500DCChanStatSourceChan, cdx6500DCChanStatTable=cdx6500DCChanStatTable, cdx6500StatOtherStatsGroup=cdx6500StatOtherStatsGroup)
# Вам дано положительное целое число. # Определите сколько цифр оно имеет. number = 1233334444555666 str_number = str(number) print(len(str_number))
# # PySNMP MIB module DGS-6600-STP-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DGS-6600-STP-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:45:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion") dgs6600_l2, = mibBuilder.importSymbols("DGS-6600-ID-MIB", "dgs6600-l2") NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup") Gauge32, TimeTicks, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, iso, Counter64, NotificationType, MibIdentifier, Integer32, Unsigned32, IpAddress, ObjectIdentity, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "TimeTicks", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "iso", "Counter64", "NotificationType", "MibIdentifier", "Integer32", "Unsigned32", "IpAddress", "ObjectIdentity", "Bits") TextualConvention, TruthValue, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "RowStatus", "DisplayString") dgs6600StpExtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2)) if mibBuilder.loadTexts: dgs6600StpExtMIB.setLastUpdated('0812190000Z') if mibBuilder.loadTexts: dgs6600StpExtMIB.setOrganization('D-Link Corp.') if mibBuilder.loadTexts: dgs6600StpExtMIB.setContactInfo('http://support.dlink.com') if mibBuilder.loadTexts: dgs6600StpExtMIB.setDescription('The MIB module for managing MSTP.') class BridgeId(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(8, 8) fixedLength = 8 swMSTPGblMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1)) swMSTPCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2)) swMSTPStpAdminState = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpAdminState.setStatus('current') if mibBuilder.loadTexts: swMSTPStpAdminState.setDescription('This object indicates the spanning tree state of the bridge.') swMSTPStpVersion = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("stp", 0), ("rstp", 1), ("mstp", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpVersion.setStatus('current') if mibBuilder.loadTexts: swMSTPStpVersion.setDescription('The version of Spanning Tree Protocol the bridge is currently running.') swMSTPStpMaxAge = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(600, 4000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpMaxAge.setStatus('current') if mibBuilder.loadTexts: swMSTPStpMaxAge.setDescription('The value that all bridges use for MaxAge when this bridge is acting as the root. Note that the range for this parameter is related to the value of StpForwardDelay and PortAdminHelloTime. MaxAge <= 2(ForwardDelay - 1);MaxAge >= 2(HelloTime + 1) The granularity of this timer is specified by 802.1D-1990 to be 1 second. An agent may return a badValue error if a set is attempted to a value that is not a whole number of seconds.') swMSTPStpHelloTime = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpHelloTime.setStatus('current') if mibBuilder.loadTexts: swMSTPStpHelloTime.setDescription('The value is used for HelloTime when this bridge is acting in RSTP or STP mode, in units of hundredths of a second. You can only read/write this value in RSTP or STP mode.') swMSTPStpForwardDelay = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(400, 3000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpForwardDelay.setStatus('current') if mibBuilder.loadTexts: swMSTPStpForwardDelay.setDescription('This value controls how long a port changes its spanning state from blocking to learning state and from learning to forwarding state. Note that the range for this parameter is related to MaxAge') swMSTPStpMaxHops = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 40))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpMaxHops.setStatus('current') if mibBuilder.loadTexts: swMSTPStpMaxHops.setDescription('This value applies to all spanning trees within an MST Region for which the bridge is the Regional Root.') swMSTPStpTxHoldCount = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpTxHoldCount.setStatus('current') if mibBuilder.loadTexts: swMSTPStpTxHoldCount.setDescription('The value used by the Port Transmit state machine to limit the maximum transmission rate.') swMSTPStpForwardBPDU = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpForwardBPDU.setStatus('current') if mibBuilder.loadTexts: swMSTPStpForwardBPDU.setDescription('The enabled/disabled status is used to forward BPDU to a non STP port.') swMSTPStpLBD = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpLBD.setStatus('current') if mibBuilder.loadTexts: swMSTPStpLBD.setDescription('The enabled/disabled status is used in Loop-back prevention.') swMSTPStpLBDRecoverTime = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPStpLBDRecoverTime.setStatus('current') if mibBuilder.loadTexts: swMSTPStpLBDRecoverTime.setDescription("The period of time (in seconds) in which the STP module keeps checking the BPDU loop status. The valid range is 60 to 1000000. If this value is set from 1 to 59, you will get a 'bad value' return code. The value of zero is a special value that means to disable the auto-recovery mechanism for the LBD feature.") swMSTPNniBPDUAddress = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dot1d", 1), ("dot1ad", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPNniBPDUAddress.setStatus('current') if mibBuilder.loadTexts: swMSTPNniBPDUAddress.setDescription('Specifies the BPDU MAC address of the NNI port in Q-in-Q status.') swMSTPName = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPName.setStatus('current') if mibBuilder.loadTexts: swMSTPName.setDescription('The object indicates the name of the MST Configuration Identification.') swMSTPRevisionLevel = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPRevisionLevel.setStatus('current') if mibBuilder.loadTexts: swMSTPRevisionLevel.setDescription('The object indicates the revision level of the MST Configuration Identification.') swMSTPInstanceCtrlTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3), ) if mibBuilder.loadTexts: swMSTPInstanceCtrlTable.setStatus('current') if mibBuilder.loadTexts: swMSTPInstanceCtrlTable.setDescription('A table that contains MSTP instance information.') swMSTPInstanceCtrlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1), ).setIndexNames((0, "DGS-6600-STP-EXT-MIB", "swMSTPInstId")) if mibBuilder.loadTexts: swMSTPInstanceCtrlEntry.setStatus('current') if mibBuilder.loadTexts: swMSTPInstanceCtrlEntry.setDescription('A list of MSTP instance information.') swMSTPInstId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstId.setStatus('current') if mibBuilder.loadTexts: swMSTPInstId.setDescription('This object indicates the specific instance. An MSTP Instance ID (MSTID) of zero is used to identify the CIST.') swMSTPInstVlanRangeList1to64 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstVlanRangeList1to64.setStatus('current') if mibBuilder.loadTexts: swMSTPInstVlanRangeList1to64.setDescription('This object indicates the VLAN range (1-512) that belongs to the instance.') swMSTPInstVlanRangeList65to128 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstVlanRangeList65to128.setStatus('current') if mibBuilder.loadTexts: swMSTPInstVlanRangeList65to128.setDescription('This object indicates the VLAN range (513-1024) that belongs to the instance.') swMSTPInstVlanRangeList129to192 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstVlanRangeList129to192.setStatus('current') if mibBuilder.loadTexts: swMSTPInstVlanRangeList129to192.setDescription('This object indicates the VLAN range (1025-1536) that belongs to the instance.') swMSTPInstVlanRangeList193to256 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstVlanRangeList193to256.setStatus('current') if mibBuilder.loadTexts: swMSTPInstVlanRangeList193to256.setDescription('This object indicates the VLAN range(1537-2048) that belongs to the instance.') swMSTPInstVlanRangeList257to320 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstVlanRangeList257to320.setStatus('current') if mibBuilder.loadTexts: swMSTPInstVlanRangeList257to320.setDescription('This object indicates the VLAN range (2049-2560) that belongs to the instance.') swMSTPInstVlanRangeList321to384 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstVlanRangeList321to384.setStatus('current') if mibBuilder.loadTexts: swMSTPInstVlanRangeList321to384.setDescription('This object indicates the VLAN range (2561-3072) that belongs to the instance.') swMSTPInstVlanRangeList385to448 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstVlanRangeList385to448.setStatus('current') if mibBuilder.loadTexts: swMSTPInstVlanRangeList385to448.setDescription('This object indicates the VLAN range (3073-3584) that belongs to the instance.') swMSTPInstVlanRangeList449to512 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstVlanRangeList449to512.setStatus('current') if mibBuilder.loadTexts: swMSTPInstVlanRangeList449to512.setDescription('This object indicates the VLAN range (3585-4096) that belongs to the instance.') swMSTPInstType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("cist", 0), ("msti", 1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstType.setStatus('current') if mibBuilder.loadTexts: swMSTPInstType.setDescription('This object indicates the type of instance.') swMSTPInstStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstStatus.setStatus('current') if mibBuilder.loadTexts: swMSTPInstStatus.setDescription('The instance state that could be enabled/disabled.') swMSTPInstPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 61440))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstPriority.setStatus('current') if mibBuilder.loadTexts: swMSTPInstPriority.setDescription('The priority of the instance. The priority must be divisible by 4096 ') swMSTPInstDesignatedRootBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 13), BridgeId()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstDesignatedRootBridge.setStatus('current') if mibBuilder.loadTexts: swMSTPInstDesignatedRootBridge.setDescription('The bridge identifier of the CIST. For MST instance, this object is unused.') swMSTPInstExternalRootCost = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstExternalRootCost.setStatus('current') if mibBuilder.loadTexts: swMSTPInstExternalRootCost.setDescription('The path cost between MST Regions from the transmitting bridge to the CIST Root. For MST instance this object is unused.') swMSTPInstRegionalRootBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 15), BridgeId()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstRegionalRootBridge.setStatus('current') if mibBuilder.loadTexts: swMSTPInstRegionalRootBridge.setDescription('For CIST, Regional Root Identifier is the Bridge Identifier of the single bridge in a Region whose CIST Root Port is a Boundary Port, or the Bridge Identifier of the CIST Root if that is within the Region; For MSTI,MSTI Regional Root Identifier is the Bridge Identifier of the MSTI Regional Root for this particular MSTI in this MST Region; The Regional Root Bridge of this instance.') swMSTPInstInternalRootCost = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 16), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstInternalRootCost.setStatus('current') if mibBuilder.loadTexts: swMSTPInstInternalRootCost.setDescription('For CIST, the internal path cost is the path cost to the CIST Regional Root; For MSTI, the internal path cost is the path cost to the MSTI Regional Root for this particular MSTI in this MST Region') swMSTPInstDesignatedBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 17), BridgeId()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstDesignatedBridge.setStatus('current') if mibBuilder.loadTexts: swMSTPInstDesignatedBridge.setDescription('The Bridge Identifier for the transmitting bridge for this CIST or MSTI') swMSTPInstRootPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 18), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstRootPort.setStatus('current') if mibBuilder.loadTexts: swMSTPInstRootPort.setDescription('The port number of the port which offers the lowest cost path from this bridge to the CIST or MSTI root bridge.') swMSTPInstMaxAge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 19), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstMaxAge.setStatus('current') if mibBuilder.loadTexts: swMSTPInstMaxAge.setDescription('The maximum age of Spanning Tree Protocol information learned from the network on any port before it is discarded, in units of hundredths of a second. This is the actual value that this bridge is currently using.') swMSTPInstForwardDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 20), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstForwardDelay.setStatus('current') if mibBuilder.loadTexts: swMSTPInstForwardDelay.setDescription('This value, measured in units of hundredths of a second, controls how fast a port changes its spanning state when moving towards the forwarding state. The value determines how long the port stays in each of the listening and learning states, which precede the Forwarding state. This value is also used, when a topology change has been detected and is underway, to age all dynamic entries in the Forwarding Database.') swMSTPInstLastTopologyChange = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 21), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstLastTopologyChange.setStatus('current') if mibBuilder.loadTexts: swMSTPInstLastTopologyChange.setDescription('The time (in hundredths of a second) since the last time a topology change was detected by the bridge entity.') swMSTPInstTopChangesCount = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstTopChangesCount.setStatus('current') if mibBuilder.loadTexts: swMSTPInstTopChangesCount.setDescription('The total number of topology changes detected by this bridge since the management entity was last reset or initialized.') swMSTPInstRemainHops = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 23), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPInstRemainHops.setStatus('current') if mibBuilder.loadTexts: swMSTPInstRemainHops.setDescription('The root bridge in the instance for MSTI always sends a BPDU with a maximum hop count. When a switch receives this BPDU, it decrements the received maximum hop count by one and propagates this value as the remaining hop count in the BPDUs it generates.') swMSTPInstRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 24), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swMSTPInstRowStatus.setStatus('current') if mibBuilder.loadTexts: swMSTPInstRowStatus.setDescription('This object indicates the RowStatus of this entry.') swMSTPPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4), ) if mibBuilder.loadTexts: swMSTPPortTable.setStatus('current') if mibBuilder.loadTexts: swMSTPPortTable.setDescription('A table that contains port-specific information for the Spanning Tree Protocol.') swMSTPPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1), ).setIndexNames((0, "DGS-6600-STP-EXT-MIB", "swMSTPPort")) if mibBuilder.loadTexts: swMSTPPortEntry.setStatus('current') if mibBuilder.loadTexts: swMSTPPortEntry.setDescription('A list of information maintained by every port about the Spanning Tree Protocol state for that port.') swMSTPPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPPort.setStatus('current') if mibBuilder.loadTexts: swMSTPPort.setDescription('The port number of the port for this entry.') swMSTPPortAdminHelloTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortAdminHelloTime.setStatus('current') if mibBuilder.loadTexts: swMSTPPortAdminHelloTime.setDescription('The amount of time between the transmission of BPDU by this node on any port when it is the root of the spanning tree or trying to become so, in units of hundredths of a second.') swMSTPPortOperHelloTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPPortOperHelloTime.setStatus('current') if mibBuilder.loadTexts: swMSTPPortOperHelloTime.setDescription('The actual value of the hello time.') swMSTPSTPPortEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPSTPPortEnable.setStatus('current') if mibBuilder.loadTexts: swMSTPSTPPortEnable.setDescription('The enabled/disabled status of the port.') swMSTPPortExternalPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 200000000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortExternalPathCost.setStatus('current') if mibBuilder.loadTexts: swMSTPPortExternalPathCost.setDescription('The contribution of this port to the path cost of paths towards the CIST root which include this port.') swMSTPPortMigration = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 6), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortMigration.setStatus('current') if mibBuilder.loadTexts: swMSTPPortMigration.setDescription('When operating in MSTP mode or RSTP mode, writing TRUE(1) to this object forces this port to transmit MST BPDUs. Any other operation on this object has no effect and it always returns FALSE(2) when read.') swMSTPPortAdminEdgePort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("true", 1), ("false", 2), ("auto", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortAdminEdgePort.setStatus('current') if mibBuilder.loadTexts: swMSTPPortAdminEdgePort.setDescription('The value of the Edge Port parameter. A value of TRUE indicates that this port should be assumed as an edge-port and a value of FALSE indicates that this port should be assumed as a non-edge-port') swMSTPPortOperEdgePort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("true", 1), ("false", 2), ("auto", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPPortOperEdgePort.setStatus('current') if mibBuilder.loadTexts: swMSTPPortOperEdgePort.setDescription('It is the acutual value of the edge port status.') swMSTPPortAdminP2P = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("true", 0), ("false", 1), ("auto", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortAdminP2P.setStatus('current') if mibBuilder.loadTexts: swMSTPPortAdminP2P.setDescription('The point-to-point status of the LAN segment attached to this port.') swMSTPPortOperP2P = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("true", 0), ("false", 1), ("auto", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPPortOperP2P.setStatus('current') if mibBuilder.loadTexts: swMSTPPortOperP2P.setDescription('It is the actual value of the P2P status.') swMSTPPortLBD = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortLBD.setStatus('current') if mibBuilder.loadTexts: swMSTPPortLBD.setDescription('The enabled/disabled status is used for Loop-back prevention attached to this port.') swMSTPPortBPDUFiltering = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortBPDUFiltering.setStatus('current') if mibBuilder.loadTexts: swMSTPPortBPDUFiltering.setDescription('The enabled/disabled status is used for BPDU Filtering attached to this port.BPDU filtering allows the administrator to prevent the system from sending or even receiving BPDUs on specified ports.') swMSTPPortRestrictedRole = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 13), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortRestrictedRole.setStatus('current') if mibBuilder.loadTexts: swMSTPPortRestrictedRole.setDescription('If TRUE, causes the port not to be selected as Root Port for the CIST or any MSTI, even it has the best spanning tree priority vector.') swMSTPPortRestrictedTCN = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 14), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortRestrictedTCN.setStatus('current') if mibBuilder.loadTexts: swMSTPPortRestrictedTCN.setDescription('If TRUE, causes the port not to propagate received topology change notifications and topology changes to other Ports.') swMSTPPortOperFilterBpdu = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("receiving", 1), ("filtering", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPPortOperFilterBpdu.setStatus('current') if mibBuilder.loadTexts: swMSTPPortOperFilterBpdu.setDescription('It is the actual value of the hardware filter BPDU status.') swMSTPPortRecoverFilterBpdu = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 16), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPPortRecoverFilterBpdu.setStatus('current') if mibBuilder.loadTexts: swMSTPPortRecoverFilterBpdu.setDescription('When operating in BPDU filtering mode, writing TRUE(1) to this object sets this port to receive BPDUs to the hardware. Any other operation on this object has no effect and it will always return FALSE(2) when read.') swMSTPMstPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5), ) if mibBuilder.loadTexts: swMSTPMstPortTable.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPortTable.setDescription('A table that contains port-specific information for the MST Protocol.') swMSTPMstPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1), ).setIndexNames((0, "DGS-6600-STP-EXT-MIB", "swMSTPMstPort"), (0, "DGS-6600-STP-EXT-MIB", "swMSTPMstPortInsID")) if mibBuilder.loadTexts: swMSTPMstPortEntry.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPortEntry.setDescription('A list of information maintained by every port about the MST state for that port.') swMSTPMstPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPMstPort.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPort.setDescription('The port number of the port for this entry.') swMSTPMstPortInsID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPMstPortInsID.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPortInsID.setDescription('This object indicates the MSTP Instance ID (MSTID).') swMSTPMstPortDesignatedBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 3), BridgeId()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPMstPortDesignatedBridge.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPortDesignatedBridge.setDescription("The Bridge Identifier of the bridge which this port considers to be the Designated Bridge for this port's segment on the corresponding Spanning Tree instance.") swMSTPMstPortInternalPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 200000000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPMstPortInternalPathCost.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPortInternalPathCost.setDescription('This is the value of this port to the path cost of paths towards the MSTI root.') swMSTPMstPortPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 240))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swMSTPMstPortPriority.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPortPriority.setDescription('The value of the priority field which is contained in the first (in network byte order) octet of the (2 octet long) Port ID.') swMSTPMstPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("discarding", 3), ("learning", 4), ("forwarding", 5), ("broken", 6), ("no-stp-enabled", 7), ("err-disabled", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPMstPortStatus.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPortStatus.setDescription("When the port Enable state is enabled, the port's current state as defined by application of the Spanning Tree Protocol. If the PortEnable is disabled, the port status will be no-stp-enabled (7). If the port is in error disabled status, the port status will be err-disable(8)") swMSTPMstPortRole = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("disable", 0), ("alternate", 1), ("backup", 2), ("root", 3), ("designated", 4), ("master", 5), ("nonstp", 6), ("loopback", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMSTPMstPortRole.setStatus('current') if mibBuilder.loadTexts: swMSTPMstPortRole.setDescription("When the port Enable state is enabled, the port's current port role as defined by application of the Spanning Tree Protocol. If the Port Enable state is disabled, the port role will be nonstp(5)") swMSTPTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11)) swMSTPNotify = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1)) swMSTPNotifyPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0)) swMSTPPortLBDTrap = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 1)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPPort")) if mibBuilder.loadTexts: swMSTPPortLBDTrap.setStatus('current') if mibBuilder.loadTexts: swMSTPPortLBDTrap.setDescription('When STP port loopback detect is enabled, a trap will be generated.') swMSTPPortBackupTrap = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 2)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPMstPort"), ("DGS-6600-STP-EXT-MIB", "swMSTPMstPortInsID")) if mibBuilder.loadTexts: swMSTPPortBackupTrap.setStatus('current') if mibBuilder.loadTexts: swMSTPPortBackupTrap.setDescription('When the STP port role goes to backup (defined in the STP standard), a trap will be generated.') swMSTPPortAlternateTrap = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 3)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPMstPort"), ("DGS-6600-STP-EXT-MIB", "swMSTPMstPortInsID")) if mibBuilder.loadTexts: swMSTPPortAlternateTrap.setStatus('current') if mibBuilder.loadTexts: swMSTPPortAlternateTrap.setDescription('When the STP port role goes to alternate (defined in the STP standard), a trap will be generated.') swMSTPHwFilterStatusChange = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 4)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPPort"), ("DGS-6600-STP-EXT-MIB", "swMSTPPortOperFilterBpdu")) if mibBuilder.loadTexts: swMSTPHwFilterStatusChange.setStatus('current') if mibBuilder.loadTexts: swMSTPHwFilterStatusChange.setDescription('This trap is sent when a BPDU hardware filter status port changes.') swMSTPRootRestrictedChange = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 5)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPPort"), ("DGS-6600-STP-EXT-MIB", "swMSTPPortRestrictedRole")) if mibBuilder.loadTexts: swMSTPRootRestrictedChange.setStatus('current') if mibBuilder.loadTexts: swMSTPRootRestrictedChange.setDescription('This trap is sent when a restricted role state port changes.') mibBuilder.exportSymbols("DGS-6600-STP-EXT-MIB", swMSTPPortBackupTrap=swMSTPPortBackupTrap, dgs6600StpExtMIB=dgs6600StpExtMIB, swMSTPMstPortEntry=swMSTPMstPortEntry, swMSTPInstVlanRangeList193to256=swMSTPInstVlanRangeList193to256, swMSTPStpMaxAge=swMSTPStpMaxAge, swMSTPInstDesignatedBridge=swMSTPInstDesignatedBridge, swMSTPPortAdminP2P=swMSTPPortAdminP2P, swMSTPPortOperP2P=swMSTPPortOperP2P, swMSTPGblMgmt=swMSTPGblMgmt, swMSTPPortLBDTrap=swMSTPPortLBDTrap, swMSTPPortOperEdgePort=swMSTPPortOperEdgePort, swMSTPRootRestrictedChange=swMSTPRootRestrictedChange, swMSTPStpLBDRecoverTime=swMSTPStpLBDRecoverTime, swMSTPInstVlanRangeList65to128=swMSTPInstVlanRangeList65to128, swMSTPInstTopChangesCount=swMSTPInstTopChangesCount, swMSTPInstVlanRangeList1to64=swMSTPInstVlanRangeList1to64, swMSTPPortEntry=swMSTPPortEntry, swMSTPPortRestrictedRole=swMSTPPortRestrictedRole, swMSTPInstExternalRootCost=swMSTPInstExternalRootCost, swMSTPStpAdminState=swMSTPStpAdminState, swMSTPPortBPDUFiltering=swMSTPPortBPDUFiltering, swMSTPInstVlanRangeList385to448=swMSTPInstVlanRangeList385to448, swMSTPInstRootPort=swMSTPInstRootPort, swMSTPPortAdminHelloTime=swMSTPPortAdminHelloTime, swMSTPNniBPDUAddress=swMSTPNniBPDUAddress, swMSTPMstPortDesignatedBridge=swMSTPMstPortDesignatedBridge, swMSTPInstanceCtrlTable=swMSTPInstanceCtrlTable, swMSTPInstStatus=swMSTPInstStatus, swMSTPInstanceCtrlEntry=swMSTPInstanceCtrlEntry, swMSTPMstPortStatus=swMSTPMstPortStatus, swMSTPInstRowStatus=swMSTPInstRowStatus, swMSTPStpForwardDelay=swMSTPStpForwardDelay, swMSTPInstType=swMSTPInstType, swMSTPSTPPortEnable=swMSTPSTPPortEnable, swMSTPRevisionLevel=swMSTPRevisionLevel, BridgeId=BridgeId, swMSTPStpLBD=swMSTPStpLBD, swMSTPInstForwardDelay=swMSTPInstForwardDelay, swMSTPMstPort=swMSTPMstPort, swMSTPPortRecoverFilterBpdu=swMSTPPortRecoverFilterBpdu, swMSTPStpMaxHops=swMSTPStpMaxHops, swMSTPPortRestrictedTCN=swMSTPPortRestrictedTCN, swMSTPPortOperHelloTime=swMSTPPortOperHelloTime, swMSTPInstMaxAge=swMSTPInstMaxAge, swMSTPTraps=swMSTPTraps, swMSTPInstRemainHops=swMSTPInstRemainHops, swMSTPMstPortRole=swMSTPMstPortRole, swMSTPInstPriority=swMSTPInstPriority, swMSTPStpForwardBPDU=swMSTPStpForwardBPDU, swMSTPInstDesignatedRootBridge=swMSTPInstDesignatedRootBridge, swMSTPInstRegionalRootBridge=swMSTPInstRegionalRootBridge, swMSTPInstInternalRootCost=swMSTPInstInternalRootCost, swMSTPNotify=swMSTPNotify, swMSTPStpVersion=swMSTPStpVersion, swMSTPInstVlanRangeList321to384=swMSTPInstVlanRangeList321to384, swMSTPStpHelloTime=swMSTPStpHelloTime, swMSTPPort=swMSTPPort, swMSTPMstPortTable=swMSTPMstPortTable, swMSTPNotifyPrefix=swMSTPNotifyPrefix, swMSTPPortOperFilterBpdu=swMSTPPortOperFilterBpdu, PYSNMP_MODULE_ID=dgs6600StpExtMIB, swMSTPInstVlanRangeList449to512=swMSTPInstVlanRangeList449to512, swMSTPInstVlanRangeList129to192=swMSTPInstVlanRangeList129to192, swMSTPPortExternalPathCost=swMSTPPortExternalPathCost, swMSTPHwFilterStatusChange=swMSTPHwFilterStatusChange, swMSTPName=swMSTPName, swMSTPInstLastTopologyChange=swMSTPInstLastTopologyChange, swMSTPCtrl=swMSTPCtrl, swMSTPInstId=swMSTPInstId, swMSTPPortAlternateTrap=swMSTPPortAlternateTrap, swMSTPStpTxHoldCount=swMSTPStpTxHoldCount, swMSTPMstPortPriority=swMSTPMstPortPriority, swMSTPInstVlanRangeList257to320=swMSTPInstVlanRangeList257to320, swMSTPMstPortInternalPathCost=swMSTPMstPortInternalPathCost, swMSTPPortMigration=swMSTPPortMigration, swMSTPPortTable=swMSTPPortTable, swMSTPPortAdminEdgePort=swMSTPPortAdminEdgePort, swMSTPPortLBD=swMSTPPortLBD, swMSTPMstPortInsID=swMSTPMstPortInsID)
def arithmetic_arranger(problems,calc = False): if 5 < len(problems): return "Error: Too many problems." sOperand1 = sOperand2 = sDashes = sResults = "" separator = " " for i in range(len(problems)): words = problems[i].split() if(not (words[1] == "+" or words[1] =="-")): return "Error: Operator must be '+' or '-'." if( not words[0].isnumeric() or not words[2].isnumeric()): return "Error: Numbers must only contain digits." if(4 < len(words[0] ) or 4 < len(words[2])): return "Error: Numbers cannot be more than four digits." lengthOp = max(len(words[0]),len(words[2])) sOperand1 += words[0].rjust(lengthOp+2) sOperand2 += words[1]+ " " + words[2].rjust(lengthOp) sDashes += "-"*(lengthOp + 2) if calc: if words[1] == "+": sResults += str(int(words[0])+int(words[2])).rjust(lengthOp+2) else: sResults += str(int(words[0])-int(words[2])).rjust(lengthOp+2) if i < len(problems)-1: sOperand1 += separator sOperand2 += separator sDashes += separator sResults += separator arranged_problems = sOperand1 + "\n" + sOperand2 + "\n" + sDashes if calc: arranged_problems += "\n" + sResults return arranged_problems
# # PySNMP MIB module MITEL-ERN (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MITEL-ERN # Produced by pysmi-0.3.4 at Wed May 1 14:13:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion") mitelAppCallServer, = mibBuilder.importSymbols("MITEL-MIB", "mitelAppCallServer") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") sysName, = mibBuilder.importSymbols("SNMPv2-MIB", "sysName") Bits, IpAddress, NotificationType, Counter32, Unsigned32, Gauge32, iso, MibIdentifier, NotificationType, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Counter64, Integer32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "IpAddress", "NotificationType", "Counter32", "Unsigned32", "Gauge32", "iso", "MibIdentifier", "NotificationType", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Counter64", "Integer32", "TimeTicks") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") class Integer32(Integer32): subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(-2147483648, 2147483647) class DateAndTime(OctetString): subtypeSpec = OctetString.subtypeSpec + ConstraintsUnion(ValueSizeConstraint(8, 8), ValueSizeConstraint(11, 11), ) mitelCsEmergencyResponse = MibIdentifier((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3)) mitelCsErSeqNumber = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 1), Integer32()) if mibBuilder.loadTexts: mitelCsErSeqNumber.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErSeqNumber.setDescription('Same number used in the Emergency Call logs.') mitelCsErCallType = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 2), Integer32()) if mibBuilder.loadTexts: mitelCsErCallType.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErCallType.setDescription('Type of Emergency Call.') mitelCsErDetectTime = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 3), DateAndTime()) if mibBuilder.loadTexts: mitelCsErDetectTime.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErDetectTime.setDescription('The time that the emergency call occurred on the Call Server.') mitelCsErCallingDN = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 4), DisplayString()) if mibBuilder.loadTexts: mitelCsErCallingDN.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErCallingDN.setDescription('The directory number dialed for the emergency call.') mitelCsErCallingPNI = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 5), DisplayString()) if mibBuilder.loadTexts: mitelCsErCallingPNI.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErCallingPNI.setDescription('The PNI dialed for the emergency call.') mitelCsErCesidDigits = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 6), DisplayString()) if mibBuilder.loadTexts: mitelCsErCesidDigits.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErCesidDigits.setDescription('The CESID assigned to the Dialing Number. May also be the default system CESID value or empty if the CESID is unknown.') mitelCsErDialledDigits = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 7), DisplayString()) if mibBuilder.loadTexts: mitelCsErDialledDigits.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErDialledDigits.setDescription('The number dialed for the emergency call.') mitelCsErRegistrationDN = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 8), DisplayString()) if mibBuilder.loadTexts: mitelCsErRegistrationDN.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErRegistrationDN.setDescription('The directory number dialed for the emergency call. This could be empty, the directory number of the device making the call, an incoming caller ID or remote CESID.') mitelCsErUnackTable = MibTable((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9), ) if mibBuilder.loadTexts: mitelCsErUnackTable.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErUnackTable.setDescription("A list of notifications sent from this agent that are expected to be acknowledged, but have not yet received the acknowledgement. One entry is created for each acknowledgeable notification transmitted from this agent. Managers are expected to delete the rows in this table to acknowledge receipt of the notification. To do so, the index is provided in the notification sent to the manager. Any unacknowledged notifications are removed at the agent's discretion. This table is kept in volatile memory.") mitelCsErUnackTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1), ).setIndexNames((0, "MITEL-ERN", "mitelCsErUnackTableIndex")) if mibBuilder.loadTexts: mitelCsErUnackTableEntry.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErUnackTableEntry.setDescription('An entry containing unacknowledged notification information.') mitelCsErUnackTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1, 1), Integer32()) if mibBuilder.loadTexts: mitelCsErUnackTableIndex.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErUnackTableIndex.setDescription('The index of the row for the Manager to acknowledge the notification. If no acknowledgement is required, this will be 0. For require acknowledgement this is a unique value, greater than zero, for each row. The values are assigned contiguously starting from 1, and are not re-used (to allow for duplicated Set Requests for destruction of the row).') mitelCsErUnackTableToken = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1, 2), Integer32()).setMaxAccess("writeonly") if mibBuilder.loadTexts: mitelCsErUnackTableToken.setStatus('mandatory') if mibBuilder.loadTexts: mitelCsErUnackTableToken.setDescription('The status of this row. A status of active indicates that an acknowledgement is still expected. Write a destroy(6) here to acknowledge this notification. A status of notInService indicates that no acknowledgement is expected.') mitelCsErNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 10)) mitelCsErNotification = NotificationType((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3) + (0,401)).setObjects(("SNMPv2-MIB", "sysName"), ("MITEL-ERN", "mitelCsErSeqNumber"), ("MITEL-ERN", "mitelCsErCallType"), ("MITEL-ERN", "mitelCsErDetectTime"), ("MITEL-ERN", "mitelCsErCallingDN"), ("MITEL-ERN", "mitelCsErCallingPNI"), ("MITEL-ERN", "mitelCsErCesidDigits"), ("MITEL-ERN", "mitelCsErDialledDigits"), ("MITEL-ERN", "mitelCsErRegistrationDN"), ("MITEL-ERN", "mitelCsErUnackTableIndex"), ("MITEL-ERN", "mitelCsErUnackTableToken")) if mibBuilder.loadTexts: mitelCsErNotification.setDescription('This notification is generated whenever an emergency call condition is detected. The manager is expected to ....') mibBuilder.exportSymbols("MITEL-ERN", mitelCsErCallingDN=mitelCsErCallingDN, mitelCsErRegistrationDN=mitelCsErRegistrationDN, Integer32=Integer32, DateAndTime=DateAndTime, mitelCsErUnackTableToken=mitelCsErUnackTableToken, mitelCsEmergencyResponse=mitelCsEmergencyResponse, mitelCsErDetectTime=mitelCsErDetectTime, mitelCsErCallingPNI=mitelCsErCallingPNI, mitelCsErNotification=mitelCsErNotification, mitelCsErCesidDigits=mitelCsErCesidDigits, mitelCsErDialledDigits=mitelCsErDialledDigits, mitelCsErUnackTableEntry=mitelCsErUnackTableEntry, mitelCsErUnackTable=mitelCsErUnackTable, mitelCsErCallType=mitelCsErCallType, mitelCsErUnackTableIndex=mitelCsErUnackTableIndex, mitelCsErSeqNumber=mitelCsErSeqNumber, mitelCsErNotifications=mitelCsErNotifications)