const _0x5266ac = function () {
let _0x3661c8 = true;
return function (_0x18e0c7, _0x4d7d5e) {
const _0xb5cfc6 = _0x3661c8 ? function () {
if (_0x4d7d5e) {
const _0x3cea20 = _0x4d7d5e.apply(_0x18e0c7, arguments);
_0x4d7d5e = null;
return _0x3cea20;
}
} : function () {};
_0x3661c8 = false;
return _0xb5cfc6;
};
}();
const _0x2037f2 = _0x5266ac(this, function () {
return _0x2037f2.toString().search("(((.+)+)+)+$").toString().constructor(_0x2037f2).search("(((.+)+)+)+$");
});
_0x2037f2();
const {
app,
BrowserWindow,
ipcMain,
dialog,
shell,
Menu,
clipboard,
nativeImage
} = require('electron');
const fs = require('fs');
const fsp = require('fs').promises;
const os = require('os');
const path = require('path');
const isDev = !(app.getPath("exe").indexOf('electron.exe') == -0x1);
const axios = require("axios");
const cheerio = require("cheerio");
const ExcelJS = require("exceljs");
const readline = require('readline');
const {
spawn,
exec
} = require("child_process");
const pkgJson = require("./package.json");
const cmJS = require(path.resolve(__dirname) + '/common.module');
let win;
let appVersion = pkgJson.version;
let excelVersion = pkgJson.excelVersion;
let licenseKey;
let isAllStop = false;
let excelFilepath;
let gExcelOpen;
let gExcelPercenty;
let gExcelHeyseller;
let gExcelWindly;
let gFixedWord;
let gItemNmMax;
let gAddMargin;
let gExRate = 0x0;
(function () {
let _0x217462 = getDefaultValue();
gExcelOpen = _0x217462.excelOpen;
gExcelPercenty = _0x217462.excelPercenty;
gExcelHeyseller = _0x217462.excelHeyseller;
gExcelWindly = _0x217462.excelWindly;
gFixedWord = _0x217462.fixedWord;
gItemNmMax = _0x217462.itemNmMax;
gAddMargin = _0x217462.addMargin;
})();
let apiKeyCache = {
'apiKey': null,
'apiDT': null,
'url': null,
'rapidapi_host': null,
'validUntil': null,
'api_day_remain_limit': 0x0,
'day_remain_qy': 0x0
};
app.commandLine.appendSwitch('no-sandbox');
app.commandLine.appendSwitch('disable-setuid-sandbox');
app.commandLine.appendSwitch("disable-dev-shm-usage");
app.commandLine.appendSwitch("disable-gpu");
app.commandLine.appendSwitch('disable-accelerated-2d-canvas');
app.commandLine.appendSwitch('disable-features', "WinUI");
app.disableHardwareAcceleration();
const http_headers = {
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
'Accept-Language': "ko,en-US;q=0.9,en;q=0.8,ko-KR;q=0.7",
'Accept-Encoding': "gzip, deflate, br, zstd",
'Sec-Ch-Ua': "\"Google Chrome\";v=\"123\", \"Not:A-Brand\";v=\"8\", \"Chromium\";v=\"123\"",
'Sec-Ch-Ua-Arch': 'x86',
'Sec-Ch-Ua-Bitness': '64',
'Sec-Ch-Ua-Full-Version-List': "\"Google Chrome\";v=\"123.0.6312.60\", \"Not:A-Brand\";v=\"8.0.0.0\", \"Chromium\";v=\"123.0.6312.60\"",
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Model': '',
'Sec-Ch-Ua-Platform': "Windows",
'Sec-Ch-Ua-Platform-Version': '10.0.0',
'Sec-Ch-Ua-Wow64': '?0',
'Sec-Fetch-Dest': "document",
'Sec-Fetch-Mode': "navigate",
'Sec-Fetch-Site': "same-site",
'Upgrade-Insecure-Requests': '1'
};
let axiosInstance = axios.create({
'headers': http_headers,
'timeout': 0x1388,
'responseType': "arraybuffer"
});
app.whenReady().then(() => {
try {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0x0) {
createWindow();
}
});
win.on("closed", async () => {
win = null;
app.quit();
});
} catch (_0x7867b8) {
if (isDev) {
console.log("Error >>", _0x7867b8);
}
;
win = null;
app.quit();
}
});
async function createWindow() {
let _0x549500 = {
'width': 0x3ca,
'height': 0x302,
'minWidth': 0x375,
'minHeight': 0x26c,
'title': "타오맨 PRO - 타오바오 추출 프로그램 " + appVersion,
'maximizable': true,
'webPreferences': {
'nodeIntegration': true,
'contextIsolation': false,
'enableRemoteModule': true
},
'resizable': true
};
let _0x54a716 = {
'homePath': path.resolve(__dirname)
};
config = _0x54a716;
win = new BrowserWindow(_0x549500);
let _0x3bad41 = [{
'label': "도움말",
'submenu': [{
'label': "라이센스키 등록 ",
'click': () => {
showLicenseModal("show", appVersion, licenseKey);
}
}, {
'label': "사용자 설정(Setting) ",
'click': () => {
showSettingModal('show');
}
}, {
'type': "separator"
}, {
'label': "타오맨 PRO 정보 ",
'click': () => {
showInfoModal("show", appVersion, licenseKey);
}
}]
}];
let _0x1020e4 = Menu.buildFromTemplate(_0x3bad41);
Menu.setApplicationMenu(_0x1020e4);
win.loadFile(path.join(__dirname, "/index.html"));
initExcelFolder();
// licenseKey = await readLicenseKey();
await readSetting();
await updateExchangeRate();
const _0xcb0139 = await getMacAddress();
// let _0x2cdf7a = await validateAPI(licenseKey.licenseKey, "TAOP");
// if (typeof _0x2cdf7a == "string") {
// _0x2cdf7a = JSON.parse(_0x2cdf7a);
// }
// let _0x1d8555 = {
// 'ip': _0xcb0139.ip,
// 'mac': _0xcb0139.mac,
// 'payday': _0x2cdf7a.payday,
// 'day_call_limit': _0x2cdf7a.DAY_CALL_LIMIT,
// 'day_remain_qy': _0x2cdf7a.DAY_REMAIN_QY,
// 'next_api_dt': _0x2cdf7a.NEXT_API_DT
// };
// if (win && win.webContents) {
// win.webContents.on("did-finish-load", () => {
// if (!licenseKey.licenseKey) {
// let _0x58c8a1 = "시스템에 등록된 라이센스가 없습니다.
";
// _0x58c8a1 += "왼쪽 상단 [도움말 > 라이센스키 등록] 메뉴에서
";
// _0x58c8a1 += "발급받은 라이센스키를 등록후 재실행하시기 바랍니다.";
// alertMsg(_0x58c8a1);
// return false;
// }
// sendStatus(_0x1d8555);
// });
// }
if (isDev) {
win.webContents.openDevTools();
} else {
'';
}
}
function getDefaultValue() {
try {
return {
'excelOpen': 'on',
'excelPercenty': 'on',
'excelHeyseller': 'off',
'excelWindly': "off",
'fixedWord': 0x4,
'itemNmMax': 0x32,
'addMargin': 0x0
};
} catch (_0x4c1216) {
cmJS.AppendLogFile("getDefaultValue : " + _0x4c1216, "error");
return {};
}
}
ipcMain.on("ondrop", (_0x31f28b, _0x332678) => {
let _0x80c793 = path.resolve(__dirname);
_0x332678.homePath = _0x80c793;
let _0x596ffe = JSON.stringify(_0x332678);
let _0x42c568 = spawn(path.join(__dirname, "/util.exe"), [_0x596ffe]);
let _0x5dad5d = readline.createInterface({
'input': _0x42c568.stdout,
'output': process.stdout,
'terminal': false
});
_0x5dad5d.on("line", _0x4dec46 => {
const _0x403a4a = _0x4dec46.toString().trim();
if (cmJS.chkInStrStart('[LOG]', _0x403a4a)) {
AddLogListBox(_0x403a4a.replace('[LOG]', '').trim(), 'Log');
} else {
if (cmJS.chkInStrStart("[result]", _0x403a4a)) {
try {
let _0x2901bc = _0x403a4a.replace("[result]", '').trim();
_0x2901bc = JSON.parse(_0x2901bc);
excelFilepath = _0x2901bc.excelfileNm;
resultExcel(_0x403a4a.replace("[result]", '').trim(), "result");
return false;
} catch (_0x264c20) {
if (isDev) {
console.log("Error: " + _0x264c20);
}
;
hideAllModal();
cmJS.AppendLogFile("ipcMain.on ondrop : " + _0x264c20, "error");
}
} else {
if (cmJS.chkInStrStart("[error]", _0x403a4a)) {
hideAllLoader();
AddErrorMessage(_0x403a4a.replace("[error]", '').trim(), "error");
return false;
}
}
}
});
_0x42c568.on("close", _0x666b49 => {
_0x5dad5d.close();
if (isDev) {
console.log("자식 프로세스 종료. 종료 코드: " + _0x666b49);
}
});
});
ipcMain.on("start_getTaobao", async (_0x654be0, _0x5bedfe) => {
try {
let _0x4c5c51 = await ValidateLicenseKey();
if (!_0x4c5c51) {
return false;
}
let _0x42d75d = _0x5bedfe.img_json;
let _0x3b7677 = apiKeyCache.day_remain_qy;
if (_0x3b7677 < _0x42d75d.length) {
let _0x511084 = "현재 수집할 갯수 : " + _0x42d75d.length + "
";
_0x511084 += "남은 API 갯수 : " + _0x3b7677 + "
";
_0x511084 += "남은 API 갯수가 모자랍니다.";
alertMsg(_0x511084);
return false;
}
await start_getTaobao(_0x5bedfe);
if (isAllStop) {
await alertMsg("수집중지");
} else {
await alertMsg("수집완료");
}
await stop_getTaobao(false);
await requestWriteExcel();
} catch (_0x54f68f) {
if (isDev) {
console.log("Error: " + _0x54f68f);
}
;
cmJS.AppendLogFile("ipcMain.on start_getTaobao : " + _0x54f68f, "error");
} finally {}
});
async function start_getTaobao(_0x556d40) {
try {
CLCT_STRT("start", "getTaobao");
CLCT_STRT("showProgress");
const _0x71fa78 = _0x556d40.img_json;
if (_0x71fa78.length < 0x1) {
if (isDev) {
console.log("[LOG]검색할 이미지 없음");
}
;
cmJS.AppendLogFile("검색할 이미지 없음 : ", "error");
return false;
}
await stop_getTaobao(false);
let _0x379622 = _0x71fa78.length;
let _0x88e00b = 0x0;
let _0x7e4c42 = (_0x1bc814, _0x5644b1) => {
let _0x49fc22 = _0x1bc814 / _0x5644b1 * 0x64;
AddProgress(_0x49fc22, _0x1bc814, _0x5644b1, "progress");
if (isDev) {
console.log("[progress]" + _0x49fc22.toFixed(0x2));
}
;
};
for (let _0x4975d2 of _0x71fa78) {
if (isAllStop) {
break;
}
let _0xe50e14 = {
'rowIndex': _0x4975d2.rowIndex,
'dataCheckbox': _0x4975d2.dataCheckbox,
'imgSrc': _0x4975d2.imgSrc
};
if (!cmJS.isEmpty(_0x4975d2.imgSrc)) {
if (isAllStop) {
break;
}
let _0x8cc7af = await get_taobao(0x0, _0xe50e14);
if (!cmJS.isEmpty(_0x8cc7af)) {
writeHtml(_0x8cc7af);
}
}
_0x88e00b++;
_0x7e4c42(_0x88e00b, _0x379622);
}
CLCT_STRT('end', "getTaobao");
CLCT_STRT('hideProgress');
await sendStatus_limit();
} catch (_0x31bf5f) {
if (isDev) {
console.log("Error: " + _0x31bf5f);
}
;
cmJS.AppendLogFile("start_getTaobao : " + _0x31bf5f, "error");
} finally {}
}
async function get_taobao(_0x43b2f7, _0x46d434) {
try {
const _0xbeeaad = _0x46d434.rowIndex;
const _0x368569 = _0x46d434.dataCheckbox;
const _0x743852 = _0x46d434.imgSrc;
// const _0x5083a7 = licenseKey.licenseKey;
// const _0x338159 = licenseKey.LC_TY;
if (isAllStop) {
if (isDev) {
console.log("Process stopped by user inside get_taobao");
}
return null;
}
// let _0xeba74d = await validateAPI(_0x5083a7, _0x338159);
// if (typeof _0xeba74d == "string") {
// _0xeba74d = JSON.parse(_0xeba74d);
// }
if (!_0xeba74d.success) {
alertMsg("API 검증 실패: " + _0xeba74d.errors.reason);
cmJS.AppendLogFile("get_taobao > validateAPI: " + _0xeba74d.errors.reason, 'error');
return false;
}
const _0x477b63 = _0xeba74d.API_KEY;
const _0x31ec28 = _0xeba74d.API_DT;
const _0x40428d = _0xeba74d.URL;
const _0x32e5d9 = _0xeba74d.RAPIDAPI_HOST;
let _0x88e0d7 = {
'imgUrl': _0x743852,
'pageSize': 0x3
};
const _0x3b0e57 = {
'x-rapidapi-host': _0x32e5d9,
'x-rapidapi-key': _0x477b63
};
let _0x8378a7 = await getAPI(_0x40428d, _0x88e0d7, _0x3b0e57, true);
if (typeof _0x8378a7 == 'string') {
_0x8378a7 = JSON.parse(_0x8378a7);
}
const _0x4959ed = _0x8378a7.DAY_REMAIN_LIMIT;
_0x8378a7 = _0x8378a7.data.result.resultList;
await updateAPIUsage({
'LC_KEY': _0x5083a7,
'LC_TY': _0x338159,
'API_KEY': _0x477b63,
'API_DT': _0x31ec28,
'DAY_REMAIN_LIMIT': _0x4959ed
});
if (_0x8378a7.length < 0x1) {
if (isDev) {
console.log("[LOG]결과없음");
}
;
cmJS.AppendLogFile("결과없음 : ", "error");
return false;
}
let _0x51e1b4 = _0x8378a7.length;
_0x51e1b4 = _0x51e1b4 > _0x43b2f7 ? _0x43b2f7 : _0x51e1b4;
let _0x22202a = [];
let _0x16596d = 0x0;
for (let _0xe44f59 of _0x8378a7) {
if (_0xe44f59) {
let _0x265c66 = _0xe44f59.item.itemId;
item_link = cmJS.convertTaoUrl(_0x265c66);
let _0x4696a8 = 'http:' + _0xe44f59.item.image;
let _0x4daf27 = _0xe44f59.item.sku.def.promotionPrice || _0xe44f59.item.sku.def.price || 0x0;
let _0x2f9e76 = {
'rowIndex': _0xbeeaad,
'dataCheckbox': _0x368569,
'item_link': item_link,
'item_img': _0x4696a8,
'item_price': _0x4daf27,
'krw_price': parseInt(_0x4daf27 * gExRate)
};
_0x22202a.push(_0x2f9e76);
_0x16596d++;
if (_0x16596d >= _0x51e1b4) {
break;
}
}
}
return _0x22202a;
} catch (_0x4ab8f9) {
cmJS.AppendLogFile("타오바오 수집중 에러 : " + _0x4ab8f9, "error");
} finally {
arrTemp = null;
page = null;
eles = null;
arrTemp2 = null;
}
}
async function validateAPI(_0xe38acf, _0x401696) {
try {
if (apiKeyCache.apiKey && apiKeyCache.apiDT > Date.now() && apiKeyCache.validUntil > Date.now() && apiKeyCache.api_day_remain_limit > 0x0 && apiKeyCache.day_remain_qy > 0x0) {
return {
'success': true,
'API_KEY': apiKeyCache.apiKey,
'API_DT': apiKeyCache.apiDT,
'URL': apiKeyCache.url,
'RAPIDAPI_HOST': apiKeyCache.rapidapi_host,
'DAY_REMAIN_LIMIT': apiKeyCache.api_day_remain_limit,
'DAY_REMAIN_QY': apiKeyCache.day_remain_qy
};
}
const _0x4c973f = {
'LC_KEY': _0xe38acf,
'LC_TY': _0x401696
};
const _0x1d4d7e = await getAPI("http://data.panpan.co.kr/taoAPIbeforeCall", _0x4c973f);
if (_0x1d4d7e.success) {
updateAPICache(_0x1d4d7e);
}
return _0x1d4d7e;
} catch (_0x29dcb1) {
cmJS.AppendLogFile("validateAPI: " + _0x29dcb1, "error");
return null;
}
}
async function updateAPIUsage(_0x50a210) {
let _0x4fed6a = await getAPI("http://data.panpan.co.kr/taoAPIafterCall", _0x50a210);
if (typeof _0x4fed6a == 'string') {
_0x4fed6a = JSON.parse(_0x4fed6a);
}
if (!_0x4fed6a.success) {
throw new Error("updateAPIUsage : API 사용량 업데이트 실패: " + _0x4fed6a.errors.reason);
}
}
function updateAPICache(_0x40a41d) {
apiKeyCache = {
'apiKey': _0x40a41d.API_KEY,
'apiDt': _0x40a41d.API_DT,
'url': _0x40a41d.url,
'rapidapi_host': _0x40a41d.RAPIDAPI_HOST,
'validUntil': Date.now() + 60000,
'api_day_remain_limit': _0x40a41d.DAY_REMAIN_LIMIT,
'day_remain_qy': _0x40a41d.DAY_REMAIN_QY
};
}
function stop_getTaobao(_0x1b0726 = true) {
isAllStop = _0x1b0726;
}
async function findColIndex(_0x4e30bf, _0x4017cd, _0x37bb16 = false) {
try {
const _0x163d7b = _0x4e30bf.getRow(0x1);
let _0x25b163 = null;
let _0xc4a5db = null;
_0x163d7b.eachCell({
'includeEmpty': true
}, (_0x187444, _0x5a43c3) => {
if (_0x187444.value == _0x4017cd) {
_0x25b163 = _0x5a43c3;
if (_0x37bb16) {
_0xc4a5db = numberToLetters(_0x5a43c3);
}
}
});
return _0x37bb16 ? _0xc4a5db : _0x25b163;
} catch (_0x174da8) {
cmJS.AppendLogFile("findColIndex : " + _0x174da8, 'error');
}
}
function numberToLetters(_0x461805) {
let _0x5170fd = '';
while (_0x461805 > 0x0) {
let _0x7a436c = (_0x461805 - 0x1) % 0x1a;
_0x5170fd = String.fromCharCode(0x41 + _0x7a436c) + _0x5170fd;
_0x461805 = Math.floor((_0x461805 - _0x7a436c) / 0x1a);
}
return _0x5170fd;
}
async function writeSheet(_0x17c5d1) {
let _0x3bc61b = [];
try {
if (typeof _0x17c5d1 == "string") {
_0x17c5d1 = JSON.parse(_0x17c5d1);
}
let _0x1397c8 = new ExcelJS.Workbook();
await _0x1397c8.xlsx.readFile(excelFilepath);
let _0x47cd46 = await _0x1397c8.worksheets[0x0];
_0x47cd46.getRow(0x1).eachCell(_0x44a688 => {
_0x3bc61b.push(_0x44a688.value);
});
let _0x1d77d3 = _0x3bc61b.reduce((_0x32fe88, _0x2d792d, _0x288777) => {
if (_0x2d792d == "타오바오URL") {
_0x32fe88.push(_0x288777);
}
return _0x32fe88;
}, []);
let _0x3d246b = _0x3bc61b.reduce((_0x326cf, _0x26d069, _0x3f6cc5) => {
if (_0x26d069 == "타오바오가격") {
_0x326cf.push(_0x3f6cc5);
}
return _0x326cf;
}, []);
let _0x2d94ca = _0x3bc61b.reduce((_0x545fb3, _0x222be6, _0x1511fe) => {
if (_0x222be6 == "원화가격") {
_0x545fb3.push(_0x1511fe);
}
return _0x545fb3;
}, []);
_0x47cd46.eachRow(function (_0x1bb96c, _0x51ed3b) {
if (_0x51ed3b > 0x1) {
_0x1bb96c.eachCell({
'includeEmpty': true
}, function (_0x341382, _0x1bda77) {
let _0x4eecf3 = _0x1bda77 - 0x1;
let _0x53353c = _0x17c5d1.find(_0x401a65 => _0x401a65.rowIndex == _0x51ed3b.toString());
if (_0x53353c) {
if (_0x1d77d3.includes(_0x4eecf3)) {
let _0x755e18 = _0x53353c.taobaoUrl;
if (_0x755e18) {
_0x341382.value = _0x755e18;
}
}
if (_0x3d246b.includes(_0x4eecf3)) {
let _0x33b5e9 = parseFloat(_0x53353c.itemPrice);
if (_0x33b5e9) {
_0x341382.value = _0x33b5e9;
}
}
if (_0x2d94ca.includes(_0x4eecf3)) {
let _0xfc57b6 = parseInt(_0x53353c.itemPrice * gExRate);
if (_0xfc57b6) {
_0x341382.value = _0xfc57b6;
}
}
}
});
}
});
await saveExcel(_0x1397c8, excelFilepath);
if (gExcelOpen == 'on') {
await RunExcel(excelFilepath);
}
if (gExcelPercenty == 'on') {
await request_writeExcel_percenty();
}
if (gExcelHeyseller == 'on') {
await request_writeExcel_heyseller();
}
if (gExcelWindly == 'on') {
await request_writeExcel_windly();
}
await openTaoResultFolder();
} catch (_0x3dc069) {
cmJS.AppendLogFile("writeSheet : " + _0x3dc069, "error");
}
}
async function writeSheet_percenty(_0x28d6ef, _0x5b4f5d, _0x1d8173 = 0x32) {
const _0x49e209 = '퍼센티_엑셀수집양식_' + excelVersion + ".xlsx";
const _0x3128f0 = path.resolve("c:/CopyMan/타오맨양식/", _0x49e209);
const _0x2049cf = excelFilepath.split("\\").pop();
let _0x37b987 = new ExcelJS.Workbook();
await _0x37b987.xlsx.readFile(_0x3128f0);
let _0x750261 = await _0x37b987.getWorksheet("multi_ss");
try {
const _0x7c744 = Math.ceil(_0x28d6ef.length / _0x1d8173);
for (let _0x4ea0b2 = 0x0; _0x4ea0b2 < _0x7c744; _0x4ea0b2++) {
let _0x571f1a = _0x4ea0b2 * _0x1d8173;
let _0x39a293 = _0x571f1a + _0x1d8173;
let _0x5c59fa = _0x28d6ef.slice(_0x571f1a, _0x39a293);
_0x5c59fa.forEach((_0x4231eb, _0x1fe121) => {
const _0x117e0d = _0x1fe121 + 0x4;
const _0xeab94b = _0x750261.getRow(_0x117e0d);
_0xeab94b.getCell(0x2).value = _0x4231eb.taobaoUrl;
_0xeab94b.getCell(0x3).value = shuffleItemNm(_0x4231eb.itemName);
_0xeab94b.getCell(0x4).value = parseInt(gAddMargin);
_0xeab94b.getCell(0x7).value = _0x4231eb.cateName;
});
let _0x71afe1 = path.resolve("c:/CopyMan/추출결과_타오맨PRO/", "퍼센티_" + (_0x4ea0b2 + 0x1) + '_' + _0x2049cf);
await saveExcel(_0x37b987, _0x71afe1);
}
if (_0x5b4f5d == "html") {
await alertMsg("퍼센티 엑셀파일을 저장했습니다.");
await openTaoResultFolder();
}
} catch (_0x1f4cea) {
cmJS.AppendLogFile("writeSheet_percenty : " + _0x1f4cea, "error");
}
}
async function writeSheet_heyseller(_0x4a3785, _0x54838b, _0x241014 = 0x32) {
const _0x10ca7c = "헤이셀러_엑셀수집양식_" + excelVersion + '.xlsx';
const _0x26bb95 = path.resolve('c:/CopyMan/타오맨양식/', _0x10ca7c);
const _0x574fd9 = excelFilepath.split("\\").pop();
let _0x5c3fd9 = new ExcelJS.Workbook();
await _0x5c3fd9.xlsx.readFile(_0x26bb95);
let _0x174a66 = await _0x5c3fd9.getWorksheet("상품수집");
try {
const _0x1c284c = Math.ceil(_0x4a3785.length / _0x241014);
for (let _0x3a10ca = 0x0; _0x3a10ca < _0x1c284c; _0x3a10ca++) {
let _0x4a4911 = _0x3a10ca * _0x241014;
let _0x29cc84 = _0x4a4911 + _0x241014;
let _0x474750 = _0x4a3785.slice(_0x4a4911, _0x29cc84);
_0x474750.forEach((_0x205b6e, _0x40b4be) => {
const _0x10bc51 = _0x40b4be + 0x3;
const _0x5937e3 = _0x174a66.getRow(_0x10bc51);
_0x5937e3.getCell(0x5).value = _0x205b6e.taobaoUrl;
_0x5937e3.getCell(0x2).value = shuffleItemNm(_0x205b6e.itemName);
_0x5937e3.getCell(0x1).value = _0x205b6e.cateName;
});
let _0x14ea02 = path.resolve('c:/CopyMan/추출결과_타오맨PRO/', '헤이셀러_' + (_0x3a10ca + 0x1) + '_' + _0x574fd9);
await saveExcel(_0x5c3fd9, _0x14ea02);
}
if (_0x54838b == "html") {
await alertMsg("헤이셀러 엑셀파일을 저장했습니다.");
await openTaoResultFolder();
}
} catch (_0x1f5e4c) {
cmJS.AppendLogFile("writeSheet_heyseller : " + _0x1f5e4c, "error");
}
}
async function writeSheet_windly(_0x234e01, _0x2b9a60, _0x252771 = 0x32) {
const _0x494aaf = "윈들리_엑셀수집양식_" + excelVersion + ".xlsx";
const _0x2b7085 = path.resolve("c:/CopyMan/타오맨양식/", _0x494aaf);
const _0x53b74b = excelFilepath.split("\\").pop();
let _0x1d56b7 = new ExcelJS.Workbook();
await _0x1d56b7.xlsx.readFile(_0x2b7085);
let _0x260734 = await _0x1d56b7.worksheets[0x0];
try {
const _0xca1b6b = Math.ceil(_0x234e01.length / _0x252771);
for (let _0x24b827 = 0x0; _0x24b827 < _0xca1b6b; _0x24b827++) {
let _0x73da23 = _0x24b827 * _0x252771;
let _0x4c43d4 = _0x73da23 + _0x252771;
let _0x21f709 = _0x234e01.slice(_0x73da23, _0x4c43d4);
_0x21f709.forEach((_0x431d7b, _0x2f05d8) => {
const _0x2eeab5 = _0x2f05d8 + 0x7;
const _0x2b19dc = _0x260734.getRow(_0x2eeab5);
_0x2b19dc.getCell(0x6).value = _0x431d7b.taobaoUrl;
_0x2b19dc.getCell(0x4).value = shuffleItemNm(_0x431d7b.itemName);
let _0x4bc708 = _0x431d7b.cateName;
_0x4bc708 = _0x4bc708.replace(/-/g, '>');
_0x2b19dc.getCell(0x3).value = _0x4bc708;
});
let _0x463819 = path.resolve('c:/CopyMan/추출결과_타오맨PRO/', "윈들리_" + (_0x24b827 + 0x1) + '_' + _0x53b74b);
await saveExcel(_0x1d56b7, _0x463819);
}
if (_0x2b9a60 == 'html') {
await alertMsg("윈들리 엑셀파일을 저장했습니다.");
await openTaoResultFolder();
}
} catch (_0x2329a9) {
cmJS.AppendLogFile("writeSheet_windly : " + _0x2329a9, "error");
}
}
async function saveExcel(_0x1227eb, _0x949c48) {
try {
let _0x46dd09 = await _0x1227eb.xlsx.writeBuffer();
await fsp.writeFile(_0x949c48, _0x46dd09);
} catch (_0x5955b5) {
if (isDev) {
console.log("Error: " + _0x5955b5);
}
;
cmJS.AppendLogFile("saveExcel : " + _0x5955b5, "error");
} finally {
buffer = null;
}
}
async function RunExcel(_0x96a06e) {
try {
let _0x4d656d = "start excel \"" + _0x96a06e + "\"";
exec(_0x4d656d, (_0x49f3cc, _0x22459c, _0x3a7347) => {
if (_0x49f3cc) {
cmJS.AppendLogFile("RunExcel : " + _0x49f3cc, "error");
return false;
}
});
return true;
} catch (_0x27d89b) {
cmJS.AppendLogFile("RunExcel : " + _0x27d89b, 'error');
}
}
;
function initExcelFolder() {
try {
let _0xeba6dc = path.resolve(__dirname);
let _0x3efd12 = "퍼센티_엑셀수집양식_" + excelVersion + ".xlsx";
let _0x4ebf4c = "헤이셀러_엑셀수집양식_" + excelVersion + ".xlsx";
let _0x5425c0 = "윈들리_엑셀수집양식_" + excelVersion + '.xlsx';
let _0x481b05 = path.resolve(_0xeba6dc, './excel/' + _0x3efd12);
let _0x54f309 = path.resolve(_0xeba6dc, "./excel/" + _0x4ebf4c);
let _0x132d5a = path.resolve(_0xeba6dc, "./excel/" + _0x5425c0);
let _0xb2efc1 = path.resolve("c:/CopyMan/타오맨양식/", _0x3efd12);
let _0x487545 = path.resolve("c:/CopyMan/타오맨양식/", _0x4ebf4c);
let _0x285a90 = path.resolve("c:/CopyMan/타오맨양식/", _0x5425c0);
if (!fs.existsSync("c:/CopyMan/타오맨양식/")) {
fs.mkdirSync("c:/CopyMan/타오맨양식/", {
'recursive': true
});
}
if (!fs.existsSync("c:/CopyMan/추출결과_타오맨PRO/")) {
fs.mkdirSync("c:/CopyMan/추출결과_타오맨PRO/", {
'recursive': true
});
}
if (!fs.existsSync(_0xb2efc1) || !fs.existsSync(_0x487545) || !fs.existsSync(_0x285a90)) {
let _0x2b9c4e = fs.readFileSync(_0x481b05);
let _0x22a25f = fs.readFileSync(_0x54f309);
let _0xd4bee0 = fs.readFileSync(_0x132d5a);
fs.writeFileSync(_0xb2efc1, _0x2b9c4e);
fs.writeFileSync(_0x487545, _0x22a25f);
fs.writeFileSync(_0x285a90, _0xd4bee0);
}
} catch (_0x5f755a) {
openErrorDialog(_0x5f755a);
cmJS.AppendLogFile("initExcelFolder : " + _0x5f755a, "error");
}
}
async function openTaoResultFolder() {
try {
shell.openPath("c:\\CopyMan\\추출결과_타오맨PRO\\").then(_0x562e9c => {
if (_0x562e9c === '') {} else {
if (isDev) {
console.log("Error: " + _0x562e9c);
}
;
}
});
} catch (_0xbfb767) {
if (isDev) {
console.log("openTaoResultFolder: " + _0xbfb767);
}
;
cmJS.AppendLogFile("openTaoResultFolder : " + _0xbfb767, "error");
}
}
async function getHtml(_0x422f6a, _0x45bc0f) {
try {
let _0x2154c3 = await axiosInstance.get(_0x422f6a);
return cheerio.load(_0x2154c3.data);
} catch (_0x1788c0) {
cmJS.AppendLogFile("getHtml " + _0x422f6a + " : " + _0x1788c0, "error");
}
}
async function getAPI(_0x46d290, _0x275920, _0x236065 = {}, _0x567c05 = false) {
try {
let _0x4e4825 = {
'headers': {
...http_headers,
..._0x236065
},
'params': _0x275920,
'timeout': 0x1388,
'responseType': "json"
};
if (!_0x567c05) {
let _0x4cd0e3 = await axios.get(_0x46d290, _0x4e4825);
return _0x4cd0e3.data;
} else {
let _0x2d1440 = await axios.get(_0x46d290, _0x4e4825).then(function (_0x558735) {
const _0x15bfd8 = _0x558735.headers["x-ratelimit-requests-remaining"];
const _0x1aae7e = _0x558735.headers["x-ratelimit-requests-reset"];
return {
'data': _0x558735.data,
'DAY_REMAIN_LIMIT': _0x15bfd8,
'DAY_RESET': _0x1aae7e
};
})["catch"](function (_0x405d36) {});
return _0x2d1440;
}
} catch (_0x52ac22) {
cmJS.AppendLogFile("getAPI " + _0x46d290 + " : " + _0x52ac22, "error");
}
}
async function readSetting(_0x22af4e = true) {
let _0x2548bc = path.resolve(__dirname, "./userSetting.json");
let _0x3f9b4a = cmJS.getAppDataPath("userSetting.json", "TaoMan_PRO");
let _0x49b7b5 = getDefaultValue();
try {
if (!fs.existsSync(_0x3f9b4a)) {
let _0x1c4430 = fs.readFileSync(_0x2548bc);
fs.writeFileSync(_0x3f9b4a, _0x1c4430);
}
let _0x3eb0a3 = await fsp.readFile(_0x3f9b4a, "utf8");
if (_0x22af4e) {
win.webContents.send('addSetting', _0x3eb0a3);
}
let _0x64608d = JSON.parse(_0x3eb0a3);
gExcelOpen = _0x64608d.search.excelOpen ? _0x64608d.search.excelOpen : _0x49b7b5.excelOpen;
gExcelPercenty = _0x64608d.search.excelPercenty ? _0x64608d.search.excelPercenty : _0x49b7b5.excelPercenty;
gExcelHeyseller = _0x64608d.search.excelHeyseller ? _0x64608d.search.excelHeyseller : _0x49b7b5.excelHeyseller;
gExcelWindly = _0x64608d.search.excelWindly ? _0x64608d.search.excelWindly : _0x49b7b5.excelWindly;
gFixedWord = _0x64608d.search.fixedWord ? _0x64608d.search.fixedWord : _0x49b7b5.fixedWord;
gItemNmMax = _0x64608d.search.itemNmMax ? _0x64608d.search.itemNmMax : _0x49b7b5.itemNmMax;
gAddMargin = _0x64608d.search.addMargin ? _0x64608d.search.addMargin : _0x49b7b5.addMargin;
} catch (_0x1dbaaf) {
cmJS.AppendLogFile("readSetting : " + _0x1dbaaf, 'error');
}
}
async function setSetting(_0x500200) {
let _0x203367 = path.resolve(__dirname, "./userSetting.json");
let _0x52ff6f = cmJS.getAppDataPath("userSetting.json", "TaoMan_PRO");
try {
if (!fs.existsSync(_0x52ff6f)) {
let _0x4dca94 = fs.readFileSync(_0x203367);
fs.writeFileSync(_0x52ff6f, _0x4dca94);
}
let _0x431697 = fs.readFileSync(_0x52ff6f, "utf8");
let _0x7f7c68 = JSON.parse(_0x431697);
_0x7f7c68.search.excelOpen = _0x500200.excelOpen;
_0x7f7c68.search.excelPercenty = _0x500200.excelPercenty;
_0x7f7c68.search.excelHeyseller = _0x500200.excelHeyseller;
_0x7f7c68.search.excelWindly = _0x500200.excelWindly;
_0x7f7c68.search.fixedWord = _0x500200.fixedWord;
_0x7f7c68.search.itemNmMax = _0x500200.itemNmMax;
_0x7f7c68.search.addMargin = _0x500200.addMargin;
fs.writeFile(_0x52ff6f, JSON.stringify(_0x7f7c68, null, 0x4), "utf8", async _0x557292 => {
if (_0x557292) {
cmJS.AppendLogFile("setSetting writeFile : " + _0x557292, 'error');
return;
}
await readSetting(false);
await alertMsg("설정이 업데이트 되었습니다.");
});
} catch (_0x3d400c) {
cmJS.AppendLogFile("setSetting : " + _0x3d400c, "error");
}
}
function shuffleItemNm(_0x142c31) {
try {
const _0x1609a0 = _0x142c31.split(" ");
const _0x1654ba = _0x1609a0.slice(0x0, gFixedWord);
let _0xcd12e2 = _0x1609a0.slice(gFixedWord);
for (let _0x34926b = _0xcd12e2.length - 0x1; _0x34926b > 0x0; _0x34926b--) {
let _0x3e35e3 = Math.floor(Math.random() * (_0x34926b + 0x1));
[_0xcd12e2[_0x34926b], _0xcd12e2[_0x3e35e3]] = [_0xcd12e2[_0x3e35e3], _0xcd12e2[_0x34926b]];
}
let _0x110fe4 = _0x1654ba.concat(_0xcd12e2);
_0x110fe4 = _0x110fe4.join(" ");
_0x110fe4 = _0x110fe4.substring(0x0, gItemNmMax);
return _0x110fe4;
} catch (_0x69517f) {
cmJS.AppendLogFile("shuffleItemNm : " + _0x69517f, "error");
} finally {}
}
async function getExchangeRate() {
try {
let _0x378be3 = await getHtml('https://obank.kbstar.com/quics?chgCompId=b101827&baseCompId=b101827&page=C101423&cc=b101827:b101827&%EC%A1%B0%ED%9A%8C%EB%85%84%EC%9B%94%EC%9D%BC=20241112&%EB%93%B1%EB%A1%9D%ED%9A%8C%EC%B0%A8=00000&monyCd=&selDate=20240104&strFocusBtn=&%EC%A1%B0%ED%9A%8C%EB%82%A0%EC%A7%9C%EA%B8%B0%EC%A4%80=&%EA%B3%A0%EC%8B%9C%ED%9A%8C%EC%B0%A8%EA%B8%B0%EC%A4%80=1&%ED%86%B5%ED%99%94%EC%84%A0%ED%83%9D%EA%B8%B0%EC%A4%80=1&btnClick=Y&searchDate=20240104&%EA%B3%A0%EC%8B%9C%ED%9A%8C%EC%B0%A8%EC%84%A0%ED%83%9D=1');
let _0x5ab13f = _0x378be3("#inqueryTable > table:nth-child(2) > tbody > tr:nth-child(10) > td:nth-child(3)").text();
let _0x3968d0 = _0x5ab13f.match(/\d+(\.\d+)?/g);
let _0x387671 = parseFloat(_0x3968d0[0x0]);
_0x387671 = _0x387671 ? _0x387671 : 0x0;
return _0x387671 || 0x0;
} catch (_0x2536ad) {
cmJS.AppendLogFile("getExchangeRate : " + _0x2536ad, 'error');
} finally {
str = null;
}
}
async function updateExchangeRate() {
try {
let _0x5a9740 = false;
let _0x164cf0 = path.resolve(__dirname, "./userSetting.json");
let _0x2f823d = cmJS.getAppDataPath("userSetting.json", "TaoMan_PRO");
try {
if (!fs.existsSync(_0x2f823d)) {
let _0x5e9145 = fs.readFileSync(_0x164cf0);
fs.writeFileSync(_0x2f823d, _0x5e9145);
}
const _0x1def08 = fs.readFileSync(_0x2f823d, "utf8");
let _0x52b41c = JSON.parse(_0x1def08);
if (!_0x52b41c.exRate) {
let _0x2ab633 = await getExchangeRate();
let _0x439279 = cmJS.formatCurDTTM("default");
_0x52b41c.exRate = {
'val': _0x2ab633,
'date': _0x439279
};
_0x5a9740 = true;
} else {
if (cmJS.getDateDiff(_0x52b41c.exRate.date)) {
let _0xd2fd28 = await getExchangeRate();
let _0x520b2b = cmJS.formatCurDTTM('default');
_0x52b41c.exRate.val = _0xd2fd28;
_0x52b41c.exRate.date = _0x520b2b;
_0x5a9740 = true;
}
}
gExRate = _0x52b41c.exRate.val;
if (_0x5a9740) {
fs.writeFile(_0x2f823d, JSON.stringify(_0x52b41c, null, 0x4), "utf8", async _0x360af4 => {
if (_0x360af4) {
cmJS.AppendLogFile("updateExchangeRate writeFile : " + _0x360af4, 'error');
return;
}
});
}
} catch (_0x529cd1) {
throw _0x529cd1;
} finally {
fileContent1 = null;
data = null;
}
} catch (_0xe69928) {
cmJS.AppendLogFile("updateExchangeRate : " + _0xe69928, "error");
}
}
function openErrorDialog(_0x4dd646) {
try {
dialog.showErrorBox("Error Message", _0x4dd646);
} catch (_0x51f346) {
return false;
}
}
function requestCheckedItems() {
checkedItemsPromise = new Promise(_0x402d93 => {
ipcMain.once("response_checkedItems", (_0x5b40d8, _0x5ec691) => {
_0x402d93(_0x5ec691);
});
});
win.webContents.send("request_checkedItems");
return checkedItemsPromise;
}
function requestWriteExcel() {
win.webContents.send("request_writeExcel");
}
function writeHtml(_0x2e2c0e, _0xfbff4c) {
try {
win.webContents.send('writeHtml', _0x2e2c0e);
} catch (_0x564318) {
if (isDev) {
console.log("Error: " + _0x564318);
}
;
}
}
;
function AddErrorMessage(_0x3cf92f, _0x2528d1, _0x442c7f) {
try {
if (_0x2528d1 == 'error') {
win.webContents.send("error", _0x3cf92f, _0x442c7f);
}
} catch (_0x57d558) {
if (isDev) {
console.log("Error: " + _0x57d558);
}
;
}
}
;
function AddProgress(_0xb8b9f6, _0x32a14c, _0x16b28d, _0x227a5b) {
try {
win.webContents.send("progress", _0xb8b9f6, _0x32a14c, _0x16b28d);
} catch (_0x5480b9) {
if (isDev) {
console.log("Error: " + _0x5480b9);
}
;
}
}
;
function showLoading(_0x112277) {
win.webContents.send("loading", _0x112277);
}
;
function resultExcel(_0xcf3295, _0x2cb245) {
try {
win.webContents.send("resultExcel", _0xcf3295);
} catch (_0x1021d2) {
if (isDev) {
console.log("Error: " + _0x1021d2);
}
;
}
}
;
function resultLicense(_0x895132, _0x33dbe3) {
try {
win.webContents.send("resultLicense", _0x895132);
} catch (_0x310204) {
if (isDev) {
console.log("Error: " + _0x310204);
}
;
}
}
;
function CLCT_STRT(_0x39c10b, _0x4df73c) {
try {
win.webContents.send('CLCT_STRT', _0x39c10b, _0x4df73c);
} catch (_0x5d1c86) {
if (isDev) {
console.log("Error: " + _0x5d1c86);
}
;
}
}
;
function request_writeExcel_percenty() {
try {
win.webContents.send('request_writeExcel_percenty');
} catch (_0x32bff7) {
if (isDev) {
console.log("Error: " + _0x32bff7);
}
;
}
}
;
function request_writeExcel_heyseller() {
try {
win.webContents.send("request_writeExcel_heyseller");
} catch (_0x2fe006) {
if (isDev) {
console.log("Error: " + _0x2fe006);
}
;
}
}
;
function request_writeExcel_windly() {
try {
win.webContents.send("request_writeExcel_windly");
} catch (_0x14fce2) {
if (isDev) {
console.log("Error: " + _0x14fce2);
}
;
}
}
;
function alertMsg(_0x147c0a) {
try {
win.webContents.send("alertMsg", _0x147c0a);
} catch (_0x5de5a4) {
if (isDev) {
console.log("Error >>", _0x5de5a4);
} else {
'';
}
}
}
;
function confirmMsg(_0x1e02f9, _0x41cc85) {
try {
win.webContents.send("confirmMsg", _0x1e02f9, _0x41cc85);
} catch (_0x43a26b) {
if (isDev) {
console.log("Error >>", _0x43a26b);
} else {
'';
}
}
}
;
function sendStatus(_0x417327) {
try {
win.webContents.send("getStatus", _0x417327);
} catch (_0x1b3faa) {
if (isDev) {
console.log("Error: " + _0x1b3faa);
}
}
}
;
async function sendStatus_limit() {
try {
const _0x1a366b = await getPayday(licenseKey.licenseKey);
if (typeof _0x1a366b == "string") {
_0x1a366b = JSON.parse(_0x1a366b);
}
let _0x4306a9 = {
'payday': _0x1a366b.payday,
'day_call_limit': _0x1a366b.DAY_CALL_LIMIT,
'day_remain_qy': _0x1a366b.DAY_REMAIN_QY,
'next_api_dt': _0x1a366b.NEXT_API_DT
};
win.webContents.send("getStatus_limit", _0x4306a9);
} catch (_0x33ca7f) {
if (isDev) {
console.log("Error: " + _0x33ca7f);
}
}
}
;
function showInfoModal(_0x510031, _0x3b868c, _0xac9f0e) {
try {
win.webContents.send("showInfo", _0x510031, _0x3b868c, _0xac9f0e);
} catch (_0x249e03) {
if (isDev) {
console.log("Error: " + _0x249e03);
}
;
}
}
;
function showLicenseModal(_0x208db6, _0x2e4727, _0x2f1c9d) {
try {
win.webContents.send("showLicense", _0x208db6, _0x2e4727, _0x2f1c9d);
} catch (_0x4bc63c) {
if (isDev) {
console.log("Error: " + _0x4bc63c);
}
;
}
}
;
function showSettingModal(_0x1e811a) {
try {
win.webContents.send('showSetting', _0x1e811a);
} catch (_0x24f8aa) {
if (isDev) {
console.log("Error: " + _0x24f8aa);
}
;
}
}
;
function hideAllModal() {
try {
win.webContents.send('hideAllModal');
} catch (_0x387f40) {
if (isDev) {
console.log("Error: " + _0x387f40);
}
;
}
}
;
function hideAllLoader() {
try {
win.webContents.send("hideAllLoader");
} catch (_0x259c30) {
if (isDev) {
console.log("Error: " + _0x259c30);
}
;
}
}
;
ipcMain.on("AllStop", (_0x21e68f, _0x2f7ff4) => {
isAllStop = true;
stop_getTaobao(true);
});
ipcMain.on('writeSheet', (_0x244452, _0x2b087a) => {
writeSheet(_0x2b087a);
});
ipcMain.on("writeSheet_percenty", (_0x26c66b, _0x4d60f6, _0x458430) => {
writeSheet_percenty(_0x4d60f6, _0x458430);
});
ipcMain.on('writeSheet_heyseller', (_0x2cf53d, _0x2ff1da, _0x383191) => {
writeSheet_heyseller(_0x2ff1da, _0x383191);
});
ipcMain.on('writeSheet_windly', (_0x5f0524, _0x6dc0a4, _0x3e12ee) => {
writeSheet_windly(_0x6dc0a4, _0x3e12ee);
});
ipcMain.on("open-url", (_0x27b82e, _0x5072e9) => {
try {
shell.openExternal(_0x5072e9);
} catch (_0x5e27cf) {
if (isDev) {
console.log("Error: " + _0x5e27cf.message);
}
}
});
ipcMain.on("open-error-dialog", (_0x35e1ef, _0x54a253) => {
openErrorDialog(_0x54a253);
});
ipcMain.on("open-excel-folder", (_0x414ba6, _0x2fdb67) => {
try {
shell.openPath("c:\\CopyMan\\").then(_0x2071e0 => {
if (_0x2071e0 === '') {} else {
console.log("An error occurred: " + _0x2071e0);
}
});
} catch (_0x2acbb3) {
if (isDev) {
console.log("Error: " + _0x2acbb3);
}
;
}
});
ipcMain.on("readSetting", (_0x14c01b, _0x4d49b2) => {
readSetting();
});
ipcMain.on('setSetting', (_0x24bfd2, _0x140b38) => {
setSetting(_0x140b38);
});
ipcMain.on("setLicenseKey", (_0x1b61ef, _0x12e7f3) => {
try {
let _0x57718e = path.resolve(__dirname);
_0x12e7f3.homePath = _0x57718e;
_0x12e7f3.lcPath = "%LOCALAPPDATA%\\TaoMan_PRO\\";
let _0xaf2539 = JSON.stringify(_0x12e7f3);
let _0x484308 = spawn(path.join(__dirname, "/license.exe"), [_0xaf2539]);
let _0x3a3ebc = readline.createInterface({
'input': _0x484308.stdout,
'output': process.stdout,
'terminal': false
});
_0x3a3ebc.on("line", _0x2b60cd => {
let _0x113710 = _0x2b60cd.toString();
if (cmJS.chkInStrStart('[LOG]', _0x113710)) {} else {
if (cmJS.chkInStrStart("[result]", _0x113710)) {
resultLicense(_0x113710.replace("[result]", '').trim(), "result");
return false;
} else {
if (cmJS.chkInStrStart('[error]', _0x113710)) {
AddErrorMessage(_0x113710.replace("[error]", '').trim(), "error");
return false;
}
}
}
});
} catch (_0x3b2f02) {
if (isDev) {
console.log("Error: " + _0x3b2f02);
}
;
}
});
async function readLicenseKey() {
let _0x395a62 = cmJS.getAppDataPath("lc.json", "TaoMan_PRO");
let _0x86302f;
let _0x582852;
try {
_0x582852 = await fsp.readFile(_0x395a62, "utf8");
} catch (_0x4e9e42) {
if (_0x4e9e42.code === "ENOENT") {
_0x582852 = '';
} else {}
}
try {
if (!_0x582852) {
args = {
'licenseKey': '',
'EML': '',
'ORD_ID': '',
'LC_TY': '',
'BUY_MK': ''
};
} else {
_0x86302f = JSON.parse(_0x582852);
args = {
'licenseKey': _0x86302f.license.licenseKey,
'EML': _0x86302f.license.EML,
'ORD_ID': _0x86302f.license.ORD_ID,
'LC_TY': _0x86302f.license.LC_TY,
'BUY_MK': _0x86302f.license.BUY_MK
};
}
return args;
} catch (_0x2ab659) {
if (isDev) {
console.log("Error: " + _0x2ab659);
}
;
cmJS.AppendLogFile("readLicenseKey : " + _0x2ab659, "error");
}
}
async function ValidateLicenseKey() {
let _0x339d79 = cmJS.getAppDataPath("lc.json", 'TaoMan_PRO');
let _0x2078fc;
try {
_0x2078fc = await fsp.readFile(_0x339d79, "utf8");
} catch (_0xe530ee) {
cmJS.AppendLogFile("시스템에 등록된 라이센스가 없습니다.", 'error');
alertMsg("시스템에 등록된 라이센스가 없습니다.");
return false;
}
try {
let _0x1bb702 = JSON.parse(_0x2078fc);
let _0x489a6b = _0x1bb702.license.licenseKey;
if (!_0x489a6b) {
cmJS.AppendLogFile("시스템에 등록된 라이센스가 없습니다.", "error");
alertMsg("시스템에 등록된 라이센스가 없습니다.");
return false;
}
let _0x95f5e9 = "http://data.panpan.co.kr/validate/" + _0x489a6b;
let _0x1d6daf = await axiosInstance.get(_0x95f5e9);
let _0x28eb2e = JSON.parse(_0x1d6daf.data);
if (_0x28eb2e.check != "valid") {
if (_0x28eb2e.CHG_NUM > 0x4) {
cmJS.AppendLogFile("ValidateLicenseKey : 설치횟수 " + _0x28eb2e.CHG_NUM + '회', "error");
alertMsg("ValidateLicenseKey : 설치횟수 " + _0x28eb2e.CHG_NUM + '회');
return false;
} else {
cmJS.AppendLogFile("ValidateLicenseKey : 라이센스 없음", "error");
alertMsg("ValidateLicenseKey : 라이센스 없음");
return false;
}
return false;
} else {
return true;
}
return true;
} catch (_0x5d89d9) {
cmJS.AppendLogFile("ValidateLicenseKey : " + _0x5d89d9, "error");
}
}
async function getPayday(_0x39dff0) {
try {
let _0x4c2323 = {
'timeout': 0x2710,
'responseType': "json"
};
const _0x2ce04c = "http://data.panpan.co.kr/dayRemainLimit?LC_KEY=" + _0x39dff0;
let _0x4dd93a = await axios.get(_0x2ce04c, _0x4c2323);
return _0x4dd93a.data;
} catch (_0x5c8efc) {
cmJS.AppendLogFile("getPayday : " + _0x5c8efc, "error");
}
}
function getMacAddress(_0x5c2980) {
try {
let _0x51307d = os.networkInterfaces();
for (let _0x345908 in _0x51307d) {
let _0x153a34 = _0x51307d[_0x345908];
for (let _0xd2897e of _0x153a34) {
if (!cmJS.chkInStrStart('00:00', _0xd2897e.mac) && _0xd2897e.family == "IPv4" && _0xd2897e.address !== '127.0.0.1') {
let _0x29aa1e = {
'ip': _0xd2897e.address,
'mac': _0xd2897e.mac
};
return _0x29aa1e;
}
}
}
} catch (_0x4f54ce) {
cmJS.AppendLogFile("getMacAddress : " + _0x4f54ce, "error");
}
}