如何自动化 telnet 端口 25 测试? [英] How can I automate telnet port 25 testing?

查看:39
本文介绍了如何自动化 telnet 端口 25 测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 telnet 中进行大量测试.我正在研究一些方法来自动检测我们电子邮件服务器上的字典攻击,然后限制它们,或将它们列入黑名单等.

I need to make a large set of tests in telnet. I am working on some ways to auto detect dictionary attacks on our email server, and then throttle them back, or blacklist them etc.

我现在准备运行一些测试,看看我的工作是否有回报.我想我只需下载一些脚本小子应用程序来运行测试.我找不到任何我能找到的坏的或二进制的和不可配置的.

I am now ready to run some tests and see if my work pays off. I figured I would just download some script kiddy app to run the tests. I can not find any and those I can are bad or binary and non configurable.

我将有一个我在循环中生成的地址列表.

I will have a list of addresses I generate in a loop.

我想将 $address 作为参数并执行以下操作:

I want to take $address as an argument and do this:

telnet myserver.com 25helo some-string.com邮件来自:me@me.comrcpt 到:$address退出

telnet myserver.com 25 helo some-string.com mail from: me@me.com rcpt to: $address quit

其中,我需要测试一些事情,例如,如果我启用灰名单,我想让脚本失败,因为这是我的第一个对策.我想在那种情况下,我只会有 telnet 超时?

Within that, I need to test a few things, such as, if I enable greylisting, I want to fail the script, as that is my first countermeasure. I suppose in that case, I would just have telnet timeout?

  • helo 应该返回一个以 220 开头的代码字符串,这与我进行此测试所需的准确度差不多.

  • helo should return a code string starting with 220, that is about as accurate as I need to make this test.

mail from 应该返回 250,或者寻找 OK 就足够了

mail from should return 250, or looking for OK would suffice

rctp to 有时应该返回 250 或 Ok,当我发送一个有效用户时,但大多数时候我会发送一个错误的地址,所以我寻找没有250 或 OK.

rctp to should return 250 or Ok sometimes, when I send in a valid user, but most of the time I will send in a bad address, so I look for the absence of 250 or OK.

最后,我会发送一个quit.

我无法在交互式情况下获取条件和日志记录.我查看了 expect 但无法让它工作.

I am not able to get conditions and logging to happen within an interactive situation. I looked at expect but could not get it to work.

echo -e "helo foo\nmail from: foo.... | telnet example.com 25 | grep -i blah 

这没有按预期执行.

我可以做什么来实现我的目标?

What can I do to accomplish my goal?

推荐答案

我很惊讶 Expect 没有为您做,因为它只是为这些类型的事情而编写的.

I'm surprised that Expect didn't do it for you since it's written for just these kinds of things.

Perl 在某些方面更简单,可以完成这样的工作.但是有了 Perl,你就不用 Telnet 了,你可以直接打开 25 端口.

Perl is simpler in some ways and can get a job like this done. But with Perl, you won't bother with Telnet, you can instead open port 25 directly.

如果你真的想锻炼你的服务器,请获取 Siege 的源代码并修改它谈论 SMTP 而不是 HTTP.这是我最喜欢的测试 Apache 性能的工具,我相信让它测试 Sendmail 不会太难.

If you really want to exercise your server get the source for Siege and modify it to talk SMTP instead of HTTP. That was my favorite tool for testing Apache performance and I'm sure it wouldn't be too hard to make it test Sendmail.

这篇关于如何自动化 telnet 端口 25 测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