Skip to content

Commit 70591f0

Browse files
Merge pull request #22 from ut-code/lv5buttonadded
lv5に飛べるボタン追加
2 parents f2e843a + 8ffe4dd commit 70591f0

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/background.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ chrome.runtime.onInstalled.addListener(() => {
22
console.log("拡張機能がインストールされました!");
33
});
44

5+
chrome.runtime.onMessage.addListener((msg) => {
6+
if (msg.type === "OPEN_BOOKING") {
7+
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
8+
chrome.tabs.update(tabs[0].id, { url: msg.url });
9+
});
10+
}
11+
});
12+
513

614
const targetURL = 'https://browser-hack.utcode.net/'
715
function isTargetPage(url?: string): boolean {

src/sidepanel/App.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,15 @@ function App() {
180180
<h2>最後のミッション</h2>
181181
<p>今までの知識を使って、予約サイトでチケットを先に予約しよう!</p>
182182
<br></br>
183-
<a href="https://browser-hack.utcode.net/reservation/">挑戦する</a>
183+
<button
184+
onClick={() => {
185+
chrome.runtime.sendMessage({
186+
type: "OPEN_BOOKING",
187+
url: "https://browser-hack.utcode.net/reservation/"
188+
});
189+
}}>
190+
挑戦する
191+
</button>
184192
<br></br>
185193
<p>上のリンクを押して、とあるイベントの予約サイトに侵入し、一足先にチケットを予約しよう。</p>
186194
</div>

vulnerable-web/reservation/script.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const ADMIN_PASSWORD = "GekiA2Rock"; // 管理者パスワード
44
// --- ページ判定 ---
55
const path = window.location.pathname;
66

7-
if (path.includes("admin.html")) {
7+
if (path.includes("admin")) {
88
initAdminPage();
9-
} else if (path.includes("index.html") || path.endsWith("/")) {
9+
} else if (path.includes("index")) {
1010
initUserPage();
1111
}
1212

0 commit comments

Comments
 (0)