Commit Graph

32 Commits

Author SHA1 Message Date
meiliumeiliu 37ef85ffa6 Merge pull request #1 from FortiSIEM/master
Merge code to FortiSIEM from AccelOps
2022-03-16 10:02:23 -07:00
Mei Liu cbda88fcbb Example:
-O:
attackMapFile: It's used to set subFunction in XML rule. It's a map of subFunction and tags.attack in YML file.
ruleIndex: It's used to set rule id in XML rule. The format of rule id is PH_Rule_{ruleType}_SIGMA_{ruleIndex}
ruleType: It's used to set rule id in XML rule.

1. Generate rule for one YML file
    a. tools/sigmac -t fortisiem -c fortisiem-windows rules/windows/network_connection/win_net_python.yml
    b. tools/sigmac -t fortisiem -c fortisiem-windows -O attackMapFile=tools/config/fortisiem/MITRE-Attack-matrix.csv -O ruleIndex=0 -O ruleType=Windows rules/windows/network_connection/win_net_python.yml
   Output:
      <Rules>
      <Rule group="PH_SYS_RULE_THREAT_HUNTING" natural_id="PH_Rule_Windows_SIGMA_0"  phIncidentCategory="Server" function="Security" subFunction="Discovery" technique="T1046">
         <Name>Python Initiated Connection </Name>
         <IncidentTitle>Python Initiated Connection</IncidentTitle>
         <active>true</active>
         <Description> Adversaries may attempt to get a listing of services running on remote hosts, including those that may be vulnerable to remote software exploitation </Description>
         <SigmaFileName> rules/windows/network_connection/win_net_python.yml </SigmaFileName>
         <CustomerScope groupByEachCustomer="true">
            <Include all="true"/>
           <Exclude/>
         </CustomerScope>
         <IncidentDef eventType="PH_RULE_Python_Initiated_Connection" severity="7">
           <ArgList> compEventType = Filter.eventType,hostName = Filter.hostName,isInitialed = Filter.isInitialed,procName = Filter.procName </ArgList>
         </IncidentDef>
         <PatternClause window="300">
           <SubPattern displayName="Filter" name="Filter">
               <SingleEvtConstr> eventType REGEXP ( "Win-Sysmon-3-Network-Connect.*" ) AND isInitialed="true" AND procName REGEXP ( ".*python.*" ) </SingleEvtConstr>
               <GroupByAttr> eventType,hostName,isInitialed,procName </GroupByAttr>
               <GroupEvtConstr> COUNT(*) &gt;= 1 </GroupEvtConstr>
           </SubPattern>
         </PatternClause>
         <TriggerEventDisplay>
           <AttrList> phRecvTime,hostName,isInitialed,procName,rawEventMsg </AttrList>
         </TriggerEventDisplay>
       </Rule>
       </Rules>

2. Generate rules for YML files under rules/windows
   a. tools/sigmac -t fortisiem -c fortisiem-windows -r rules/windows -o rule.xml
   b. tools/sigmac -t fortisiem -c fortisiem-windows -r rules/windows -O attackMapFile=tools/config/fortisiem/MITRE-Attack-matrix.csv -O ruleIndex=0 -O ruleType=Windows -o rule.xml
   Generate rules for YML files under rules/windows

3. Find files that is modified after some date.
  a. tools/sigmac --lists-files-after-date 2020/06/04 rules/windows/wmi_event/sysmon_wmi_susp_scripting.yml
  b. tools/sigmac --lists-files-after-date 2020/06/04 -r rules/windows/
  Output:
     rules/windows/wmi_event/sysmon_wmi_susp_scripting.yml, Updated
     rules/windows/wmi_event/TestFile.yml, No date
2022-03-08 17:16:08 -08:00
Wagga da6b5969a0 Add a check to avoid outputting empty JSON or YAML rules.
Add a check to avoid outputting empty JSON or YAML rules.
2022-02-26 18:24:15 +01:00
Mei Liu b2f29afccb Example:
-O:
attackMapFile: It's used to set subFunction in XML rule. It's a map of subFunction and tags.attack in YML file.
ruleIndex: It's used to set rule id in XML rule. The format of rule id is PH_Rule_{ruleType}_SIGMA_{ruleIndex}
ruleType: It's used to set rule id in XML rule.

