我们要挑战的是最长的山路,我们不会轻言放弃。
91 |但是命是自己的!行程中要注意安全,紧跟团队。如有身体不适请立即联系医护人员。没有命,就没有挑战。以下列出本次活动规范,请大家仔细阅读并相互传播。
92 | 93 |├── 10
├── 10-1
│ ├── __init__.py
│ ├── 10-1-3-one.py
│ ├── public.pem
│ ├── 10-1-5-one.py
│ ├── private.pem
│ ├── 10-1-6-one.py
│ └── custom64.py
├── 10-2
│ ├── __init__.py
│ ├── parse.js
│ └── 10-2-4-two.js
└── 10-3
│ ├── 10-3-1-two.html
│ ├── 10-3-1-one.html
│ └── 10-3-2-one.html
├── 02
└── 2-3
│ ├── __init__.py
│ └── websocket.py
├── 04
├── 4-1
│ ├── __init__.py
│ ├── 4-1-1-one.py
│ └── 4-1-1-two.py
├── 4-2
│ ├── __init__.py
│ ├── 4-2-1-one.py
│ ├── 4-2-1-two.py
│ └── fet.js
├── 4-3
│ ├── __init__.py
│ ├── 4-3-2
│ │ ├── __init__.py
│ │ ├── static
│ │ │ ├── sign.js
│ │ │ └── md5.js
│ │ ├── 4-3-2-one.py
│ │ └── template
│ │ │ └── index.html
│ ├── 4-3-1-one.py
│ └── sign.js
├── 4-4
│ ├── __init__.py
│ ├── client.py
│ └── server.py
├── 4-5
│ ├── __init__.py
│ ├── client.py
│ └── server.py
└── __init__.py
├── 05
└── 5-2
│ ├── __init__.py
│ ├── ituring.png
│ ├── 5-2-1-one.py
│ ├── 5-2-5-one.py
│ ├── 5-2-1-two.py
│ ├── 5-2-1-three.py
│ ├── 5-2-2-one.py
│ ├── 5-2-5-two.py
│ ├── 5-2-2-two.py
│ └── 5-2-3-one.py
├── 06
├── 6-1
│ ├── __init__.py
│ ├── 6-1-1-one.py
│ └── 6-1-1-two.py
├── 6-2
│ ├── __init__.py
│ └── 6-2-1-one.py
├── 6-3
│ ├── __init__.py
│ ├── 6-3-1-one.py
│ ├── 6-3-1-two.py
│ └── 6-3-3-one.py
├── 6-4
│ ├── __init__.py
│ ├── movie.woff
│ ├── target.woff
│ ├── 6-4-2-one.py
│ └── 6-4-2-two.py
└── 6-5
│ ├── __init__.py
│ ├── ganrao.png
│ ├── total.png
│ ├── 6-5-2-one.py
│ └── 6-5-1-one.py
├── 07
├── 7-1
│ ├── __init__.py
│ ├── webdriver.png
│ ├── 7-1-1-one.py
│ ├── 7-1-1-two.py
│ └── 7-1-3-one.py
├── 7-2
│ ├── __init__.py
│ ├── browser.png
│ └── 7-2-1-one.py
├── 7-3
│ ├── __init__.py
│ ├── 7-3-2-one.py
│ ├── 7-3-1-one.py
│ └── 7-3-1-two.py
└── 7-4
│ ├── __init__.py
│ ├── static
│ ├── magic_2.png
│ ├── mate_20.png
│ ├── huawei_p30.png
│ ├── mate_20_x.png
│ ├── mate_20_pro.png
│ └── huawei_p30_pro.png
│ ├── 7-4-1-one.py
│ ├── hidden.py
│ └── template
│ └── details.html
├── 08
├── 8-1
│ ├── __init__.py
│ └── 8-1-1-one.py
└── 8-2
│ ├── __init__.py
│ └── 8-2-2-one.py
├── 09
├── 9-1
│ ├── __init__.py
│ ├── images
│ │ └── words.png
│ ├── 9-1-1-one.py
│ ├── 9-1-1-two.py
│ └── 9-1-1-three.py
├── 9-2
│ ├── __init__.py
│ ├── images
│ │ └── mathes.png
│ ├── 9-2-1-one.py
│ └── 9-2-1-two.py
├── 9-3
│ ├── __init__.py
│ └── 9-3-1-one.py
├── 9-4
│ ├── __init__.py
│ ├── after.png
│ ├── before.png
│ ├── 9-4-5-one.py
│ ├── 9-4-1-one.py
│ └── 9-4-5-two.py
├── 9-5
│ ├── __init__.py
│ └── 9-5-1-one.py
├── 9-6
│ ├── __init__.py
│ ├── 9-6-one.py
│ ├── 9-6-two.py
│ └── 9-6-three.py
├── .DS_Store
└── captcha
│ ├── .DS_Store
│ ├── images
│ ├── 0.jpg
│ ├── 1.jpg
│ ├── 2.jpg
│ └── 3.jpg
│ ├── css
│ ├── clicks.css
│ ├── sliders.css
│ ├── jigsaw.css
│ └── jigsawCanvas.css
│ ├── js
│ ├── common.js
│ ├── words.js
│ ├── mathes.js
│ ├── sliders.js
│ ├── jigsaw.js
│ ├── jigsawCanvas.js
│ ├── jigsawCanvas.html
│ └── clicks.js
│ ├── jigsawCanvas.js
│ ├── mousemove.html
│ ├── clicks.html
│ ├── nomal.html
│ ├── words.html
│ ├── mathes.html
│ ├── sliders.html
│ ├── jigsawCanvas.html
│ └── jigsaw.html
├── .DS_Store
├── .idea
├── vcs.xml
├── misc.xml
├── modules.xml
├── antispider.iml
└── workspace.xml
└── README.md
/02/2-3/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/04/4-1/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/04/4-2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/04/4-3/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/04/4-4/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/04/4-5/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/04/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/05/5-2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/06/6-1/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/06/6-2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/06/6-3/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/06/6-4/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/06/6-5/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/07/7-1/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/07/7-2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/07/7-3/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/07/7-4/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/08/8-1/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/08/8-2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/09/9-1/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/09/9-2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/09/9-3/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/09/9-4/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/09/9-5/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/09/9-6/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/10/10-1/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/10/10-2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/04/4-3/4-3-2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/.DS_Store
--------------------------------------------------------------------------------
/09/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/.DS_Store
--------------------------------------------------------------------------------
/05/5-2/ituring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/05/5-2/ituring.png
--------------------------------------------------------------------------------
/06/6-4/movie.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/06/6-4/movie.woff
--------------------------------------------------------------------------------
/06/6-4/target.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/06/6-4/target.woff
--------------------------------------------------------------------------------
/06/6-5/ganrao.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/06/6-5/ganrao.png
--------------------------------------------------------------------------------
/06/6-5/total.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/06/6-5/total.png
--------------------------------------------------------------------------------
/07/7-2/browser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/07/7-2/browser.png
--------------------------------------------------------------------------------
/09/9-4/after.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/9-4/after.png
--------------------------------------------------------------------------------
/09/9-4/before.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/9-4/before.png
--------------------------------------------------------------------------------
/07/7-1/webdriver.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/07/7-1/webdriver.png
--------------------------------------------------------------------------------
/09/captcha/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/captcha/.DS_Store
--------------------------------------------------------------------------------
/09/9-1/images/words.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/9-1/images/words.png
--------------------------------------------------------------------------------
/09/captcha/images/0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/captcha/images/0.jpg
--------------------------------------------------------------------------------
/09/captcha/images/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/captcha/images/1.jpg
--------------------------------------------------------------------------------
/09/captcha/images/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/captcha/images/2.jpg
--------------------------------------------------------------------------------
/09/captcha/images/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/captcha/images/3.jpg
--------------------------------------------------------------------------------
/06/6-5/6-5-2-one.py:
--------------------------------------------------------------------------------
1 | import pytesseract
2 | #识别结果
3 | print(pytesseract.image_to_string('ganrao.png'))
4 |
--------------------------------------------------------------------------------
/07/7-4/static/magic_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/07/7-4/static/magic_2.png
--------------------------------------------------------------------------------
/07/7-4/static/mate_20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/07/7-4/static/mate_20.png
--------------------------------------------------------------------------------
/09/9-2/images/mathes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/09/9-2/images/mathes.png
--------------------------------------------------------------------------------
/07/7-4/static/huawei_p30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/07/7-4/static/huawei_p30.png
--------------------------------------------------------------------------------
/07/7-4/static/mate_20_x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/07/7-4/static/mate_20_x.png
--------------------------------------------------------------------------------
/07/7-4/static/mate_20_pro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/07/7-4/static/mate_20_pro.png
--------------------------------------------------------------------------------
/07/7-4/static/huawei_p30_pro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rockyzsu/antispider/master/07/7-4/static/huawei_p30_pro.png
--------------------------------------------------------------------------------
/06/6-4/6-4-2-one.py:
--------------------------------------------------------------------------------
1 | from fontTools.ttLib import TTFont
2 | font = TTFont('movie.woff') # 打开当前目录的movie.woff文件
3 | font.saveXML('movie.xml') # 另存为movie.xml
--------------------------------------------------------------------------------
/07/7-3/7-3-2-one.py:
--------------------------------------------------------------------------------
1 | import requests
2 | for i in range(10):
3 | resp = requests.get('http://www.porters.vip:8090/rate.html')
4 | print(resp.status_code)
--------------------------------------------------------------------------------
/07/7-3/7-3-1-one.py:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 | for i in range(10):
4 | resp = requests.get('http://www.porters.vip/features/rate.html')
5 | print(resp.status_code)
--------------------------------------------------------------------------------
/09/captcha/css/clicks.css:
--------------------------------------------------------------------------------
1 | .divTips {
2 | border: 1px solid #e0e0e0;
3 | font-size: 16px;
4 | height: 30px;
5 | line-height: 30px;
6 | text-align: center;
7 | }
--------------------------------------------------------------------------------
/10/10-2/parse.js:
--------------------------------------------------------------------------------
1 | var UglifyJS = require("uglify-js");
2 | var ast = UglifyJS.parse("function sum(x, y){ return x + y }");
3 | console.log(ast)
4 | console.log(ast.body[0].name.name)
--------------------------------------------------------------------------------
/05/5-2/5-2-1-one.py:
--------------------------------------------------------------------------------
1 | from selenium import webdriver
2 |
3 | url = 'http://www.porters.vip/verify/sign'
4 | # 初始化浏览器对象
5 | browser = webdriver.Chrome()
6 | # 向指定网址发起GET请求
7 | browser.get(url)
--------------------------------------------------------------------------------
/10/10-1/10-1-3-one.py:
--------------------------------------------------------------------------------
1 | from base64 import b64decode
2 |
3 | code = ['d3d3Lmh1YXdlaS5jb20=', 'd3d3Lmp1ZWppbi5pbQ==']
4 | for c in code:
5 | string = b64decode(c).decode('utf8')
6 | print(string)
--------------------------------------------------------------------------------
/07/7-3/7-3-1-two.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import time
3 |
4 | for i in range(10):
5 | resp = requests.get('http://www.porters.vip/features/rate.html')
6 | print(resp.status_code)
7 | time.sleep(1)
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
今天天气真好,下午去海滩游玩。
4 | 10 | 11 | -------------------------------------------------------------------------------- /10/10-3/10-3-1-one.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |今天天气真好,下午去海滩游玩。
4 | 10 | 11 | -------------------------------------------------------------------------------- /10/10-1/public.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcL0c4oVjmgp0QxA5PMDo2XwIW 3 | DFXAPnyuvZ1NFOgCAe3utPOxaAoXxyRFPlQIZXaRSVNCPxzALLBWpXb+j+j9m3yQ 4 | BCY4746BA/dxF8zaKt1bkS9YVWK+zJGTe9rt0LmcSUJLKJqcui+PRbTLD/xi8rPU 5 | 4cqHxfZZMQ2WAnnoLwIDAQAB 6 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 |用户无法通过快捷键“F12”唤起开发者工具。
4 | 11 | 12 | -------------------------------------------------------------------------------- /09/9-1/9-1-1-two.py: -------------------------------------------------------------------------------- 1 | try: 2 | from PIL import Image 3 | except ImportError: 4 | import Image 5 | import pytesseract 6 | from os import path 7 | 8 | # 保存在本地的验证码图片路径 9 | images = path.join(path.dirname(path.abspath(__file__)), 'images/words.png') 10 | # 图片灰度处理 11 | gray = Image.open(images).convert('L') 12 | # 显示处理后的图片 13 | gray.show() -------------------------------------------------------------------------------- /05/5-2/5-2-1-two.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | 3 | url = 'http://www.porters.vip/verify/sign' 4 | # 初始化浏览器对象 5 | browser = webdriver.Chrome() 6 | # 向指定网址发起GET请求 7 | browser.get(url) 8 | # 使用CSS选择器定位按钮,并点击按钮 9 | browser.find_element_by_css_selector('#fetch_button').click() 10 | # 将按钮点击后的网页文本赋值给变量resp 11 | resp = browser.page_source 12 | print(resp) 13 | # 程序退出,关闭浏览器 14 | browser.quit() -------------------------------------------------------------------------------- /09/9-5/9-5-1-one.py: -------------------------------------------------------------------------------- 1 | import re 2 | from selenium import webdriver 3 | from parsel import Selector 4 | 5 | 6 | url = 'http://www.porters.vip/captcha/clicks.html' 7 | browser = webdriver.Chrome() 8 | browser.get(url) 9 | html = Selector(browser.page_source) 10 | # 获取验证要求 11 | require = html.css('#divTips::text').get() 12 | # 用正则提取验证要求中的文字 13 | target = re.findall('“(.)”', require) 14 | print(target) -------------------------------------------------------------------------------- /07/7-1/7-1-1-one.py: -------------------------------------------------------------------------------- 1 | from selenium.webdriver import Chrome 2 | import time 3 | 4 | browser = Chrome() 5 | browser.get('http://www.porters.vip/features/webdriver.html') 6 | # 定位按钮并点击 7 | browser.find_element_by_css_selector('.btn.btn-primary.btn-lg').click() 8 | # 定位到文章内容元素 9 | elements = browser.find_element_by_css_selector('#content') 10 | time.sleep(1) 11 | # 打印文章内容 12 | print(elements.text) 13 | browser.close() -------------------------------------------------------------------------------- /05/5-2/5-2-1-three.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | 3 | url = 'http://www.porters.vip/verify/sign' 4 | # 初始化浏览器对象 5 | browser = webdriver.Chrome() 6 | # 向指定网址发起GET请求 7 | browser.get(url) 8 | # 使用CSS选择器定位按钮,并点击按钮 9 | browser.find_element_by_css_selector('#fetch_button').click() 10 | # 使用CSS选择器定位文本,并取出文本内容 11 | resp = browser.find_element_by_css_selector('#content').text 12 | print(resp) 13 | # 程序退出,关闭浏览器 14 | browser.quit() -------------------------------------------------------------------------------- /05/5-2/5-2-2-one.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from datetime import datetime 3 | # 记录开始时间 4 | starts = datetime.now() 5 | url = 'http://www.porters.vip/verify/sign' 6 | # 初始化浏览器对象 7 | browser = webdriver.Chrome() 8 | for i in range(30): 9 | # 循环30次访问目标url 10 | browser.get(url) 11 | resp = browser.page_source 12 | browser.quit() 13 | # 计算并打印耗时秒数 14 | runtime = datetime.now() - starts 15 | print(runtime.total_seconds()) -------------------------------------------------------------------------------- /07/7-2/7-2-1-one.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from pyppeteer import launch 3 | 4 | async def main(): 5 | browser = await launch() 6 | page = await browser.newPage() 7 | await page.goto('http://www.porters.vip/features/browser.html') 8 | await page.setViewport({'width': 1000, 'height': 1000}) 9 | await page.screenshot({'path': 'browser.png'}) 10 | await browser.close() 11 | 12 | asyncio.get_event_loop().run_until_complete(main()) -------------------------------------------------------------------------------- /09/9-6/9-6-two.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | browser = webdriver.Chrome() 3 | 4 | # 访问指定URL 5 | browser.get('http://www.porters.vip/captcha/mousemove.html') 6 | # 定位页面中的first按钮 7 | hover = browser.find_element_by_class_name('button1') 8 | 9 | action = webdriver.ActionChains(browser) 10 | action.click_and_hold(hover).perform() # 点击并保持不松开 11 | action.move_by_offset(340, 5) # 设置滑动距离,横向距离340px,纵向距离5px 12 | action.release().perform() # 松开鼠标 -------------------------------------------------------------------------------- /09/9-3/9-3-1-one.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | 3 | 4 | browser = webdriver.Chrome() 5 | # 驱动Chrome浏览器打开滑动验证码示例页面 6 | browser.get('http://www.porters.vip/captcha/sliders.html') 7 | # 定位滑块 8 | hover = browser.find_element_by_css_selector('.hover') 9 | 10 | action = webdriver.ActionChains(browser) 11 | action.click_and_hold(hover).perform() # 点击并保持不松开 12 | action.move_by_offset(340, 0) # 设置滑动距离,横向距离340px,纵向距离0px 13 | action.release().perform() # 松开鼠标 -------------------------------------------------------------------------------- /07/7-4/7-4-1-one.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from parsel import Selector 3 | from urllib.parse import urljoin 4 | 5 | url = 'http://www.porters.vip:8202/' 6 | resp = requests.get(url) 7 | text = Selector(resp.text) 8 | # 提取商品详情的超链接 9 | shops = text.css('.col-md-3 a::attr("href")').extract() 10 | for s in shops: 11 | # 循环商品超链接列表,依次向商品详情页发出请求 12 | detail = urljoin(url, s) 13 | detail_resp = requests.get(detail) 14 | # 打印商品详情页响应正文 15 | print(detail_resp.text) -------------------------------------------------------------------------------- /09/captcha/js/common.js: -------------------------------------------------------------------------------- 1 | var fontSize = 18; // 字体大小 2 | var fonts = fontSize +'px Arial'; 3 | 4 | 5 | function randNumber(min, max){ 6 | // 随机数方法 7 | var res = parseInt(Math.random() * (max - min) + min); 8 | return res; 9 | } 10 | 11 | function randColor(min, max){ 12 | // 随机色方法 13 | var r = randNumber(min, max); var g = randNumber(min, max); var b = randNumber(min, max); 14 | var colorRes = `rgb(${r}, ${b}, ${b})`; 15 | return colorRes; 16 | } -------------------------------------------------------------------------------- /06/6-3/6-3-1-two.py: -------------------------------------------------------------------------------- 1 | # 定义映射关系 2 | mappings = {'vhk08k': 0, 'vhk6zl': 1, 'vhk9or': 2, 3 | 'vhkfln': 3, 'vhkbvu': 4, 'vhk84t': 5, 4 | 'vhkvxd': 6, 'vhkqsc': 7, 'vhkjj4': 8, 5 | 'vhk0f1': 9} 6 | # 商家联系电话class属性 7 | html_d_class = ['vhkbvu', 'vhk08k', 'vhk08k', 8 | '', 'vhk84t', 'vhk6zl', 9 | 'vhkqsc', 'vhkqsc', 'vhk6zl'] 10 | 11 | phone = [mappings.get(i) for i in html_d_class] 12 | # 将映射后的结果打印输出 13 | print(phone) -------------------------------------------------------------------------------- /04/4-1/4-1-1-one.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from parsel import Selector 3 | 4 | 5 | url = 'http://www.porters.vip/verify/uas/index.html' 6 | # 向目标网址发起网络请求 7 | resp = requests.get(url) 8 | # 打印输出状态码 9 | print(resp.status_code) 10 | # 如果本次请求的状态码为200则继续,否则提示失败 11 | if resp.status_code == 200: 12 | sel = Selector(resp.text) 13 | # 根据HTML标签和属性从响应正文中提取新闻标题 14 | res = sel.css('.list-group-item::text').extract() 15 | print(res) 16 | else: 17 | print('This request is fial.') -------------------------------------------------------------------------------- /04/4-2/4-2-1-one.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from lxml import etree 3 | 4 | url = 'http://www.porters.vip/verify/cookie/content.html' 5 | # 向目标网址发起网络请求 6 | resp = requests.get(url) 7 | # 打印输出状态码 8 | print(resp.status_code) 9 | # 如果本次请求的状态码为200则继续,否则提示失败 10 | if resp.status_code == 200: 11 | # 将响应正文赋值给html变量 12 | html = etree.HTML(resp.text) 13 | # 根据HTML标签和样式属性从文本中标题的Element对象 14 | res = html.cssselect('.page-header h1') 15 | print(res) 16 | else: 17 | print('This request is fial.') -------------------------------------------------------------------------------- /.idea/antispider.iml: -------------------------------------------------------------------------------- 1 | 2 |参团的游客,应听从领队、导游人员的安全提醒,切莫擅自行动。 18 | 自身的人身、财物安全要注意,购买人身意外险,贵重物品要随身携带, 19 | 不要留在车内或者交由他人保管。参加漂流、摩天轮等高风险项目的时候, 20 | 要认真听从工作人员的安排,切莫求刺激而发生意外。
21 |以下是本次参团出行需要遵守的规范要求:
22 |一、跟刺激相比,命更重要,没有命就什么都没了。
23 |二、旅行中会遇到很多你从未见过的植物和动物,不要轻易打扰它们,有可能有毒。
24 |三、身体感觉不适,尤其是发烧、乏力和呕吐等情况必须报告随队医护人员。
25 |四、出发前请跟家人沟通好,避免造成失联错觉。
26 |五、出发前请按照队长的要求准备好必备衣物和干粮,最重要的是水。
27 |六、旅行途中必须紧跟队伍,不许在无人知晓的情况下行动。
28 |七、如不慎走失,请先释放信号弹,半小时后无人联系再想办法报警。
29 |八、如果不同意以上几条,请在出发前告知队长。
30 |九、最重要的是:没有命,就什么都没了。
31 | """ 32 | @staticmethod 33 | def deltas(tp): 34 | # 将前端传递的时间戳与当前时间戳对比并返回差值秒数 35 | tamp = int(tp) 36 | now = round(time()) 37 | delta = datetime.fromtimestamp(now) - datetime.fromtimestamp(tamp) 38 | return delta.total_seconds() 39 | 40 | @staticmethod 41 | def hex5(value): 42 | # 使用 md5 加密值并返回加密后的字符串 43 | manipulator = hashlib.md5() 44 | manipulator.update(value.encode('utf-8')) 45 | return manipulator.hexdigest() 46 | 47 | def comparison(self, actions, tim, randstr, sign): 48 | # 根据传递的参数计算md5值,并与客户端提交的md5值进行比对 49 | value = actions+tim+randstr 50 | hexs = self.hex5(value) 51 | if sign == hexs: 52 | return True 53 | return False 54 | 55 | def get(self): 56 | # 返回数据的视图 57 | params = self.request.arguments # 获取请求正文 58 | actions = params.get('actions')[0].decode('utf-8') 59 | tim = params.get('tim')[0].decode('utf-8') 60 | randstr = params.get('randstr')[0].decode('utf-8') 61 | sign = params.get('sign')[0].decode('utf-8') 62 | seconds = self.deltas(tim) # 取双端时间差值 63 | if self.comparison(actions, tim, randstr, sign) and seconds < 5: 64 | # 如果双端 MD5 值和时间戳差值都符合要求则返回正常内容 65 | self.write(self.content) 66 | else: 67 | self.set_status(403) 68 | 69 | 70 | def make_app(): 71 | # 路由和静态文件路径设置 72 | return tornado.web.Application( 73 | [(r"/", MainHandler), (r"/fet", FetHandler)], 74 | template_path=os.path.join(os.path.dirname(__file__), 'template'), 75 | static_path=os.path.join(os.path.dirname(__file__), 'static') 76 | ) 77 | 78 | 79 | if __name__ == "__main__": 80 | # 绑定端口并启动 81 | app = make_app() 82 | app.listen(8206) 83 | tornado.ioloop.IOLoop.current().start() -------------------------------------------------------------------------------- /04/4-5/server.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import json 3 | 4 | 5 | def verify(data): 6 | """验证客户端握手信息""" 7 | data = data[:-4].split('\r\n') 8 | method = data.pop(0) # 取出请求方式和协议 9 | header = {} 10 | # 将列表转为字典 11 | for key, val in enumerate(data): 12 | try: 13 | name, value = val.split(':') 14 | except Exception as exc: 15 | name, host, port = val.split(':') 16 | value = '{}:{}'.format(host, port) 17 | header[name] = value 18 | 19 | # 不满足条件则False 20 | if any(['GET' not in method, 'HTTP/1.1' not in method, 21 | header.get('Connection') != 'Upgrade', 22 | header.get('Upgrade') != 'websocket', 23 | header.get('Sec-WebSocket-Version') != '13', 24 | not header.get('Sec-WebSocket-Key'), 25 | not header.get('Origin')]): 26 | return False 27 | return True 28 | 29 | 30 | def set_response(status): 31 | """设置响应头""" 32 | head = {'Status Code': '101 Web Socket Protocol Handshake', 'Connection': 'Upgrade', 'Upgrade': 'websocket', 33 | 'Sec-WebSocket-Accept': 'T5ar3gbl3rZJcRmEmBT8vxKjdDo='} 34 | if not status: 35 | head = {'Status Code': '403'} 36 | headers = ['{}:{}'.format(k, item) for k, item in head.items()] 37 | headers.append('\r\n') 38 | res = '\r\n'.join(headers) 39 | return res.encode('utf8') 40 | 41 | 42 | def verify_sting(conn): 43 | """读取客户端发送的消息并进行简单验证""" 44 | methods = ['GET', 'POST'] 45 | while True: 46 | message = conn.recv(1024) 47 | if message: 48 | break 49 | message = json.loads(message) 50 | method = message.get('method') 51 | content = message.get('content') 52 | if method in methods: 53 | return content 54 | shake_hands_status = False # 设置握手成功的状态,默认False 55 | 56 | 57 | def get_data(content): 58 | data = {'huawei': '{"title": "Huawei latest flagship mobile P30 Pro", "price": 3999, "RAM": "8G", "ROM": "256G", "pixel": "4000W"}', 59 | 'iphone': 'iOS'} 60 | return data.get(content) 61 | 62 | 63 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: 64 | # 使用Python底层接口创建socket 65 | s.bind(('localhost', 50007)) # 绑定地址和端口 66 | s.listen(1) # 只允许同时1个客户端连接 67 | conn, addr = s.accept() # 客户端对象和客户端地址 68 | shake_hands_status = False # 设置握手成功的状态,默认False 69 | with conn: 70 | # 读取客户端发送的消息 71 | data = conn.recv(1024).decode('utf8') 72 | if not shake_hands_status: 73 | # 避免重复握手 74 | status = verify(data) # 校验握手信息 75 | resp = set_response(status) # 根据握手校验结果返回响应头 76 | conn.send(resp) 77 | shake_hands_status = True # 握手成功后对应状态 78 | 79 | # 以下为客户端消息校验和数据推送 80 | content = verify_sting(conn) 81 | if content: 82 | # 如果客户端消息通过校验则从数据从库中取出对应数据并推送给客户端 83 | data = get_data(content) 84 | conn.send(data.encode('utf8')) -------------------------------------------------------------------------------- /09/captcha/js/jigsaw.js: -------------------------------------------------------------------------------- 1 | /* 拼图验证码 2 | 验证逻辑: 3 | 1、记录缺口位置 4 | 2、在鼠标按下和松开时记录鼠标的相对位置 5 | 3、鼠标松开时的位置与按下时的位置差值与缺口位置比较,在范围内则认为通过 6 | */ 7 | 8 | 9 | var jigsaw = $('.jigsaw'), jigsawTrack = $('.jigsawTrack'), 10 | jigsawCircle = $('.jigsawCircle'), jigsawTips = $('.jigsawTips'), 11 | missblock = $('.missblock'), targetblock = $('.targetblock') 12 | 13 | $(function() { 14 | var imageback = $('.imageback') // 背景图所在标签 15 | imageback.attr('src', `images/1.jpg`) // 背景图 16 | missblock.css('background-image', `url('images/0.jpg')`) // 对应的滑块 17 | var imageback = document.getElementById('imageback'); 18 | imageback.onload = function() { 19 | // 获取图片高度 20 | var imageHeight = this.clientHeight 21 | // 生成缺口坐标 22 | var CoordinateX = 150/2 * (1 + Math.random()), CoordinateY = Math.random() * imageHeight / 2 23 | // 鼠标按下 24 | fnDown(CoordinateX , CoordinateY) 25 | 26 | } 27 | }) 28 | 29 | function fnDown(CoordinateX, CoordinateY) { 30 | jigsawCircle.mousedown(function(e) { 31 | e.stopPropagation() 32 | // 鼠标按下时,显示圆角矩形的位置 33 | var missblockFirst = 10; 34 | missblock.css('left', `${missblockFirst}px`) 35 | // 鼠标按下时,滑块的位置 36 | var circleMousedown = jigsawCircle.offset().left 37 | var missblockWidth = missblock.width(); 38 | var missblockWidthHalf = missblockWidth/2; 39 | // 缺块显示 40 | missblock.css({ 41 | display: 'block', 42 | top: `${CoordinateY}px`, 43 | 'background-position': `-${CoordinateX - missblockWidth/3}px -${CoordinateY - missblockWidth/2}px` 44 | }) 45 | // 缺口位置显示 46 | targetblock.css({ display: 'block', left: `${CoordinateX}px`, top: `${CoordinateY}px` }) 47 | var distanceX = e.clientX - $(this).offset().left; 48 | // 提示文字设为透明 49 | jigsawTips.css('opacity', '0') 50 | 51 | // 监听鼠标移动事件 52 | jigsaw.bind('mousemove', function(e) { 53 | fnMove(e, distanceX) 54 | }) 55 | 56 | // 监听mouseup,根据滑块位置判断结果 57 | jigsaw.bind('mouseup', function() { 58 | var circleMouseup = jigsawCircle.offset().left; 59 | var verifyPosition = circleMouseup - circleMousedown 60 | console.log('缺口位置:' + CoordinateX) 61 | console.log('circle Mouseup:' + circleMouseup + '-减去-' + 'circle Mousedown:' + circleMousedown) 62 | // 误差在2px以内则算成功 63 | if (Math.abs(verifyPosition - CoordinateX + 10) > 2) { 64 | console.log('验证失败') 65 | // 缺块和滑块归位 66 | jigsawCircle.css('left', '0px'); 67 | missblock.css('left', '10px'); 68 | // 显示提示文字 69 | jigsawTips.css('opacity', '1'); 70 | 71 | } else { 72 | alert('您已完成拼图,通过验证'); 73 | } 74 | // 移除鼠标事件监听 75 | jigsaw.unbind('mousemove') 76 | jigsaw.unbind('mouseup') 77 | }) 78 | }) 79 | } 80 | 81 | function fnMove(e, distanceX) { 82 | // 滑块移动范围控制在滑轨中,不可超出 83 | var l = e.clientX - distanceX - $(jigsawTrack).offset().left, winW = $(jigsawTrack).width() + 29 84 | if (l < 0) {l = 0} else if (l > winW) {l = winW} 85 | jigsawCircle.css('left', `${l}px`) 86 | missblock.css('left', `${l + 10}px`) 87 | } -------------------------------------------------------------------------------- /09/captcha/js/jigsawCanvas.js: -------------------------------------------------------------------------------- 1 | /* Canvas 拼图 */ 2 | 3 | var jigsaw = $('.jigsaw'), jigsawTrack = $('.jigsawTrack'), 4 | jigsawCircle = $('.jigsawCircle'), jigsawTips = $('.jigsawTips'), 5 | missblock = $('.missblock'), targetblock = $('.targetblock') 6 | 7 | var missblockFirst = 10; 8 | 9 | $(function() { 10 | var jigsawCanvas = document.getElementById('jigsawCanvas'); 11 | var cvas = jigsawCanvas.getContext('2d'); 12 | var jigsawImages = new Image(); 13 | jigsawImages.src = 'images/2.jpg' 14 | 15 | jigsawImages.onload = function start() { 16 | // 图片加载后将图片绘制到Canvas画布 17 | var imageHeight = jigsawCanvas.height; 18 | var imageWidth = jigsawCanvas.width; 19 | cvas.drawImage(jigsawImages, 0, 0, imageWidth, imageHeight); 20 | cvas.save(); 21 | // 根据背景图标签的宽高生成缺口坐标 22 | var CoordinateX = imageWidth/5 + imageWidth/2 * Math.random(), CoordinateY = imageHeight / 2 * Math.random() 23 | mouseDowns(CoordinateX , CoordinateY) 24 | } 25 | 26 | function mouseDowns(CoordinateX, CoordinateY) { 27 | var targetblockTimes = 0; 28 | jigsawCircle.mousedown(function(e) { 29 | e.stopPropagation() 30 | // 鼠标按下时,滑块的位置 31 | var circleMousedown = jigsawCircle.offset().left; 32 | // 圆角矩形显示 33 | missblock.css({ 34 | display: 'block', 35 | top: `${CoordinateY}px`, 36 | 'background-position': `-${missblockFirst}px -${CoordinateY}px` 37 | }) 38 | // 绘制缺口,计数避免重复绘制 39 | if(targetblockTimes<1){ 40 | var targetImage = new Image(); 41 | targetImage.src = 'images/1.jpg'; 42 | cvas.fillStyle = "rgba(0,0,0,0.6)"; 43 | // 在指定位置绘制38x38大小的矩形 44 | cvas.fillRect(CoordinateX, CoordinateY, 38, 38); 45 | targetblockTimes += 1; 46 | }else{ 47 | console.log('missblock alredy in canvas') 48 | } 49 | // 获取鼠标到按钮的距离 50 | var disX = e.clientX - $(this).offset().left; 51 | // 提示文字设为透明 52 | jigsawTips.css('opacity', '0') 53 | // 监听鼠标移动事件 54 | jigsaw.bind('mousemove', function(e) { 55 | mouseMoves(e, disX) 56 | }) 57 | 58 | // 监听mouseup,根据滑块位置判断结果 59 | jigsaw.bind('mouseup', function() { 60 | // 滑块移动距离等于鼠标松开时的X坐标减去鼠标按下时的X坐标 61 | var circleMouseup = jigsawCircle.offset().left; 62 | var endPosition = circleMouseup - circleMousedown; 63 | // 误差在2px以内则算成功 64 | if (Math.abs(endPosition - CoordinateX + missblockFirst) > 2) { 65 | console.log('验证失败') 66 | // 缺块和滑块归位 67 | jigsawCircle.css('left', '0px'); 68 | missblock.css('left', '10px'); 69 | // 显示提示文字 70 | jigsawTips.css('opacity', '1'); 71 | } else { 72 | alert('您已完成拼图,通过验证'); 73 | } 74 | // 移除鼠标事件监听 75 | jigsaw.unbind('mousemove') 76 | jigsaw.unbind('mouseup') 77 | }) 78 | }) 79 | } 80 | }) 81 | 82 | function mouseMoves(e, distanceX) { 83 | // 滑块移动范围控制在滑轨中,不可超出 84 | var jigsawCirclePosition = e.clientX - distanceX - $(jigsawTrack).offset().left; 85 | var jigsawTrackWidth = jigsawTrack.width(); // 滑轨长度 86 | if (jigsawCirclePosition < 0) { 87 | jigsawCirclePosition = 0 88 | }else if (jigsawCirclePosition > jigsawTrackWidth) { 89 | jigsawCirclePosition = jigsawTrackWidth 90 | } 91 | //实时显示滑块和圆角矩形的位置 92 | jigsawCircle.css('left', `${jigsawCirclePosition}px`) 93 | missblock.css('left', `${jigsawCirclePosition + missblockFirst}px`) 94 | } -------------------------------------------------------------------------------- /09/captcha/jigsawCanvas.js: -------------------------------------------------------------------------------- 1 | /* Canvas 拼图 */ 2 | 3 | var jigsaw = $('.jigsaw'), jigsawTrack = $('.jigsawTrack'), 4 | jigsawCircle = $('.jigsawCircle'), jigsawTips = $('.jigsawTips'), 5 | missblock = $('.missblock'), targetblock = $('.targetblock') 6 | 7 | var missblockFirst = 10; 8 | 9 | $(function() { 10 | var jigsawCanvas = document.getElementById('jigsawCanvas'); 11 | var cvas = jigsawCanvas.getContext('2d'); 12 | var jigsawImages = new Image(); 13 | jigsawImages.src = 'images/2.jpg' 14 | 15 | jigsawImages.onload = function start() { 16 | // 图片加载后将图片绘制到Canvas画布 17 | var imageHeight = jigsawCanvas.height; 18 | var imageWidth = jigsawCanvas.width; 19 | cvas.drawImage(jigsawImages, 0, 0, imageWidth, imageHeight); 20 | cvas.save(); 21 | // 根据背景图标签的宽高生成缺口坐标 22 | var CoordinateX = imageWidth/5 + imageWidth/2 * Math.random(), CoordinateY = imageHeight / 2 * Math.random() 23 | mouseDowns(CoordinateX , CoordinateY) 24 | } 25 | 26 | function mouseDowns(CoordinateX, CoordinateY) { 27 | var targetblockTimes = 0; 28 | jigsawCircle.mousedown(function(e) { 29 | e.stopPropagation() 30 | // 鼠标按下时,滑块的位置 31 | var circleMousedown = jigsawCircle.offset().left; 32 | // 圆角矩形显示 33 | missblock.css({ 34 | display: 'block', 35 | top: `${CoordinateY}px`, 36 | 'background-position': `-${missblockFirst}px -${CoordinateY}px` 37 | }) 38 | // 绘制缺口,计数避免重复绘制 39 | if(targetblockTimes<1){ 40 | var missblockImage = new Image(); 41 | missblockImage.src = 'images/1.jpg'; 42 | cvas.fillStyle = "rgba(0,0,0,0.6)"; 43 | // 在指定位置绘制38x38大小的矩形 44 | cvas.fillRect(CoordinateX, CoordinateY, 38, 38); 45 | targetblockTimes += 1; 46 | }else{ 47 | console.log('missblock alredy in canvas') 48 | } 49 | // 获取鼠标到按钮的距离 50 | var disX = e.clientX - $(this).offset().left; 51 | // 提示文字设为透明 52 | jigsawTips.css('opacity', '0') 53 | // 监听鼠标移动事件 54 | jigsaw.bind('mousemove', function(e) { 55 | mouseMoves(e, disX) 56 | }) 57 | 58 | // 监听mouseup,根据滑块位置判断结果 59 | jigsaw.bind('mouseup', function() { 60 | // 滑块移动距离等于鼠标松开时的X坐标减去鼠标按下时的X坐标 61 | var circleMouseup = jigsawCircle.offset().left; 62 | var endPosition = circleMouseup - circleMousedown; 63 | // 误差在2px以内则算成功 64 | if (Math.abs(endPosition - CoordinateX + missblockFirst) > 2) { 65 | console.log('验证失败') 66 | // 缺块和滑块归位 67 | jigsawCircle.css('left', '0px'); 68 | missblock.css('left', '10px'); 69 | // 显示提示文字 70 | jigsawTips.css('opacity', '1'); 71 | } else { 72 | alert('您已完成拼图,通过验证'); 73 | } 74 | // 移除鼠标事件监听 75 | jigsaw.unbind('mousemove') 76 | jigsaw.unbind('mouseup') 77 | }) 78 | }) 79 | } 80 | }) 81 | 82 | function mouseMoves(e, distanceX) { 83 | // 滑块移动范围控制在滑轨中,不可超出 84 | var jigsawCirclePosition = e.clientX - distanceX - $(jigsawTrack).offset().left; 85 | var jigsawTrackWidth = jigsawTrack.width(); // 滑轨长度 86 | if (jigsawCirclePosition < 0) { 87 | jigsawCirclePosition = 0 88 | }else if (jigsawCirclePosition > jigsawTrackWidth) { 89 | jigsawCirclePosition = jigsawTrackWidth 90 | } 91 | //实时显示滑块和圆角矩形的位置 92 | jigsawCircle.css('left', `${jigsawCirclePosition}px`) 93 | missblock.css('left', `${jigsawCirclePosition + missblockFirst}px`) 94 | } -------------------------------------------------------------------------------- /09/captcha/mousemove.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |点选验证码在图片显示4-5个字,要求用户依次点击2-3个字
51 |文字可以用其他图形代替,也可以在此基础上将文字进行变形、模糊处理
52 |我们要挑战的是最长的山路,我们不会轻言放弃。
91 |但是命是自己的!行程中要注意安全,紧跟团队。如有身体不适请立即联系医护人员。没有命,就没有挑战。以下列出本次活动规范,请大家仔细阅读并相互传播。
92 | 93 |字符验证码主要以数字和英文字母为主,辅以部分干扰线和彩色噪点
51 |并且对字符元素使用随机颜色,甚至是角度倾斜
52 |字符验证码主要以数字和英文字母为主,辅以部分干扰线和彩色噪点
51 |并且对字符元素使用随机颜色,甚至是角度倾斜
52 |计算型验证码主要通过主观的数学计算区分人类和机器
51 |通常只有加、减、乘,而没有除,因为除法的结果不适合用来验证。
52 |滑动验证码属于行为验证码,需要通过人为滑动指定的滑块才能通过验证
52 |滑块会有起点与终点,相比“眼睛”来说,手动的耗时更长
53 |Canvas 将背景和缺口合并
52 |要将指定的缺块滑到缺口处,才能通过验证
53 |Canvas 将背景和缺口合并
52 |要将指定的缺块滑到缺口处,才能通过验证
53 |滑动拼图验证码中,目标位置是随机的
52 |要将指定的缺块滑到缺口处,才能通过验证
53 |华为P30系列新机国行版发布会,同时EMUI9.1操作系统或许也将同步面向国内消费者。
78 |
83 |
88 |
93 |
98 |
103 |
108 |
113 |
118 |
124 |
129 |
134 |
139 |
144 |
149 |
154 |
159 |