Skip to main content

Microsoft EASM Data Plane Client Client Library for Python

Project description

Azure EASM Data Plane client library for Python

Microsoft Defender External Attack Surface Management (Defender EASM) continuously discovers and maps your digital attack surface to provide an external view of your online infrastructure. This visibility enables security and IT teams to identify unknowns, prioritize risk, eliminate threats, and extend vulnerability and exposure control beyond the firewall. Defender EASM leverages Microsoft’s crawling technology to discover assets that are related to your known online infrastructure, and actively scans these assets to discover new connections over time. Attack Surface Insights are generated by leveraging vulnerability and infrastructure data to showcase the key areas of concern for your organization.

Source Code | Package (pypi) | Api Reference Documentation | Product Documentation

Getting started

Installing the package

pip

python -m pip install azure-defender-easm

from source

python setup.py intall

Prerequisites

  • Python 3.7 or later is required to use this package.
  • You need an Azure subscription to use this package.
  • An existing EASM Data Plane Client instance.

Create with an Azure Active Directory Credential

To use an Azure Active Directory (AAD) token credential, provide an instance of the desired credential type obtained from the azure-identity library.

To authenticate with AAD, you must first pip install azure-identity

After setup, you can choose which type of credential from azure.identity to use. As an example, DefaultAzureCredential can be used to authenticate the client:

Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

Use the returned token credential to authenticate the client:

from azure.defender.easm import EasmClient
from azure.identity import DefaultAzureCredential

sub_id = '<your subscription ID here>'
workspace_name = '<your workspace name here>'
resource_group = '<your resource group here>'
region = '<your region here>'

endpoint = f'{region}.easm.defender.microsoft.com'

client = EasmClient(endpoint, resource_group, sub_id, workspace_name, credential=DefaultAzureCredential())

Key concepts

Basic understanding these terms will help to get started with EASM client library.

Assets

Defender EASM includes the discovery of the following kinds of assets:

  • Domains
  • Hosts
  • Pages
  • IP Blocks
  • IP Addresses
  • Autonomous System Numbers (ASNs)
  • SSL Certificates
  • WHOIS Contacts

These asset types comprise your attack surface inventory in Defender EASM. This solution discovers externally facing assets that are exposed to the open internet outside of traditional firewall protection; they need to be monitored and maintained to minimize risk and improve an organization’s security posture. Microsoft Defender External Attack Surface Management (Defender EASM) actively discovers and monitors these assets, then surfacing key insights that help customers efficiently address any vulnerabilities in their organization.

Discovery

Microsoft Defender External Attack Surface Management (Defender EASM) relies on our proprietary discovery technology to continuously define your organization’s unique Internet-exposed attack surface. Discovery scans known assets owned by your organization to uncover previously unknown and unmonitored properties. Discovered assets are indexed in a customer’s inventory, providing a dynamic system of record of web applications, third party dependencies, and web infrastructure under the organization’s management through a single pane of glass.

Discovery Groups

Custom discoveries are organized into Discovery Groups. They are independent seed clusters that comprise a single discovery run and operate on their own recurrence schedules. Users can elect to organize their Discovery Groups to delineate assets in whatever way best benefits their company and workflows. Common options include organizing by responsible team/business unit, brands or subsidiaries.

Examples

After authenticating as shown in the "Create with an Azure Active Directory Credential" section, you can get started building your inventory like this:

Create a discovery group

from azure.defender.easm import EasmClient
from azure.identity import DefaultAzureCredential

sub_id = '<your subscription ID here>'
workspace_name = '<your workspace name here>'
resource_group = '<your resource group here>'
region = '<your region here>'

endpoint = f'{region}.easm.defender.microsoft.com'

client = EasmClient(endpoint, resource_group, sub_id, workspace_name, credential=DefaultAzureCredential())

client.discovery_groups.put("example group", {
	'seeds': [
	    {'kind': 'host', 'name': 'example.org'}
	]
})
client.discovery_groups.run("example group")

View assets

from azure.defender.easm import EasmClient
from azure.identity import DefaultAzureCredential

sub_id = '<your subscription ID here>'
workspace_name = '<your workspace name here>'
resource_group = '<your resource group here>'
region = '<your region here>'

endpoint = f'{region}.easm.defender.microsoft.com'

client = EasmClient(endpoint, resource_group, sub_id, workspace_name, credential=DefaultAzureCredential())

for asset in client.assets.list():
	print(f'{asset.kind}: {asset.name}')

More examples

More examples can be viewed in the samples directory of this repository

Troubleshooting

Next steps

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure-defender-easm-1.0.0b1.zip (119.8 kB view details)

Uploaded Source

Built Distribution

azure_defender_easm-1.0.0b1-py3-none-any.whl (96.2 kB view details)

Uploaded Python 3

File details

Details for the file azure-defender-easm-1.0.0b1.zip.

File metadata

  • Download URL: azure-defender-easm-1.0.0b1.zip
  • Upload date:
  • Size: 119.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.28.2 setuptools/58.1.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.9.16

File hashes

Hashes for azure-defender-easm-1.0.0b1.zip
Algorithm Hash digest
SHA256 524b0fe0f561b69215fc18ebca1010dbba843daaeb27ca579b0a9924c287e4a7
MD5 70f70f5253acf867bf01437255fe533d
BLAKE2b-256 4d55adc063793cd4962493b6fa3bb96b4bb6a92391e89c6c575b2fb1aa77049e

See more details on using hashes here.

File details

Details for the file azure_defender_easm-1.0.0b1-py3-none-any.whl.

File metadata

  • Download URL: azure_defender_easm-1.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 96.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.28.2 setuptools/58.1.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.9.16

File hashes

Hashes for azure_defender_easm-1.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 f6017b4c42b5bb7109936e39772f412759b0faf36f3cfddddbe1b46cf3a90696
MD5 5c2b3f955b29326afb5f51352eb90025
BLAKE2b-256 6ff27d95e9d7006c8556ffbf456f69192505c1e27d297b5357901532281e176e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page