#### Overview of this book

Cyber threats today are one of the costliest losses that an organization can face. In this book, we use the most efficient tool to solve the big problems that exist in the cybersecurity domain. The book begins by giving you the basics of ML in cybersecurity using Python and its libraries. You will explore various ML domains (such as time series analysis and ensemble modeling) to get your foundations right. You will implement various examples such as building system to identify malicious URLs, and building a program to detect fraudulent emails and spam. Later, you will learn how to make effective use of K-means algorithm to develop a solution to detect and alert you to any malicious activity in the network. Also learn how to implement biometrics and fingerprint to validate whether the user is a legitimate user or not. Finally, you will see how we change the game with TensorFlow and learn how deep learning is effective for creating models and training systems
Preface
Free Chapter
Basics of Machine Learning in Cybersecurity
Time Series Analysis and Ensemble Modeling
Segregating Legitimate and Lousy URLs
Using Data Science to Catch Email Fraud and Spam
Efficient Network Anomaly Detection Using k-means
Decision Tree and Context-Based Malicious Event Detection
Catching Impersonators and Hackers Red Handed
Changing the Game with TensorFlow
Financial Fraud and How Deep Learning Can Mitigate It
Case Studies
Other Books You May Enjoy

# Levenshtein distance

Levenshtein distance is an editing distance-based metric that helps to detect the distance between two alphanumeric string sequences. It computes the number of edits (replacements or insertions) required to traverse from the first character sequence to the second character sequence.

The Levenshtein distance between two alphanumeric sequences a and b can be computed as follows:

Where is the indicator function equal to 0 when , and equal to 1 otherwise.

We will now see examples based on Levenshtein distance.

# Finding domain similarity between malicious URLs

The following code is a Python-based implementation of the iterative Levenshtein distance:

`def iterative_levenshtein(a, b):      rows = len(a)+1  cols...`