SlideShare a Scribd company logo
1 of 44
Regular Expressions (Regex) Overview
September 24, 2017
Matt Scheurer
@c3rkah
Slides:
https://www.slideshare.net/cerkah
((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]).(25[0-5]|2[0-4]
[0-9]|1[0-9][0-9]|[1-9]?[0-9]).(25[0-5]|2[0-4][0-9]|1[0-9][0-
9]|[1-9]?[0-9]).(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))
About Me
Matt Scheurer
Systems Security Engineer
Working in the Financial Services Industry
Meeting Organizer for the CiNPA Security SIG
DerbyCon 5.0 “Unity” Speaker
Certifications: CompTIA Security+, MCP, MCPS, MCTS, MCSA,
and MCITP
What Regular Expressions are Not!
● The term “Regular Expressions” or often
simply called “Regex” for short should not be
confused with “Old Sayings”
– Adages, Allegories, Aphorisms, Axioms, Clichés,
Epigrams, Idioms, Hyperboles, Maxims, Platitudes,
Proverbs, Truisms, etc.
When it comes to “Old Sayings”...
You would be hard
pressed to beat the
recollection and
retelling of old
sayings than my own
mother...
What is Regex?
Regex is a common syntax used to match
patterns when parsing text data or output. Regex
capture groups are used to extract strings of
specific data into reference points for retrieval or
processing.
Why learn Regex?
● Regex is a great skill set to have in the back pocket of
nearly any interdisciplinary role across the Information
Technology landscape
● Uses include:
– Application and Software Development
– Database queries
– Linux Administration and power user commands such as
grep, awk, sed, find, etc.
– Searching through any type of text data or system logs
Regex uses in InfoSec
● Content filtering
● Input validation
● NGFW / UTM Layer 7 definitions
● Parsing large volumes of data or system logs to pick out specific
data points of interest
● SIEM systems
– Building or refining entire searches, or performing advanced parsing to
narrow down extraneous information
– Finding specific log events or log event items and sub-data
● Understand the underpinnings of many security products and
utilities
Regex Variations and Variances
Different flavors of Regex
● While all versions of Regex share common
conventions there are proprietary differences
across the various Regex engines
● Popular Regex Engines include:
– Perl, PCRE, PHP, .NET, Java, JavaScript,
XRegExp, VBScript, Python, Ruby, Delphi, R, Tcl,
POSIX, and others
Regex Resources
● Online Learning Site - https://regexone.com/
● Regex Test Site - http://regexr.com/
● Tutorial Site - http://www.rexegg.com/
● Countless Additional Resources -
https://www.google.com/search?q=regex
● Further Reading -
https://en.wikipedia.org/wiki/Regular_expression
Let’s Begin...
Regex Basics – Simple Matching
● Simply type in exactly what you are trying to
match
● Text string pattern matching is case-sensitive!
– NOTE: certain non-alpha-numeric characters may
require an escape prefix to match
●
Regex Basics – Text Matching
● In addition to typing in an exact text string for
an exact match “w” will match a single
alphanumeric character
– Matches any word character (alphanumeric &
underscore)
– Only matches low-ascii characters (no accented or
non-roman characters)
Regex Basics – Number Matching
● In addition to typing in an exact numeric string
for an exact match “d” will match a single digit.
– Matches any digit character (0-9)
Regex Basics – Matching a Space
● In addition to typing in an exact string with a
space included for an exact match “s” will
match a space in text
– Matches any whitespace character (spaces, tabs,
line breaks)
Regex Basics – Matching Opposites
● We just looked at a few character classes
– All character classes are case-sensitive
– Specifying those character classes in upper-case changes
the pattern match to match the opposite
● “W”, “D”, and “S” respectively translate to
– Not a word character
– Not a digit
– Not whitespace
Regex Basics – Quantifiers
● “.” matches any single character
● “+” suffix matches one or more repetitions
● “*” suffix matches zero or more repetitions
● “?” suffix means the character is optional
● “|” is an ‘or’ separator between characters
● “^” is a ‘not’ specifier to exclude a character
– Enclosed in square brackets prefixing the pattern
– [^<pattern>]
Regex Basics – Escaped Characters
● What if I want to match escaped characters such as a
“., +, *, ?, |, ^, etc.” in my pattern against the data?
– Prefix reserved escape characters with a “”
● What if I want to match a “” in my pattern
against the data?
–
Regex Basics – Ranges
● In addition to quantifiers (wild cards), ranges may be
specified with pattern matching
– Characters are enclosed inside of square brackets
“[“ “]” and separated by a hyphen “-”
● Examples:
– [a-z], [A-Z], and [0-9]
Regex Basics – Repetitions
● In addition to a range quantifier, repetitions may be
specified with pattern matching
– The number of character occurrences are specified
inside of curly brackets/braces “{“ “}”, or separated
by a comma “,” for a range of occurrences
● A{4} matches exactly “AAAA”
● A{1,4} matches “A”, “AA”, “AAA”, or “AAAA”
● A{4,} matches four or more consecutive “A’s”
Regex Basics – Line Matching
● The beginning of a line and/or end of a line may be
specified in Regex pattern matching
– “^”, matches the beginning (starts with) of a line
– “$”, matches the end of a line
– “^<pattern>$”, matches when the line begins with
and ends with the specified pattern
Regex Capture Groups
● The true power of Regex is fully realized with
defined capture groups
● These essentially define array like variables to
pattern matched data
– This is how we return the precise data we want,
while ignoring the content we do not care about
● Capture groups are defined by patterns
enclosed inside of parenthesis “(“ “)”
Regex Sub-Capture Groups
● Regex sub-capture groups can be defined by
using nested parenthesis “(“ “)”
– Example:
● “(Pattern (match))”
– First Capture Group = Pattern match
– Second Capture Group = match
Regex Pattern Matching Problems?
Really Stuck? Just Remember...
Regex Example 1
● Threat Feed: malware-domains
– Latest Blackhole-DNS File list
– "BOOT" format
– http://malware-domains.com/files/BOOT.zip
● Objective: Capture a list of FQDN’s
Example 1 – Data Format
Example 1 – Expression
PRIMARYs(S+)
Capture Group
amazon.co.uk.security-check.ga
autosegurancabrasil.com
christianmensfellowshipsoftball.org
dadossolicitado-antendimento.sad879.mobi
hitnrun.com.my
houmani-lb.com
maruthorvattomsrianjaneyatemple.org
paypalsecure-2016.sucurecode524154241.arita.ac.tz
tei.portal.crockerandwestridge.com
tonyyeo.com
update-apple.com.betawihosting.net
Regex Example 2
● Threat Feed: malware-domains
– Complete Zone File (bind)
– Spyware Domains
– http://malware-domains.com/files/spywaredomains.zones.zip
● Objective: Capture a list of FQDN’s
Example 2 – Data Format
Example 2 – Expression
zones"(S+)"
Capture Group
amazon.co.uk.security-check.ga
autosegurancabrasil.com
christianmensfellowshipsoftball.org
dadossolicitado-antendimento.sad879.mobi
hitnrun.com.my
houmani-lb.com
maruthorvattomsrianjaneyatemple.org
Regex Example 3
● Threat Feed: DNS BlackHole
– IP Blacklist
– http://malc0de.com/bl/IP_Blacklist.txt
● Objective: Capture a list of IP addresses
Example 3 – Data Format
Example 3 – Expression
(d{1,3}.d{1,3}.d{1,3}.d{1,3})
Capture Group
185.165.29.49
185.91.116.237
76.74.167.171
193.227.248.241
149.210.167.172
216.114.192.21
89.255.9.102
86.109.162.144
85.25.203.171
209.90.88.139
Regex Example 4
● Threat Feed: SpamCop
– Spam in progress
– Source of Mail
– wget https://www.spamcop.net/w3m?action=inprogress
● Objective: Capture a list of IP addresses
Example 4 – Data Format
Example 4 – Expression
>(d{1,3}.d{1,3}.d{1,3}.d{1,3})<
Capture Group
182.139.29.84
201.37.197.39
182.151.104.105
119.5.175.57
119.5.175.57
Regex Example 5
● Threat Feed: Malware Domain List
– Complete database in CSV format
– http://www.malwaredomainlist.com/mdlcsv.php
● export.csv
● Objective: Capture a list of FQDN’s
Example 5 – Data Format
Example 5 – Expression
"d{4}/d{2}/d{2}_d{2}:d{2}","(w[.|-|w]+)
Capture Group
down.mykings.pw
ssl-6582datamanager.de
privatkunden.datapipe9271.com
alegroup.info
fourthgate.org
dieutribenhkhop.com
dieutribenhkhop.com
amazon-sicherheit.kunden-ueberpruefung.xyz
sarahdaniella.com
Keeping the Regex Saw Sharpened
Upcoming Speaking Engagements
Questions?
The End
Big Thank You and shout
out to my dear sweet
mother! She’s a very
special person in my life,
and a fantastic
Grandmother!
...Plus she endured the
unenviable task of raising me as
a child and teenager. :)
Pictured above: My mom with my son
Love you mom!

