# NTU NASA Hw0 ### Author : IM B12705064 趙子佾 ## Network Administration ### 1. True/False 1. True 因為使用VPN後,會先將封包送往VPN的伺服器後,再送往影音服務的伺服器,故影音服務平台收到封包的source IP會是VPN的IP,不是原本的IP。 Reference:https://zicodeng.medium.com/how-vpn-works-b7549dcc6ce4 2. True 因為沒有在使用NAT取得虛擬IP時設定轉譯規則,故若收到送往該public IP時會不知道要送往該server,所以外面的裝置無法連接到該私有server,若要連線則需要設定Port forwarding。 Reference:https://hackmd.io/@a000058556/ByuGVhGzs 3. False gateway可以在許多軟體中實作,並可以將LAN與WAN互相連接,也能提供多種服務,包括但不限於路由、安全、負載均衡、快取、壓縮、加密、認證、授權、過濾、轉碼等。 Reference:https://zh.wikipedia.org/zh-tw/%E7%BD%91%E5%85%B3 4. True 因為該網站使用HTTP協定,故封包傳送時都不會進行加密,所以擷取到的封包可以直接進行解讀,如下圖擷取到送往該伺服器的封包。  Reference:https://tenten.co/learning/http-vs-https/ 5. False 若server A和client需要互相連線的話,就會需要有NAT進行位置轉譯,將封包IP位置進行動態偽裝(IP Masquerade)。 Reference:https://hackmd.io/@a000058556/ByuGVhGzs 6. False DDoS是使用兩台以上的電腦作為殭屍進行分散式DoS攻擊,目的在於使目標電腦的網路或系統資源耗盡,使其服務終止。 Reference:https://www.fortinet.com/resources/cyberglossary/ddos-attack 7. True 理論上相同的加密演算法,使用的密鑰長度越長的話,就需要花更多的時間破解,所以安全性更高,但解碼時間則會較長。 Reference:https://justcryptography.com/key-length/ --- ### 2. ChatGPT 1. 每一台電腦可能有超過一個以上的MAC Address,取決於NIC的數量,且有可能是實體的或是虛擬的。而MAC address雖然是理論上是唯一的,但其實有可能會重複,且可以透過軟體進行修改,在傳輸封包時到L2時才會使用MAC address識別。 Reference:https://blog.miniasp.com/post/2022/07/18/How-to-get-MAC-address-and-about-ARP-Protocol 2. 4G在網路通信技術中指的是第四代行動通訊技術,是3G之後的延伸,有更高的傳輸速度及更低的延遲。 Reference:https://www.techtarget.com/searchmobilecomputing/definition/4G 3. 由於現在有NAT等技術的幫助下,讓IPv4的資源還不至於匱乏,所以IPv4仍然在被廣泛使用著。 Reference:https://www.mygreatlearning.com/blog/ipv4-vs-ipv6/ --- ### 3. Short Answer 1. 名詞解釋 (a) DHCP:動態主機設定協定,是用於IP網路的協定,主要用來進行自動分配內部網路的IP位置給使用者,和用於內部網路管理員對所有電腦進行中央管理。 Reference:https://www.stockfeel.com.tw/dhcp%E4%BC%BA%E6%9C%8D%E5%99%A8%E6%98%AF%E4%BB%80%E9%BA%BC%EF%BC%9F%E5%A6%82%E4%BD%95%E9%81%8B%E7%94%A8%EF%BC%9F/ (b) VLAN是虛擬區域網路技術,可以讓管理者在switch中將網域進行軟體切割,將交換器中的終端進行邏輯分群管理,可以降低在區域網路中大量資料廣播時因終端過多導致壅塞等問題。 Reference:https://www.cs.nthu.edu.tw/~nfhuang/chap16.htm \(c) Switch是網路交換器,是一個多埠的網橋,可以讓終端可以在電腦網路上連接不同的裝置。 Reference:https://www.cloudflare.com/zh-tw/learning/network-layer/what-is-a-network-switch/ (d) Broadcast storm是廣播風暴,是指在同一個LAN中有太多的廣播的累積,導致佔用大量的網路頻寬而導致網路信號癱瘓。 Reference:https://zh.wikipedia.org/zh-tw/%E5%BB%A3%E6%92%AD%E9%A2%A8%E6%9A%B4 2. IP Validation (a) 合法 (b) 合法 \(c) 合法 Reference:https://ithelp.ithome.com.tw/articles/10311096 3. TCP/IP model 1. Physical Layer:利用實體設備進行資料傳輸,如:網路線、Wifi 2. Data Link Layer:在網路之間進行邏輯連接,並進行流量控制及錯誤偵測,將實體層(Physical Layer)的訊號封裝,稱為Data Frame,如:MAC Address、L2 switch 3. Network Layer:將資料跟IP組成封包,並決定封包的傳送路徑(trace),如:router、L3 switch、ARP 4. Transport Layer:封包傳輸前透過協定分拆成多個封包(Packet),並進行偵錯及更正,如:TCP、UDP 5. Application Layer:將傳輸的資料處理成應用程式的資料,如:http、ftp Reference:https://medium.com/@z3337059/%E5%AD%B8%E7%BF%92day1-%E7%B6%B2%E8%B7%AF%E6%9E%B6%E6%A7%8B%E5%8F%8A%E5%9F%BA%E7%A4%8E%E7%9F%A5%E8%AD%98-1-d6e7744937ec 4. TCP vs UDP (a) TCP:傳輸資料前先拆成封包並加上編號,送到目的地時進行檢查缺失或錯誤及順序,等到資料沒有問題才會還原成資料。 (b) UDP:收到封包後直接還原成資料,不會管資料正確性及順序。 \(c) TCP速度較慢,但資料傳輸較穩定,適用於ftp、http。UDP速度較快,但容易遺失資料,適用於網路電話或是影音媒體。 Reference:https://ithelp.ithome.com.tw/articles/10294859 5. Protocols (a) LDAP/LDAPS:通過IP協定提供訪問控制和維護分散式資訊的目錄資訊。LDAP:389, LDAPS:636 (b) SMTP:可用在傳送和接收電子郵件的資訊,但SMTP通常用作傳送電子郵件資訊,而不是接收。SMTP:25 \(c) SNMP:該協定能夠支援網路管理系統,用以監測連接到網路上的裝置是否有任何引起管理上關注的情況。SNMP:161 (d) HTTP/HTTPS:全球資訊網(www)的數據通訊的基礎。HTTP:80, HTTPS:443 Reference: 1. https://www.jendow.com.tw/wiki/ladp 2. https://aws.amazon.com/tw/what-is/smtp/ 3. https://www.manageengine.com/tw/network-monitoring/what-is-snmp.html 4. https://aws.amazon.com/tw/compare/the-difference-between-https-and-http/ 5. https://zh.wikipedia.org/wiki/TCP/UDP%E7%AB%AF%E5%8F%A3%E5%88%97%E8%A1%A8 --- ### 4. Command Line Utilities 1. IP Address (a) 140.112.8.116 ```Shell $ dig www.ntu.edu.tw ```  (b) 140.112.30.26 ```Shell $ dig csie.ntu.edu.tw ```  <br> Domain Name (a) printing.csie.ntu.edu.tw ```Shell $ dig -x 140.112.30.25 ```  (b) if176.aca.ntu.edu.tw ```Shell $ dig -x 140.112.161.176 ```  2. NTU VPN (a) 140.112.87.221 ```Shell $ curl ifconfig.me ```  (b) DNS server IP & Routing Path 1. DNS Server IP ```Shell $ dig 8.8.8.8 ``` Before VPN: 192.168.0.1  After VPN: 140.112.254.4  2. Routing Path Before VPN ```Shell $ traceroute 192.168.0.1 ```  After VPN ```Shell $ traceroute 140.112.254.4 ```  Reference: 1. https://ithelp.ithome.com.tw/articles/10214466 2. https://www.ibm.com/docs/zh-tw/power10?topic=commands-traceroute-command 3. Finding Port Port : 18763, Flag : NASA{P4-3_Y0u_Found_M3!} ```Shell $ sudo nmap 140.112.30.158 -p 0-65535 -Pn -sS -T4 $ wget 140.112.30.158:18763 $ cat index.html ```   --- ## System Administration ### 1. NASA{P1_I_4m_r00t!} ```Shell! $ sudo ./p1-checker ```  ### 2. NASA{P2_P4CM4N_1$_TH3_M4N} ```Shell! $ man pacman | grep NASA{P2_ ```  ### 3. SSH setup 1. 啟用sshd ```Shell $ sudo systemctl enable sshd $ sudo systemctl start sshd ``` 2. 查詢VM IP ```Shell $ ip a ```  3. 設定Port Forwarding 1. VM Manager => 設定 => 網路 => 進階 => 連接埠轉送 2. 主機IP填寫127.0.0.1,Port選一個未使用的;客機IP填寫2.查詢到的IP,Port 22  3. 點擊確認儲存 4. 開啟電腦終端(iTerm2/zsh) 5. ssh連接VM  6. Done! ### 4. NASA{P4_Matryoshka_Files} ```Shell $ unzip airdrop.tar.gz.zip $ tar zxf airdrop.tar.gz $ cd airdrop/p4 $ cat flag ```  Reference:https://zh.wikipedia.org/zh-tw/Tar ### 5. NASA{P5_Th3_5PY_1s_Am0nG_U5} ```Shell $ sudo hostnamectl set-hostname totally-not-tux $ sudo chfn -f "Definitely Legit Guy" nasa-intern $ ./airdrop/p5/security ```  Reference:https://serverfault.com/questions/522377/how-to-change-users-full-name-on-debian ### 6. NASA{P6_W3_4r3_fri3nd5_n0t_f00d} ```Shell $ sudo useradd coolguy $ sudo groupadd friends $ sudo usermod -a -G friends coolguy $ sudo usermod -a -G friends nasa-intern $ ./airdrop/p6/friendship-test ```  Reference:https://ithelp.ithome.com.tw/articles/10224343 ### 7. NASA{P7_I5_th1s_TH3_h0m3w0rk_f0ld3er?} ```Shell $ chown nasa-intern:friends -R ./p7/ $ chmod 710 -R ./p7/ $ cd ./p7 $ ./pentester ```  Reference: 1. https://www.runoob.com/linux/linux-comm-chmod.html 2. https://blog.gtwang.org/linux/linux-chown-command-tutorial/ ### 8. Careless Cool Cat Commentator 1. NASA{P8_cowsay -f dragon-and-cow 'Hello There!'}  2. NASA{P8_cowsay -f dragon-and-cow 'My name is MSI RTX 4090' \| lolcat}  ### 9. NASA{P9_I_Prefer_Arch} ```Shell $ sed 's/gentoo//g' book | tr 'aFS9PoUYXyQEvDfc7bVqW5hg)s18NeziB6xt0(RJjumM{Zkw3d4CGnT}rOLKH2lpAI' 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789(){}' | grep NASA{[a-zA-Z0-9_]*} ```   Reference: 1. https://zh.wikipedia.org/zh-tw/Tr_(Unix) 2. https://www.hy-star.com.tw/tech/linux/sed/sed.html#sed_basic ### 10. NASA{P10_D0_Y0U_F1ND_DA_W43} ```Shell $ mkdir tmp; cd tmp $ cp ../airdrop.tar.gz.zip airdrop.tar.gz.zip $ unzip airdrop.tar.gz.zip $ tar zxvf airdrop.tar.gz | grep NASA{P10_ ```  ### 11. Loop de Loop 1. NASA{P11_1_d1d_y0u_g3t_th3_51gn4l?} ```Shell ^Z $ bg ```  2. NASA{P11_2_1_wi1l_b3_b4ck} ```Shell $ pkill -15 loop ```  3. NASA{P11_pkill -9 loop}  Reference:https://clay-atlas.com/blog/2022/07/21/%E5%B7%B2%E8%A7%A3%E6%B1%BA-linux-kill-9-%E4%BB%8D%E7%84%B6%E7%84%A1%E6%B3%95%E6%AE%BA%E6%AD%BB%E8%A1%8C%E7%A8%8B/ ### 12. The Final Showdown 檢查 crontab 及 cron.d/minute (因每分鐘會檢查一次) ```Shell $ cat /etc/crontab $ cat /etc/cron.d/minute ```  發現並檢視 check.sh ```Shell $ cat /usr/src/nano_gang/check.sh ```  發現會檢查使用者的.bashrc與backup是否相同並修正,檢視 /root/.docker.service ```Shell $ sudo cat /root/.docker.service ```  發現alias腳本,刪掉Nano Gang的部分並儲存  登出後重新進入,已發現可以正常使用vim 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up