## Hướng dẫn sử dụng bản MHPKMS Online
___
### Working with framework
Phần hướng dẫn này sẽ giúp các bạn sử dụng MHPKMS với Flask, nhưng bạn cũng có thể áp dụng MHPKMS vào các framework khác.
```python
from flask import (Flask, request, abort, make_response) # Load thư viện flask
from MHPKMS_client import Client # Load Client của MHPKMS
app = Flask(__name__)
client = Client()
# client.set_client(<client-key>)
# client.set_appid(<appid>)
@app.get("/api/secrets")
def secrets():
# Sử dụng MHPKMS để kiểm tra key
key = request.args.get('key')
check = client.activate(key) # Kiểm tra key
if not check: # Sai key
abort(401)
return make_response("Hi, I'm secret.", 200) # Trả về thông tin được bảo vệ
```
### Selenium with framework, and MHPKMS
Bạn thậm chí có thể chạy Selenium (Automation) trên framework! Trong bài viết này, chúng ta sẽ chạy Selenium trên Flask cùng với bảo mật
của MHPKMS
```python
import ... # Thêm các thư viện cần thiết cho Selenium, Flask
from MHPKMS_client import Client
app = Flask(__name__)
client = Client()
# client.set_client(<client-key>)
# client.set_appid(<appid>)
@app.get("/api/tool/dojob")
def dojob():
# Kiểm tra key trước, giảm resource cần dùng cho server
key = request.args.get('key')
check = client.activate(key)
if not check:
abort(401)
driver = ... # Loại driver bạn muốn dùng
... # Do job
return make_response(<kết-quả>, 200) # Return sau khi do job xong
```
```
curl <host>/api/tool/dojob -> 401
```
```
curl <host>/api/tool/dojob?key=<legit-key> -> 200
```
Với mợt vài lệnh cơ bản, bạn đã có thể làm tool mà không lo bị sử dụng trái phép, MHPKMS sẽ bảo vệ bạn khỏi abuse nên bạn không phải lo
lắng 💖
Raw data
{
"_id": null,
"home_page": "https://github.com/MHP0920/MHPKMS",
"name": "MHPKMS",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "MHP,KMS,trial,python,python3",
"author": "MHP",
"author_email": "py.hacker.hieu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9e/13/4c36ab8c4f143c9bfec6fac4a57752a7a8f7d80391f9659ed9ce4f13adb3/MHPKMS-1.0.0.2.tar.gz",
"platform": null,
"description": "## H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ea3n MHPKMS Online\r\n___\r\n### Working with framework\r\nPh\u1ea7n h\u01b0\u1edbng d\u1eabn n\u00e0y s\u1ebd gi\u00fap c\u00e1c b\u1ea1n s\u1eed d\u1ee5ng MHPKMS v\u1edbi Flask, nh\u01b0ng b\u1ea1n c\u0169ng c\u00f3 th\u1ec3 \u00e1p d\u1ee5ng MHPKMS v\u00e0o c\u00e1c framework kh\u00e1c.\r\n```python\r\nfrom flask import (Flask, request, abort, make_response) # Load th\u01b0 vi\u1ec7n flask\r\nfrom MHPKMS_client import Client # Load Client c\u1ee7a MHPKMS\r\n\r\napp = Flask(__name__)\r\nclient = Client()\r\n# client.set_client(<client-key>)\r\n# client.set_appid(<appid>)\r\n\r\n@app.get(\"/api/secrets\")\r\ndef secrets():\r\n # S\u1eed d\u1ee5ng MHPKMS \u0111\u1ec3 ki\u1ec3m tra key\r\n key = request.args.get('key')\r\n check = client.activate(key) # Ki\u1ec3m tra key\r\n if not check: # Sai key\r\n abort(401)\r\n return make_response(\"Hi, I'm secret.\", 200) # Tr\u1ea3 v\u1ec1 th\u00f4ng tin \u0111\u01b0\u1ee3c b\u1ea3o v\u1ec7\r\n```\r\n\r\n### Selenium with framework, and MHPKMS\r\nB\u1ea1n th\u1eadm ch\u00ed c\u00f3 th\u1ec3 ch\u1ea1y Selenium (Automation) tr\u00ean framework! Trong b\u00e0i vi\u1ebft n\u00e0y, ch\u00fang ta s\u1ebd ch\u1ea1y Selenium tr\u00ean Flask c\u00f9ng v\u1edbi b\u1ea3o m\u1eadt\r\nc\u1ee7a MHPKMS\r\n```python\r\nimport ... # Th\u00eam c\u00e1c th\u01b0 vi\u1ec7n c\u1ea7n thi\u1ebft cho Selenium, Flask\r\nfrom MHPKMS_client import Client\r\n\r\napp = Flask(__name__)\r\nclient = Client()\r\n# client.set_client(<client-key>)\r\n# client.set_appid(<appid>)\r\n\r\n@app.get(\"/api/tool/dojob\")\r\ndef dojob():\r\n # Ki\u1ec3m tra key tr\u01b0\u1edbc, gi\u1ea3m resource c\u1ea7n d\u00f9ng cho server\r\n key = request.args.get('key')\r\n check = client.activate(key)\r\n if not check:\r\n abort(401)\r\n driver = ... # Lo\u1ea1i driver b\u1ea1n mu\u1ed1n d\u00f9ng\r\n ... # Do job\r\n return make_response(<k\u1ebft-qu\u1ea3>, 200) # Return sau khi do job xong\r\n```\r\n```\r\ncurl <host>/api/tool/dojob -> 401\r\n```\r\n```\r\ncurl <host>/api/tool/dojob?key=<legit-key> -> 200\r\n```\r\n\r\nV\u1edbi m\u1ee3t v\u00e0i l\u1ec7nh c\u01a1 b\u1ea3n, b\u1ea1n \u0111\u00e3 c\u00f3 th\u1ec3 l\u00e0m tool m\u00e0 kh\u00f4ng lo b\u1ecb s\u1eed d\u1ee5ng tr\u00e1i ph\u00e9p, MHPKMS s\u1ebd b\u1ea3o v\u1ec7 b\u1ea1n kh\u1ecfi abuse n\u00ean b\u1ea1n kh\u00f4ng ph\u1ea3i lo \r\nl\u1eafng \ud83d\udc96\r\n\r\n",
"bugtrack_url": null,
"license": "CC BY-ND 4.0",
"summary": "Send trial products take easy.",
"version": "1.0.0.2",
"project_urls": {
"Homepage": "https://github.com/MHP0920/MHPKMS"
},
"split_keywords": [
"mhp",
"kms",
"trial",
"python",
"python3"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7a08aee99760e517d29ae7e292a5bc19f8f3ffc90083506d9b8db20f769b394f",
"md5": "bc2d65d960bea15cad2586dd4a42ce6c",
"sha256": "1acd743e7c6eb1fb29541978908e1cc48c0474ec12bc50a0ad4e0caf09e42d31"
},
"downloads": -1,
"filename": "MHPKMS-1.0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc2d65d960bea15cad2586dd4a42ce6c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 2972,
"upload_time": "2023-08-18T16:41:59",
"upload_time_iso_8601": "2023-08-18T16:41:59.520556Z",
"url": "https://files.pythonhosted.org/packages/7a/08/aee99760e517d29ae7e292a5bc19f8f3ffc90083506d9b8db20f769b394f/MHPKMS-1.0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9e134c36ab8c4f143c9bfec6fac4a57752a7a8f7d80391f9659ed9ce4f13adb3",
"md5": "c9e258614f1080f71de91774d03d760b",
"sha256": "efd2402cc58a7abc5ed1410a4fed48a08f0767cf9b6b5940107b421bcc4e9405"
},
"downloads": -1,
"filename": "MHPKMS-1.0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "c9e258614f1080f71de91774d03d760b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3151,
"upload_time": "2023-08-18T16:42:00",
"upload_time_iso_8601": "2023-08-18T16:42:00.979474Z",
"url": "https://files.pythonhosted.org/packages/9e/13/4c36ab8c4f143c9bfec6fac4a57752a7a8f7d80391f9659ed9ce4f13adb3/MHPKMS-1.0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-18 16:42:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MHP0920",
"github_project": "MHPKMS",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mhpkms"
}