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.
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://specialneedsforspecialkids.com/yun/11121.html
摘要:前言是一個(gè)開(kāi)源和社區(qū)驅(qū)動(dòng)的監(jiān)控報(bào)警時(shí)序數(shù)據(jù)庫(kù)的項(xiàng)目。集群上部署的應(yīng)用監(jiān)控部署在集群上的應(yīng)用。通過(guò)和的接口采集。相應(yīng),配置文件官方也提供了一份,今天我們就解讀一下該配置文件。對(duì)于服務(wù)的終端節(jié)點(diǎn),也需要加注解,為則會(huì)將作為監(jiān)控目標(biāo)。 前言 Prometheus 是一個(gè)開(kāi)源和社區(qū)驅(qū)動(dòng)的監(jiān)控&報(bào)警&時(shí)序數(shù)據(jù)庫(kù)的項(xiàng)目。來(lái)源于谷歌BorgMon項(xiàng)目?,F(xiàn)在最常見(jiàn)的Kubernetes容器管理系統(tǒng)中,...
摘要:如果有報(bào)錯(cuò)官方文檔即可是時(shí)候來(lái)張圖了具體的和漢化,可以通過(guò)頁(yè)面對(duì)應(yīng)的插件。 下載jdk&sonarqube&sonar-scanner 安裝jdk 基于ubuntu 16.04+apache[具體webserver采用缺省安裝]推薦下載安裝【底部有網(wǎng)盤(pán)地址】 sonarqube-5.6.6.zip jdk-8u121-linux-x64.tar.gz sonar-scanner-2...
摘要:視圖層表示層數(shù)據(jù)傳遞給層實(shí)現(xiàn)接收用戶輸入并調(diào)用打印菜單獲取用戶輸入調(diào)用對(duì)應(yīng)方法歡迎來(lái)到學(xué)生管理系統(tǒng)添加用戶編輯用戶查詢用戶刪除用戶退出系統(tǒng)請(qǐng)輸入要操作的功能序號(hào)接收用戶的菜單選擇對(duì)選擇的菜單判 showImg(https://segmentfault.com/img/bVbiXjw?w=939&h=509); 1.視圖層 package net.allidea.studentoa.ui...
閱讀 1422·2021-11-15 11:38
閱讀 3566·2021-11-09 09:47
閱讀 1969·2021-09-27 13:36
閱讀 3211·2021-09-22 15:17
閱讀 2547·2021-09-13 10:27
閱讀 2862·2019-08-30 15:44
閱讀 1158·2019-08-27 10:53
閱讀 2702·2019-08-26 14:00