control a users USB device via a webpage? Possible? - asp.net

I'm wondering if there is a way to create an asp.net webpage that will connect a visitors USB device to an application on the windows bases server? This way we avoid having to install a software on the visitors computer to control a USB device update that they purchase form us.
All they have to do is visit our update page, plug their deivce to the USB, and have our site update the usb hardware.
Possible? or am I dreaming? :)
i found software like: USB over IP, and few others. But not show ure its possible to create a C# or vb.net based ASP.net page to control the visitors USB device.
Please advise.

In general, Web pages and scripts that run in browsers are limited in what local system resources they can access. Direct access to hardware like USB devices has obvious security implications.
The only way I can think of to do this might be an ActiveX control (IE only, I think) or some other kind of browser plugin.

One possibility is building a webserver into the USB device. Give the device internet access, and get it to download its own firmware in a process controlled through the webpage that the usb device serves.
Note that I have no idea if this is actually possible, just thought I'd throw in this different way of looking at the problem.

It is possible to create an ActiveX/.NETcontrol/Java Applet that will do it.
Granting the rights to this thing to access local devices will require certain security setup which can be automated, but in any case will require some user consent/interaction

I see here 2 ways:
ActiveX control
The problem is that the user should first download and install the
ActiveX from an Internet web server or from a local file
USB Device driver + DHCP Server + Web server embedded in the
device
Your USB device, once plugged, should present itself as a "Virtual
Ethernet Interface" in order for Windows to add the driver to the
list of the Internet Connections.
The Device should have also a DHCP server in order to give Windows
an IP address. Beware of the fact
The USB Device should also have an HTTP server.
At the end of this process, Windows will have 2 IP addresses.
Now you have to figure out how to have IE point to the index.html
file of the device.
Buy/Find a commercial software
You are not the first guy on this planet that has similar
requirements.

The only way I can possibly imagine doing this is through JAVA
EDIT: Looks like there might be an ActiveX way to do this as well, though ActiveX is Internet Explorer only, which limits it's usability.

Related

Serial COM port data over WebRTC

I'm currently looking at options to allow me to build a remote COM-port solution.
The idea is to be able to access from my remote PC, another PC that's directly connected to a device locally via its serial COM-port.
I know that the obivous answer is to use a VPN between the 2 Internet connected PCs.
However, I need this solution to be as seamless to the end-user as possible.
i.e. no installing and configuring VPN software, etc.
So I was thinking that WebRTC would be great because the end-user can simply use their web-browser and not have to install any additional software.
My question is, is it possible to stream the COM port data between the 2 PCs via WebRTC?
If so, can you please point me in the right direction as to how I can go about achieving this?
Sorry if this is a ridiculous question, I'm very new to WebRTC, just exploring my options.
Thanks.
That should work great!
Networking wise you get NAT Traversal. That means the two computers can be in completely different networks, and still communicate. You may have to run a TURN server if P2P isn't possible.
Data wise you can exchange anything you want via data channels. It is datagram based and you can send/receive binary data. You get a callback telling you how much has been delivered, that way you can detect backpressure.
Are you ok with installing software on the remote host? You can do something like Pion WebRTC's data-channels. This shows you can have a browser connect to a Go process via WebRTC. Then use tarm/serial on the remote host to interact with the device.
If you want a browser on both ends there is the Web Serial API I haven't used it myself though. That locks you into only doing Chromium which might be an issue.

Control sonoff with mqtt or http?

I am wondering what is suitable for my case, using espeasy or Tasmota. I know espeasy is using http requests and Tasmota is using mqtt.
I want to control my sonoff devices by a raspberry pi that is acting as a home automation hub, and it in turn send updates and receives commands from AWSIoT platform. For interacting with AWSIoT platform, it uses mqtt.
What are the pros and cons of using either? and will it cause problems if I control several sonoff devices with http, while using mqtt for AWSIoT? or better use mqtt for all AWSIoT and sonoff?
I am not an expert on the topic but have tried a few things and got some insight for you on why to prefer MQTT over HTTP.
Security. Remember that the 'S' in IOT stands for security. Joking aside. I have not seen an option for encryption (HTTPS) of the HTTP-traffic for tasmota. (May the internet correct me if I am wrong) So choosing HTTP means your user/password (which are not a requirement but should totally be used) are transfered via URL query parameters as plain text. MQTT has built-in mechanisms for encrypting the traffic. I haven't been able to get that working in my network but I'm trying.
Flexibility/Reliability. With MQTT/Tasmota you have the ability to implement automations that do not rely on your home automation hub by having your devices publish MQTT-messages directly to each other for interaction. For example if you would like to implement an emergency off button that turns multiple devices off you do not want that to rely on your home automation server. Doing this with HTTP 'could' be done too but requires all users/passwords of all the devices to reside not only in your home automation hub but also on other single devices.
Networking. Adding new devices to your hub should be as easy as possible. In matters of HTTP your home automation hub has to know how to find your devices via IP-addresses or domain names since it has to resolve a URL. When using MQTT you just connect your tasmota devices to your broker and use their topic in the home automation hub. The devices do not even need to have a static IP or reachable domain name of mDNS name of any sort. That's in an essence what makes pub/sub for IOT so interesting in the first place.
Existing support. Before building your own home automation solution be sure to check out home assistant (my favorite) or any of the other home automation solutions if they fit your need. Do not reinvent the wheel. A tipp for home assistant: Do not use MQTT auto discovery in combination with tasmota. This is the only thing that has not worked out for me. Manually registering devices works reliably.
Hope that helps. If you still prefer HTTP checkout the app "Tasmota control".

