Is it possible to get the status of my network from the usb port on an UNO R3?

Hi all and thanks for looking at my question.

I have a project in mind where I need to be able to see if my laptop has network connectivity or not and take actions according to the results. Any ideas on how to do this? I'd like to be able to check against 3 or so various addresses on the web to verify when I have absolutely NO internet access. Thanks in advance for any help.

You either did not describe your whole setup or your project is impossible because the Arduino has no network connection.

BTW I don't understand why you need an Arduino for that, a simple piece of software on the notebook does everything you need without any additional hardware.

Deadbot1:
Any ideas on how to do this?

There are lots of ways to do this using software on the PC, depending on your level of skill. At the simplest level you would just check the status of a regular ping to well known external addresses. For example I've used this approach to automate the maintenance of an unreliable VPN.

I don't see how an Arduino is any use in solving this problem.

pylon:
You either did not describe your whole setup or your project is impossible because the Arduino has no network connection.

BTW I don't understand why you need an Arduino for that, a simple piece of software on the notebook does everything you need without any additional hardware.

PeterH:

Deadbot1:
Any ideas on how to do this?

There are lots of ways to do this using software on the PC, depending on your level of skill. At the simplest level you would just check the status of a regular ping to well known external addresses. For example I've used this approach to automate the maintenance of an unreliable VPN.

I don't see how an Arduino is any use in solving this problem.

I didn't describe it fully, no. I have a project in mind where I am creating an intelligent USB hub that only allows devices on it to be connected to the computer when the host computer has NO internet connectivity. I live in The US and with all the news about the various acronym agencies and their abilities to crack our networks and systems, I've decided I want to reclaim my right to privacy. To accomplish this, this hub will be used. By plugging my secure hard drive into it, I can have storage that ONLY I can see. Since the hub will only connect the drive when there is NO internet connectivity, files on it can NEVER be accessed from a hacking attempt. You can't hack what you can't see. The only way to access files on this system will be to have physical access to the hardware. This needs to be a HARDWARE solution. Software is hackable via malware, so is not acceptable.

The ideal solution would be if I could just use the USB serial interface to determine connectivity on the host, allowing the unit to be cross platform. It seems though, that I'll need a piece of software host side to send serial data to the arduino to let it make the determination of whether the hub should be on or off. I have some programing experience, so a simple tray resident program would be no problem. I could probably figure out a simple script for *nix OS's. As stated above, I'd like to avoid this if possible, as the signals to the arduino could be spoofed. I know that sounds horribly paranoid, but just because I'm paranoid doesn't mean they aren't out to get me ;).

Turn off wireless and use a big multi-pole mechanical switch on the cat5 going in.

KeithRB:
Turn off wireless and use a big multi-pole mechanical switch on the cat5 going in.

Ahh, but I'm a lazy bastard...and so are the masses I hope to market the end result to :wink:

The ideal solution would be if I could just use the USB serial interface to determine connectivity on the host, allowing the unit to be cross platform. It seems though, that I'll need a piece of software host side to send serial data to the arduino to let it make the determination of whether the hub should be on or off. I have some programing experience, so a simple tray resident program would be no problem. I could probably figure out a simple script for *nix OS's. As stated above, I'd like to avoid this if possible, as the signals to the arduino could be spoofed. I know that sounds horribly paranoid, but just because I'm paranoid doesn't mean they aren't out to get me smiley-wink.

If you install a piece of software on the PC that tells the Arduino if the PC has an internet connection or not, what hold the bad guys with access to your PCs software back from modifying that piece of software too and allowing the USB hub access although there is a (secret) internet connection? BTW, if they're controlling your PC, they can make copies of the hard drive content on the local harddisk while you're offline to transfer it later when you're online again. You'll never get security by such hardware solutions.

The only way to avoid that such information leaves your house is having it on a separate computer that never had and will never have internet connectivity nor any other, even temporary, connection to the outside (USB stick, flash card or the like).

True, one could copy those files, but that activity has a much higher chance of being noticed. Also, it is very hard to initiate such a transfer if you don't know of the existence of said hardware. The aim of the project is to limit the visibility of the hard drive.

The scenario of transferring files to the main hard drive from the secure dive while I'm offline is very unlikely. First the attacker has to know of the offline drive, then have software in place that can act autonomously while offline, then have knowledge of what files to transfer...all from a drive they can never actually see. By all means not IMPOSSIBLE, but very IMPROBABLE.

Deadbot1:
This needs to be a HARDWARE solution. Software is hackable via malware, so is not acceptable.

What you say about software is absolutely true, but makes it impossible to achieve your stated objective unless you're prepared to require all network connectivity to be controlled by your proposed device. You might be able to do that either by electrically disconnecting an Ethernet cable via an eight pole single throw relay controlled by the USB device, or by basing your solution around a router rather than an Arduino and treating the isolation as a routing problem rather than an electrical problem - with that approach it would make more sense to be looking at network attached storage rather than a USB drive.

Could you use a network switch as a "gateway" to the rest of your network, and have your USB hub turn the power on/off as required?

PeterH:
What you say about software is absolutely true, but makes it impossible to achieve your stated objective unless you're prepared to require all network connectivity to be controlled by your proposed device. You might be able to do that either by electrically disconnecting an Ethernet cable via an eight pole single throw relay controlled by the USB device, or by basing your solution around a router rather than an Arduino and treating the isolation as a routing problem rather than an electrical problem - with that approach it would make more sense to be looking at network attached storage rather than a USB drive.

Unfortunately, what I'm after is the polar opposite. I want to have the device controlled by network connectivity. Impossible is a bad word with me...there is SOME way of gaining my objective. It may not be an Arduino. I live in a fully networked home, with tablets for kids, laptops for my wife and oldest daughter, not to mention all my goodies. Shutting off all connectivity for one devices sake seems a bit over the top. I think I see a way out of the forest using the Serial Event procedure. It will require a program running on the host computer, but I think a bit of clever usage can eliminate any spoofing issues.

It will require a program running on the host computer, but I think a bit of clever usage can eliminate any spoofing issues.

If they are on your computer, they can control every program they want to. So if you solution depends on some software on the host, they can trick it out. Do you really think that if they are smart enough to get into your computer from the outside, they aren't smart enough to analyze what you've done and find a solution to circumvent it? Dream on. If they are interested in you they will get through, otherwise they won't break into your computer.

If you want to keep them out, take care of the main network device (router or the like) and ensure that every person in your household is sensitized for the ways trojans might get in. Your planned hardware device (at least the way you currently plan it) will not be a relevant barricade for a mildly elaborated intruder. At least it won't be one for me and I'm not working for one of agencies with the acronyms, nor am I a specialist in these things.

Deadbot1:
It will require a program running on the host computer

If you don't mind compromising the security of your solution slightly, that would be viable. Obviously the software would be inherently OS-specific.

Note that this approach would rely primarily on obscurity (nobody would be motivated to hack an arbitrary 3rd party application for no obvious benefit) but once you have malware present you can no longer rely on the integrity of any software on the PC so you need to decide how valuable your data is and what lengths you are prepared to go to to protect it. You also have to consider that changes to the network connectivity may occur outside of your control, so if this solution connects and disconnects your USB drive automatically there will be reasonably forseeable situations where it forcibly disconnects the drive while you are accessing it. That could easily lead to corruption of data on the drive.

There are various ways that software on the PC can detect the availability of internet access, depending how much knowledge of networking and your local OS you have. At the simplest level, this could just be a ping to a well-known address.

I wonder... I'm not really familiar enough with the Arduino Leonardo (or the Pro Micro, which is similar), to be able to tell if the following is possible.

The Leonardo can be made to be a keyboard, which means that it can send keystrokes in to a PC. If it can be made to receive data from the PC via a standard IO method (for example, like an IO device), at the same time, then it might be possible to have the Leonardo run a "standard" program (one that is on all Windows systems, for example) that will send its output back to the device. Essentially, you could just issue a command like ping -n 1 192.168.100.5 > X:\filename.txt If you have a grep, you can pipe it through that to only report a line containing "Reply"

If you run a command line window on a Virtual Machine, you won't even need to see the conole window or worry about giving it focus.

  1. No "non native" software to analyze and hack (except the VM)
  2. It just looks like another keyboard
  3. You could spoof the name/ID of the keyboard, making it look like a commercial one.

Just a thought.

lar3ry:
it might be possible to have the Leonardo run a "standard" program (one that is on all Windows systems, for example) that will send its output back to the device.

I don't see how you could achieve that without interfering with whatever the real user and real keyboard are doing - I expect that would be highly intrusive. Putting a dedicated application on the PC to handle the serial port directly would seem like a much cleaner solution. If you were feeling keen, you could even include a USB storage device in your solution and run the application from that, subject to permission from a PC administrator.

PeterH:
I don't see how you could achieve that without interfering with whatever the real user and real keyboard are doing - I expect that would be highly intrusive.

As I mentioned, running it on a virtual machine would make it completely unobtrusive. On VMWare Player, for example, when you plug in a USB device while you are running a VM, the VM will ask you if you want that device under control of the VM. If you say yes, the main OS will not see it at all, and the device can be merrily operating under the OS running the VM. I often have two different VMs up, one running XP and one running Windows 8, and unless I am actively using them, I don't even notice them. They both control USB devices that my main OS does not see.