Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A Python class to send events to an Observe Inc Datastream via the HTTP API endpoint
Version/Date: 1.3.3 2024-3-16
This is a python class to send events to an Observe Inc Datastream via the HTTP API endpoint.
You will need to put this with any other code and import the class as needed.
ObserveHttpSender
objectpost_observation
method.flush
method to ensure any non batched payload data is flushed to Observe.pip3 install observe-http-sender
Once installed you can start python try the following.
from observe_http_sender import ObserveHttpSender
help(ObserveHttpSender)
The arguments needed to initialize an Observer:
from observe_http_sender import ObserveHttpSender
# Setup Observer and its logging level.
observer = ObserveHttpSender(OBSERVE_URL,OBSERVE_TOKEN)
observer.log.setLevel(logging.INFO)
You may use logging by setting up a logger in your code from the import logging
module.
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S %z')
logger = logging.getLogger(u"OBSERVE_EXAMPLE")
logger.setLevel(logging.INFO)
You may set a different logging level for the ObserveHttpSender
class.
# Setup Observer and its logging level.
observer = ObserveHttpSender(OBSERVE_CUSTOMER,OBSERVE_TOKEN,OBSERVE_DOMAIN)
observer.log.setLevel(logging.INFO)
check_connectivity
method that is optional but recommended before attempting to submit large amounts of data to Observe. See example.py for use and docstrings on the method for details.flush
before your code completes to ensure all remaining non batch posted data is sent to Observe.get_pop_empty_fields
and set_pop_empty_fields
. Defaults to True to remove empty/null fields from payloads to save ingestion cost.get_payload_json_format
and set_payload_json_format
. Defaults to True to post payload in format application/json
. False will post the payload in format text/plain
Set this at instantiation for text payloads.get_post_path
and set_post_path
. Defaults to None append an optional path segment example /orca/alerts
. This will show in the Datastream EXTRAS field as path
.The included python script example-postcsv.py
takes a csv file with a header row and posts it to Observe in JSON format.
Usage:
python3 example-postcsv.py data/sample-authevents.csv
FAQs
A Python class to send events to an Observe Inc Datastream via the HTTP API endpoint
We found that observe-http-sender demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.