Introduction:
I have a \'magic\' tool that can perform a command line operation on a machine if I provide the IP. The tool knows the OS that machine is
If I understood your problem correctly, then uname is the ideal command. If it's any Unix-system (including OSX), it'll return the correct variable, and if it's Windows it'll return command not found or similar.
uname