Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
What's new
2
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Projects
Groups
Snippets
Sign up now
Login
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈子云
nodePractice
Commits
64d3bf28
Commit
64d3bf28
authored
Jun 23, 2016
by
陈子云
Browse files
加入伪造接口
parent
8982ca35
Changes
5
Hide whitespace changes
Inline
Side-by-side
form/server1.js
View file @
64d3bf28
var
http
=
require
(
"
http
"
);
var
url
=
require
(
"
url
"
);
var
fs
=
require
(
'
fs
'
);
var
jade
=
require
(
'
jade
'
)
,
querystring
=
require
(
'
querystring
'
);
var
jade
=
require
(
'
jade
'
)
;
var
querystring
=
require
(
'
querystring
'
);
function
start
()
{
function
onRequest
(
request
,
response
)
{
...
...
interface/app.js
0 → 100644
View file @
64d3bf28
var
http
=
require
(
'
http
'
);
var
url
=
require
(
'
url
'
);
var
fs
=
require
(
'
fs
'
);
var
deal
=
require
(
'
./deal
'
);
function
start
()
{
function
onRequest
(
request
,
response
)
{
var
params
=
url
.
parse
(
request
.
url
,
true
),
pathname
=
params
.
pathname
;
//静态资源服务器
//fs.readFile(filename,[options],callback);
if
(
pathname
===
'
/
'
)
{
response
.
end
(
'
index page,the author only left this message
'
);
}
else
{
fs
.
readFile
(
__dirname
+
pathname
,
'
utf8
'
,
function
(
err
,
file
){
if
(
err
&&
err
.
code
===
'
ENOENT
'
)
{
response
.
writeHead
(
404
,
{
'
Content-Type
'
:
'
text/plain
'
});
response
.
write
(
err
+
"
\n
"
);
response
.
end
();
}
else
if
(
err
)
{
response
.
writeHead
(
500
,
{
'
Content-Type
'
:
'
text/plain
'
});
response
.
write
(
err
+
"
\n
"
);
response
.
end
();
}
else
{
response
.
writeHead
(
200
,
{
'
Content-Type
'
:
'
text/plain
'
});
if
(
params
.
query
&&
params
.
query
.
callback
)
{
var
str
=
params
.
query
.
callback
+
'
(
'
+
deal
(
file
)
+
'
)
'
;
response
.
end
(
str
);
}
else
{
response
.
end
(
deal
(
file
));
//普通的json
}
}
});
}
}
var
port
=
process
.
argv
[
2
]
||
9527
;
http
.
createServer
(
onRequest
).
listen
(
port
);
console
.
log
(
"
Server has started at port
"
+
port
);
}
start
();
interface/dafengche-price-tag/carinfoprice.json
0 → 100644
View file @
64d3bf28
{
factoryWarranty:
"2年12个月"
,
carAssessorName:
"{{string|10}}"
,
colorName:
"白色"
,
carId:
"23e18af3968d46339662dbdd17d86548"
,
mileage:
"{{num}}.00"
,
newPrice:
"{{num|1-99}}.57"
,
status:
"ok"
,
internetPrice:
"{{num|1-99}}.00"
,
carPic:
"files/default/cc0b9a52dfac55099ae55c6906b138dc"
,
qrCode:
"https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFg8DoAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL0lFeFJoMDdsU1kwd2VHaUVqbUN4AAIEFLM_VgMEAAAAAA=="
,
userDefinedNumber:
"MH2004"
,
isInsuranceExpired:
"无"
,
engineVolumeName:
"0.0L"
,
purchaseTax:
"20128"
,
emissionStandardName:
"国四"
,
shopName:
"杭州旗舰店"
,
newPriceIncludeTax:
"25.57"
,
carName:
"安凯客车2014款 宝斯通 3.0T VIP版安凯客车20安凯客车安"
,
salePrice:
"12.00"
,
logo:
"20160616/jpg/dc6160de5157ee694e03328f2bbf1bf3.jpg"
,
reportId:
'
94
r
982
eAaIaXacG'
,
tagList:
[
{
type:
"fbsz"
,
value:
"防抱死制动系统"
},
{
type:
"aqql"
,
value:
"安全气囊"
},
{
type:
"brakeAssist"
,
value:
"刹车辅助系统"
},
{
type:
"stabilityControl"
,
value:
"车身稳定控制系统"
},
{
type:
"backMirrorElectricAdjustment"
,
value:
"后视镜电动调节"
},
{
type:
"ddxt"
,
value:
"导航"
},
{
type:
"dvdd"
,
value:
"CD/DVD"
},
{
type:
"zdhw"
,
value:
"空调"
},
{
type:
"centralDoorLock"
,
value:
"中控锁"
},
{
type:
"remoteKey"
,
value:
"遥控钥匙"
},
{
type:
"yjqd"
,
value:
"一键启动"
},
{
type:
"qhdd"
,
value:
"电动车窗"
},
{
type:
"backRada"
,
value:
"倒车雷达"
},
{
type:
"dcyx"
,
value:
"倒车影像"
},
{
type:
"spareWheel"
,
value:
"备用轮胎"
},
{
type:
"dsxh"
,
value:
"定速巡航"
},
{
type:
"qjtc"
,
value:
"天窗"
},
{
type:
"leatherSeat"
,
value:
"真皮座椅"
},
{
type:
"ddtj"
,
value:
"前座椅电动调节"
}
],
firstLicensePlateDate:
{{
date|
0-10
}},
insuranceExpiresDate:
1464710400000
,
commercialInsuranceExpiresDate:
1464710400000
,
sparePrice:
"13.57"
,
summary:
"哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈哈哈哈,,这个是一个测试哇哈"
,
}
\ No newline at end of file
interface/dafengche-price-tag/detection.json
0 → 100644
View file @
64d3bf28
{
"success"
:
true
,
"code"
:
10000
,
"msg"
:
"success"
,
"data"
:
{
"processorName"
:
"13685846898"
,
"auditPassDate"
:
"2016-06-16"
,
"level"
:
"A"
,
"slogan"
:
"专业事故鉴定,如错包退!
\n
100% 真实描述,如错包赔!"
,
"cheniu_promise_rule_url"
:
"http://f2e.souche.com/cheniu/detail/detect_promise.html"
,
"cheniu_level_rule_url"
:
"http://f2e.souche.com/cheniu/detail/rate_rule.html?level=A%2B%2B"
,
"summary"
:
[
{
"total"
:
30
,
"abnormal"
:
1
,
"name"
:
"事故排查"
,
"link"
:
"accident"
},
{
"total"
:
51
,
"abnormal"
:
0
,
"name"
:
"外观内饰"
,
"link"
:
"appearance"
},
{
"total"
:
5
,
"abnormal"
:
0
,
"name"
:
"机械部件"
,
"link"
:
"machine"
},
{
"total"
:
7
,
"abnormal"
:
0
,
"name"
:
"电器检测"
,
"link"
:
"appliance"
}
],
"remark"
:
""
}
}
\ No newline at end of file
interface/deal.js
0 → 100644
View file @
64d3bf28
var
crypto
=
require
(
'
crypto
'
);
var
generateRandomNum
=
function
(
base
,
limit
)
{
//产生从base到limit范围内的数字
min
=
+
base
;
max
=
+
limit
-
min
+
1
;
return
Math
.
floor
((
Math
.
random
()
*
max
+
min
));
};
var
generateRandomString
=
function
(
len
)
{
//产生len位长度的随机字符串
len
=
+
len
;
var
rdmString
=
""
;
for
(;
rdmString
.
length
<
len
;
rdmString
+=
Math
.
random
().
toString
(
36
).
substr
(
2
));
return
rdmString
.
substr
(
0
,
len
);
};
var
generateRandomDate
=
function
(
past
,
future
)
{
//产生从现在为起点,过去past年到未来future年间的时间
var
rdmString
=
''
,
now
=
new
Date
().
getTime
();
past
=
+
past
*
31536000000
;
future
=
+
future
*
31536000000
;
min
=
now
-
past
,
max
=
future
+
past
;
return
Math
.
floor
((
Math
.
random
()
*
max
+
min
));
};
var
deal
=
function
(
data
){
//正则匹配,抓出类型然后替换字符
var
result
=
data
;
//var reg = /{{[A-Za-z0-9\|\-]+}}/g;
//result = result.replace(reg, '11');
result
=
result
.
replace
(
/{{
[
A-Za-z0-9
\|\-]
+}}/g
,
function
(
word
){
var
arr
,
newWord
,
temp
;
//去除双括号
word
=
word
.
slice
(
2
);
word
=
word
.
slice
(
0
,
word
.
length
-
2
);
//比如说拆分成["{{num", "1-11}}"]
arr
=
word
.
split
(
'
|
'
);
arr
[
0
]
=
arr
[
0
].
trim
();
arr
[
1
]
?
arr
[
1
]
=
arr
[
1
].
trim
()
:
''
;
newWord
=
word
;
switch
(
arr
[
0
].
trim
())
{
case
'
num
'
:
//默认随机数从0到9999
arr
[
1
]
?
temp
=
arr
[
1
].
split
(
'
-
'
)
:
temp
=
[
0
,
9999
];
newWord
=
generateRandomNum
(
temp
[
0
],
temp
[
1
]);
break
;
case
'
string
'
:
//默认字符串位数有10位
arr
[
1
]
?
temp
=
arr
[
1
]
:
temp
=
10
;
newWord
=
generateRandomString
(
temp
);
break
;
case
'
date
'
:
//默认时间为本地时间的前10年到后10年间。
arr
[
1
]
?
temp
=
arr
[
1
].
split
(
'
-
'
)
:
temp
=
[
10
,
10
];
newWord
=
generateRandomDate
(
temp
[
0
],
temp
[
1
]);
break
;
default
:
newWord
=
word
;
}
return
newWord
;
});
return
result
;
};
module
.
exports
=
deal
;
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment