soar_ops 模組
TIPCommon.soar_ops.create_slo_message
TIPCommon.soar_ops.create_slo_message(slo: int, interval_days: Iterable[int], existing_comments: Iterable[str])
根據時間間隔和現有留言取得服務水準目標警告訊息。
如果是 interval_days=[0, 1, 7, 14] 參數,函式會傳送訊息,警告下一個排程後將違反 SLO:
- 距離到期時間還有 7 到 14 天。
- 距離到期時間 1 到 7 天。
- 違反服務水準目標的時間。
如果目前違規間隔已傳送留言,則不會傳回新留言 (傳回 None)。
| 參數 | |
|---|---|
slo |
int違反服務水準目標的日期 (以 Unix 微秒為單位),例如 1_673_774_674_567 |
interval_days |
Iterable[int]可疊代物件,內含應傳送時間違規警告的天數 (例如 [0, 1, 3, 7, 14]) |
existing_comments |
Iterable[int]現有註解,用於檢查是否已傳送註解。 |
發出
ValueError- 其中一個時間間隔為負數。
傳回
如果適用,系統會傳回註解。否則會傳回 None。
TIPCommon.soar_ops.get_clean_comment_body
TIPCommon.soar_ops.get_clean_comment_body(comment: str | CaseComment, prefix: str)
從註解字串或註解物件中移除前置字元。
| 參數 | |
|---|---|
comment |
str | CaseComment要移除前置字元的留言字串或留言物件。 |
prefix |
str要移除的前置字串。 |
發出
TypeError - 留言類型既不是 str 也不是 CaseComment。
傳回
不含前置字元的註解。
傳回類型
str
TIPCommon.soar_ops.get_file
TIPCommon.soar_ops.get_file(chronicle_soar: SiemplifyAction | SiemplifyConnectorExecution | SiemplifyJob, identifier: str)→ bytes | None
以位元組為單位傳回檔案內容。
參數
| 參數 | |
|---|---|
chronicle_soar |
ChronicleSOARGoogle Security Operations SOAR SDK 物件。 |
identifier |
str檔案名稱 ID 和完整路徑。 |
傳回
所提供 ID 的資料位元組。
傳回類型
bytes | None
TIPCommon.soar_ops.get_secops_mode
TIPCommon.soar_ops.get_secops_mode()→ str | None
傳回 SECOPS_MODE 環境變數。
傳回
SECOPS_MODE 環境變數。
傳回類型
str | None
TIPCommon.soar_ops.get_soar_case_comments
TIPCommon.soar_ops.get_soar_case_comments(chronicle_soar: SiemplifyAction | SiemplifyJob, case_id: str | int)
使用案件 ID,傳回案件中的留言物件清單。
| 參數 | |
|---|---|
chronicle_soar |
SiemplifyAction | SiemplifyJobSDK 物件。 |
case_id |
str | int要擷取留言的案件 ID。 |
傳回
註解物件清單。
傳回類型
list[base.action.CaseComment]
TIPCommon.soar_ops.get_user_by_id
TIPCommon.soar_ops.get_user_by_id(chronicle_soar: SiemplifyAction | SiemplifyConnectorExecution | SiemplifyJob, user_id: str)→ UserProfileCard | None
從使用者 ID 取得 UserProfileCard 物件。
參數
| 參數 | |
|---|---|
chronicle_soar |
ChronicleSOARGoogle Security Operations SOAR SDK 物件。 |
user_id |
str使用者 ID,例如 |
傳回
如果找到使用者物件,則傳回該物件;否則傳回 None。
傳回類型
UserProfileCard | None
TIPCommon.soar_ops.get_users_profile_cards_with_pagination
TIPCommon.soar_ops.get_users_profile_cards_with_pagination(chronicle_soar: SiemplifyAction | SiemplifyConnectorExecution | SiemplifyJob, search_term: str = '', page_size: int = 20, filter_by_role: bool = False, filter_disabled_users: bool = False, filter_support_users: bool = False, fetch_only_support_users: bool = False, filter_permission_types: list[int] | None = None)→ list[UserProfileCard]
使用分頁取得所有使用者設定檔卡片。頁面大小是每次疊代的使用者人數上限。
參數
| 參數 | |
|---|---|
chronicle_soar |
ChronicleSOARGoogle Security Operations SOAR SDK 物件。 |
search_term |
str搜尋字詞。 預設值為 |
page_size |
int要傳回的使用者人數。 預設值為 |
filter_by_role |
bool定義是否要依角色篩選。 預設值為 |
filter_disabled_users |
bool定義是否要篩選已停用的使用者。 預設值為 |
filter_support_users |
bool定義是否要篩選支援使用者。 預設值為 |
fetch_only_support_users |
bool定義是否只傳回支援使用者。 預設值為 |
filter_permission_types |
list[int] | None篩選器權限類型清單 (例如 預設值為 |
傳回
所有使用者的清單。
傳回類型
list[UserProfileCard]
TIPCommon.soar_ops.is_slo_comment
TIPCommon.soar_ops.is_slo_comment(comment: str)
檢查留言是否為服務等級目標警告留言。
服務水準目標註解可以是服務水準目標警告 (「服務水準目標將在 {int} 天內遭到違反」),也可以是服務水準目標違反訊息 (「服務水準目標遭到違反」)。
| 參數 | |
|---|---|
comment |
str要檢查的註解。 |
傳回
True如果留言是 SLO 留言。否則會傳回 False。
傳回類型
bool
TIPCommon.soar_ops.remove_prefix_from_comments
TIPCommon.soar_ops.remove_prefix_from_comments(comments: list[str], prefix: str)
從留言清單中移除前置字元 (如有)。
| 參數 | |
|---|---|
comments |
list[str]要移除前置碼的註解。 |
prefix |
str要移除的前置字串。 |
傳回
移除前置字元後的所有註解清單
傳回類型
list[str]
TIPCommon.soar_ops.save_file
TIPCommon.soar_ops.save_file(chronicle_soar: SiemplifyAction | SiemplifyConnectorExecution | SiemplifyJob, path: str, name: str, content: bytes)→ bytes | None
將檔案儲存至 Google Cloud bucket 或本機路徑。
參數
| 參數 | |
|---|---|
chronicle_soar |
ChronicleSOARGoogle Security Operations SOAR SDK 物件。 |
path |
str要儲存檔案的資料夾路徑。 |
name |
str要儲存的檔案名稱。 |
content |
bytes檔案內容 (位元組格式)。 |
傳回
下載檔案的路徑。
傳回類型
str | None
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。