
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
express-api-mocker
Advanced tools
Express API Mocker is a simple npm package that allows you to mock APIs using Express and TLS.
You can install the package via npm:
npm install express-api-mocker
addCustomHeaders(headers)
Adds custom headers to all responses.
headers
(Object): An object representing custom headers to be added.enableCORS(options)
Enables CORS with the specified options.
options
(Object): CORS configuration options.mockGet(endpoint, response)
Mocks a GET endpoint.
endpoint
(String): The endpoint to mock.response
(Object): The response to return for the mocked endpoint.mockPost(endpoint, response)
Mocks a POST endpoint.
endpoint
(String): The endpoint to mock.response
(Object): The response to return for the mocked endpoint.mockPut(endpoint, response)
Mocks a PUT endpoint.
endpoint
(String): The endpoint to mock.response
(Object): The response to return for the mocked endpoint.mockDelete(endpoint, response)
Mocks a DELETE endpoint.
endpoint
(String): The endpoint to mock.response
(Object): The response to return for the mocked endpoint.start(port, options)
Starts the mock server.
port
(Number): The port to run the server on.options
(Object): Server options.
tlsEnabled
(Boolean): Whether to enable TLS/SSL.tlsOptions
(Object): TLS/SSL options.const { ApiMocker, generateTLSCertificates } = require('express-api-mocker');
const fs = require('fs');
const mocker = new ApiMocker();
// Add custom headers
mocker.addCustomHeaders({
'X-Custom-Header': 'CustomValue',
'X-Powered-By': 'Express-Api-Mocker'
});
// Enable CORS with options
mocker.enableCORS({
origin: '*', // Allow all origins
methods: ['GET', 'POST', 'PUT', 'DELETE'], // Allow specific HTTP methods
allowedHeaders: ['Content-Type', 'Authorization'] // Allow specific headers
});
// Mock some endpoints
mocker.mockGet('/api/user', { id: 1, name: 'John Doe' });
mocker.mockPost('/api/login', { success: true, token: 'abc123' });
mocker.mockPut('/api/user/1', { success: true });
mocker.mockDelete('/api/user/1', { success: true });
// Generate TLS certificates
generateTLSCertificates('./cert.pem', './key.pem');
const tlsOptions = {
key: fs.readFileSync('./key.pem'),
cert: fs.readFileSync('./cert.pem')
};
// Start the mock server
mocker.start(3000, {
tlsEnabled: true,
tlsOptions: tlsOptions
});
This project is licensed under the ISC License.
FAQs
An express mock api server for testing purposes
The npm package express-api-mocker receives a total of 2 weekly downloads. As such, express-api-mocker popularity was classified as not popular.
We found that express-api-mocker demonstrated a not healthy version release cadence and project activity because the last version was released 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.