{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/chatgpt-game-autotest-sql-injection-testing/",
  "atlas": "https://www.pystone.net/?node=chatgpt-game-autotest-sql-injection-testing#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/chatgpt-game-autotest-sql-injection-testing.md",
  "context": "https://www.pystone.net/notes/chatgpt-game-autotest-sql-injection-testing.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:chatgpt-game-autotest-sql-injection-testing",
  "slug": "chatgpt-game-autotest-sql-injection-testing",
  "title": "【ChatGPT】游戏自动化测试实践案例 - SQL注入测试",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "【ChatGPT】游戏自动化测试实践案例 SQL注入测试",
  "contentRole": "unspecified",
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "unspecified",
  "domain": "99-资料来源、摘录与归档",
  "tags": [],
  "mocs": [],
  "contentHash": "7027cd470adab2b92afd13d301eddf0d5743dec8eb03adf751b78ed6c1b03390",
  "assets": [],
  "headings": [
    {
      "depth": 1,
      "text": "【ChatGPT】游戏自动化测试实践案例 - SQL注入测试",
      "anchor": "chatgpt游戏自动化测试实践案例---sql注入测试",
      "citation": "https://www.pystone.net/notes/chatgpt-game-autotest-sql-injection-testing/#chatgpt%E6%B8%B8%E6%88%8F%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E5%AE%9E%E8%B7%B5%E6%A1%88%E4%BE%8B---sql%E6%B3%A8%E5%85%A5%E6%B5%8B%E8%AF%95"
    },
    {
      "depth": 2,
      "text": "初始化 Pocopoco = UnityPoco()",
      "anchor": "初始化-pocopoco-unitypoco",
      "citation": "https://www.pystone.net/notes/chatgpt-game-autotest-sql-injection-testing/#%E5%88%9D%E5%A7%8B%E5%8C%96-pocopoco-unitypoco"
    },
    {
      "depth": 2,
      "text": "准备模拟 SQL 注入攻击的用户名和密码sqlinjectionusername = \"' OR '1'='1\"sqlinjectionpassword = \"' OR '1'='1\"# 在用户名和密码输入框中输入恶意数据usernameinput = poco(\"usernameinput\")",
      "anchor": "准备模拟-sql-注入攻击的用户名和密码sqlinjectionusername-or-11sqlinjectionpassword-or-11-在用户名和密码输入框中输入恶意数据usernameinput-pocousernameinput",
      "citation": "https://www.pystone.net/notes/chatgpt-game-autotest-sql-injection-testing/#%E5%87%86%E5%A4%87%E6%A8%A1%E6%8B%9F-sql-%E6%B3%A8%E5%85%A5%E6%94%BB%E5%87%BB%E7%9A%84%E7%94%A8%E6%88%B7%E5%90%8D%E5%92%8C%E5%AF%86%E7%A0%81sqlinjectionusername-or-11sqlinjectionpassword-or-11-%E5%9C%A8%E7%94%A8%E6%88%B7%E5%90%8D%E5%92%8C%E5%AF%86%E7%A0%81%E8%BE%93%E5%85%A5%E6%A1%86%E4%B8%AD%E8%BE%93%E5%85%A5%E6%81%B6%E6%84%8F%E6%95%B0%E6%8D%AEusernameinput-pocousernameinput"
    },
    {
      "depth": 2,
      "text": "点击登录按钮loginbutton = poco(\"loginbutton\")",
      "anchor": "点击登录按钮loginbutton-pocologinbutton",
      "citation": "https://www.pystone.net/notes/chatgpt-game-autotest-sql-injection-testing/#%E7%82%B9%E5%87%BB%E7%99%BB%E5%BD%95%E6%8C%89%E9%92%AEloginbutton-pocologinbutton"
    },
    {
      "depth": 2,
      "text": "检查是否成功登录if poco(\"userloggedin\").exists():",
      "anchor": "检查是否成功登录if-pocouserloggedinexists",
      "citation": "https://www.pystone.net/notes/chatgpt-game-autotest-sql-injection-testing/#%E6%A3%80%E6%9F%A5%E6%98%AF%E5%90%A6%E6%88%90%E5%8A%9F%E7%99%BB%E5%BD%95if-pocouserloggedinexists"
    }
  ],
  "claims": [],
  "outgoing": [],
  "incoming": [
    {
      "id": "note:sources-excerpts-archive",
      "title": "资料来源、摘录与归档",
      "url": "https://www.pystone.net/notes/sources-excerpts-archive/",
      "atlas": "https://www.pystone.net/?node=sources-excerpts-archive#knowledge-atlas",
      "label": "资料来源、摘录与归档",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "02-AI对话与研究原始输出中的“【ChatGPT】游戏自动化测试实践案例 - SQL注入测试”导航项",
      "citation": "https://www.pystone.net/notes/sources-excerpts-archive/#02-ai%E5%AF%B9%E8%AF%9D%E4%B8%8E%E7%A0%94%E7%A9%B6%E5%8E%9F%E5%A7%8B%E8%BE%93%E5%87%BA"
    }
  ],
  "contentMarkdown": "# 【ChatGPT】游戏自动化测试实践案例 - SQL注入测试\n\n> [!note] ChatGPT 问答录\n> 本文保存一次 ChatGPT 问答原始输出，仅作为资料来源；其中结论未自动视为已验证知识，使用前应结合可靠来源复核。\n\n\n> 创建时间：2023/6/11 19:07\n\n我们使用 Poco 来定位和操作游戏中的 UI 元素，并向用户名和密码输入框中输入尝试进行 SQL 注入的恶意数据。然后，我们检查是否成功登录，以判断游戏是否存在 SQL 注入漏洞。\n\nfrom airtest.core.api import *\n\nfrom poco.drivers.unity3d import UnityPoco\n\n## 初始化 Pocopoco = UnityPoco()\n\n## 准备模拟 SQL 注入攻击的用户名和密码sql_injection_username = \"' OR '1'='1\"sql_injection_password = \"' OR '1'='1\"# 在用户名和密码输入框中输入恶意数据username_input = poco(\"username_input\")\n\nusername_input.set_text(sql_injection_username)\n\npassword_input = poco(\"password_input\")\n\npassword_input.set_text(sql_injection_password)\n\n## 点击登录按钮login_button = poco(\"login_button\")\n\nlogin_button.click()\n\n## 检查是否成功登录if poco(\"user_logged_in\").exists():\n\nprint(\"游戏可能存在 SQL 注入漏洞！\")\n\nelse:\n\nprint(\"游戏似乎不受 SQL 注入攻击的影响！\")\n"
}
