Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
IOT-fuzz
Overview
Overview
Details
Activity
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
尹启迪
IOT-fuzz
Commits
8ea94abc
Commit
8ea94abc
authored
Sep 17, 2020
by
张航玮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
爬虫,结合网页分析
parent
a2977a28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
pyppeteer_test.py
pyppeteer_test.py
+66
-0
No files found.
pyppeteer_test.py
0 → 100644
View file @
8ea94abc
import
asyncio
from
pyppeteer
import
launch
import
os
import
random
def
input_time_random
():
return
random
.
randint
(
100
,
151
)
async
def
main
():
browser
=
await
launch
({
'headless'
:
False
,
# 关闭无头模式
'devtools'
:
False
,
# 打开 chromium 的 devtools
'executablePath'
:
'/home/zhw/.local/share/pyppeteer/chrome'
,
'args'
:
[
'--disable-extensions'
,
'--hide-scrollbars'
,
'--disable-bundled-ppapi-flash'
,
'--mute-audio'
,
'--no-sandbox'
,
'--disable-setuid-sandbox'
,
'--disable-gpu'
,
],
'dumpio'
:
True
,
})
page
=
await
browser
.
newPage
()
await
page
.
goto
(
'http://192.168.1.1/'
)
#await page.type("#userName", "admin")
await
page
.
type
(
"#Pwd"
,
"admin"
,
{
'delay'
:
input_time_random
()
-
50
})
await
page
.
click
(
"#logIn_btn"
)
#page.mouse
#content = await page.content()
#cookies = await page.cookies()
await
page
.
screenshot
({
'path'
:
'example.png'
})
await
page
.
waitFor
(
1
)
# frame = page.frames
# print(frame)
# title = await frame[1].title()
# print(title)
# title_linklist=[]#Pwd#logIn_btn
#//*[@id="login_form"]//*[@id="logIn"]//*[@id="Pwd"]//*[@id="content"]#content
print
(
"??????????????????"
)
# title_frame = await page.xpath('//*[@id="Pwd"]')
# print(title_frame)
await
browser
.
close
()
# title_elements = await title_frame[0].xpath('//*[@id="lo39"]')
# for item in title_elements:
# title_link = await (await item.getProperty('href')).jsonValue()
# title_linklist.append(title_link)
# await page.waitFor(1000)
# await page.screenshot({'path': 'example.png'})
# await browser.close()
# return {'cookies':cookies,'title_linklist':title_linklist}
# loop = asyncio.get_event_loop()
# task = asyncio.ensure_future(main())
# loop.run_until_complete(task)
# print(task.result())
asyncio
.
get_event_loop
()
.
run_until_complete
(
main
())
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