Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
cardinal-cors-client
Advanced tools
The Earthquake Data Library is a Node.js SDK that provides an easy-to-use interface for fetching and analyzing earthquake data from the USGS (United States Geological Survey) Earthquake API. This library allows users to retrieve recent earthquake information, query earthquakes by geographic radius, and perform basic analysis on seismic events.
Please make sure you have a valid license prior to installing this library. To install the Earthquake Data Library, run the following command in your project directory:
npm install earthquake-data-library
Note: Make sure you have Node.js and npm installed on your system.
Here's a basic example of how to use the Earthquake Data Library:
const EarthquakeLibrary = require("earthquake-data-library");
const earthquakeLib = new EarthquakeLibrary();
async function main() {
try {
// Get recent earthquakes
const recentQuakes = await earthquakeLib.getEarthquakes({
startTime: "2023-06-01",
minMagnitude: 4.5,
limit: 10,
});
console.log("Recent significant earthquakes:", recentQuakes);
// Get earthquakes within 1000km of Tokyo
const tokyoQuakes = await earthquakeLib.getEarthquakesByRadius(
35.6762,
139.6503,
1000,
5
);
console.log("Recent earthquakes near Tokyo:", tokyoQuakes);
// Get magnitude description
console.log(
"A magnitude 6.5 earthquake is considered:",
earthquakeLib.getMagnitudeDescription(6.5)
);
} catch (error) {
console.error("Error:", error.message);
}
}
main();
getEarthquakes(options)
Fetches earthquake data based on specified parameters.
options
(Object):
startTime
(String): Start date for the query (default: '2023-01-01')endTime
(String): End date for the query (default: current date)minMagnitude
(Number): Minimum magnitude (default: 0)maxMagnitude
(Number): Maximum magnitude (default: 10)limit
(Number): Maximum number of results to return (default: 100)Returns a Promise that resolves to an array of earthquake objects.
getEarthquakesByRadius(latitude, longitude, maxRadiusKm, minMagnitude)
Fetches earthquakes within a specified radius of a geographic point.
latitude
(Number): Latitude of the center pointlongitude
(Number): Longitude of the center pointmaxRadiusKm
(Number): Maximum radius in kilometersminMagnitude
(Number): Minimum magnitude (default: 0)Returns a Promise that resolves to an array of earthquake objects.
getMostSignificantEarthquakes(limit)
Retrieves the most significant recent earthquakes.
limit
(Number): Maximum number of results to return (default: 10)Returns a Promise that resolves to an array of earthquake objects.
calculateDistance(lat1, lon1, lat2, lon2)
Calculates the distance between two geographic points.
lat1
, lon1
: Latitude and longitude of the first pointlat2
, lon2
: Latitude and longitude of the second pointReturns the distance in kilometers.
getMagnitudeDescription(magnitude)
Provides a descriptive category for an earthquake magnitude.
magnitude
(Number): The earthquake magnitudeReturns a string describing the magnitude category (e.g., "Minor", "Moderate", "Major").
The library uses a centralized error handling mechanism. All methods that interact with the USGS API will throw an error if the request fails or if there's an issue with the data. It's recommended to use try-catch blocks when calling these methods.
Contributions to the Earthquake Data Library are welcome! Please feel free to submit a Pull Request. Author: Incisiv3
This project is licensed under the MIT License! - see the LICENSE file for details.
FAQs
security holding package
The npm package cardinal-cors-client receives a total of 1 weekly downloads. As such, cardinal-cors-client popularity was classified as not popular.
We found that cardinal-cors-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.