Recently I"m writting a port scanner and I need to verify if some standard services are running on remote hosts as expected. The verification method is quite simple(but took me a long time), that is, using connect() to that port, then analyze the returned messages. All messages will be returned by remote host only when the port being scanned is open, otherwise tag it as Unable to be connected.
HTTP
Send string "GET / HTTP
" to port 80 of an ip address. The remote host will send back message like
HTTP/1.0 400 Bad Request Content-Type: text/html; charset=UTF-8 Content-Length: 1419 Date: Tue, 02 Dec 2014 05:56:25 GMT Server: GFE/2.0 ..
Then parse the first line we can obtain the version of HTTP running on that machine is 1.0.
SSH
Send an empty string to port 22 of a specific ip address(129.79.247.86 is tested in my case, which is the server in my school), then we can get SSH-2.0-OpenSSH_5.3. The SSH service version is 5.3.
SMTP
The port 24, 25, or 587 is open, only in a mailbox ip address. So I tested my code on 113.108.16.44(smtp.qq.com) and 202.108.6.242(smtp.sina.com.cn). After sending an empty string to those hosts, I received 220 smtp.qq.com Esmtp QQ Mail Server and 220 smtp545-123.sinamail.sina.com.cn ESMTP separately. The SMTP versions are Esmtp QQ Mail Server and ESMTP.
POP
I checked port 110 on ip addresses 163.177.65.209(pop.qq.com) and 123.125.50.29(pop3.163.idns.yeah.net). Similarly, an empty string was sent and I received
+OK QQMail POP3 Server v1.0 Service Ready(QQMail v2.0)
and
+OK Welcome to coremail Mail Pop3 Server (163coms[8db726ec93e9d4e3e9a2fd3d31b05251s])
Both are long statements. So I just put "POP3" in my result when there is a response.
WHOIS
It"s not easy to find a proper ip address with 43 port open. Finally, I found one here, which is 199.7.54.74(whois.crsnic.net). This time a string "
" should be sent and the following content will shown on screen.
Whois Server Version 2.0 Domain names in the .com and .net domains can now be registered with many different competing registrars. Go to http://www.internic.net for detailed information.Select a sub-topic for help; "?" (with no RETURN) for a list of options; RETURN key to return to WHOIS. ...
A lot of stuff. But we noticed that the service version is 2.0 in first line.
IMAP
As I did before, I sent an empty string to 163.177.65.209(imap.qq.com) and got
* OK [CAPABILITY IMAP4 IMAP4rev1 IDLE XAPPLEPUSHSERVICE ID UIDPLUS AUTH=LOGIN NAMESPACE] QQMail IMAP4Server ready
So I put "IMAP" in my result if there is a response.
This is a basic idea to verify the services on remote hosts. If the port we want to check is open, it will response something once we send a appropriate query to it. The service information is then exposed by the port itself. When the port is closed or filtered, it won"t response on any request messages. In this case, the service should be unknown instead of a simply hardcode result.
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/11121.html
摘要:前言是一个开源和社区驱动的监控报警时序数据库的项目。集群上部署的应用监控部署在集群上的应用。通过和的接口采集。相应,配置文件官方也提供了一份,今天我们就解读一下该配置文件。对于服务的终端节点,也需要加注解,为则会将作为监控目标。 前言 Prometheus 是一个开源和社区驱动的监控&报警&时序数据库的项目。来源于谷歌BorgMon项目。现在最常见的Kubernetes容器管理系统中,...
摘要:如果有报错官方文档即可是时候来张图了具体的和汉化,可以通过页面对应的插件。 下载jdk&sonarqube&sonar-scanner 安装jdk 基于ubuntu 16.04+apache[具体webserver采用缺省安装]推荐下载安装【底部有网盘地址】 sonarqube-5.6.6.zip jdk-8u121-linux-x64.tar.gz sonar-scanner-2...
摘要:视图层表示层数据传递给层实现接收用户输入并调用打印菜单获取用户输入调用对应方法欢迎来到学生管理系统添加用户编辑用户查询用户删除用户退出系统请输入要操作的功能序号接收用户的菜单选择对选择的菜单判 showImg(https://segmentfault.com/img/bVbiXjw?w=939&h=509); 1.视图层 package net.allidea.studentoa.ui...
阅读 1400·2021-11-15 11:38
阅读 3534·2021-11-09 09:47
阅读 1949·2021-09-27 13:36
阅读 3188·2021-09-22 15:17
阅读 2524·2021-09-13 10:27
阅读 2843·2019-08-30 15:44
阅读 1135·2019-08-27 10:53
阅读 2682·2019-08-26 14:00