More Related Content

Viewers also liked

Cyber crime &amp; security
Cyber crime &amp; securityCyber crime &amp; security
Cyber crime &amp; securityAvani Patel
 
Dns Hardening Linux Os
Dns Hardening   Linux OsDns Hardening   Linux Os
Dns Hardening Linux Osecarrow
 
How to send DNS over anything encrypted
How to send DNS over anything encryptedHow to send DNS over anything encrypted
How to send DNS over anything encryptedMen and Mice
 
Umbrella Webcast: Redefining Security for the Nomadic Worker
Umbrella Webcast: Redefining Security for the Nomadic WorkerUmbrella Webcast: Redefining Security for the Nomadic Worker
Umbrella Webcast: Redefining Security for the Nomadic WorkerOpenDNS
 
Phishing Scams: 8 Helpful Tips to Keep You Safe
Phishing Scams: 8 Helpful Tips to Keep You SafePhishing Scams: 8 Helpful Tips to Keep You Safe
Phishing Scams: 8 Helpful Tips to Keep You SafeCheapSSLsecurity
 
Windows Server 2016 Webinar
Windows Server 2016 WebinarWindows Server 2016 Webinar
Windows Server 2016 WebinarMen and Mice
 
Microsoft Cyber Security IT-Camp
Microsoft Cyber Security IT-CampMicrosoft Cyber Security IT-Camp
Microsoft Cyber Security IT-CampAlexander Benoit
 
Cisco Connect Toronto 2017 - Anatomy-of-attack
Cisco Connect Toronto 2017 - Anatomy-of-attackCisco Connect Toronto 2017 - Anatomy-of-attack
Cisco Connect Toronto 2017 - Anatomy-of-attackCisco Canada
 
Comodo Multi Domain SSL Certificate: Key Features by CheapSSLsecurity
Comodo Multi Domain SSL Certificate: Key Features by CheapSSLsecurityComodo Multi Domain SSL Certificate: Key Features by CheapSSLsecurity
Comodo Multi Domain SSL Certificate: Key Features by CheapSSLsecurityCheapSSLsecurity
 
DNS High-Availability Tools - Open-Source Load Balancing Solutions
DNS High-Availability Tools - Open-Source Load Balancing SolutionsDNS High-Availability Tools - Open-Source Load Balancing Solutions
DNS High-Availability Tools - Open-Source Load Balancing SolutionsMen and Mice
 
Cisco umbrella overview
Cisco umbrella overviewCisco umbrella overview
Cisco umbrella overviewCisco Canada
 
Cisco Connect Toronto 2017 - NFV/SDN Platform for Orchestrating Cloud and vBr...
Cisco Connect Toronto 2017 - NFV/SDN Platform for Orchestrating Cloud and vBr...Cisco Connect Toronto 2017 - NFV/SDN Platform for Orchestrating Cloud and vBr...
Cisco Connect Toronto 2017 - NFV/SDN Platform for Orchestrating Cloud and vBr...Cisco Canada
 
Namespaces for Local Networks
Namespaces for Local NetworksNamespaces for Local Networks
Namespaces for Local NetworksMen and Mice
 

Viewers also liked (16)

Cyber crime &amp; security
Cyber crime &amp; securityCyber crime &amp; security
Cyber crime &amp; security
 
Dns Hardening Linux Os
Dns Hardening   Linux OsDns Hardening   Linux Os
Dns Hardening Linux Os
 
How to send DNS over anything encrypted
How to send DNS over anything encryptedHow to send DNS over anything encrypted
How to send DNS over anything encrypted
 
Umbrella Webcast: Redefining Security for the Nomadic Worker
Umbrella Webcast: Redefining Security for the Nomadic WorkerUmbrella Webcast: Redefining Security for the Nomadic Worker
Umbrella Webcast: Redefining Security for the Nomadic Worker
 
Phishing Scams: 8 Helpful Tips to Keep You Safe
Phishing Scams: 8 Helpful Tips to Keep You SafePhishing Scams: 8 Helpful Tips to Keep You Safe
Phishing Scams: 8 Helpful Tips to Keep You Safe
 
Windows Server 2016 Webinar
Windows Server 2016 WebinarWindows Server 2016 Webinar
Windows Server 2016 Webinar
 
Microsoft Cyber Security IT-Camp
Microsoft Cyber Security IT-CampMicrosoft Cyber Security IT-Camp
Microsoft Cyber Security IT-Camp
 
Cisco Connect Toronto 2017 - Anatomy-of-attack
Cisco Connect Toronto 2017 - Anatomy-of-attackCisco Connect Toronto 2017 - Anatomy-of-attack
Cisco Connect Toronto 2017 - Anatomy-of-attack
 
Comodo Multi Domain SSL Certificate: Key Features by CheapSSLsecurity
Comodo Multi Domain SSL Certificate: Key Features by CheapSSLsecurityComodo Multi Domain SSL Certificate: Key Features by CheapSSLsecurity
Comodo Multi Domain SSL Certificate: Key Features by CheapSSLsecurity
 
