janh / go-dsl

Library and application for reading xDSL stats
Mozilla Public License 2.0
31 stars 2 forks source link

Billion 8800NL support #2

Closed drguildo closed 2 years ago

drguildo commented 2 years ago

This is mostly the same as the Broadcom code, although the main difference is the different login prompt, which prevented the generic Broadcom device type working for me.

P.S. Thanks for creating this. I found DSLstats recently which helped me diagnose some issues with my phone line, but it looks like that isn't going to receive any more updates, and so it's good to see an open source project taking up the mantle.

janh commented 2 years ago

As the only difference here are the Telnet prompts, I don't think it makes sense to duplicate the entire client. Just adding a BillionTelnet client within the broadcom package should be enough.

However, even that may not be necessary. The branch telnet-multiple-prompts adds transparent support for multiple sets of prompts within a client. Can you check if that works for you?

By the way, are those the full prompts, i.e. is there nothing else on the same lines? I'm asking because I may add more strict prompt matching in the future, and knowing the full prompt lines would be important to retain compatibility.

Your README message mentions outdated 3DES-CBC as a reason for not supporting SSH. The SSH library actually supports that cipher, it just isn't enabled by default (for obvious reasons). And even without modern encryption, SSH is just a way better protocol, as it doesn't require parsing any prompts. The branch ssh-insecure-algorithms adds an option to enable insecure algorithms. Could you please also try if that works?

drguildo commented 2 years ago

However, even that may not be necessary. The branch telnet-multiple-prompts adds transparent support for multiple sets of prompts within a client. Can you check if that works for you?

The telnet-multiple-prompts branch works with dsl -d broadcom_telnet -u admin.

By the way, are those the full prompts, i.e. is there nothing else on the same lines? I'm asking because I may add more strict prompt matching in the future, and knowing the full prompt lines would be important to retain compatibility.

Yup.

The branch ssh-insecure-algorithms adds an option to enable insecure algorithms. Could you please also try if that works?

Doesn't seem to work, unless I'm doing something wrong. I get:

$ ./dsl -d broadcom_ssh -u admin -o InsecureAlgorithms=1 192.168.1.254

Connecting… password required
Password: 
Authenticating… done
Loading data… failed: wait: remote command exited without exit status or exit signal
janh commented 2 years ago

The telnet-multiple-prompts branch works with dsl -d broadcom_telnet -u admin.

The branch is now merged into master.

Loading data… failed: wait: remote command exited without exit status or exit signal

According to the change that added this error it is apparently valid for a SSH server to not return the exit status. I updated the ssh-insecure-algorithms branch to handle this. Can you check if that makes it work?

If that doesn't help, you could try if something like ssh admin@192.168.1.254 xdslctl info --state (with the appropriate -oKexAlgorithms, -oHostKeyAlgorithms, -oCiphers options) works, just to check if there is a more fundamental issue with the device's SSH server.

drguildo commented 2 years ago

That fixes the error, but I don't get any stats output after it's finished running:

./dsl -d broadcom_ssh -u admin -o InsecureAlgorithms=1 192.168.1.254

Connecting… password required
Password: 
Authenticating… done
Loading data… done

           State:    Unknown
            Mode:    Unknown
          Uptime:    -

          Remote:    Unknown
           Modem:    Unknown

     Actual rate:           - kbit/s          - kbit/s 
 Attainable rate:           - kbit/s          - kbit/s 
         MINEFTR:           - kbit/s          - kbit/s 

         Bitswap:           -                 -        
   Rate adaption:           -                 -        

    Interleaving:           - ms              - ms     
             INP:           - symbols         - symbols
  Retransmission:           -                 -        

       Vectoring:           -                 -        

     Attenuation:           - dB              - dB     
      SNR margin:           - dB              - dB     
  Transmit power:           - dBm             - dBm    

       FEC Count:           -                 -        
    RTX TX Count:           -                 -        
     RTX C Count:           -                 -        
    RTX UC Count:           -                 -        
       CRC Count:           -                 -        
        ES Count:           -                 -        
       SES Count:           -                 -        

I haven't dug into the SSH code, but is this because, when connecting via SSH, you don't get a proper shell, but rather the Billion/Broadcom CLI?

$ ssh admin@192.168.1.254 xdslctl info --state
admin@192.168.1.254's password: 
 > exit
exit

Bye bye. Have a nice day!!!

It is possible to get a BusyBox shell, but you have to issue "sh" in the CLI.

janh commented 2 years ago

but is this because, when connecting via SSH, you don't get a proper shell, but rather the Billion/Broadcom CLI?

In the SSH protocol, getting a shell and executing a command are different requests. In this case, the client requests to execute a command, so there shouldn't be any shell at all. It looks like the SSH server is just broken and you'll have to stick to using Telnet.

Just one more thing, in the output you posted there is a space before the > prompt. Is it also there in the Telnet prompt? If I ever implement more strict prompt matching, this space would be an important detail (in addition to the exact prompts, another useful resource to avoid breaking things in the future would be a copy of the raw data from a short Telnet session including control characters, e.g. TCP payload from a packet capture).

drguildo commented 2 years ago

Just one more thing, in the output you posted there is a space before the > prompt. Is it also there in the Telnet prompt?

Yeah. Looks like the exact prompt is " > ".

in addition to the exact prompts, another useful resource to avoid breaking things in the future would be a copy of the raw data from a short Telnet session including control characters, e.g. TCP payload from a packet capture

If you give me an e-mail address, I'll send you a PCAP file of a Telnet session.

janh commented 2 years ago

If you give me an e-mail address, I'll send you a PCAP file of a Telnet session.

That would be great! You can use the e-mail address from my Git commits. If you prefer not to send the full PCAP file, anything other than the actual TCP payload doesn't matter. The output from Wiresharks "Analyze -> Follow -> TCP Stream" in "Hex Dump" format is fine.