IoC Extraction ============== This class allows you to extract IoC patterns from a string or a DataFrame. Several patterns are built in to the class and you can override these or supply new ones. .. code:: ipython3 # Imports import sys MIN_REQ_PYTHON = (3,6) if sys.version_info < MIN_REQ_PYTHON: print('Check the Kernel->Change Kernel menu and ensure that Python 3.6') print('or later is selected as the active kernel.') sys.exit("Python %s.%s or later is required.\n" % MIN_REQ_PYTHON) from IPython.display import display, HTML import matplotlib.pyplot as plt import seaborn as sns sns.set() import pandas as pd pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 50) pd.set_option('display.max_colwidth', 100) .. code:: ipython3 # Load test data process_tree = pd.read_csv('data/process_tree.csv') process_tree[['CommandLine']].head() .. raw:: html
| CommandLine | |
|---|---|
| 0 | .\ftp -s:C:\RECYCLER\xxppyy.exe |
| 1 | .\reg not /domain:everything that /sid:shines is /krbtgt:golden ! |
| 2 | cmd /c "systeminfo && systeminfo" |
| 3 | .\rundll32 /C 42424.exe |
| 4 | .\rundll32 /C c:\users\MSTICAdmin\42424.exe |
| IoCType | Observable | SourceIndex | |
|---|---|---|---|
| 48 | windows_path | .\powershell | 36 |
| 49 | url | http://somedomain/best-kitten-names-1.jpg' | 37 |
| 53 | windows_path | .\pOWErS^H^ElL^.eX^e^ | 37 |
| 58 | md5_hash | 81ed03caf6901e444c72ac67d192fb9c | 44 |
| 59 | url | http://badguyserver/pwnme" | 46 |
| 68 | windows_path | .\reg query add mscfile\\\\open | 59 |
| 72 | windows_path | \system\CurrentControlSet\Control\Terminal | 63 |
| 92 | ipv4 | 1.2.3.4 | 78 |
| 108 | ipv4 | 127.0.0.1 | 102 |
| 109 | url | http://127.0.0.1/ | 102 |
| 110 | windows_path | \SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost\MyNastySvcHostConfig | 103 |
{esc_pattern}| IoCType | Regex |
|---|---|
| ipv4 | (?P<ipaddress>(?:[0-9]{1,3}\\.){3}[0-9]{1,3}) |
| ipv6 | (?<![:.\\w])(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}(?![:.\\w]) |
| dns | ((?=[a-z0-9-]{1,63}\\.)[a-z0-9]+(-[a-z0-9]+)*\\.){2,}[a-z]{2,63} |
| url |
(?P<protocol>(https?|ftp|telnet|ldap|file)://) (?P<userinfo>([a-z0-9-._~!$&\\'()*+,;=:]|%[0-9A-F]{2})*@)?
(?P<host>([a-z0-9-._~!$&\\'()*+,;=]|%[0-9A-F]{2})*)
|
| windows_path |
(?P<root>[a-z]:|\\\\\\\\[a-z0-9_.$-]+||[.]+) (?P<folder>\\\\(?:[^\\/:*?"\\\'<>|\\r\\n]+\\\\)*) > (?P<file>[^\\\\/*?""<>|\\r\\n ]+) |
| linux_path |
(?P<root>/+||[.]+) (?P<folder>/(?:[^\\\\/:*?<>|\\r\\n]+/)*) (?P<file>[^/\\0<>|\\r\\n ]+) |
| md5_hash | (?:^|[^A-Fa-f0-9])(?P<hash>[A-Fa-f0-9]{32})(?:$|[^A-Fa-f0-9]) |
| sha1_hash | (?:^|[^A-Fa-f0-9])(?P<hash>[A-Fa-f0-9]{40})(?:$|[^A-Fa-f0-9]) |
| ipv6 | (?:^|[^A-Fa-f0-9])(?P<hash>[A-Fa-f0-9]{64})(?:$|[^A-Fa-f0-9]) |
| IoCType | Observable | SourceIndex | |
|---|---|---|---|
| 116 | win_named_pipe | \\.\pipe\blahtest" | 107 |