Hi, is there a way to get the FTP Welcome banner (not the welcome message, but the banner)? What I'm trying to do is to discover several AXIS security cameras over a network using FTP. When I try to FTP into a camera using cmd.exe, the camera answers like:

C:\>ftp <ip address of camera>
Connected to <ip address of camera>
220 Axis 2100 Network Camera 2.12 Feb 05 2001 ready.  <-------
User (<ip address of camera>:(none)):

What I'm trying to get is just the "220 Axis 2100..." part. I already tried sending the ftp command to a cmd and read the StandardOutput, however this doesn't helped, it just skipped that part, like if it wasn't actually part of the cmd process :(.

Is there a way of getting the "220 Axis 2100..." part!?

Thank you very very much for your help!

Edited by matiasrad

4 Years
Discussion Span
Last Post by Reverend Jim

I would use a String.SubString method and String.IndexOf methods.

BannerMessage = "Connected to <ip address of camera>" & vbCrLf &
                "220 Axis 2100 Network Camera 2.12 Feb 05 2001 ready." & vbCrLf &
                "User (<ip address of camera>:(none)):"

' extract Axis position (2100)

' check the line for the word Axis.
If BannerMessage.Contains("Axis") Then
    ' split the message into words.
    Dim Words() As String = BannerMessage.Split(" "c)
    Dim AxisPos As Integer

    For i = 0 To Words.Length - 1
        Dim Word As String = Words(i)

        If Word = "Axis" Then
            ' we have found the Axis. get the word after the axis.
             Dim Position As String = Words(i + 1)

             ' convert the word into an integer.
             AxisPos = Integer.Parse(Position)

            Exit For
        End If

End If

' Display the Axis Position; in this case 2100

Thanks Maligui. That wasn't actually my question. My original question was how to retirieve the welcome banner from an FTP session. I will declare this post solved since I managed to do it by using sockets. If anyone is interested send me a PM and I will share the code with him/her.

Thanks again!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.