Tcp udp
Tcp udpTcp udp
Tcp udp
 
Cyber Security # Lec 2
Cyber Security # Lec 2Cyber Security # Lec 2
Cyber Security # Lec 2
 
DNS High-Availability Tools - Open-Source Load Balancing Solutions
DNS High-Availability Tools - Open-Source Load Balancing SolutionsDNS High-Availability Tools - Open-Source Load Balancing Solutions
DNS High-Availability Tools - Open-Source Load Balancing Solutions
 
Cisco umbrella overview
Cisco umbrella overviewCisco umbrella overview
Cisco umbrella overview
 
Cisco Connect Toronto 2017 - NFV/SDN Platform for Orchestrating Cloud and vBr...
Cisco Connect Toronto 2017 - NFV/SDN Platform for Orchestrating Cloud and vBr...Cisco Connect Toronto 2017 - NFV/SDN Platform for Orchestrating Cloud and vBr...
Cisco Connect Toronto 2017 - NFV/SDN Platform for Orchestrating Cloud and vBr...
 
Namespaces for Local Networks
Namespaces for Local NetworksNamespaces for Local Networks
Namespaces for Local Networks
 
Dns ppt
Dns pptDns ppt
Dns ppt
 

Similar to DerbyCon 7.0 Legacy: Regular Expressions (Regex) Overview

CiNPA Security SIG - Regex Presentation
CiNPA Security SIG - Regex PresentationCiNPA Security SIG - Regex Presentation
CiNPA Security SIG - Regex PresentationCiNPA Security SIG
 
Python Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular ExpressionsPython Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular ExpressionsRanel Padon
 
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...Ioannis Stais
 
Extracting data from text documents using the regex
Extracting data from text documents using the regexExtracting data from text documents using the regex
Extracting data from text documents using the regexSteve Mylroie
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to ElasticsearchSperasoft
 
SMS Spam Filter Design Using R: A Machine Learning Approach
SMS Spam Filter Design Using R: A Machine Learning ApproachSMS Spam Filter Design Using R: A Machine Learning Approach
SMS Spam Filter Design Using R: A Machine Learning ApproachReza Rahimi
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHPShweta A
 
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...Data Con LA
 
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/ibrettflorio
 
Regular expressions tutorial for SEO & Website Analysis
Regular expressions tutorial for SEO & Website AnalysisRegular expressions tutorial for SEO & Website Analysis
Regular expressions tutorial for SEO & Website AnalysisGlobal Media Insight
 
Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Sandy Smith
 
Overview of running R in the Oracle Database
Overview of running R in the Oracle DatabaseOverview of running R in the Oracle Database
Overview of running R in the Oracle DatabaseBrendan Tierney
 
Tools for quality matrix and kloc
Tools for quality matrix and klocTools for quality matrix and kloc
Tools for quality matrix and klocRajesh Kumar
 
SQL Server - Introduction to TSQL
SQL Server - Introduction to TSQLSQL Server - Introduction to TSQL
SQL Server - Introduction to TSQLPeter Gfader
 
Python - code quality and production monitoring
Python - code quality and production monitoringPython - code quality and production monitoring
Python - code quality and production monitoringDavid Melamed
 
Using Regular Expressions in Document Management Data Capture and Indexing
Using Regular Expressions in Document Management Data Capture and IndexingUsing Regular Expressions in Document Management Data Capture and Indexing
Using Regular Expressions in Document Management Data Capture and IndexingSandy Schiele
 
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log InsightVMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log InsightVMworld
 

Similar to DerbyCon 7.0 Legacy: Regular Expressions (Regex) Overview (20)

CiNPA Security SIG - Regex Presentation
CiNPA Security SIG - Regex PresentationCiNPA Security SIG - Regex Presentation
CiNPA Security SIG - Regex Presentation
 
Python Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular ExpressionsPython Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular Expressions
 
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
 
Extracting data from text documents using the regex
Extracting data from text documents using the regexExtracting data from text documents using the regex
Extracting data from text documents using the regex
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 
SMS Spam Filter Design Using R: A Machine Learning Approach
SMS Spam Filter Design Using R: A Machine Learning ApproachSMS Spam Filter Design Using R: A Machine Learning Approach
SMS Spam Filter Design Using R: A Machine Learning Approach
 
Regular expression for everyone
Regular expression for everyoneRegular expression for everyone
Regular expression for everyone
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
 
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
 
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i
 
Regular expressions tutorial for SEO & Website Analysis
Regular expressions tutorial for SEO & Website AnalysisRegular expressions tutorial for SEO & Website Analysis
Regular expressions tutorial for SEO & Website Analysis
 
