ผลต่างระหว่างรุ่นของ "01204223/natas"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
(สร้างหน้าด้วย ": ''หน้านี้เป็นส่วนหนึ่งของ 01204223'' '''Natas'' [https://overthewire.org/wargames/natas/ https://ove...")
 
 
แถว 12: แถว 12:
  
 
แต่เครื่องมือที่นิยมใช้กันมากจะเป็นเครื่องมือ แบบ command line ชื่อ [https://curl.se/ curl] ซึ่งนิยมใช้ทั้งในสายนักพัฒนาซอฟต์แวร์และด้านอื่น ๆ จึงควรลองนำมาติดตั้งและหัดใช้อย่างยิ่ง
 
แต่เครื่องมือที่นิยมใช้กันมากจะเป็นเครื่องมือ แบบ command line ชื่อ [https://curl.se/ curl] ซึ่งนิยมใช้ทั้งในสายนักพัฒนาซอฟต์แวร์และด้านอื่น ๆ จึงควรลองนำมาติดตั้งและหัดใช้อย่างยิ่ง
 +
 +
ตัวอย่างการเรียกไปหน้า http://natas0.natas.labs.overthewire.org/ แบบไม่ใส่รหัสผ่าน
 +
 +
curl http://natas0.natas.labs.overthewire.org/
 +
 +
ได้ผลลัพธ์เป็น
  
 
<pre>
 
<pre>
$ curl --help
+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
Usage: curl [options...] <url>
+
<html><head>
-d, --data <data>           HTTP POST data
+
<title>401 Unauthorized</title>
-f, --fail                  Fail fast with no output on HTTP errors
+
</head><body>
-h, --help <subject>       Get help for commands
+
<h1>Unauthorized</h1>
-o, --output <file>         Write to file instead of stdout
+
<p>This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.</p>
  -O, --remote-name          Write output to file named as remote file
+
<hr>
-i, --show-headers          Show response headers in output
+
<address>Apache/2.4.58 (Ubuntu) Server at natas0.natas.labs.overthewire.org Port 80</address>
-s, --silent                Silent mode
+
</body></html>
-T, --upload-file <file>   Transfer local FILE to destination
+
</pre>
-u, --user <user:password> Server user and password
+
 
-A, --user-agent <name>     Send User-Agent <name> to server
+
ถ้าใส่ basic authentication จะเรียกเป็น
  -v, --verbose              Make the operation more talkative
+
 
-V, --version              Show version number and quit
+
  curl http://natas0.natas.labs.overthewire.org/ -u natas0:natas0
 +
 
 +
จะเห็นข้อความจากเพจ
  
This is not the full help; this menu is split into categories.
+
Curl ยังมี option อีกมากมาย สามารถตั้งค่าการ request ได้ครบถ้วน และเป็นเครื่องมือที่สามารถใช้ในการแก้ด่านต่าง ๆ ของ natas ได้อย่างดี
Use "--help category" to get an overview of all categories, which are:
 
auth, connection, curl, deprecated, dns, file, ftp, global, http, imap, ldap, output, pop3, post, proxy, scp, sftp, smtp, ssh, telnet, tftp, timeout,
 
tls, upload, verbose.
 
Use "--help all" to list all options
 
Use "--help [option]" to view documentation for a given option
 
</pre>
 

รุ่นแก้ไขปัจจุบันเมื่อ 23:08, 5 มีนาคม 2569

หน้านี้เป็นส่วนหนึ่งของ 01204223

'Natas https://overthewire.org/wargames/natas/ เป็นเกมสงครามสำหรับฝึกเกี่ยวกับความปลอดภัยบนเว็บ (ฝึก hack เว็บ)

เครื่องมือที่ใช้ในการทำ

นอกจากการกดดู source code ของ page แล้ว การ inspect รายละเอียด รวมถึงการดู request ที่ส่งไปยัง server ก็เป็นเครื่องมือสำคัญที่เราจะได้เรียนรู้ ตัวอย่างหน้าจอการ inspect ส่วน network แสดงด้านล่าง เราจะได้เห็น request และ response ของการเรียกใช้งานเว็บ

223-inspec-screenshot.png

ในการเรียก request นั้น นอกจากจะกดทาง browser แล้ว เรายังสามารถใช้เครื่องมือพวก browser extension ที่เราใช้ตอนพัฒนา backend api ก็ได้

แต่เครื่องมือที่นิยมใช้กันมากจะเป็นเครื่องมือ แบบ command line ชื่อ curl ซึ่งนิยมใช้ทั้งในสายนักพัฒนาซอฟต์แวร์และด้านอื่น ๆ จึงควรลองนำมาติดตั้งและหัดใช้อย่างยิ่ง

ตัวอย่างการเรียกไปหน้า http://natas0.natas.labs.overthewire.org/ แบบไม่ใส่รหัสผ่าน

curl http://natas0.natas.labs.overthewire.org/

ได้ผลลัพธ์เป็น

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you are authorized to access the document requested.  Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.</p>
<hr>
<address>Apache/2.4.58 (Ubuntu) Server at natas0.natas.labs.overthewire.org Port 80</address>
</body></html>

ถ้าใส่ basic authentication จะเรียกเป็น

curl http://natas0.natas.labs.overthewire.org/ -u natas0:natas0

จะเห็นข้อความจากเพจ

Curl ยังมี option อีกมากมาย สามารถตั้งค่าการ request ได้ครบถ้วน และเป็นเครื่องมือที่สามารถใช้ในการแก้ด่านต่าง ๆ ของ natas ได้อย่างดี