
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
npm install r2curl --save
AxiosResponse
// if js, const r2curl = require('r2curl');
import r2curl from 'r2curl';
const response = await axios.get('https://google.com');
const curl = r2curl(response);
console.log(curl);
// stdout "curl -X GET 'https://google.com' -H 'Accept:application/json, text/plain, */*' -H 'User-Agent:axios/0.18.0'"
AxiosRequestConfig
// if js, const r2curl = require('r2curl');
import r2curl from 'r2curl';
// config as AxiosRequestConfig
const config = {
url: 'https://google.com',
method: 'POST',
data: {
caller: 'curl tester',
},
headers: {
'Content-Type': 'application/json',
},
};
const curl = r2curl(reqeustConfig);
console.log(curl);
// stdout `curl -X POST 'https://google.com' -H 'Content-Type:application/json' --data '{"caller":"curl tester"}'`
const response = await axios.request(config);
r2curl
Optionsoption.quote
single
import r2curl from 'r2curl';
// option as IR2CurlOptions.ts
const option = {
/** Determines the type of quota around the body and uri. */
quote: 'double',
};
const curl = r2curl(requestConfig, option);
console.log(curl);
option.defaultContentType
POST
and PUT
requests.application/json; charset=utf-8
(enum) HTTP_HEADER_CONTENT_TYPE
| string
| false
;(boolean) false
to defaultContentType
, you can disable Content-Type
Header.import r2curl, { HTTP_HEADER_CONTENT_TYPE } from 'r2curl';
// const optionUsingEnum = {
// defaultContentType: HTTP_HEADER_CONTENT_TYPE.TEXT,
// };
const option = {
defaultContentType: 'application/json5',
}
const request: AxiosRequestConfig = { url: 'https://google.com', method: 'POST' };
const curl = r2curl(config, option);
console.log(curl);
// output: curl -X POST 'https://google.com' -H 'Content-Type:application/json5
option.forceBody
GET
and DELETE
methods.GET
method. At this point, use this option to activate the Body.import r2curl from 'r2curl';
const config: AxiosRequestConfig = {
url: 'https://google.com',
method: 'GET',
data: {
caller: 'https://github.com/uyu423/r2curl',
sorry: true,
},
};
const option = {
forceBody: true,
}
const curl = r2curl(config, option);
// output: 'curl -X GET \'https://google.com\' --data \'{"caller":"https://github.com/uyu423/r2curl","sorry":true}\''
FAQs
Node.js Request Wrapper (axios, fetch, ..) to cURL Command String
The npm package r2curl receives a total of 1,035 weekly downloads. As such, r2curl popularity was classified as popular.
We found that r2curl 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
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.