1. Generate rule for one YML file
    a. tools/sigmac -t fortisiem -c fortisiem-windows rules/windows/network_connection/win_net_python.yml
    b. tools/sigmac -t fortisiem -c fortisiem-windows -O attackMapFile=/opt/phoenix/data-definition/MITRE-Attack-matrix.csv -O ruleIndex=0 -O ruleType=Windows rules/windows/network_connection/win_net_python.yml
   Output:
      <Rule group="PH_SYS_RULE_THREAT_HUNTING" id="PH_Rule_Windows_SIGMA_0"  phIncidentCategory="Server" function="Security" subFunction="Discovery" technique="T1046">
         <Name>Python Initiated Connection </Name>
         <IncidentTitle>Python Initiated Connection</IncidentTitle>
         <active>true</active>
         <Description> Adversaries may attempt to get a listing of services running on remote hosts, including those that may be vulnerable to remote software exploitation </Description>
         <SigmaFileName> rules/windows/network_connection/win_net_python.yml </SigmaFileName>
         <CustomerScope groupByEachCustomer="true">
            <Include all="true"/>
           <Exclude/>
         </CustomerScope>
         <IncidentDef eventType="PH_RULE_Python_Initiated_Connection" severity="7">
           <ArgList> compEventType = Filter.eventType,hostName = Filter.hostName,isInitialed = Filter.isInitialed,procName = Filter.procName </ArgList>
         </IncidentDef>
         <PatternClause window="300">
           <SubPattern displayName="Filter" name="Filter">
               <SingleEvtConstr> eventType REGEXP ( "Win-Sysmon-3-Network-Connect.*" ) AND isInitialed="true" AND procName REGEXP ( ".*python.*" ) </SingleEvtConstr>
               <GroupByAttr> eventType,hostName,isInitialed,procName </GroupByAttr>
               <GroupEvtConstr> COUNT(*) &gt;= 1 </GroupEvtConstr>
           </SubPattern>
         </PatternClause>
         <TriggerEventDisplay>
           <AttrList> phRecvTime,hostName,isInitialed,procName,rawEventMsg </AttrList>
         </TriggerEventDisplay>
       </Rule>

2. Generate rules for YML files under rules/windows
   a. tools/sigmac -t fortisiem -c fortisiem-windows -r rules/windows -o rule.xml
   b. tools/sigmac -t fortisiem -c fortisiem-windows -r rules/windows -O attackMapFile=/opt/phoenix/data-definition/MITRE-Attack-matrix.csv -O ruleIndex=0 -O ruleType=Windows -o rule.xml
   Generate rules for YML files under rules/windows

3. Find files that is modified after some date.
  a. tools/sigmac --lists-files-after-date 2020/06/04 rules/windows/wmi_event/sysmon_wmi_susp_scripting.yml
  b. tools/sigmac --lists-files-after-date 2020/06/04 -r rules/windows/
  Output:
     rules/windows/wmi_event/sysmon_wmi_susp_scripting.yml, Updated
     rules/windows/wmi_event/TestFile.yml, No date
2022-02-15 18:17:01 -08:00
Mei Liu c5e72a9446 Example:
-O:
attackMapFile: It's used to set subFunction in XML rule. It's a map of subFunction and tags.attack in YML file.
ruleIndex: It's used to set rule id in XML rule. The format of rule id is PH_Rule_{ruleType}_SIGMA_{ruleIndex}
ruleType: It's used to set rule id in XML rule.

1. Generate rule for one YML file
    a. tools/sigmac -t fortisiem -c fortisiem-windows rules/windows/sysmon/sysmon_config_modification_error.yml
    b. tools/sigmac -t fortisiem -c fortisiem-windows -O attackMapFile=/opt/phoenix/data-definition/MITRE-Attack-matrix.csv -O ruleIndex=0 -O ruleType=Windows rules/windows/sysmon/sysmon_config_modification_error.yml
   Output:
         <Rule group="PH_SYS_RULE_THREAT_HUNTING" id="PH_Rule_SIGMA_1"  phIncidentCategory="Server" function="Security" subFunction="Persistence" technique="T1564">
           <Name>Sysmon Configuration Error </Name>
           <IncidentTitle>Sysmon Configuration Error</IncidentTitle>
           <active>true</active>
           <Description> Someone try to hide from Sysmon </Description>
           <SigmaFileName> rules/windows/sysmon/sysmon_config_modification_error.yml </SigmaFileName>
           <CustomerScope groupByEachCustomer="true">
               <Include all="true"/>
               <Exclude/>
           </CustomerScope>
           <IncidentDef eventType="PH_RULE_Sysmon_Configuration_Error" severity="7">
               <ArgList> description = Filter.description,hostName = Filter.hostName </ArgList>
           </IncidentDef>
           <PatternClause window="300">
              <SubPattern displayName="Filter" name="Filter">
                  <SingleEvtConstr> description REGEXP ( ".*Failed to connect to the driver to update configuration.*|.*Failed to open service configuration with error.*" ) AND (description NOT REGEXP ( ".*Failed to open service configuration with error.*" ) OR description NOT REGEXP ( ".*Last error: The media is write protected\\..*" )) </SingleEvtConstr>
                  <GroupByAttr> description,hostName </GroupByAttr>
                  <GroupEvtConstr> COUNT(*) &gt;= 1 </GroupEvtConstr>
              </SubPattern>
          </PatternClause>
          <TriggerEventDisplay>
              <AttrList> phRecvTime,hostName,description,rawEventMsg </AttrList>
          </TriggerEventDisplay>
      </Rule>

