Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
马玮
/
carspider
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fe17e966
authored
Aug 03, 2017
by
马玮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change code style
parent
63289abf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
50 deletions
+32
-50
boot.js
+0
-1
config/default.toml
+11
-11
lib/captcha/index.js
+7
-6
lib/captcha/ruokuai.js
+8
-8
test/testcaptcha.js
+6
-4
testcaptcha.js
+0
-20
No files found.
boot.js
View file @
fe17e966
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
User: MaWei
User: MaWei
Date: 2017.7.31
Date: 2017.7.31
*/
*/
const
path
=
require
(
'path'
);
const
path
=
require
(
'path'
);
const
program
=
require
(
'commander'
);
const
program
=
require
(
'commander'
);
const
config
=
require
(
'config'
);
const
config
=
require
(
'config'
);
...
...
config/default.toml
View file @
fe17e966
...
@@ -5,29 +5,29 @@ host = "http://api.dama2.com:7766/app/"
...
@@ -5,29 +5,29 @@ host = "http://api.dama2.com:7766/app/"
user
=
"test"
user
=
"test"
pwd
=
"test"
pwd
=
"test"
[
dealer_account
.ifeng]
[
Dealer
.ifeng]
username
=
"上海车城汽车"
username
=
"上海车城汽车"
password
=
"Checheng235#"
password
=
"Checheng235#"
captcha
_type
=
"4_letter_number
"
captcha
Type
=
"FOUR_CHARACTERS
"
[
dealer_account
.easypass]
[
Dealer
.easypass]
username
=
"100074110"
username
=
"100074110"
password
=
"hnmz147852"
password
=
"hnmz147852"
captcha
_type
=
"calculation
"
captcha
Type
=
"ARITHMETIC
"
[
dealer_account
.autohome]
[
Dealer
.autohome]
username
=
"河南明志汽车大迈8054"
username
=
"河南明志汽车大迈8054"
password
=
"hnmz147852"
password
=
"hnmz147852"
captcha
_type
=
"4_letter
"
captcha
Type
=
"FOUR_LETTERS
"
[
c
aptcha.ruokuai]
[
C
aptcha.ruokuai]
username
=
"chedev"
username
=
"chedev"
password
=
"Checheng235#"
password
=
"Checheng235#"
softid
=
86134
softid
=
86134
softkey
=
"b167ed636a224990a2f04ae2d28d1542"
softkey
=
"b167ed636a224990a2f04ae2d28d1542"
[
c
aptcha.ruokuai.typeids]
[
C
aptcha.ruokuai.typeids]
4
_letter
=
2040
FOUR_LETTERS
=
2040
# 四个英文字母
4
_letter_number
=
3040
FOUR_CHARACTERS
=
3040
# 四个字母数字混合
calculation
=
7100
ARITHMETIC
=
7100
# 算术题
lib/captcha/index.js
View file @
fe17e966
...
@@ -2,11 +2,11 @@ const config = require('config');
...
@@ -2,11 +2,11 @@ const config = require('config');
const
ruokuai
=
require
(
'./ruokuai'
);
const
ruokuai
=
require
(
'./ruokuai'
);
const
captcha
=
exports
;
const
captcha
=
exports
;
captcha
.
decode
=
function
(
captcha
_type
,
imagef
ile
,
callback
)
{
captcha
.
decode
=
function
(
captcha
Type
,
imageF
ile
,
callback
)
{
console
.
log
(
captcha
_t
ype
);
console
.
log
(
captcha
T
ype
);
console
.
log
(
image
f
ile
);
console
.
log
(
image
F
ile
);
const
typeids
=
config
.
get
(
'
c
aptcha.ruokuai.typeids'
);
const
typeids
=
config
.
get
(
'
C
aptcha.ruokuai.typeids'
);
typeid
=
typeids
[
captcha
_t
ype
];
typeid
=
typeids
[
captcha
T
ype
];
ruokuai
.
decode
(
typeid
,
image
f
ile
,
function
(
captcha
)
{
ruokuai
.
decode
(
typeid
,
image
F
ile
,
function
(
captcha
)
{
});
});
}
}
\ No newline at end of file
lib/captcha/ruokuai.js
View file @
fe17e966
...
@@ -7,16 +7,16 @@ const request = require('request');
...
@@ -7,16 +7,16 @@ const request = require('request');
const
filename
=
'2.png'
;
const
filename
=
'2.png'
;
let
ruokuai
=
exports
;
let
ruokuai
=
exports
;
ruokuai
.
decode
=
function
(
typeid
,
image
f
ile
,
callback
)
{
ruokuai
.
decode
=
function
(
typeid
,
image
F
ile
,
callback
)
{
let
ruokuai
_info
=
config
.
get
(
'c
aptcha.ruokuai'
);
let
ruokuai
Info
=
config
.
get
(
'C
aptcha.ruokuai'
);
const
image
=
fs
.
createReadStream
(
image
f
ile
);
const
image
=
fs
.
createReadStream
(
image
F
ile
);
formData
=
{
formData
=
{
username
:
ruokuai
_i
nfo
.
username
,
username
:
ruokuai
I
nfo
.
username
,
password
:
ruokuai
_i
nfo
.
password
,
password
:
ruokuai
I
nfo
.
password
,
softid
:
ruokuai
_i
nfo
.
softid
,
softid
:
ruokuai
I
nfo
.
softid
,
softkey
:
ruokuai
_i
nfo
.
softkey
,
softkey
:
ruokuai
I
nfo
.
softkey
,
typeid
:
typeid
,
typeid
:
typeid
,
image
:
fs
.
createReadStream
(
image
f
ile
)
image
:
fs
.
createReadStream
(
image
F
ile
)
}
}
request
.
post
({
url
:
'http://api.ruokuai.com/create.json'
,
formData
:
formData
},
function
optionalCallback
(
err
,
httpResponse
,
body
)
{
request
.
post
({
url
:
'http://api.ruokuai.com/create.json'
,
formData
:
formData
},
function
optionalCallback
(
err
,
httpResponse
,
body
)
{
if
(
err
)
{
if
(
err
)
{
...
...
test/testcaptcha.js
View file @
fe17e966
...
@@ -2,9 +2,11 @@
...
@@ -2,9 +2,11 @@
User: MaWei
User: MaWei
Date: 2017.7.31
Date: 2017.7.31
*/
*/
process
.
env
.
NODE_CONFIG_DIR
=
'../config'
;
const
program
=
require
(
'commander'
);
const
program
=
require
(
'commander'
);
const
config
=
require
(
'config'
);
const
config
=
require
(
'config'
);
const
captcha
=
require
(
'./lib/captcha'
);
const
captcha
=
require
(
'.
.
/lib/captcha'
);
program
program
.
version
(
'1.0.0'
)
.
version
(
'1.0.0'
)
...
@@ -12,8 +14,7 @@ program
...
@@ -12,8 +14,7 @@ program
.
parse
(
process
.
argv
);
.
parse
(
process
.
argv
);
(
function
()
{
(
function
()
{
console
.
log
(
config
);
captcha_type
=
config
.
get
(
'Dealer'
)[
program
.
website
][
'captchaType'
];
captcha_type
=
config
.
get
(
'dealer_account'
)[
program
.
website
][
'captcha_type'
];
const
imagefile
=
'images/'
+
program
.
website
+
'.png'
;
const
imagefile
=
'test/images/'
+
program
.
website
+
'.png'
;
captcha
.
decode
(
captcha_type
,
imagefile
);
captcha
.
decode
(
captcha_type
,
imagefile
);
}());
}());
\ No newline at end of file
testcaptcha.js
deleted
100755 → 0
View file @
63289abf
/*
User: MaWei
Date: 2017.7.31
*/
const
program
=
require
(
'commander'
);
const
config
=
require
(
'config'
);
const
captcha
=
require
(
'./lib/captcha'
);
program
.
version
(
'1.0.0'
)
.
option
(
'-w, --website <website name>'
,
'Add website we want fetch'
)
.
parse
(
process
.
argv
);
(
function
()
{
console
.
log
(
config
);
captcha_type
=
config
.
get
(
'dealer_account'
)[
program
.
website
][
'captcha_type'
];
const
imagefile
=
'test/images/'
+
program
.
website
+
'.png'
;
captcha
.
decode
(
captcha_type
,
imagefile
);
}());
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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