
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
#back-mock
这个一个模拟后端api数据交互的模块。
##安装
npm install back-mock
##使用
新建一个文件(假如命名为mock.js)。在里面写入如下代码。
var mockServer = require("back-mock");
var path = require("path");
mockServer('0.0.0.0', 2000, path.resolve('./mocks'));
然后在mock.js的同目录新建一个mocks目录,在mocks目录里新建一个文件api.js。api.js里的内容是如下
exports.api_test = {
path: '/api/test',
POST: function() {
return {
xxoo: "this is post"
};
},
GET: function() {
return {
xxoo: "this is get"
}
}
};
exports.api_comptest = {
path: '/api/love',
GET: function(req){
if (req.query.name == "girl"){
return "yes"
}
else {
return "no"
}
}
}
GET和POST方法里的req是express里的req,具体使用可以参考express。
现在就是现在,运行一下mock.js。
node mock.js
就可以访问
查看结果。
http://127.0.0.1/api/love?name=girl
{"data":"yes","status":"ok","description":"no error"}
mocks目录里可以放很多.js文件,只要格式和api.js文件一样就行,还要保证各个文件的path参数不一样。
##tips 启动mock.js时,推荐使用supervior来启动,这样修改文件后不用重启服务,supervior会自动重新启动。
FAQs
Used to simulate the backend API interface
The npm package back-mock receives a total of 0 weekly downloads. As such, back-mock popularity was classified as not popular.
We found that back-mock 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.