通過命令行檢測mail服務器
工具/原料
Linux perl
方法/步驟
Base64 編碼的生成
# perl -MMIME::Base64 -e 'print encode_base64("root\@test.net");'
cm9vdEB0ZXN0Lm5ldA==
# perl -MMIME::Base64 -e 'print encode_base64("000000");'
MDAwMDAw
測試發送郵件(端口:25):
mail# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 0.
Escape character is '^]'.
220 mail.test.net ESMTP Postfix
ehlo mail
250-mail.test.net
250-PIPELINING
250-SIZE 4194304
250-VRFY
250-ETRN
250-AUTH NTLM LOGIN PLAIN OTP
250-AUTH=NTLM LOGIN PLAIN OTP
250 8BITMIME
auth login
334 VXNlcm5hbWU6
cm9vdEB0ZXN0Lm5ldA== //用戶名id:[email protected]
334 UGFzc3dvcmQ6
MDAwMDAw //用戶密碼password:000000
235 Authentication successful
MAIL FROM:<[email protected]> //告訴服務器發件人的Email地址
250 Ok
RCPT TO:<[email protected]> //告訴服務器收件人的地址
250 OK
DATA //告訴服務器開始寫信
354 End data with .
SUBJECT:test //subject後面填寫的是郵件的主題
test
. //換行後輸入.後按回車,表示信件內容書寫完畢
250 Ok: queued as 58DC71D5
quit //發送信件,結束對話,退出SMTP服務器
221 Bye
Connection closed by foreign host
測試收取郵件(端口:110):
mail# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 0
Escape character is '^]'
+OK Hello there
user [email protected]
+OK Password required
pass 000000
+OK logged in
list
+OK POP3 clients that break here, they violate STD53
1 2217
retr 1 //返回第一封信的全部內容
+OK 2217 octets follow.
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from mail (localhost.test.net [127.0.0.1])
by mail.test.net (Postfix) with ESMTP id 58DC71D5
for <[email protected]>; Mon, 9 Aug 2013 21:11:20 +0800 (CST)
SUBJECT:test
Message-Id: <[email protected]>
Date: Mon, 9 Aug 2013 21:11:20 +0800 (CST)
From: [email protected]
To: undisclosed-recipients:;
test
.
dele 1 //刪除
+OK Deleted
quit
+OK Bye-bye
Connection closed by foreign host