2. Generate rules for YML files under rules/windows
   a. tools/sigmac -t fortisiem -c fortisiem-windows -r rules/windows
   b. tools/sigmac -t fortisiem -c fortisiem-windows -r rules/windows -O attackMapFile=/opt/phoenix/data-definition/MITRE-Attack-matrix.csv -O ruleIndex=0 -O ruleType=Windows
   Generate rules for YML files under rules/windows
2022-02-14 15:51:45 -08:00
Tim Shelton 9b6be31c8d commenting out exceptions output from handling 2021-10-26 18:25:23 +00:00
Tim Shelton 6e35c031de Add additional information to the analytic record, including tags, author info, rule id and references 2021-10-18 21:39:49 +00:00
frack113 11dc276185 Update filter help 2021-09-28 10:33:10 +02:00
frack113 d08d3712be Add more debug info 2021-09-25 19:33:30 +02:00
Austin Songer e039f91272 Spelling 2021-08-18 19:00:57 +00:00
Wagga 4d53e4b040 Merge branch 'master' into master 2021-08-12 22:49:11 +02:00
wagga40 13a3e78184 Fix options : removed "raw" 2021-08-12 15:54:02 +02:00
wagga40 cbb03db2dd Fix the way YAML is dumped 2021-08-12 15:28:45 +02:00
wagga40 c165783fff Add an option to enhance default output by choosing fields
Add an option to output in JSON or YAML
2021-08-12 15:26:46 +02:00
frack113 4a8192fecc fix typo mono 2021-08-05 22:38:48 +02:00
RedKyper b353a10643 elastalert multi output file 2021-08-05 20:37:07 +02:00
frack113 359dd6bbb8 fix my code 2021-08-01 19:34:07 +02:00
frack113 f2b24ea6a3 Add support for action yml 2021-06-29 17:45:59 +02:00
frack113 bb8fe7f3b8 Add --output-extention if you want a custom output file extention (.ndjson,.txt,.splunk,..) 2021-06-29 08:13:48 +02:00
frack113 b26fc228b4 update help and add '/' or '\\' for surfix 2021-06-28 21:25:51 +02:00
frack113 831654a57a Add a way to have a output prefix 2021-06-28 19:27:20 +02:00
frack113 b3a608599a Add some fun backend option for es-rule 2021-05-28 10:51:08 +02:00
Florian Roth a9417b3f7b docs: better error highlighting 2021-05-05 12:59:13 +02:00
jaegeral e1f43f17c2 fixed various spelling errors all over rules and source code 2021-02-24 14:43:13 +00:00
Simon 97fcae56fd Update sigmac.py 2020-12-06 20:08:00 +01:00
Simon 4a4d3e1d35 Update sigmac.py 2020-12-04 18:22:24 +01:00
Simon Hilchenbach a40ef7360d Add sigmac flag to delimit results by NUL instead of \n 2020-12-04 18:05:23 +01:00
Aidan Bracher 1e5ee5823c Fix for indentation issue
Wrong indentation of line 182 meant that even where config options
were given, the default per backend was being used, rendering
custom config useless.
2020-07-15 16:29:27 +01:00
Florian Roth 825bda397d desc: better descriptions in help for backends and configurations 2020-06-25 13:21:43 +02:00
Thomas Patzke 915ea1cc67 Merge branch 'script_entry_points' into master 2020-06-10 00:51:47 +02:00
Thomas Patzke 36a7077648 Moved tool executables to new location 2020-06-07 01:14:04 +02:00
Thomas Patzke 13dbb4cdbd Moved tools into sigma namespace 2020-03-31 23:46:58 +02:00