Telnet을 사용하여 파일 다운로드

Telnet을 사용하여 파일 다운로드

파일을 다운로드 하려고 하는데, https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe또는https://www.7-zip.org/a/7z1806-x64.exe, curl또는 ; 대신 다음을 사용하여 파일을 다운로드 wget하고 싶습니다 .telnet

(echo 'GET /~sgtatham/putty/latest/w64/putty.exe'; echo ""; sleep 1; ) | telnet the.earth.li 80 > s.exe

이것은 작동하지 않습니다. 파일 내용을 사용할 때 cat다음과 같습니다.

HTTP/1.1 302 Found
Date: Sun, 17 Feb 2019 18:40:22 GMT
Server: Apache
Location: https://the.earth.li/~sgtatham/putty/0.70/w64/putty.exe
Content-Length: 301
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://the.earth.li/~sgtatham/putty/0.70/w64/putty.exe">here</a>.</p>
<hr>
<address>Apache Server at the.earth.li Port 80</address>
</body></html>

답변1

답장에서 "문서가 다음으로 이동되었습니다"라는 메시지를 볼 수 있습니다.https://the.earth.li/~sgtatham/putty/0.70/w64/putty.exe”이므로 명령에서 링크를 변경해야 합니다(“최신”을 “0.70”으로 변경).
브라우저는 이 작업을 자동으로 수행합니다.
(echo 'GET /~sgtatham/putty/0.70/w64/putty.exe'; echo ""; sleep 1; ) | telnet the.earth.li 80 > s.exe

관련 정보