"Fun" with Ping

RobertKaucherRobertKaucher Member Posts: 4,298
Did you guys know that ping (in Windows) uses the standard C libraries which allow for automatic conversion between number format types?

Try this:
from CMD type this with 192.168.1.1 in hex.
ping 0xc0.0xA8.0x1.0x1
Now in octal...
ping 0300.0250.01.01

This was discovered troubleshooting a script that improperly parsed IP addresses and prefixed them with 0; which means they are Octal and not decimal.

Comments

  • veritas_libertasveritas_libertas CISSP, GIAC x5, CompTIA x5 Greenville, SC USAMember Posts: 5,735 ■■■■■■■■■■
    But can you do it in Binary? :)

    Seriously though, that is cool!
    Currently working on: Linux and Python
  • DevilsbaneDevilsbane Member Posts: 4,212 ■■■■■■■■□□
    But can you do it in Binary? :)

    Seriously though, that is cool!

    I'd assume it could. I don't know what the prefix is though....
    Decide what to be and go be it.
  • RobertKaucherRobertKaucher Member Posts: 4,298
    But can you do it in Binary? :)

    Seriously though, that is cool!

    I think the prefix for a binary number is 0B and it does not seem to work. I just fugured someone somewhere is going to experience this issue where a system is being configured with an IP address and it lets them type the 0 and if it is 010 or 032 or something those are not the same as 10 and 32 and they will bang their head for hours about why this device is not working properly.
Sign In or Register to comment.