Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
feedly
/
python-api-client
Public
Notifications
You must be signed in to change notification settings
Fork
9
Star
59
Code
Issues
4
Pull requests
3
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Files
Expand file tree
master
Breadcrumbs
python-api-client
/
examples
/
enterprise
/
export_indicators_of_compromise_from_a_stream_as_stix.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
47 lines (36 loc) · 1.93 KB
master
Breadcrumbs
python-api-client
/
examples
/
enterprise
/
export_indicators_of_compromise_from_a_stream_as_stix.py
Copy path
Top
File metadata and controls
Code
Blame
47 lines (36 loc) · 1.93 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import json
from datetime import datetime, timedelta
from pathlib import Path
from pprint import pprint
from feedly.api_client.enterprise.indicators_of_compromise import IoCDownloaderBuilder, IoCFormat
from feedly.api_client.session import FeedlySession
from feedly.api_client.utils import run_example
RESULTS_DIR = Path(__file__).parent / "results"
RESULTS_DIR.mkdir(exist_ok=True)
def example_export_indicators_of_compromise_from_all_enterprise_feeds_as_stix():
"""
This example will save a STIX 2.1 bundle containing the contextualized IoCs that Leo extracted during the past 12
hours in all your enterprise feeds.
"""
# Authenticate using the default auth directory
session = FeedlySession()
# Create the STIX IoC downloader builder object, and limit it to 12 hours
# Usually newer_than will be the datetime of the last fetch
downloader_builder = IoCDownloaderBuilder(
session=session, newer_than=datetime.now() - timedelta(hours=12), format=IoCFormat.STIX
)
# Fetch the IoC from all the enterprise categories, and create a bundle containing them
# You can use a different method to get the iocs from you personal categories, personal or enterprise boards,
# or from specific categories/boards using their names or ids
downloader = downloader_builder.from_all_enterprise_categories()
iocs_bundle = downloader.download_all()
# Save the bundle in a file
with (RESULTS_DIR / "ioc_example_stix.json").open("w") as f:
json.dump(iocs_bundle, f, indent=2)
# Console display
pprint(iocs_bundle)
if __name__ == "__main__":
# Warning: This example requires the Threat Intelligence package to be enabled on your account
# Will prompt for the token if missing, and launch the example above
# If a token expired error is raised, will prompt for a new token and restart the example
run_example(example_export_indicators_of_compromise_from_all_enterprise_feeds_as_stix)
You can’t perform that action at this time.