Work with multiple NICs/networks in Windows

I'm searching for a solution to work on a Windows machine with multiple NICs/networks. While working within the network of a customer I tend to get a lot of problems. I need an internet connection for several things like git/sourcesafe/development system etc. but clients often can't offer internet access. So the solution is to use a mobilephone to connect to the internet and ethernet to access the client network/database.
Windows seems to be pretty random here. Sometimes everything works, some mintues later it trys to access the internet over the clients gataway or access the database via the internet. So I end up deactivting/activating NIC's all day long.
Is there some easy way to use the ethernet connection only to access the clients network and the mobile for everything else?
From what you described I think this might help: turn off DHCP for the interface that connects to your customers network and set a static address for that (without a gateway). Then configure your other interface to use DHCP. This should set ONE default gateway (your phone) and all traffic will run through it, except endpoints in your customer's net.
BTW: You can only have one default gateway at a time, of course, but in your case the gateway that was set the latest won, so to speak.

read MAC address of machine from Adobe AIR

i want to read MAC address of machine from Adobe AIR. I am using flex 3 and AIR 2.
how can i do this
the main purpose is i want to install that product in only one machine
var ni:NetworkInfo = NetworkInfo.networkInfo;
var interfaceVector:Vector.<NetworkInterface> = ni.findInterfaces();
Taken from the Network Info sample in the desktop version of Tour de Flex.
As far as I can tell, you cannot do it with Flex/AIR alone - you can however use the NativeProcess API to communicate with a Java/C program that can do this for you.
If you want to limit your application to just one machine, why don't you just install it manually without giving away the setup file - is it a remote machine? Even in that case you should be able to do a remote installation, right?
The answer "track the combination of IP address and user ID" won't satisfy my (very similar) needs. If the (laptop) computer is moved across WiFi domains, its IP address will change. If the computer is on a commerical IP provider, the IP address can often change without warning or notice.
My users don't want to deal with such problems. They don't even want to know that these problems exist!
The binding of MAC address and user ID can be done at installation time. It's not perfect, but it's pretty good.
Of course what we need is an implementation of public-private key...
Oz

network monitoring on windows mobile 6

I am currently trying to write a network monitoring software for windows mobile 6. I googled a lot and some people say that it is not possible to use a NDIS driver or WinPcap or so for monitoring any network interface. Others say that it is possible. Fact is, that I found no exaples, nor any sourcecode on the net.
Therefore I ask this community: Is it possible to write a packet capturing tool that works on data-link layer for windows mobile in C or C#?
with best regards
Desktop and Server Windows products have a very defined, generic, and pluggable structure into which you can insert hooks into the network layer. (Look up LSP or Layered Service Provider - this is how AntiVirus/Firewall programs plug themselves into monitoring your network traffic). As far as WinPCap, it plugs in one level lower at the NDIS driver level, but regardless, Windows Mobile just is not nearly as flexible when it comes to this. I don't necessarily think it's just Microsoft being short-sighted here, though - it takes much more power to provide a generic and pluggable LSP or NDIS layer that most mobile devices just can't afford.
The most important point here - NDIS Packet Capturing is not supported for Windows Mobile. Closest you can get to a mobile platform with packet capture is Windows Embedded CE.
So, in order to capture network traffic for Windows Mobile you would need to develop your own NDIS driver framework. Not a small task.
Windows Mobile uses Windows CE.
NDIS is very much present on Windows Mobile, so you can write an intermediate driver to capture traffic.
However, it already has netlog which should do the work for you: http://msdn.microsoft.com/en-us/library/ms883126.aspx

Resources