├── src ├── lib │ ├── __init__.py │ ├── logger.py │ ├── dlc_eatasmr.py │ ├── dlc_getlink.py │ ├── v1_selenium.py │ ├── dlc_stage1st.py │ ├── v2_request.py │ └── model.py ├── private │ └── do-not-upload-this └── farmer.py ├── doc ├── scf_1.png ├── scf_2.png ├── scf_3.png ├── farmer2.png ├── settings.py.example ├── dlc_readme.md ├── serverless_readme.md ├── server_readme.md └── cookies.json.example ├── requirements.txt ├── .gitignore ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature-request--.md ├── dist ├── readme.md ├── SCF_s1.py ├── SCF_eat.py ├── SCF_sign.py └── SCF_work.py ├── README.md └── LICENSE /src/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/private/do-not-upload-this: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/scf_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trojblue/TSDM-coin-farmer/HEAD/doc/scf_1.png -------------------------------------------------------------------------------- /doc/scf_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trojblue/TSDM-coin-farmer/HEAD/doc/scf_2.png -------------------------------------------------------------------------------- /doc/scf_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trojblue/TSDM-coin-farmer/HEAD/doc/scf_3.png -------------------------------------------------------------------------------- /doc/farmer2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trojblue/TSDM-coin-farmer/HEAD/doc/farmer2.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | selenium~=3.141.0 2 | schedule~=1.1.0 3 | requests~=2.26 4 | urllib3==1.25.11 5 | pyperclip 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | .idea/ 3 | __pycache__ 4 | src/privates 5 | src/settings.py 6 | src/testing.py 7 | src/testing2.py 8 | 9 | *.txt 10 | *.log 11 | *.json -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Bug report 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **描述**: 11 | 12 | **平台**: 13 | 14 | **产生方法**: 15 | 16 | **相关代码/commit**: 17 | 18 | **错误报告等**: 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request--.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'feature request: ' 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **简单描述你的需求和提议:** 11 | 12 | **补充:** 13 | Add any other context or screenshots about the feature request here. 14 | -------------------------------------------------------------------------------- /dist/readme.md: -------------------------------------------------------------------------------- 1 | # Dist 2 | 3 | SCF_sign: 云函数签到 4 | 5 | SCF_work: 云函数打工 6 | 7 | 8 | 9 | 用法见`/doc`文件夹: 10 | 11 | - [tsdm签到 - 云函数](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/serverless_readme.md) 12 | - [S1 / EatASMR DLC](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/dlc_readme.md) 13 | 14 | -------------------------------------------------------------------------------- /doc/settings.py.example: -------------------------------------------------------------------------------- 1 | # 样本settings.py, 需要修改的时候把文件后缀的.example去掉 2 | 3 | 4 | # 天使动漫: 5 | TSDM_CREDENTIALS = [['user1', 'password1'], 6 | ['user2', 'password2'] 7 | ] 8 | 9 | 10 | # Stage1st: 11 | # S1_CREDENTIALS = [["user1", "password1"]] 12 | 13 | 14 | # 是否使用s1自动刷时间功能 15 | enable_s1_read = False 16 | -------------------------------------------------------------------------------- /doc/dlc_readme.md: -------------------------------------------------------------------------------- 1 | ## S1刷阅读: 2 | 3 | 1. 在电脑上用selenium获取cookie (或者手动填), 执行`dlc_stage1st.py`里的相关函数; 获得`cookie.json` 4 | 5 | 2. 复制`/dist/SCF_s1.py`到腾讯云函数, 用类似的办法部署; 6 | 3. 复制`cookie.json`到云函数相同目录下 7 | 4. 部署, 设置触发周期 8 | 9 | 办法和tsdm云函数部署的类似, 可以参考 [这里](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/serverless_readme.md); 触发周期按照需要自己调整, 我设置的是半小时一次; 建议改掉`s1_sample_post`变量来自定义反复刷新的页面, 也可以自己写个List随机访问, 我这里是固定访问同一个网页 10 | 11 | 12 | 13 | 14 | 15 | ## EatASMR: 16 | 17 | 部署办法同上, 用`dlc_eatasmr.py`登录后获取cookie, 再部署到云函数, 或者自己看相关文件写成本地运行 18 | 19 | 不同组件(tsdm, s1, eatasmr)的cookie可以放在同一个`cookies.json`文件里, 但目前不同站之间不能有相同的用户名. 否则要单独各自建一个文件, 不然会覆写掉相同用户名的cookie记录. 20 | 21 | 或者获取完一个用户名的cookie后把`cookies.json`里的用户名改成不重复的项目; 直接改在云函数版里没关系, 但本地selenium运行会出错. 22 | 23 | -------------------------------------------------------------------------------- /doc/serverless_readme.md: -------------------------------------------------------------------------------- 1 | # 云函数版使用: 2 | 3 | 部署需要约20分钟 4 | 5 |
6 | 7 | 首先获取`cookies.json`: 8 | 9 | - 账户多推荐设置好`settings.py`后在电脑上执行`python farmer.py -r`, 见主页readme 10 | - 账户少可以在浏览器里获取`s_gkr8_xxx_auth` 和`s_gkr8_xxx_saltkey` 后手动填入[这个](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/cookies.json.example)模板里 11 | 12 |
13 | 14 | 然后在腾讯云[新建一个函数服务](https://console.cloud.tencent.com/scf/list): 15 | 16 | 1. 选择"**自定义创建**" → 依次选择: **事件函数, 代码部署, python3.6, 在线编辑** 17 | 2. 复制`SCF_sign.py` ([这里](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/dist/SCF_sign.py)) 的内容到底下编辑器里的`index.py`中 18 | 3. 复制`cookies.json`到云函数同目录 19 | 4. 高级配置不用动 20 | 5. 触发器配置: **默认流量, 定时触发, 自定义触发周期, 无附加信息, 立即启用** 21 | 1. 签到触发周期: `5 9 * * *` (每天9点05分) 22 | 23 |
24 | 25 | **截图:** 26 | 27 | ![](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/scf_1.png?raw=true) 28 | 29 | ![](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/scf_2.png?raw=true) 30 | 31 |
32 | 33 |
34 | 35 | 回到[函数服务页](https://console.cloud.tencent.com/scf/list), 复制刚才创建好的函数服务, 再用`SCF_work.py`([这里](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/dist/SCF_work.py)) 的内容替换`index.py`原有代码 36 | 37 | 触发器配置: 其他不变, **修改触发周期**: 38 | 39 | - 打工触发周期: ` 5 2,9,16 * * *` 40 | - 每天3次, 2点9点16点; 受限于腾讯云的cron设置不支持每6小时5分钟运行一次, 只能这样了 41 | 42 | ![](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/scf_3.png?raw=true) 43 | 44 |
45 | 46 | 配置完成, 运行情况可以在腾讯云 函数管理 - "日志查询"一栏看到 47 | 48 |
49 | 50 | ### s1刷阅读: 51 | 52 | 办法和上面的类似, 新建一个原函数, 复制`cookies.json`和`SCF_S1.py`进入, 触发周期按照需要自己调整, 我设置的是半小时一次; 53 | 建议改掉`s1_sample_post`变量来自定义反复刷新的页面, 也可以自己写个List随机访问, 我这里是固定访问同一个网页 54 | 55 | -------------------------------------------------------------------------------- /src/lib/logger.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | from logging.handlers import RotatingFileHandler 4 | 5 | 6 | # 最大存储30m的log, 先试着以后改 7 | FILE_SIZE = 10*1024*1024 8 | FILE_COUNT = 3 9 | 10 | 11 | def set_logger(): 12 | """设置log格式 13 | """ 14 | logger = logging.getLogger('farmer') 15 | logger.setLevel(logging.INFO) 16 | 17 | os.makedirs(os.path.dirname('./private/farmer.log'), exist_ok=True) 18 | log_formatter = logging.Formatter('%(asctime)s %(levelname)s %(funcName)s(%(lineno)d) %(message)s') 19 | logHandler = RotatingFileHandler('./private/farmer.log', maxBytes=FILE_SIZE, backupCount=FILE_COUNT, encoding='UTF-8') 20 | 21 | logHandler.setFormatter(log_formatter) 22 | logHandler.setLevel(logging.WARNING) 23 | logger.addHandler(logHandler) 24 | logger.info("farmer.py: 开始运行") 25 | 26 | 27 | 28 | def heartbeat(): 29 | """定时心跳来确认进程存活 30 | """ 31 | logger = logging.getLogger('farmer') 32 | logger.debug("heartbeat") 33 | 34 | 35 | def display_info(info_str:str): 36 | """同时打印和输出到log一行信息 37 | """ 38 | logger = logging.getLogger('farmer') 39 | print(info_str) 40 | logger.info(info_str) 41 | 42 | def add_debug(debug_str:str): 43 | """同时输出到log一行debug 44 | """ 45 | logger = logging.getLogger('farmer') 46 | logger.debug(debug_str) 47 | 48 | def display_warning(warn_str:str): 49 | """同时打印和输出到log一行警告 50 | """ 51 | logger = logging.getLogger('farmer') 52 | print(warn_str) 53 | logger.warning(warn_str) 54 | 55 | def display_error(error_str:str): 56 | """同时打印和输出到log一行错误 57 | """ 58 | logger = logging.getLogger('farmer') 59 | print(error_str) 60 | logger.error(error_str) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TSDM-coin-farmer 2 | 3 | ![](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/farmer2.png) 4 | 5 | 天使动漫(tsdm39.net) 多账户自动签到+打工, 支持PC/Server/腾讯云函数 6 | 7 | 新增s1刷在线时间支持 8 | 9 |
10 | 11 | 12 | **最近比较忙, 本地版改到一半还没搞好. 要用本地版可以看下历史commit, 里面有能直接用的版本. 云函数目前正常** 13 | 14 | 15 | ## 使用 16 | 17 | 1. **腾讯云函数版**: 见 [这里](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/serverless_readme.md), 相比本地运行更稳定, *比较推荐* 18 | 19 |
20 | 21 | 2. **本地** (服务器/电脑/安卓手机): 见[这里](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/server_readme.md) 22 | 23 |
24 | 25 | 3. DLC (s1阅读, eatasmr): 见[这里](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/dlc_readme.md) 26 | 27 |
28 | 29 | ## 结构 30 | 31 | - `farmer.py`: 主程序 32 | - `actions.py`: cookie/工具类函数 33 | - `dlc_xxx.py`: 各种额外功能 34 | - `settings.py`, `cookies.json`: 存储登录信息, ***请不要上传*** 35 | 36 | 37 | cookies.json: 38 | ``` 39 | { 40 | "用户名1": [ 41 | {cookie1}, 42 | {cookie2}, 43 | .... 44 | ], 45 | "用户名2": [...] 46 | } 47 | ``` 48 | 49 | 50 | ## 更新 51 | 52 | 2022.3.9: 重构代码, 之前的教程可能没有更新, 注意分辨 53 | 54 |
55 | 56 | 2022.2.10: 增加eatASMR的自动签到 (本地&云函数)DLC 57 | 58 | 2021.12.1: 增加s1刷阅读的云函数版本 59 | 60 |
61 | 62 | 2021.9.10: 增加日志记录, 优化在服务器上使用的稳定性 63 | 2021.9.11: 增加腾讯云函数支持 64 | 65 |
66 | 67 | 2021.8.23: 增加stage1st的刷在线时间功能, 改一改可扩展成任意discuz论坛的刷在线时间功能 68 | 69 |
70 | 71 | ## 其他 72 | 73 | - 需要`urllib3==1.25.11`, 74 | 因为[这个bug](https://stackoverflow.com/questions/66642705/why-requests-raise-this-exception-check-hostname-requires-server-hostname) 75 | 76 | - 服务器上使用selenium模式打工, 需要先设置成headless模式: 在`/src/actions`中 `get_webdriver()`添加headless旗帜 77 | 78 | - 没有条件在pc上获取cookie的话, 可以尝试手动配置: 见`doc/cookies.json.example` 79 | 80 | - 使用IDE时, 把'/src'标记为source root; 把'/dist'标记为excluded 81 | 82 | ## TODO 83 | - [ x ] 随机浏览s1页面 84 | - [ x ] eatASMR自动签到 85 | - [ ] tsdm自动提取页面 86 | - [ ] tsdm批量提取页面 87 | -------------------------------------------------------------------------------- /doc/server_readme.md: -------------------------------------------------------------------------------- 1 | # 服务器/本地使用: 2 | 3 | 从clone到签到完成需要约10分钟 4 | 5 | **下载repo:** 6 | 7 | ```bash 8 | git clone https://github.com/Trojblue/TSDM-coin-farmer 9 | cd TSDM-coin-farmer 10 | pip3 install -r requirements.txt 11 | ``` 12 | 13 | **打工/签到:** 14 | 15 | 1. 在电脑上[配置selenium driver](https://selenium-python.readthedocs.io/installation.html#drivers) (填写验证码需要图形界面) 16 | 2. `python farmer.py -r` 刷新cookie, 未配置`settings.py`时支持单个账户 17 | 3. `python farmer.py -n` 立刻打工/签到并开始定时任务 18 | 19 | ``` 20 | usage: farmer.py [-h] [-s | -r] [-n] 21 | 22 | optional arguments: 23 | -h, --help show this help message and exit 24 | -s, --selenium 运行: 使用selenium模式(不填默认用post模式) 25 | -r, --reset 刷新cookie 26 | -n, --now 立刻运行打工和签到 27 | ``` 28 | 29 |
30 | 31 | ### 高级使用 32 | 33 | **多账户打工/签到:** 34 | 35 | 在`/src`文件夹新建`settings.py`, 按照`/doc`文件夹里的[例子](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/settings.py.example)进行修改, 刷新cookie后运行 36 | 37 | ```python 38 | TSDM_CREDENTIALS = [["user1", "pswd1"], ["user2", "pswd2"]] 39 | ``` 40 | 41 |
42 | 43 | **S1论坛 自动刷在线时间:** 44 | 45 | 在`/src/settings.py`批量填好需要的账号密码, 修改`enable_s1_read`变量为`True`, 刷新cookie后运行 46 | ```python 47 | S1_CREDENTIALS = [["user1", "pswd1"]] # 把变量S1_CREDENTIALS取消注释 48 | enable_s1_read = True # 把这行改成True 49 | ``` 50 | 51 |
52 | 53 | **服务器部署:** 54 | 55 | 1. 在电脑上获取cookie+测试, 确认可以运行 56 | 2. 在服务器上clone repo并安装所需库 57 | 3. 复制`cookies.json`和`settings.py`到服务器相同目录下 58 | 4. `python farmer.py -n` 立刻打工/签到并开始定时任务 59 | 60 |
61 | 62 | **Selenium模式:** 63 | - 用selenium模拟点击来签到/打工, 适用于post模式失效的情况 64 | - `python farmer.py -s -n` 65 | - 也可以获取cookie后在设置headless参数, 来在无图形界面的服务器上运行↓ 66 | - 服务器上运行的话添加这两行到`actions.py → get_webdriver()`: 67 | ```python 68 | options.add_argument('--headless') 69 | options.add_argument('--disable-gpu') 70 | ``` 71 | 72 |
73 | 74 | **手动填写cookie:** 75 | 76 | - 例子见[这里](https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/cookies.json.example) 77 | 78 |
79 | 80 | ### 安卓手机使用 81 | 82 | 和服务器部署的步骤一样, 下载终端模拟器(比如termux), 部署python环境后可以运行 83 | 网上教程很多, 比如https://zhuanlan.zhihu.com/p/150082183 -------------------------------------------------------------------------------- /doc/cookies.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "user1": [ 3 | { 4 | "domain": ".tsdm39.net", 5 | "expiry": 1533687398, 6 | "httpOnly": true, 7 | "name": "s_gkr8_f719_auth", 8 | "path": "/", 9 | "secure": true, 10 | "value": "tcyKV5oukBlJAMtagHcKWcpCPBBIiNJK1YjZAmJcUm4zNxRrGC2Ww3DbeuON419fz7odk8UBThmzbHneCt2QCVOP415J45d5f7" 11 | }, 12 | { 13 | "domain": ".tsdm39.net", 14 | "expiry": 1533687390, 15 | "httpOnly": true, 16 | "name": "s_gkr8_f719_saltkey", 17 | "path": "/", 18 | "secure": true, 19 | "value": "61RA153P" 20 | } 21 | ], 22 | "user2": [ 23 | { 24 | "domain": ".tsdm39.net", 25 | "expiry": 1533687412, 26 | "httpOnly": true, 27 | "name": "s_gkr8_f719_auth", 28 | "path": "/", 29 | "secure": true, 30 | "value": "3q1dilPKxzPoo6pjaTVkE3DcLo9bpyPYPJuwzOJbEnlXNEGQM241jeJMEDgTcJmau6NE31lvfSfCGpj32HW1M8FiYfxlX78KVe" 31 | }, 32 | { 33 | "domain": ".tsdm39.net", 34 | "expiry": 1533687403, 35 | "httpOnly": true, 36 | "name": "s_gkr8_f719_saltkey", 37 | "path": "/", 38 | "secure": true, 39 | "value": "PpWi3Qds" 40 | } 41 | ], 42 | "user3": [ 43 | { 44 | "domain": "bbs.saraba1st.com", 45 | "expiry": 1533875252, 46 | "httpOnly": true, 47 | "name": "B7Y9_2132_auth", 48 | "path": "/", 49 | "secure": true, 50 | "value": "4e8AfQYcEuuMtT4lZY07mQitxu36pykdKVtRjKdCs3udxdOAjqc1tRcGYOtVLcF9yIZZ2CvWnr6jPtcFbvy21Vi4Yr6hvdtkwk" 51 | }, 52 | { 53 | "domain": "bbs.saraba1st.com", 54 | "expiry": 1533875214, 55 | "httpOnly": true, 56 | "name": "B7Y9_2132_saltkey", 57 | "path": "/", 58 | "secure": true, 59 | "value": "TS4HFgSa" 60 | } 61 | ] 62 | } -------------------------------------------------------------------------------- /src/lib/dlc_eatasmr.py: -------------------------------------------------------------------------------- 1 | from lib.v1_selenium import * 2 | from lib.v2_request import * 3 | from lib.logger import * 4 | from private.settings import EAT_CREDENTIALS 5 | 6 | eat_login_url = "https://eatasmr.com/community" 7 | eat_attendance_url = "https://eatasmr.com/tasks/attendance" 8 | eat_sign_url_without_formhash = "https://eatasmr.com/tasks/attendance?a=check&__v=" 9 | 10 | 11 | def refresh_cookies_eatasmr(): 12 | """从credentials重新获取所有cookie 13 | """ 14 | cred = EAT_CREDENTIALS[0] 15 | refresh_cookie_eatasmr(cred[0]) 16 | return 17 | 18 | 19 | def refresh_cookie_eatasmr(username: str): 20 | """selenium获取cookie 21 | """ 22 | add_debug("刷新cookie") 23 | driver = get_webdriver() 24 | driver.get(eat_login_url) 25 | driver.find_element_by_xpath("//*[@id=\"menu-item-13336\"]/a").click() 26 | 27 | done = input("登录完成后按回车: ") 28 | 29 | 30 | 31 | my_username = username 32 | new_cookie = driver.get_cookies() 33 | driver.close() 34 | 35 | write_new_cookie_all(new_cookie, my_username) 36 | return new_cookie 37 | 38 | def do_sign_eat_single(cookie:List): 39 | """浏览一个帖子 40 | """ 41 | headers = get_headers(cookie, HEADER_EAT_SIGN) 42 | s = requests.session() 43 | 44 | sign_response = s.get(eat_attendance_url, headers=headers).text 45 | 46 | if ("过去30天中, 我连续签到了") in sign_response: 47 | print("可能登录成功") 48 | 49 | # if("class=\"nav__title\">🔑 登錄") in sign_response: 50 | # print("可能登录失败") 51 | 52 | 53 | if ("/tasks/attendance?a=check&__v=") in sign_response: 54 | form_start = sign_response.find("/tasks/attendance?a=check&__v=") + 30 # 此处30个字符 55 | formhash = sign_response[form_start:form_start + 10] # formhash 10位, 保留15 56 | complete_url = eat_sign_url_without_formhash + formhash 57 | formdata = "check=%E7%B0%BD%E5%88%B0" # URL-encoded "簽到" 58 | sign_response2 = s.post(complete_url, data=formdata, headers=headers) 59 | 60 | 61 | print("WAIT") 62 | 63 | def do_read_eat_all(): 64 | eat = get_cookies_by_domain(eatasmr_domain) 65 | display_info("正在eatASMR签到...") 66 | 67 | for user in eat.keys(): 68 | display_info("%s eatASMR签到: %s"%(datetime.now(), user)) 69 | do_sign_eat_single(eat[user]) 70 | 71 | display_info("eatASMR签到完成") 72 | 73 | if __name__ == '__main__': 74 | do_read_eat_all() 75 | # refresh_cookies_eatasmr() -------------------------------------------------------------------------------- /src/lib/dlc_getlink.py: -------------------------------------------------------------------------------- 1 | """ 2 | 输入网页, 自动付费并提取百度云/mega/谷歌/onedrive等链接 3 | """ 4 | import re, pyperclip, webbrowser 5 | from typing import * 6 | from lib.model import * 7 | 8 | sample_text = """链接: https://pan.baidu.com/s/1LQbrPC5LMG_0h3wt2k0WHg 提取码:tk20 == == 客官您好! 订单2512189764920274961给您上菜啦: 链接: https://pan.baidu.com/s/1evb3BhKgncfm4wGWYsTm6g 提取码:1234 满意再来光临哈! == == 下面发的内容是你购买的订单号: 2512189764920274961 的全部内容哦~ 链接: https://pan.baidu.com/s/1no4uSOxmkvTZ-Ps3M64J7Q 提取码:ayc0 祝你每天都有好心情哦~ ==""" 9 | 10 | 11 | def get_URL_from_line(line:str) -> str: 12 | """ 13 | 从一行提取url; 返回输出的url 14 | """ 15 | if not line: 16 | return "" 17 | r = (re.search(re_URL, line)) 18 | 19 | if not r: 20 | return "" 21 | full_url = f'{r.group(1)}' 22 | 23 | return full_url 24 | 25 | 26 | def append_links(curr_list:List, url:str, pswd:str): 27 | """链接和密码, 添加到list 28 | :param curr_list: List[Dict{'url':str, 'pswd':str}] 29 | """ 30 | my_dictionary = {'url' : url, 'pswd' : pswd} 31 | curr_list.append(my_dictionary) 32 | 33 | def export_clipboard(s:str): 34 | """复制string s到剪贴板 35 | :param s: 要复制的string 36 | """ 37 | pyperclip.copy(s) 38 | 39 | 40 | def parse_text(text:str)-> List[Dict]: 41 | """ 42 | :param text: 不带空格的所有百度云内容 (sample_text) 43 | :return: 提取的链接 44 | """ 45 | split_text = text.split(' ') 46 | url_list = [] 47 | curr_url = "" 48 | 49 | for line in split_text: 50 | url = get_URL_from_line(line) 51 | if (url != ""): 52 | curr_url = url 53 | 54 | if ("提取码:") in line: 55 | curr_pswd = line.split("提取码:")[1] 56 | # has_pswd = True 57 | append_links(url_list, curr_url, curr_pswd) 58 | 59 | return url_list 60 | 61 | 62 | 63 | def open_link_all(url_list:List[Dict]): 64 | """浏览器自动打开链接, 并复制密码 65 | """ 66 | print("len(url_list) = %s" %(len(url_list))) 67 | for i in range (len(url_list)): 68 | curr_url, curr_pswd = url_list[i]['url'], url_list[i]['pswd'] 69 | short_url = curr_url.split("https://pan.baidu.com")[1] 70 | webbrowser.open(curr_url, new=2) 71 | export_clipboard(curr_pswd) 72 | input("第%s个, %s: %s 回车以进行下一个"%(i+1, short_url, curr_pswd)) 73 | 74 | print("DONE") 75 | 76 | 77 | 78 | if __name__ == '__main__': 79 | # parse_text(sample_text) 80 | input_text = input("使用方法: 用ditto全部复制一遍, 一起黏贴, 用特殊黏贴去掉换行符\n") 81 | url_list = parse_text(input_text) 82 | open_link_all(url_list) 83 | -------------------------------------------------------------------------------- /src/farmer.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys, schedule 3 | 4 | from lib.v1_selenium import * 5 | from lib.v2_request import * 6 | from lib.logger import * 7 | 8 | 9 | def do_parse(): 10 | """ 11 | 命令行读取参数 12 | """ 13 | try: 14 | # 万一有人没改settings.py, 也不会闪退 15 | from private.settings import enable_s1_read 16 | except ImportError: 17 | display_warning("====未发现settings.py, 使用默认设置运行===") 18 | enable_s1_read = False 19 | 20 | 21 | parser = argparse.ArgumentParser() 22 | action_group = parser.add_mutually_exclusive_group() 23 | action_group.add_argument("-s", "--selenium", help="运行: 使用selenium模式(不填默认用post模式)", action="store_true") 24 | action_group.add_argument("-r", "--reset", help="刷新cookie", action="store_true") 25 | parser.add_argument("-n", "--now", help="立刻运行打工和签到", action="store_true") 26 | 27 | args = parser.parse_args() 28 | 29 | sign_hour = random.randint(10, 20) 30 | sign_minute = random.randint(11, 55) 31 | sign_time = str(sign_hour)+':'+str(sign_minute) 32 | 33 | if args.reset: 34 | 35 | display_info("刷新cookie") 36 | get_cookies_tsdm_all() 37 | # todo: 包含s1 38 | display_info("所有cookie刷新完毕") 39 | 40 | sys.exit() 41 | 42 | elif args.selenium: 43 | 44 | display_info("使用selenium模式运行, 签到时间: %s"%sign_time) 45 | schedule.every(362).minutes.do(work_multi_selenium) 46 | schedule.every().day.at(sign_time).do(sign_multi_selenium) # 每天签到时间 47 | 48 | else: 49 | 50 | display_info("默认: 使用post模式运行, 签到时间: %s"%sign_time) 51 | schedule.every(362).minutes.do(work_multi_post) 52 | schedule.every().day.at(sign_time).do(sign_multi_post) 53 | 54 | if args.now: 55 | display_info("[-n] 立即进行:") 56 | if args.reset: 57 | display_info("刷新cookie时-n选项无效") 58 | pass 59 | elif args.selenium: 60 | work_multi_selenium() 61 | sign_multi_selenium() 62 | else: 63 | work_multi_post() 64 | sign_multi_post() 65 | 66 | 67 | if enable_s1_read: 68 | from lib.dlc_stage1st import do_read_s1_all 69 | schedule.every(20).minutes.do(do_read_s1_all) 70 | 71 | 72 | def do_schedule(): 73 | display_info("正在运行计划任务, 每6小时签到一次") 74 | 75 | while True: 76 | print("距离下一次任务的时间: {:.1f}分钟".format(schedule.idle_seconds()/60), end='\r') 77 | schedule.run_pending() # 运行所有可以运行的任务 78 | time.sleep(10) 79 | 80 | 81 | if __name__ == '__main__': 82 | set_logger() 83 | do_parse() 84 | do_schedule() 85 | -------------------------------------------------------------------------------- /dist/SCF_s1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # 适配云函数, 单个文件完成s1阅读 4 | 5 | 6 | 7 | from datetime import datetime 8 | from typing import List 9 | import random, requests, time, json 10 | 11 | # ======== CONSTANT ======= 12 | 13 | s1_domain = "bbs.saraba1st.com" 14 | s1_frontpage = "https://bbs.saraba1st.com/2b/forum.php" 15 | s1_sample_post = "https://bbs.saraba1st.com/2b/thread-2039915-1-4.html" 16 | 17 | 18 | # ========= COOKIE ======== 19 | 20 | def get_cookies_all(): 21 | """从文件读取所有cookies 22 | { username: [cookie_list] } 23 | """ 24 | try: 25 | with open('cookies.json', 'r', encoding='utf-8') as json_file: 26 | data = json.load(json_file) 27 | return data 28 | 29 | except FileNotFoundError: # 文件不存在 30 | print("cookies.json不存在") 31 | return {} 32 | 33 | 34 | def get_cookies_by_domain(domain:str): 35 | """从所有cookie里分离出指定域名的cookie 36 | domain: cookie_list domain, (".tsdm39.net") 37 | """ 38 | cookies_all = get_cookies_all() # { username: [cookie_list] } 39 | domain_cookies = {} 40 | 41 | for username in cookies_all.keys(): 42 | curr_user_cookies = cookies_all[username] 43 | curr_user_cookies_domained = [] 44 | 45 | # 同一个用户名下可能有多个网站的cookie 46 | for cookie in curr_user_cookies: 47 | if cookie['domain'] == domain: 48 | curr_user_cookies_domained.append(cookie) 49 | 50 | if curr_user_cookies_domained != []: 51 | domain_cookies[username] = curr_user_cookies_domained 52 | 53 | return domain_cookies 54 | 55 | 56 | # ======= WORK ====== 57 | 58 | 59 | def do_read_s1_single(cookie:List): 60 | """浏览一个帖子 61 | """ 62 | cookie_serialized = "; ".join([i['name'] + "=" + i['value'] for i in cookie]) 63 | 64 | headers = { 65 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', 66 | 'cookie_list': cookie_serialized, 67 | 'connection': 'Keep-Alive', 68 | 'referer': 'https://bbs.saraba1st.com/2b/forum-6-1.html', 69 | } 70 | 71 | read_response = requests.get(s1_sample_post, headers=headers) 72 | 73 | if ("动漫论坛 - Stage1st") in read_response.text: 74 | print("%s S1: 状态正常"%datetime.now()) 75 | else: 76 | print("%s ====S1: 状态异常===="%datetime.now()) 77 | 78 | 79 | def do_read_s1_all(): 80 | s1_cookie = get_cookies_by_domain(s1_domain) 81 | print("正在s1刷在线时间...") 82 | 83 | for user in s1_cookie.keys(): 84 | print("%s 正在s1阅读: %s"%(datetime.now(), user)) 85 | try: 86 | do_read_s1_single(s1_cookie[user]) 87 | except Exception as e: 88 | print("====S1阅读失败, 继续运行: %s==="%e) 89 | 90 | print("s1阅读完成") 91 | 92 | 93 | 94 | def main_handler(event, context): 95 | do_read_s1_all() -------------------------------------------------------------------------------- /src/lib/v1_selenium.py: -------------------------------------------------------------------------------- 1 | import time 2 | from typing import Dict 3 | 4 | from lib.model import * 5 | from lib.model import tsdm_sign_url 6 | 7 | """ 8 | selenium方式的签到/打工 9 | 没有成功与否查询 10 | """ 11 | 12 | 13 | def sign_single(cookies): 14 | """签到主程序 15 | """ 16 | driver = get_webdriver() 17 | 18 | driver.get(tsdm_sign_url) # selenium: 必须先访问一次来获取cookie domain 19 | for cookie in cookies: 20 | driver.add_cookie(cookie) 21 | 22 | driver.get(tsdm_sign_url) # 回到签到页 23 | print("返回签到页....") 24 | time.sleep(0.5) 25 | 26 | try: 27 | silent_btn = driver.find_elements_by_name("qdmode")[1] 28 | except Exception: 29 | print("未找到按钮, 可能已经签过到") 30 | driver.quit() 31 | return 32 | 33 | # 没签过到 34 | silent_btn.click() # 不填写签到留言 35 | time.sleep(0.5) 36 | 37 | driver.find_element_by_id('kx').click() # 签到心情: 开心 38 | pages = driver.window_handles 39 | driver.switch_to.window(pages[0]) 40 | time.sleep(0.5) 41 | 42 | driver.find_element_by_xpath('//*[@id="qiandao"]/table[1]/tbody/tr/td/div/a[1]').click() # 提交 43 | # 如果失效了这样更新: https://stackoverflow.com/questions/39864280/xpath-for-elements-using-chrome 44 | 45 | print("签到完成") 46 | return 47 | 48 | 49 | def work_single_click(driver, eleement): 50 | """点击单个广告, 然后返回签到页 51 | """ 52 | eleement.click() 53 | time.sleep(0.2) 54 | og, popup = driver.window_handles[0], driver.window_handles[1] 55 | driver.switch_to.window(popup) 56 | driver.close() 57 | driver.switch_to.window(og) 58 | 59 | 60 | def work_single(cookies): 61 | """打工主程序 62 | """ 63 | driver = get_webdriver() 64 | 65 | driver.get(work_url) # selenium: 必须先访问一次来获取cookie domain 66 | for cookie in cookies: 67 | driver.add_cookie(cookie) 68 | 69 | driver.get(work_url) # 回到打工页 70 | time.sleep(0.5) 71 | 72 | try: 73 | driver.find_element_by_id("np_advid1") 74 | except Exception: 75 | print("未找到按钮, 可能已经打工过") 76 | driver.quit() 77 | return 78 | 79 | for i in driver.find_elements_by_xpath("//*[starts-with(@id,'np_advid')]"): 80 | work_single_click(driver, i) 81 | 82 | driver.find_element_by_xpath('//*[@id="stopad"]/a').click() 83 | time.sleep(2) 84 | 85 | print("打工完成") 86 | driver.quit() 87 | 88 | return 89 | 90 | 91 | def sign_multi_selenium(): 92 | all_cookies = get_cookies_all(COOKIE_PATH) 93 | for account in all_cookies.keys(): 94 | print("正在签到账号: ", account) 95 | try: 96 | sign_single(all_cookies[account]) 97 | except Exception as e: 98 | print("====selenium签到出错:=====", e) 99 | 100 | print("全部账号签到完成") 101 | 102 | 103 | def work_multi_selenium(): 104 | print(time.time(), "正在打工, 使用selenium方式.......") 105 | all_cookies = get_cookies_all(COOKIE_PATH) 106 | for account in all_cookies.keys(): 107 | print("正在打工账号: ", account) 108 | try: 109 | work_single(all_cookies[account]) 110 | except Exception as e: 111 | print("====selenium打工出错:=====", e) 112 | 113 | print("全部账号打工完成") -------------------------------------------------------------------------------- /src/lib/dlc_stage1st.py: -------------------------------------------------------------------------------- 1 | """ 2 | DLC: s1论坛自动浏览刷时间功能 3 | """ 4 | import time 5 | 6 | import requests 7 | 8 | from lib.model import * 9 | from lib.logger import * 10 | from lib.v2_request import get_headers 11 | 12 | 13 | def refresh_cookie_s1(username: str, password:str): 14 | """selenium获取单个S1 cookie_list 15 | """ 16 | driver = get_webdriver() 17 | driver.get(s1_frontpage) 18 | driver.find_element_by_id("ls_cookietime").click() 19 | 20 | if username and password: 21 | # 存在S1_CREDENTIALS, 自动填入密码登录 22 | driver.find_element_by_id("ls_username").send_keys(username) 23 | driver.find_element_by_id("ls_password").send_keys(password) 24 | time.sleep(2) 25 | driver.find_element_by_xpath("//*[@id=\"lsform\"]/div/div/table/tbody/tr[2]/td[3]/button").click() 26 | display_info("自动登录:") 27 | time.sleep(4) # 增加延迟确保获得auth 28 | 29 | else: 30 | display_warning("刷新cookie: 未找到S1_CREDENTIALS, 想要自动获取cookie请按readme设置好该变量") 31 | wait_input = input("请填入账号密码, 点击登录后按回车") 32 | 33 | if not username: 34 | # 无s1_CREDENTIAL, 从浏览器获取用户名 35 | my_username = driver.find_element_by_xpath("//*[@id='um']/p[1]/strong/a").text 36 | assert my_username is not None 37 | else: 38 | my_username = username 39 | 40 | new_cookie = driver.get_cookies() 41 | driver.close() 42 | 43 | display_info("正在写入cookie..") 44 | write_new_cookie_s1(new_cookie, my_username) 45 | return new_cookie 46 | 47 | 48 | def refresh_cookies_s1(): 49 | """从credentials重新获取所有cookie 50 | ===仅测试过单账户使用=== 51 | """ 52 | try: 53 | # 多账户刷新 54 | from private.settings import S1_CREDENTIALS 55 | for i in S1_CREDENTIALS: 56 | get_cookie_tsdm(i[0], i[1]) 57 | 58 | except ImportError: 59 | display_warning("未找到S1_credentials, 为单个账户手动刷新cookie; \n" 60 | "如果需要多账户签到/自动填写密码, 请先按照readme设置好账户密码") 61 | refresh_cookie_s1("", "") 62 | 63 | return 64 | 65 | 66 | def write_new_cookie_s1(new_cookie: List, username: str) -> None: 67 | """向cookie文件写入新的用户cookie 68 | { username: [cookie_list] } 69 | """ 70 | cookies = get_cookies_all(COOKIE_PATH) 71 | cookies[username] = simplify_cookie(new_cookie) 72 | 73 | with open(COOKIE_PATH, 'w', encoding='utf-8') as json_file: 74 | json.dump(cookies, json_file, ensure_ascii=False, indent=4) 75 | 76 | display_info("write done") 77 | 78 | def do_read_s1_single(cookie:List): 79 | """浏览一个帖子 80 | """ 81 | headers = get_headers(cookie, HEADER_S1_READ) 82 | read_response = requests.get(s1_sample_post, headers=headers) 83 | 84 | if ("动漫论坛 - Stage1st") in read_response.text: 85 | display_info("%s S1: 状态正常"%datetime.now()) 86 | else: 87 | display_error("%s ====S1: 状态异常===="%datetime.now()) 88 | 89 | 90 | def do_read_s1_all(): 91 | s1_cookie = get_cookies_by_domain(s1_domain) 92 | display_info("正在s1刷在线时间...") 93 | 94 | for user in s1_cookie.keys(): 95 | display_info("%s 正在s1阅读: %s"%(datetime.now(), user)) 96 | try: 97 | do_read_s1_single(s1_cookie[user]) 98 | except Exception as e: 99 | display_error("====S1阅读失败, 继续运行: %s==="%e) 100 | 101 | display_info("s1阅读完成") 102 | -------------------------------------------------------------------------------- /dist/SCF_eat.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from typing import * 3 | import random, requests, time, json 4 | 5 | 6 | eat_login_url = "https://eatasmr.com/community" 7 | eat_attendance_url = "https://eatasmr.com/tasks/attendance" 8 | eat_sign_url_without_formhash = "https://eatasmr.com/tasks/attendance?a=check&__v=" 9 | eatasmr_domain = "eatasmr.com" 10 | 11 | def get_cookies_all(): 12 | """从文件读取所有cookies 13 | { username: [cookie_list] } 14 | """ 15 | try: 16 | with open('cookies.json', 'r', encoding='utf-8') as json_file: 17 | data = json.load(json_file) 18 | return data 19 | 20 | except FileNotFoundError: # 文件不存在 21 | print("cookies.json不存在") 22 | return {} 23 | 24 | def write_new_cookie_all(new_cookie: List, username: str) -> None: 25 | """写入所有新的用户cookie 26 | { username: [cookie_list] } 27 | """ 28 | cookies = get_cookies_all() 29 | # TODO: 相同名称的直接覆盖, 不同站点的用不同cookie文件, 或者机制检测 30 | cookies[username] = new_cookie 31 | 32 | with open('cookies.json', 'w', encoding='utf-8') as json_file: 33 | json.dump(cookies, json_file, ensure_ascii=False, indent=4) 34 | 35 | print("写入cookie文件完成") 36 | 37 | 38 | def get_cookies_by_domain(domain:str): 39 | """从所有cookie里分离出指定域名的cookie 40 | domain: cookie_list domain, (".tsdm39.net") 41 | """ 42 | cookies_all = get_cookies_all() # { username: [cookie_list] } 43 | domain_cookies = {} 44 | 45 | for username in cookies_all.keys(): 46 | curr_user_cookies = cookies_all[username] 47 | curr_user_cookies_domained = [] 48 | 49 | # 同一个用户名下可能有多个网站的cookie 50 | for cookie in curr_user_cookies: 51 | if cookie['domain'] == domain: 52 | curr_user_cookies_domained.append(cookie) 53 | 54 | if curr_user_cookies_domained != []: 55 | domain_cookies[username] = curr_user_cookies_domained 56 | 57 | return domain_cookies 58 | 59 | 60 | 61 | # ================================= 62 | 63 | 64 | 65 | def do_sign_eat_single(cookie:List): 66 | """浏览一个帖子 67 | """ 68 | cookie_serialized = "; ".join([i['name'] + "=" + i['value'] for i in cookie]) 69 | 70 | headers = { 71 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', 72 | 'cookie_list': cookie_serialized, 73 | 'connection': 'Keep-Alive', 74 | 'referer': 'https://eatasmr.com/tasks/attendance', 75 | 'accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", 76 | 'content-type': "application/x-www-form-urlencoded", 77 | 'origin': "https://eatasmr.com" 78 | } 79 | s = requests.session() 80 | 81 | sign_response = s.get(eat_attendance_url, headers=headers).text 82 | 83 | if ("过去30天中, 我连续签到了") in sign_response: 84 | print("可能登录成功") 85 | 86 | # if("class=\"nav__title\">🔑 登錄") in sign_response: 87 | # print("可能登录失败") 88 | 89 | 90 | if ("/tasks/attendance?a=check&__v=") in sign_response: 91 | form_start = sign_response.find("/tasks/attendance?a=check&__v=") + 30 # 此处30个字符 92 | formhash = sign_response[form_start:form_start + 10] # formhash 10位, 保留15 93 | complete_url = eat_sign_url_without_formhash + formhash 94 | formdata = "check=%E7%B0%BD%E5%88%B0" # URL-encoded "簽到" 95 | sign_response2 = s.post(complete_url, data=formdata, headers=headers) 96 | 97 | 98 | print("WAIT") 99 | 100 | def do_read_eat_all(): 101 | eat = get_cookies_by_domain(eatasmr_domain) 102 | print("正在eatASMR签到...") 103 | 104 | for user in eat.keys(): 105 | print("%s eatASMR签到: %s"%(datetime.now(), user)) 106 | do_sign_eat_single(eat[user]) 107 | 108 | print("eatASMR签到完成") 109 | 110 | def main_handler(event, context): 111 | do_read_eat_all() -------------------------------------------------------------------------------- /dist/SCF_sign.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | TSDM-coin-farmer 5 | 适配云函数, 单个文件完成天使动漫多人签到 6 | requests方式 7 | cookies.json的例子见 https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/cookies.json.example 8 | """ 9 | 10 | from datetime import datetime 11 | import random, requests, time, json 12 | 13 | 14 | # ======== CONSTANT ======== 15 | sign_url = 'https://www.tsdm39.net/plugin.php?id=dsu_paulsign:sign' 16 | work_url = 'https://www.tsdm39.net/plugin.php?id=np_cliworkdz:work' 17 | login_url = 'https://www.tsdm39.net/member.php?mod=logging&action=login' 18 | 19 | tsdm_domain = ".tsdm39.net" 20 | s1_domain = "bbs.saraba1st.com" 21 | 22 | 23 | 24 | # ========= COOKIE ======== 25 | 26 | def get_cookies_all(): 27 | """从文件读取所有cookies 28 | { username: [cookie_list] } 29 | """ 30 | try: 31 | with open('cookies.json', 'r', encoding='utf-8') as json_file: 32 | data = json.load(json_file) 33 | return data 34 | 35 | except FileNotFoundError: # 文件不存在 36 | print("cookies.json不存在") 37 | return {} 38 | 39 | 40 | def get_cookies_by_domain(domain:str): 41 | """从所有cookie里分离出指定域名的cookie 42 | domain: cookie_list domain, (".tsdm39.net") 43 | """ 44 | cookies_all = get_cookies_all() # { username: [cookie_list] } 45 | domain_cookies = {} 46 | 47 | for username in cookies_all.keys(): 48 | curr_user_cookies = cookies_all[username] 49 | curr_user_cookies_domained = [] 50 | 51 | # 同一个用户名下可能有多个网站的cookie 52 | for cookie in curr_user_cookies: 53 | if cookie['domain'] == domain: 54 | curr_user_cookies_domained.append(cookie) 55 | 56 | if curr_user_cookies_domained != []: 57 | domain_cookies[username] = curr_user_cookies_domained 58 | 59 | return domain_cookies 60 | 61 | 62 | # ======= SIGN ====== 63 | 64 | sign_page_with_param = \ 65 | 'https://www.tsdm39.net/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&sign_as=1&inajax=1' 66 | 67 | 68 | def sign_single_post_v2(cookie): 69 | cookie_serialized = "; ".join([i['name'] + "=" + i['value'] for i in cookie]) 70 | 71 | # 必须要这个content-type, 否则没法接收 72 | headers = { 73 | 'accept': 'text/html, application/xhtml+xml, image/jxr, */*', 74 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', 75 | 'cookie_list': cookie_serialized, 76 | 'connection': 'Keep-Alive', 77 | 'referer': 'https://www.tsdm39.net/home.php?mod=space&do=pm', 78 | 'content-type': 'application/x-www-form-urlencoded' 79 | } 80 | 81 | s = requests.session() 82 | sign_response = s.get(sign_url, headers=headers).text 83 | 84 | form_start = sign_response.find("formhash=") + 9 # 此处9个字符 85 | formhash = sign_response[form_start:form_start + 8] # formhash 8位 86 | 87 | sign_data = "formhash=" + formhash + "&qdxq=wl&qdmode=3&todaysay=&fastreply=1" # formhash, 签到心情, 签到模式(不发言) 88 | 89 | sign_response = s.post(sign_page_with_param, data=sign_data, headers=headers) 90 | 91 | if "恭喜你签到成功!获得随机奖励" in sign_response.text: 92 | print("签到成功") 93 | return True 94 | elif "您今日已经签到" in sign_response.text: 95 | print("该账户已经签到过") 96 | elif "已经过了签到时间段" in sign_response.text or "签到时间还没有到" in sign_response.text: 97 | print("签到失败: 目前不在签到时间段") 98 | elif "未定义操作" in sign_response.text: 99 | print("%s签到失败, 可能是formhash获取错误" % datetime.now()) 100 | print("签到", sign_response.text) 101 | else: 102 | print("%s======未知原因签到失败, 已保存response=======" % datetime.now()) 103 | print("签到", sign_response.text) 104 | 105 | return False 106 | 107 | 108 | def sign_multi_post(): 109 | cookies = get_cookies_by_domain(tsdm_domain) 110 | 111 | for user in cookies.keys(): 112 | print("%s正在签到: %s" % (datetime.now(), user)) 113 | try: 114 | sign_single_post_v2(cookies[user]) 115 | except Exception as e: 116 | print("%s====post签到出错: %s===" % (datetime.now(), e)) 117 | 118 | time.sleep(random.uniform(0.5, 1)) 119 | 120 | print("POST方式: 全部签到完成") 121 | return 122 | 123 | def main_handler(event, context): 124 | sign_multi_post() -------------------------------------------------------------------------------- /dist/SCF_work.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | TSDM-coin-farmer 5 | 适配云函数, 单个文件完成天使动漫多人打工 6 | requests方式 7 | cookies.json的例子见 https://github.com/Trojblue/TSDM-coin-farmer/blob/main/doc/cookies.json.example 8 | """ 9 | 10 | 11 | import json, random, requests, time 12 | from typing import List 13 | 14 | # ======== CONSTANT ======== 15 | sign_url = 'https://www.tsdm39.net/plugin.php?id=dsu_paulsign:sign' 16 | work_url = 'https://www.tsdm39.net/plugin.php?id=np_cliworkdz:work' 17 | login_url = 'https://www.tsdm39.net/member.php?mod=logging&action=login' 18 | 19 | tsdm_domain = ".tsdm39.net" 20 | s1_domain = "bbs.saraba1st.com" 21 | 22 | 23 | # ========= COOKIE ======== 24 | 25 | def get_cookies_all(): 26 | """从文件读取所有cookies 27 | { username: [cookie_list] } 28 | """ 29 | try: 30 | with open('cookies.json', 'r', encoding='utf-8') as json_file: 31 | data = json.load(json_file) 32 | return data 33 | 34 | except FileNotFoundError: # 文件不存在 35 | print("cookies.json不存在") 36 | return {} 37 | 38 | 39 | def get_cookies_by_domain(domain: str): 40 | """从所有cookie里分离出指定域名的cookie 41 | domain: cookie_list domain, (".tsdm39.net") 42 | """ 43 | cookies_all = get_cookies_all() # { username: [cookie_list] } 44 | domain_cookies = {} 45 | 46 | for username in cookies_all.keys(): 47 | curr_user_cookies = cookies_all[username] 48 | curr_user_cookies_domained = [] 49 | 50 | # 同一个用户名下可能有多个网站的cookie 51 | for cookie in curr_user_cookies: 52 | if cookie['domain'] == domain: 53 | curr_user_cookies_domained.append(cookie) 54 | 55 | if curr_user_cookies_domained != []: 56 | domain_cookies[username] = curr_user_cookies_domained 57 | 58 | return domain_cookies 59 | 60 | 61 | # ======= WORK ====== 62 | 63 | def work_single_post(cookie: List): 64 | """用post方式为一个账户打工 65 | cookie_list: List[Dict] 66 | """ 67 | cookie_serialized = "; ".join([i['name'] + "=" + i['value'] for i in cookie]) 68 | 69 | # 必须要这个content-type, 否则没法接收 70 | headers = { 71 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', 72 | 'cookie_list': cookie_serialized, 73 | 'connection': 'Keep-Alive', 74 | 'x-requested-with': 'XMLHttpRequest', 75 | 'referer': 'https://www.tsdm39.net/plugin.php?id=np_cliworkdz:work', 76 | 'content-type': 'application/x-www-form-urlencoded' 77 | } 78 | 79 | # 打工之前必须访问过一次网页 80 | requests.get(work_url, headers=headers) 81 | 82 | ad_feedback = requests.post(work_url, data="act=clickad", headers=headers) 83 | if "必须与上一次间隔" in ad_feedback.text: 84 | print("该账户已经打工过") 85 | return 86 | 87 | for i in range(7): # 总共6次打工, 实际打工8次保险 88 | ad_feedback = requests.post(work_url, data="act=clickad", headers=headers) 89 | 90 | wait_time = round(random.uniform(0.5, 1), 2) 91 | print("点击广告: 第%s次, 等待%s秒, 服务器标识:%s" % (i + 2, wait_time, ad_feedback.text), end="\r") 92 | print("点击广告: 第%s次, 等待%s秒, 服务器标识:%s" % (i + 2, wait_time, ad_feedback.text)) 93 | time.sleep(wait_time) 94 | 95 | if int(ad_feedback.text) > 1629134400: 96 | print("检测到作弊判定, 请尝试重新运行") 97 | break 98 | elif int(ad_feedback.text) >= 6: # 已点击6次, 停止 99 | break 100 | else: 101 | continue 102 | 103 | getcre_response = requests.post(work_url, data="act=getcre", headers=headers) 104 | 105 | if "您已经成功领取了奖励天使币" in getcre_response.text: 106 | print("打工成功") 107 | return True 108 | elif "作弊" in getcre_response.text: 109 | print("作弊判定, 打工失败, 重试...") 110 | elif "请先登录再进行点击任务" in getcre_response.text: 111 | print("打工失败, cookie失效...") 112 | elif "服务器负荷较重" in getcre_response.text: 113 | print("打工失败, TSDM:\"服务器负荷较重,操作超时\"...") 114 | else: 115 | print("======未知原因打工失败, 已保存response=======") 116 | print("打工", getcre_response.text) 117 | 118 | return False 119 | 120 | 121 | def work_multi_post(): 122 | cookies = get_cookies_by_domain(tsdm_domain) 123 | 124 | for user in cookies.keys(): 125 | print("正在打工: %s" % user) 126 | try: 127 | work_single_post(cookies[user]) 128 | except Exception as e: 129 | print("====post打工出错: %s=====" % e) 130 | 131 | print("POST方式: 全部打工完成") 132 | return 133 | 134 | 135 | def main_handler(event, context): 136 | work_multi_post() 137 | -------------------------------------------------------------------------------- /src/lib/v2_request.py: -------------------------------------------------------------------------------- 1 | """ 2 | 尝试用requests方式完成签到 3 | """ 4 | from datetime import datetime 5 | from typing import List 6 | 7 | import random, requests, time 8 | 9 | from lib.model import * 10 | from lib.logger import * 11 | from lib.model import * 12 | 13 | 14 | def get_headers(cookie_list:List, header:Dict) -> Dict: 15 | """读取 , 添加到
16 | :param cookie_list: get_cookies_by_domain() 17 | :param header: 在model.py设置 18 | :return: 完整cookie 19 | """ 20 | cookie_serialized = get_serialized_cookie(cookie_list) 21 | headers = HEADER_UNIVERSAL 22 | for k in header.keys(): 23 | headers[k] = header[k] 24 | headers['cookie_list'] = cookie_serialized 25 | 26 | return headers 27 | 28 | 29 | def work_single_post(cookie: List): 30 | """用post方式为一个账户打工 31 | cookie_list: List[Dict] 32 | """ 33 | headers = get_headers(cookie, HEADER_TSDM_WORK) 34 | 35 | # 打工之前必须访问过一次网页 36 | page_feedback = requests.get(work_url, headers=headers) 37 | 38 | ad_feedback = requests.post(work_url, data="act=clickad", headers=headers) 39 | if "必须与上一次间隔" in ad_feedback.text: 40 | display_info("该账户已经打工过") 41 | return 42 | elif "请先登录" in ad_feedback.text: 43 | display_info("登录信息失效") 44 | return 45 | elif len(ad_feedback.text) > 100: # 失败, 返回未error check的网页 46 | display_info("其他原因打工错误") 47 | return 48 | 49 | 50 | for i in range(7): # 总共6次打工, 实际打工8次保险 51 | ad_feedback = requests.post(work_url, data="act=clickad", headers=headers) 52 | 53 | wait_time = round(random.uniform(0.5, 1), 2) 54 | # todo: 这里会打印整行feedback 55 | print("点击广告: 第%s次, 等待%s秒, 服务器标识:%s" % (i + 2, wait_time, ad_feedback.text), end="\r") 56 | add_debug("点击广告: 第%s次, 等待%s秒, 服务器标识:%s" % (i + 2, wait_time, ad_feedback.text)) 57 | time.sleep(wait_time) 58 | 59 | if int(ad_feedback.text) > 1629134400: 60 | display_error("检测到作弊判定, 请尝试重新运行") 61 | break 62 | # todo: 延时, 重试 63 | elif int(ad_feedback.text) >= 6: # 已点击6次, 停止 64 | break 65 | else: 66 | continue 67 | 68 | getcre_response = requests.post(work_url, data="act=getcre", headers=headers) 69 | 70 | if "您已经成功领取了奖励天使币" in getcre_response.text: 71 | display_info("打工成功") 72 | elif "作弊" in getcre_response.text: 73 | display_error("作弊判定, 打工失败, 重试...") 74 | # todo: 增加重试逻辑 75 | elif "请先登录再进行点击任务" in getcre_response.text: 76 | display_error("打工失败, cookie失效...") 77 | elif "服务器负荷较重" in getcre_response.text: 78 | display_error("打工失败, TSDM:\"服务器负荷较重,操作超时\"...") 79 | else: 80 | display_error("======未知原因打工失败, 已保存response=======") 81 | write_error("打工", getcre_response.text) 82 | 83 | return 84 | 85 | 86 | def work_multi_post(): 87 | cookies = get_cookies_by_domain(tsdm_domain) 88 | 89 | for user in cookies.keys(): 90 | display_info("正在打工: %s" % user) 91 | try: 92 | work_single_post(cookies[user]) 93 | except Exception as e: 94 | display_error("====post打工出错: %s=====" % e) 95 | 96 | display_info("POST方式: 全部打工完成") 97 | return 98 | 99 | 100 | def sign_single_post_v2(cookie): 101 | cookie_serialized = get_serialized_cookie(cookie) 102 | 103 | # 必须要这个content-type, 否则没法接收 104 | headers = HEADER_TSDM_SIGN 105 | headers['cookie_list'] = cookie_serialized 106 | 107 | s = requests.session() 108 | sign_response = s.get(tsdm_sign_url, headers=headers).text 109 | 110 | form_start = sign_response.find("formhash=") + 9 # 此处9个字符 111 | formhash = sign_response[form_start:form_start + 8] # formhash 8位 112 | 113 | sign_data = "formhash=" + formhash + "&qdxq=wl&qdmode=3&todaysay=&fastreply=1" # formhash, 签到心情, 签到模式(不发言) 114 | 115 | sign_response = s.post(sign_url_with_param, data=sign_data, headers=headers) 116 | 117 | if "恭喜你签到成功!获得随机奖励" in sign_response.text: 118 | display_info("签到成功") 119 | elif "您今日已经签到" in sign_response.text: 120 | display_info("该账户已经签到过") 121 | elif "已经过了签到时间段" in sign_response.text or "签到时间还没有到" in sign_response.text: 122 | display_error("签到失败: 目前不在签到时间段") 123 | elif "未定义操作" in sign_response.text: 124 | display_error("%s签到失败, 可能是formhash获取错误" % datetime.now()) 125 | write_error("签到", sign_response.text) 126 | else: 127 | display_error("%s======未知原因签到失败, 已保存response=======" % datetime.now()) 128 | write_error("签到", sign_response.text) 129 | 130 | return 131 | 132 | 133 | def sign_multi_post(): 134 | cookies = get_cookies_by_domain(tsdm_domain) 135 | 136 | for user in cookies.keys(): 137 | display_info("%s正在签到: %s" % (datetime.now(), user)) 138 | try: 139 | sign_single_post_v2(cookies[user]) 140 | except Exception as e: 141 | display_error("%s====post签到出错: %s===" % (datetime.now(), e)) 142 | 143 | time.sleep(random.uniform(0.5, 1)) 144 | 145 | display_info("POST方式: 全部签到完成") 146 | return 147 | -------------------------------------------------------------------------------- /src/lib/model.py: -------------------------------------------------------------------------------- 1 | import json 2 | import logging 3 | 4 | from typing import List, Dict 5 | from selenium import webdriver 6 | from selenium.webdriver.support.ui import WebDriverWait 7 | from selenium.webdriver.support import expected_conditions as EC 8 | from datetime import datetime 9 | 10 | from lib.logger import * 11 | 12 | # Local path 13 | COOKIE_PATH = './private/cookies.json' 14 | 15 | # ======= Header ========= 16 | 17 | # 通用header, 如果相同会被下面的其他header覆盖 18 | HEADER_UNIVERSAL = { 19 | 'cookie_list': "===CHANGE ME===", 20 | 'connection': 'Keep-Alive', 21 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', 22 | } 23 | 24 | HEADER_TSDM_WORK = { 25 | 'x-requested-with': 'XMLHttpRequest', 26 | 'referer': 'https://www.tsdm39.net/plugin.php?id=np_cliworkdz:work', 27 | 'content-type': 'application/x-www-form-urlencoded' 28 | } 29 | 30 | HEADER_TSDM_SIGN = { 31 | 'accept': 'text/html, application/xhtml+xml, image/jxr, */*', 32 | 'referer': 'https://www.tsdm39.net/home.php?mod=space&do=pm', 33 | 'content-type': 'application/x-www-form-urlencoded' 34 | } 35 | 36 | HEADER_S1_READ = { 37 | 'referer': 'https://bbs.saraba1st.com/2b/forum-6-1.html', 38 | } 39 | 40 | HEADER_EAT_SIGN = { 41 | 'referer': 'https://eatasmr.com/tasks/attendance', 42 | 'accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", 43 | 'content-type': "application/x-www-form-urlencoded", 44 | 'origin': "https://eatasmr.com" 45 | } 46 | 47 | 48 | # ====== URL ======== 49 | 50 | tsdm_sign_url = 'https://www.tsdm39.net/plugin.php?id=dsu_paulsign:sign' 51 | sign_url_with_param = 'https://www.tsdm39.net/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&sign_as=1&inajax=1' 52 | 53 | work_url = 'https://www.tsdm39.net/plugin.php?id=np_cliworkdz:work' 54 | login_url = 'https://www.tsdm39.net/member.php?mod=logging&action=login' 55 | 56 | s1_frontpage = "https://bbs.saraba1st.com/2b/forum.php" 57 | s1_sample_post = "https://bbs.saraba1st.com/2b/thread-2022232-1-1.html" 58 | 59 | # cookie_list domain 60 | tsdm_domain = ".tsdm39.net" 61 | s1_domain = "bbs.saraba1st.com" 62 | eatasmr_domain = "eatasmr.com" 63 | 64 | # re相关 65 | re_URL = "(?Phttps?://[^\s]+)" 66 | 67 | 68 | 69 | # ========= COOKIES ======= 70 | def get_cookie_tsdm(username: str, password: str): 71 | """selenium获取cookie 72 | """ 73 | add_debug("刷新cookie") 74 | driver = get_webdriver() 75 | driver.get(login_url) 76 | driver.find_element_by_xpath("//*[starts-with(@id,'cookietime_')]").click() 77 | 78 | if username and password: # 账户密码非空 79 | driver.find_element_by_xpath("//*[starts-with(@id,'username_')]").send_keys(username) 80 | driver.find_element_by_xpath("//*[starts-with(@id,'password3_')]").send_keys(password) 81 | driver.find_element_by_name("tsdm_verify").click() 82 | display_info("在浏览器内填写验证码后点击登录:") 83 | else: 84 | # 无TSDM_CREDENTIAL, 手动填写信息 85 | display_warning("请手动填写信息后点击登录:") 86 | 87 | wait = WebDriverWait(driver, 100) 88 | wait.until(EC.title_contains("提示信息 - ")) 89 | 90 | if not username: 91 | # 无TSDM_CREDENTIAL, 从浏览器获取用户名 92 | my_username = driver.find_element_by_xpath("//*[@id='um']/p[1]/strong/a").text 93 | assert my_username is not None 94 | else: 95 | my_username = username 96 | 97 | new_cookie = driver.get_cookies() 98 | driver.close() 99 | 100 | write_new_cookie(new_cookie, my_username) 101 | return new_cookie 102 | 103 | def get_cookies_tsdm_all(): 104 | """从credentials重新获取所有cookie 105 | """ 106 | try: 107 | # 多账户刷新 108 | from private.settings import TSDM_CREDENTIALS 109 | for i in TSDM_CREDENTIALS: 110 | get_cookie_tsdm(i[0], i[1]) 111 | 112 | except ImportError: 113 | display_warning("未找到TSDM_credentials, 为单个账户手动刷新cookie; \n" 114 | "如果需要多账户签到/自动填写密码, 请先按照readme设置好天使动漫的账户密码") 115 | get_cookie_tsdm("", "") 116 | 117 | return 118 | 119 | 120 | def get_cookies_all() -> Dict: 121 | """从文件读取所有cookies 122 | { username: [cookie_list] } 123 | """ 124 | try: 125 | with open(COOKIE_PATH, 'r', encoding='utf-8') as json_file: 126 | data = json.load(json_file) 127 | return data 128 | 129 | except FileNotFoundError: # 文件不存在 130 | display_warning("cookies.json不存在") 131 | return {} 132 | 133 | 134 | def get_cookies_by_domain(domain:str): 135 | """从所有cookie里分离出指定域名的cookie 136 | domain: cookie_list domain, (".tsdm39.net") 137 | """ 138 | cookies_all = get_cookies_all() # { username: [cookie_list] } 139 | domain_cookies = {} 140 | 141 | for username in cookies_all.keys(): 142 | curr_user_cookies = cookies_all[username] 143 | curr_user_cookies_domained = [] 144 | 145 | # 同一个用户名下可能有多个网站的cookie 146 | for cookie in curr_user_cookies: 147 | if cookie['domain'] == domain: 148 | curr_user_cookies_domained.append(cookie) 149 | 150 | if curr_user_cookies_domained != []: 151 | domain_cookies[username] = curr_user_cookies_domained 152 | 153 | return domain_cookies 154 | 155 | def write_new_cookie(new_cookie: List, username: str) -> None: 156 | """向cookie文件写入新的用户cookie 157 | { username: [cookie_list] } 158 | """ 159 | simplified_new_cookie = simplify_cookie(new_cookie) 160 | cookies = get_cookies_all() 161 | 162 | # TODO: 相同名称的直接覆盖, 不同站点的用不同cookie文件, 或者机制检测 163 | cookies[username] = simplified_new_cookie 164 | 165 | with open(COOKIE_PATH, 'w', encoding='utf-8') as json_file: 166 | json.dump(cookies, json_file, ensure_ascii=False, indent=4) 167 | 168 | display_info("写入cookie文件完成") 169 | 170 | 171 | def write_new_cookie_all(new_cookie: List, username: str) -> None: 172 | """写入所有新的用户cookie 173 | { username: [cookie_list] } 174 | """ 175 | cookies = get_cookies_all(COOKIE_PATH) 176 | # TODO: 相同名称的直接覆盖, 不同站点的用不同cookie文件, 或者机制检测 177 | cookies[username] = new_cookie 178 | 179 | with open(COOKIE_PATH, 'w', encoding='utf-8') as json_file: 180 | json.dump(cookies, json_file, ensure_ascii=False, indent=4) 181 | 182 | display_info("写入cookie文件完成") 183 | 184 | 185 | def simplify_cookie(cookie): 186 | """只保存登录需要的2个cookie: saltkey, auth 187 | """ 188 | simplified_cookie = [] 189 | login_word = ['_saltkey', '_auth', 'EATSESSID', 190 | 'wordpress_logged_in_bbae6ecd47232ff70d42a5fbe3863254'] 191 | for i in cookie: 192 | if any(word in i['name'] for word in login_word): 193 | simplified_cookie.append(i) 194 | 195 | return simplified_cookie 196 | 197 | 198 | # ========= Others ======= 199 | 200 | def get_webdriver(): 201 | """返回设置好参数的webdriver 202 | """ 203 | options = webdriver.ChromeOptions() 204 | options.add_argument("disable-software-rasterizer") 205 | options.add_argument("log-level=3") 206 | driver = webdriver.Chrome(chrome_options=options) 207 | return driver 208 | 209 | def get_serialized_cookie(cookie_list:List): 210 | return "; ".join([i['name'] + "=" + i['value'] for i in cookie_list]) 211 | 212 | def write_error(prefix:str, content:str): 213 | """保存错误日志 214 | prefix: 文件名前缀 215 | content: 错误日志内容 216 | """ 217 | my_date = prefix + datetime.today().strftime(' %Y-%m-%d %H%M %S.%f.log') 218 | with open(my_date, "w") as f: 219 | f.write(content) 220 | return -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------