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.
coding-picbed
Advanced tools
基于 Coding 企业版仓库的图床。通过『静态网站』或公开源代码的方式获得外链链接。使用 Coding 个人令牌 API 上传图像。
npm install coding-picbed
const coding = require('coding-picbed')({
token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
repository: 'https://imlinhanchao.coding.net/imlinhanchao/upload-file'
});
const path = require('path');
const fs = require('fs');
router.post('/upload', async (req, res, next) => {
let data = req.files[0].buffer;
let filename = req.files[0].originalname;
let filepath = path.join(__dirname, filename);
fs.writeFileSync(filepath, data)
let upload = await coding.upload(filepath, '/', filename);
fs.unlinkSync(filepath);
res.json(upload);
})
或者
const { Coding } = require('coding-picbed');
const path = require('path');
const fs = require('fs');
router.post('/upload', async (req, res, next) => {
let coding = new Coding();
await coding.config({
token: req.query.token,
repository: req.query.repo
});
let data = req.files[0].buffer;
let filename = req.files[0].originalname;
let filepath = path.join(__dirname, filename);
fs.writeFileSync(filepath, data)
let upload = await coding.upload(filepath, '/', filename);
fs.unlinkSync(filepath);
res.json(upload);
})
project|project:depot|project:file
权限即可。
async function config({ token, repository });
键 | 描述 |
---|---|
token | 你创建的 Coding 访问令牌。 |
repository | 你的用于上传文件存储库地址。 |
async function isInitialized();
bool - true 表示完成初始化。
async function upload(filepath, dir, filename);
键 | 描述 |
---|---|
filepath | 您要上传的文件路径。 |
dir | 你要保存到仓库的文件夹,若不存在会自动创建。(可选) |
filename | 你要保存到仓库的文件名。(可选) |
键 | 描述 |
---|---|
filename | 最终上传的文件名。 |
urls | 所有可用的 Web 访问地址。 |
配置 Coding 存储库地址和访问令牌后,大约需要几秒钟来获取 Coding 仓库的信息。因此,请不要在配置后立即上传。你可以使用 isInitialized
检查初始化是否已完成,或者使用 await
等待配置完成。
FAQs
Upload file to coding repository and Get Url
The npm package coding-picbed receives a total of 3 weekly downloads. As such, coding-picbed popularity was classified as not popular.
We found that coding-picbed 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
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.