Socket
Socket
Sign inDemoInstall

ipa-rename

Package Overview
Dependencies
4
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

lib/tempPath.js

27

index.js

@@ -16,3 +16,3 @@ // 获取证书名称

} catch (err) {
console.error(err);
console.error(`文件${filepath}处理出错`);
}

@@ -23,10 +23,14 @@ };

const getIpasAndRename = async filepath => {
const isAbsolute = path.isAbsolute(filepath);
if (!isAbsolute) {
filepath = path.join(process.cwd(), filepath);
try {
const isAbsolute = path.isAbsolute(filepath);
if (!isAbsolute) {
filepath = path.join(process.cwd(), filepath);
}
const ipaFilepaths = getIpas(filepath);
for (let i = 0, len = ipaFilepaths.length; i < len; i++) {
await rename(ipaFilepaths[i]);
}
} catch (err) {
console.error(err);
}
const ipaFilepaths = getIpas(filepath);
for (let i = 0, len = ipaFilepaths.length; i < len; i++) {
await rename(ipaFilepaths[i]);
}
};

@@ -36,3 +40,4 @@

module.exports = () => {
if (process.argv.length === 2) {
const argv = process.argv;
if (argv.length === 2) {
console.log('请指定目录或ipa文件');

@@ -42,2 +47,6 @@ return process.exit(0);

if (argv.length === 3 && ['-v', '-V', '--version'].indexOf(argv[2]) > -1) {
return console.log(require(path.join(__dirname, '../package.json')).version);
}
const filepaths = process.argv.slice(2);

@@ -44,0 +53,0 @@

@@ -8,10 +8,14 @@ // 遍历目录,读取所有的ipa文件路径

const walk = d => {
const stats = fse.statSync(d);
if (stats.isFile()) {
if (/\.ipa$/i.test(d)) {
list.push(d);
try {
const stats = fse.statSync(d);
if (stats.isFile()) {
if (/\.ipa$/i.test(d)) {
list.push(d);
}
} else {
const dirs = fse.readdirSync(d);
dirs.forEach(el => walk(path.join(d, el)));
}
} else {
const dirs = fse.readdirSync(d);
dirs.forEach(el => walk(path.join(d, el)));
} catch (err) {
console.log(`${d}目录不存在`);
}

@@ -18,0 +22,0 @@ }

@@ -5,11 +5,12 @@

const fse = require('fs-extra');
const temp = require('./tempPath');
module.exports = async () => {
return new Promise((resolve, reject) => {
const dirs = fse.readdirSync(path.join(__dirname, '../temp/Payload'));
const dirs = fse.readdirSync(path.join(temp, 'Payload'));
const appDir = dirs.find(el => /\.app$/i.test(el));
if (!appDir) return reject('未找到`*.app`目录');
const mobileprovisionPath = path.join(__dirname, `../temp/Payload/${appDir}/embedded.mobileprovision`);
const plistPath = path.join(__dirname, '../temp/ipaInfo.plist');
const mobileprovisionPath = path.join(temp, `Payload/${appDir}/embedded.mobileprovision`);
const plistPath = path.join(temp, 'ipaInfo.plist');

@@ -16,0 +17,0 @@ const cmd = `security cms -D -i ${mobileprovisionPath} > ${plistPath}`;

// 获取证书名称
const cp = require('child_process');
const fse = require('fs-extra');
const temp = require('./tempPath');
module.exports = filepath => {
return new Promise((resolve, reject) => {
fse.ensureDirSync('./temp');
fse.emptyDirSync('./temp');
const unzip = cp.spawn('unzip', [filepath, '-d', './temp']);
fse.emptyDirSync(temp);
const unzip = cp.spawn('unzip', [filepath, '-d', temp]);

@@ -11,0 +11,0 @@ unzip.stdout.on('data', (data) => {

{
"name": "ipa-rename",
"version": "1.0.1",
"version": "1.1.0",
"description": "将ipa文件重命名,重命名的格式`[ipa包名]--[证书名].ipa`。只支持macOS系统!",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc