Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
px3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangmingming
px3
Commits
5778036d
Commit
5778036d
authored
Apr 24, 2024
by
wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
f9
parent
fff00571
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
run.js
src/run.js
+18
-16
No files found.
src/run.js
View file @
5778036d
...
@@ -3,7 +3,9 @@ import {bl, genUuid, ht, ie, Ol, randint, se} from "./utils.js"
...
@@ -3,7 +3,9 @@ import {bl, genUuid, ht, ie, Ol, randint, se} from "./utils.js"
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
{
PxEnv
}
from
'./px.js'
import
{
PxEnv
}
from
'./px.js'
import
{
MongoClient
}
from
"mongodb"
;
import
{
MongoClient
}
from
"mongodb"
;
import
*
as
fs
from
"fs"
;
let
ENVS
=
JSON
.
parse
(
fs
.
readFileSync
(
'./env.json'
,
'utf-8'
).
toString
())
let
keys
=
Object
.
keys
(
ENVS
);
const
uri
=
"mongodb://lcc-spider:JIUsfhiad&^@54.183.159.9:27017/?authSource=admin&directConnection=true"
;
const
uri
=
"mongodb://lcc-spider:JIUsfhiad&^@54.183.159.9:27017/?authSource=admin&directConnection=true"
;
const
client
=
new
MongoClient
(
uri
);
const
client
=
new
MongoClient
(
uri
);
log4js
.
levels
.
INFO
.
colour
=
'white'
;
log4js
.
levels
.
INFO
.
colour
=
'white'
;
...
@@ -95,21 +97,21 @@ class PxBypass {
...
@@ -95,21 +97,21 @@ class PxBypass {
async
initMongo
()
{
async
initMongo
()
{
this
.
log
.
info
(
"init mongo 获取环境数据"
)
this
.
log
.
info
(
"init mongo 获取环境数据"
)
const
database
=
client
.
db
(
"env"
);
//
const database = client.db("env");
const
movies
=
database
.
collection
(
"env_shape"
);
//
const movies = database.collection("env_shape");
// Query for a movie that has the title 'The Room'
//
//
Query for a movie that has the title 'The Room'
const
query
=
{
//
const query = {
'env.funcs'
:
{
$ne
:
null
},
//
'env.funcs': {$ne: null},
};
//
};
//
// Execute query
//
//
Execute query
const
movie
=
await
movies
.
aggregate
([
//
const movie = await movies.aggregate([
{
$match
:
query
},
//
{$match: query},
{
$sample
:
{
size
:
1
}}
//
{$sample: {size: 1}}
])
//
])
let
res
=
await
movie
.
toArray
()
//
let res = await movie.toArray()
this
.
env
=
res
[
0
].
env
//
this.env = res[0].env
this
.
env
=
ENVS
[
keys
[
randint
(
0
,
keys
.
length
-
1
)]]
this
.
ua
=
this
.
env
.
navigatorparams
.
useragent
this
.
ua
=
this
.
env
.
navigatorparams
.
useragent
this
.
log
.
info
(
'ua'
,
this
.
ua
)
this
.
log
.
info
(
'ua'
,
this
.
ua
)
...
...
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