Don't Fear the Regex LSP15
Don't Fear the Regex LSP15Don't Fear the Regex LSP15
Don't Fear the Regex LSP15
 
R tutorial
R tutorialR tutorial
R tutorial
 
Overview of running R in the Oracle Database
Overview of running R in the Oracle DatabaseOverview of running R in the Oracle Database
Overview of running R in the Oracle Database
 
Tools for quality matrix and kloc
Tools for quality matrix and klocTools for quality matrix and kloc
Tools for quality matrix and kloc
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
SQL Server - Introduction to TSQL
SQL Server - Introduction to TSQLSQL Server - Introduction to TSQL
SQL Server - Introduction to TSQL
 
Python - code quality and production monitoring
Python - code quality and production monitoringPython - code quality and production monitoring
Python - code quality and production monitoring
 
Using Regular Expressions in Document Management Data Capture and Indexing
Using Regular Expressions in Document Management Data Capture and IndexingUsing Regular Expressions in Document Management Data Capture and Indexing
Using Regular Expressions in Document Management Data Capture and Indexing
 
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log InsightVMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
 

More from CiNPA Security SIG

CONHESI 2021 - Exploiting Web APIs
CONHESI 2021 - Exploiting Web APIsCONHESI 2021 - Exploiting Web APIs
CONHESI 2021 - Exploiting Web APIsCiNPA Security SIG
 
BSides Columbus - Lend me your IR's!
BSides Columbus - Lend me your IR's!BSides Columbus - Lend me your IR's!
BSides Columbus - Lend me your IR's!CiNPA Security SIG
 
PwnSchool: Exploiting Web APIs
PwnSchool: Exploiting Web APIsPwnSchool: Exploiting Web APIs
PwnSchool: Exploiting Web APIsCiNPA Security SIG
 
CiNPA Security SIG - Exploiting the Tiredful API
CiNPA Security SIG - Exploiting the Tiredful APICiNPA Security SIG - Exploiting the Tiredful API
CiNPA Security SIG - Exploiting the Tiredful APICiNPA Security SIG
 
DMA - Stupid Cyber Criminal Tricks
DMA - Stupid Cyber Criminal TricksDMA - Stupid Cyber Criminal Tricks
DMA - Stupid Cyber Criminal TricksCiNPA Security SIG
 
OISF - Continuous Skills Improvement for Everyone
OISF - Continuous Skills Improvement for EveryoneOISF - Continuous Skills Improvement for Everyone
OISF - Continuous Skills Improvement for EveryoneCiNPA Security SIG
 
Central Ohio InfoSec Summit: Why Script Kiddies Succeed
Central Ohio InfoSec Summit: Why Script Kiddies SucceedCentral Ohio InfoSec Summit: Why Script Kiddies Succeed
Central Ohio InfoSec Summit: Why Script Kiddies SucceedCiNPA Security SIG
 
OISC 2019 - The OWASP Top 10 & AppSec Primer
OISC 2019 - The OWASP Top 10 & AppSec PrimerOISC 2019 - The OWASP Top 10 & AppSec Primer
OISC 2019 - The OWASP Top 10 & AppSec PrimerCiNPA Security SIG
 
Butler Tech - Working in IT and InfoSec
Butler Tech - Working in IT and InfoSecButler Tech - Working in IT and InfoSec
Butler Tech - Working in IT and InfoSecCiNPA Security SIG
 
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...CiNPA Security SIG
 
CiNPA Security SIG - Physical Security
CiNPA Security SIG - Physical SecurityCiNPA Security SIG - Physical Security
CiNPA Security SIG - Physical SecurityCiNPA Security SIG
 
CiNPA / CiNPA Security SIG History
CiNPA / CiNPA Security SIG HistoryCiNPA / CiNPA Security SIG History
CiNPA / CiNPA Security SIG HistoryCiNPA Security SIG
 
OISF Aniversary: Active Defense - Helping threat actors hack themselves!
OISF Aniversary: Active Defense - Helping threat actors hack themselves!OISF Aniversary: Active Defense - Helping threat actors hack themselves!
OISF Aniversary: Active Defense - Helping threat actors hack themselves!CiNPA Security SIG
 
BSides Cleveland: Phishing Forensics - Is it just suspicious or is it malicious?
BSides Cleveland: Phishing Forensics - Is it just suspicious or is it malicious?BSides Cleveland: Phishing Forensics - Is it just suspicious or is it malicious?
BSides Cleveland: Phishing Forensics - Is it just suspicious or is it malicious?CiNPA Security SIG
 
BSides Cleveland: Active Defense - Helping threat actors hack themselves!
BSides Cleveland: Active Defense - Helping threat actors hack themselves!BSides Cleveland: Active Defense - Helping threat actors hack themselves!
BSides Cleveland: Active Defense - Helping threat actors hack themselves!CiNPA Security SIG
 
Circle City Con: Phishing Forensics - Is it just suspicious or is it malicious?
Circle City Con: Phishing Forensics - Is it just suspicious or is it malicious?Circle City Con: Phishing Forensics - Is it just suspicious or is it malicious?
Circle City Con: Phishing Forensics - Is it just suspicious or is it malicious?CiNPA Security SIG
 

More from CiNPA Security SIG (20)

CONHESI 2021 - Exploiting Web APIs
CONHESI 2021 - Exploiting Web APIsCONHESI 2021 - Exploiting Web APIs
CONHESI 2021 - Exploiting Web APIs
 
SecureWV: Exploiting Web APIs
SecureWV: Exploiting Web APIsSecureWV: Exploiting Web APIs
SecureWV: Exploiting Web APIs
 
BSides Columbus - Lend me your IR's!
BSides Columbus - Lend me your IR's!BSides Columbus - Lend me your IR's!
BSides Columbus - Lend me your IR's!
 
PwnSchool: Exploiting Web APIs
PwnSchool: Exploiting Web APIsPwnSchool: Exploiting Web APIs
PwnSchool: Exploiting Web APIs
 
CiNPA Security SIG - Exploiting the Tiredful API
CiNPA Security SIG - Exploiting the Tiredful APICiNPA Security SIG - Exploiting the Tiredful API
CiNPA Security SIG - Exploiting the Tiredful API
 
CCC - Lend me your IR's
CCC - Lend me your IR'sCCC - Lend me your IR's
CCC - Lend me your IR's
 
DMA - Stupid Cyber Criminal Tricks
DMA - Stupid Cyber Criminal TricksDMA - Stupid Cyber Criminal Tricks
DMA - Stupid Cyber Criminal Tricks
 
ISC2: AppSec & OWASP Primer
ISC2: AppSec & OWASP PrimerISC2: AppSec & OWASP Primer
ISC2: AppSec & OWASP Primer
 
OISF - Continuous Skills Improvement for Everyone
OISF - Continuous Skills Improvement for EveryoneOISF - Continuous Skills Improvement for Everyone
OISF - Continuous Skills Improvement for Everyone
 
Central Ohio InfoSec Summit: Why Script Kiddies Succeed
Central Ohio InfoSec Summit: Why Script Kiddies SucceedCentral Ohio InfoSec Summit: Why Script Kiddies Succeed
Central Ohio InfoSec Summit: Why Script Kiddies Succeed
 
AppSec & OWASP Top 10 Primer
AppSec & OWASP Top 10 PrimerAppSec & OWASP Top 10 Primer
AppSec & OWASP Top 10 Primer
 
OISC 2019 - The OWASP Top 10 & AppSec Primer
OISC 2019 - The OWASP Top 10 & AppSec PrimerOISC 2019 - The OWASP Top 10 & AppSec Primer
OISC 2019 - The OWASP Top 10 & AppSec Primer
 
Butler Tech - Working in IT and InfoSec
Butler Tech - Working in IT and InfoSecButler Tech - Working in IT and InfoSec
Butler Tech - Working in IT and InfoSec
 
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
 
CiNPA Security SIG - Physical Security
CiNPA Security SIG - Physical SecurityCiNPA Security SIG - Physical Security
CiNPA Security SIG - Physical Security
 
CiNPA / CiNPA Security SIG History
CiNPA / CiNPA Security SIG HistoryCiNPA / CiNPA Security SIG History
CiNPA / CiNPA Security SIG History
 
OISF Aniversary: Active Defense - Helping threat actors hack themselves!
OISF Aniversary: Active Defense - Helping threat actors hack themselves!OISF Aniversary: Active Defense - Helping threat actors hack themselves!
OISF Aniversary: Active Defense - Helping threat actors hack themselves!
 
BSides Cleveland: Phishing Forensics - Is it just suspicious or is it malicious?
BSides Cleveland: Phishing Forensics - Is it just suspicious or is it malicious?BSides Cleveland: Phishing Forensics - Is it just suspicious or is it malicious?
BSides Cleveland: Phishing Forensics - Is it just suspicious or is it malicious?
 
BSides Cleveland: Active Defense - Helping threat actors hack themselves!
BSides Cleveland: Active Defense - Helping threat actors hack themselves!BSides Cleveland: Active Defense - Helping threat actors hack themselves!
BSides Cleveland: Active Defense - Helping threat actors hack themselves!
 
