Jump to content


HTTPS Monitoring

  • Please log in to reply
1 reply to this topic

#1 coelhopsi



  • Members
  • Pip
  • 1 posts

Posted 23 March 2013 - 10:16 PM



I was just making some tests regarding HTTPS monitoring and I can see that TNM is sending the following string to the monitored servers:


Test handshake<cr><lf>


(where <cr> and <lf> are carriage return and line feed characters, respectively)


Since the HTTPS server does not recognize this as a valid TLS handshake, it does not respond and closes the connection. As such, TNM thinks the server is offline.


If you could replace the "Test handshake<cr><lf>" string in your code with the following Hex characters (which is a valid TLS handshake), then not only regular TCP checks will succeed, but also HTTPS will do:




Would it be possible to change this on tnm.exe and recompile your code?


I understand you are currently not actively working on TNM anymore, but if you could provide the recompiled tnm.exe with the change above only in the forum, a lot of people here would be very thankful.


Please see below a sample VB.NET (sorry... I'm more of a SysAdmin than a Developer) which tests an HTTPS server on port 443 and returns OK if there is a valid HTTPS response (ServerHello) or NOK if there is no valid HTTPS response.


Imports System
Imports System.IO
Imports System.Net.Sockets
Imports System.Text

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim tcpClient As New System.Net.Sockets.TcpClient()
        tcpClient.Connect("www.google.com", 443)
        Dim networkStream As NetworkStream = tcpClient.GetStream()
        If networkStream.CanWrite And networkStream.CanRead Then
            Dim sendBytes As [Byte]() = HexToByte("16030100b8010000b403029999999999999999999999999999999999999999999999999999999999999999000048c00ac0140088008700390038c00fc00500840035c007c009c011c01300450044006600330032c00cc00ec002c0040096004100050004002fc008c01200160013c00dc003feff000a0100004300000013001100000e9999999999999999999999999999ff01000100000a00080006001700180019000b000201000023000033740000754f0000000500050100000000")
            networkStream.Write(sendBytes, 0, sendBytes.Length)
            Dim bytes(tcpClient.ReceiveBufferSize) As Byte
            networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
            If Mid(BytesToHex(bytes), 1, 2) = "16" And Mid(BytesToHex(bytes), 11, 2) = "02" Then
                Label1.Text = "OK"
                Label1.Text = "NOK"
            End If
        End If
    End Sub

    Private Function HexToByte(ByVal hex As String)
        Dim length As Integer = hex.Length
        Dim upperBound As Integer = length \ 2
        If length Mod 2 = 0 Then
            upperBound -= 1
            hex = "0" & hex
        End If
        Dim bytes(upperBound) As Byte
        For i As Integer = 0 To upperBound
            bytes(i) = Convert.ToByte(hex.Substring(i * 2, 2), 16)
        HexToByte = bytes
    End Function

    Private Function BytesToHex(ByVal bytes As Byte()) As String
        Dim strTmpHex
        Dim strTemp As New StringBuilder(bytes.Length * 2)
        For Each b As Byte In bytes
            strTmpHex = Conversion.Hex(b)
            If strTmpHex.Length = 1 Then
                strTemp.Append("0" & strTmpHex)
            End If
        Return strTemp.ToString()
    End Function

End Class


The form has just a button to start testing (Button1) and a Label where the OK or NOK appears (Label1).




Fábio Pinto Coelho

#2 Zak



  • Root Admin
  • PipPipPip
  • 747 posts
  • Gender:Male

Posted 21 May 2013 - 07:17 AM



Thanks for your input. We need to investigate this further as the time permits.

Softinventive Lab support

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users