Circle City Con: Phishing Forensics - Is it just suspicious or is it malicious?
Circle City Con: Phishing Forensics - Is it just suspicious or is it malicious?Circle City Con: Phishing Forensics - Is it just suspicious or is it malicious?
Circle City Con: Phishing Forensics - Is it just suspicious or is it malicious?
 

Recently uploaded

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Recently uploaded (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

DerbyCon 7.0 Legacy: Regular Expressions (Regex) Overview

  • 1. Regular Expressions (Regex) Overview September 24, 2017 Matt Scheurer @c3rkah Slides: https://www.slideshare.net/cerkah ((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]).(25[0-5]|2[0-4] [0-9]|1[0-9][0-9]|[1-9]?[0-9]).(25[0-5]|2[0-4][0-9]|1[0-9][0- 9]|[1-9]?[0-9]).(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))
  • 2. About Me Matt Scheurer Systems Security Engineer Working in the Financial Services Industry Meeting Organizer for the CiNPA Security SIG DerbyCon 5.0 “Unity” Speaker Certifications: CompTIA Security+, MCP, MCPS, MCTS, MCSA, and MCITP
  • 3. What Regular Expressions are Not! ● The term “Regular Expressions” or often simply called “Regex” for short should not be confused with “Old Sayings” – Adages, Allegories, Aphorisms, Axioms, Clichés, Epigrams, Idioms, Hyperboles, Maxims, Platitudes, Proverbs, Truisms, etc.
  • 4. When it comes to “Old Sayings”... You would be hard pressed to beat the recollection and retelling of old sayings than my own mother...
  • 5. What is Regex? Regex is a common syntax used to match patterns when parsing text data or output. Regex capture groups are used to extract strings of specific data into reference points for retrieval or processing.
  • 6. Why learn Regex? ● Regex is a great skill set to have in the back pocket of nearly any interdisciplinary role across the Information Technology landscape ● Uses include: – Application and Software Development – Database queries – Linux Administration and power user commands such as grep, awk, sed, find, etc. – Searching through any type of text data or system logs
  • 7. Regex uses in InfoSec ● Content filtering ● Input validation ● NGFW / UTM Layer 7 definitions ● Parsing large volumes of data or system logs to pick out specific data points of interest ● SIEM systems – Building or refining entire searches, or performing advanced parsing to narrow down extraneous information – Finding specific log events or log event items and sub-data ● Understand the underpinnings of many security products and utilities
  • 9. Different flavors of Regex ● While all versions of Regex share common conventions there are proprietary differences across the various Regex engines ● Popular Regex Engines include: – Perl, PCRE, PHP, .NET, Java, JavaScript, XRegExp, VBScript, Python, Ruby, Delphi, R, Tcl, POSIX, and others
  • 10. Regex Resources ● Online Learning Site - https://regexone.com/ ● Regex Test Site - http://regexr.com/ ● Tutorial Site - http://www.rexegg.com/ ● Countless Additional Resources - https://www.google.com/search?q=regex ● Further Reading - https://en.wikipedia.org/wiki/Regular_expression
  • 12. Regex Basics – Simple Matching ● Simply type in exactly what you are trying to match ● Text string pattern matching is case-sensitive! – NOTE: certain non-alpha-numeric characters may require an escape prefix to match ●
  • 13. Regex Basics – Text Matching ● In addition to typing in an exact text string for an exact match “w” will match a single alphanumeric character – Matches any word character (alphanumeric & underscore) – Only matches low-ascii characters (no accented or non-roman characters)
  • 14. Regex Basics – Number Matching ● In addition to typing in an exact numeric string for an exact match “d” will match a single digit. – Matches any digit character (0-9)
  • 15. Regex Basics – Matching a Space ● In addition to typing in an exact string with a space included for an exact match “s” will match a space in text – Matches any whitespace character (spaces, tabs, line breaks)
  • 16. Regex Basics – Matching Opposites ● We just looked at a few character classes – All character classes are case-sensitive – Specifying those character classes in upper-case changes the pattern match to match the opposite ● “W”, “D”, and “S” respectively translate to – Not a word character – Not a digit – Not whitespace
  • 17. Regex Basics – Quantifiers ● “.” matches any single character ● “+” suffix matches one or more repetitions ● “*” suffix matches zero or more repetitions ● “?” suffix means the character is optional ● “|” is an ‘or’ separator between characters ● “^” is a ‘not’ specifier to exclude a character – Enclosed in square brackets prefixing the pattern – [^<pattern>]
  • 18. Regex Basics – Escaped Characters ● What if I want to match escaped characters such as a “., +, *, ?, |, ^, etc.” in my pattern against the data? – Prefix reserved escape characters with a “” ● What if I want to match a “” in my pattern against the data? –
  • 19. Regex Basics – Ranges ● In addition to quantifiers (wild cards), ranges may be specified with pattern matching – Characters are enclosed inside of square brackets “[“ “]” and separated by a hyphen “-” ● Examples: – [a-z], [A-Z], and [0-9]
  • 20. Regex Basics – Repetitions ● In addition to a range quantifier, repetitions may be specified with pattern matching – The number of character occurrences are specified inside of curly brackets/braces “{“ “}”, or separated by a comma “,” for a range of occurrences ● A{4} matches exactly “AAAA” ● A{1,4} matches “A”, “AA”, “AAA”, or “AAAA” ● A{4,} matches four or more consecutive “A’s”
  • 21. Regex Basics – Line Matching ● The beginning of a line and/or end of a line may be specified in Regex pattern matching – “^”, matches the beginning (starts with) of a line – “$”, matches the end of a line – “^<pattern>$”, matches when the line begins with and ends with the specified pattern
  • 22. Regex Capture Groups ● The true power of Regex is fully realized with defined capture groups ● These essentially define array like variables to pattern matched data – This is how we return the precise data we want, while ignoring the content we do not care about ● Capture groups are defined by patterns enclosed inside of parenthesis “(“ “)”
  • 23. Regex Sub-Capture Groups ● Regex sub-capture groups can be defined by using nested parenthesis “(“ “)” – Example: ● “(Pattern (match))” – First Capture Group = Pattern match – Second Capture Group = match
  • 25. Really Stuck? Just Remember...
  • 26. Regex Example 1 ● Threat Feed: malware-domains – Latest Blackhole-DNS File list – "BOOT" format – http://malware-domains.com/files/BOOT.zip ● Objective: Capture a list of FQDN’s
  • 27. Example 1 – Data Format
  • 28. Example 1 – Expression PRIMARYs(S+) Capture Group amazon.co.uk.security-check.ga autosegurancabrasil.com christianmensfellowshipsoftball.org dadossolicitado-antendimento.sad879.mobi hitnrun.com.my houmani-lb.com maruthorvattomsrianjaneyatemple.org paypalsecure-2016.sucurecode524154241.arita.ac.tz tei.portal.crockerandwestridge.com tonyyeo.com update-apple.com.betawihosting.net
  • 29. Regex Example 2 ● Threat Feed: malware-domains – Complete Zone File (bind) – Spyware Domains – http://malware-domains.com/files/spywaredomains.zones.zip ● Objective: Capture a list of FQDN’s
  • 30. Example 2 – Data Format
  • 31. Example 2 – Expression zones"(S+)" Capture Group amazon.co.uk.security-check.ga autosegurancabrasil.com christianmensfellowshipsoftball.org dadossolicitado-antendimento.sad879.mobi hitnrun.com.my houmani-lb.com maruthorvattomsrianjaneyatemple.org
  • 32. Regex Example 3 ● Threat Feed: DNS BlackHole – IP Blacklist – http://malc0de.com/bl/IP_Blacklist.txt ● Objective: Capture a list of IP addresses
  • 33. Example 3 – Data Format
  • 34. Example 3 – Expression (d{1,3}.d{1,3}.d{1,3}.d{1,3}) Capture Group 185.165.29.49 185.91.116.237 76.74.167.171 193.227.248.241 149.210.167.172 216.114.192.21 89.255.9.102 86.109.162.144 85.25.203.171 209.90.88.139
  • 35. Regex Example 4 ● Threat Feed: SpamCop – Spam in progress – Source of Mail – wget https://www.spamcop.net/w3m?action=inprogress ● Objective: Capture a list of IP addresses
  • 36. Example 4 – Data Format
  • 37. Example 4 – Expression >(d{1,3}.d{1,3}.d{1,3}.d{1,3})< Capture Group 182.139.29.84 201.37.197.39 182.151.104.105 119.5.175.57 119.5.175.57
  • 38. Regex Example 5 ● Threat Feed: Malware Domain List – Complete database in CSV format – http://www.malwaredomainlist.com/mdlcsv.php ● export.csv ● Objective: Capture a list of FQDN’s
  • 39. Example 5 – Data Format
  • 40. Example 5 – Expression "d{4}/d{2}/d{2}_d{2}:d{2}","(w[.|-|w]+) Capture Group down.mykings.pw ssl-6582datamanager.de privatkunden.datapipe9271.com alegroup.info fourthgate.org dieutribenhkhop.com dieutribenhkhop.com amazon-sicherheit.kunden-ueberpruefung.xyz sarahdaniella.com
  • 41. Keeping the Regex Saw Sharpened
  • 44. The End Big Thank You and shout out to my dear sweet mother! She’s a very special person in my life, and a fantastic Grandmother! ...Plus she endured the unenviable task of raising me as a child and teenager. :) Pictured above: My mom with my son Love you mom!