I want to bridge two adapters on Windows 10 using WinPcap/npcap library. Even after setting the flag PCAP_OPENFLAG_NOCAPTURE_LOCAL, I'm still receiving packets indefinitely (packets sent by Adapter A are sent to Adapter B and vice versa, in a loop).
I'm using the example code provided here https://github.com/nmap/npcap/tree/master/Examples/UserLevelBridge. Does anyone know a solution to this problem?
Related
I was able to make a working HID USB stack on my "StartUSB for PIC" board for the 18F2550 microcontroller. I based it on one of the MLA libraries, which was made for the 18F45K50 (MLA 2018_11_26, hid_custom, picdem_fs_usb_k50.x), but I converted it to work with the 18F2550 (there might have been easier ways, but only learned to work with PIC about 1 month ago). On the host side, I'm using LibUsbDotNet (also here, there might be easier ways - the documentation on this library really sucks) on a Windows 10 machine.
I'm using the HID class, full speed, and all seems to work. Although, I get some random errors on the host PC (see below), but doing one close/re-open cycle on the host side when getting the error is kind of solving it. Dirty, but it works. So I kind of ignore this now.
Win32Error:Win32Error:GetOverlappedResult Ep 0x01
995:The I/O operation has been aborted because of either a thread exit or an application request.
I'm not an expert on USB (yet). But all examples I'm seeing are based on 1) you send first a command to the device and 2) then you retrieve the answer from the device. I did some performance tests, and see that this indeed shows that I can do about 500 cycles/second. I think that is correct, because each cycle, sending command and retrieving answer, each takes 1 msec.
But do I really need to send a command? Can't I just keep reading endlessly, and when the device has somthing to say, it does send the data in an IN transaction, and when not it ignores which creates a timeout on the host side. That would mean that I can poll at 1000 cycles/second? Unfortunately, I have tried it by changing my implementation on the PIC, but I get very weird results. I think I have issues with suspend mode. That brings me to another question - how can I make the device get out of suspend mode (means that not the host, but the device should be triggering this event). I have searched the MLA library for command such as "wakeup", "resume", ... but couldn't find anything.
So, to summarize, 2 questions:
Conceptual: Can I send data from device to host without being requested for it by a command from the host?
For PIC experts: How can I have a device trigger for a wakeup from suspend mode?
And indeed, the answer is Yes on the first question.
In the meantime, I found another link on the web that contains a Visual Studio C# implementation of a USB library including all the source files.
If you're interested, this is the link
This C# host implementation works as a charm. Without sending a command to the device, I get notified immediately if a button is pressed. Great!
It also proofs that my earlier device implementation based on the original MicroChip MLA, is 100% correct. I stress tested the implementation by sending a "toggle LED command" as fast as I could, and I reach 1000 commands/second. Again great!
I think that LibUsbDotNet isn't that perfect after all. As I wrote above, I get rather unstable communication (Win32Error). But with this implementation, I don't get a single error, even after running for half an hour # 1000 commands/second.
So for me, case closed.
I'm currently playing SignalR 2.0.3, scaling out with a BackPlane that utilizes Redis for windows
http://msopentech.com/blog/2013/04/22/redis-on-windows-stable-and-reliable/
I've integrated with the appropriate SignalR.Redis package in VS.
I made the following changes to my startup:
GlobalHost.DependencyResolver.UseRedis(
server: "localhost",
port: 6379,
password: string.Empty,
eventKey: "BroadcasterExample"
);
app.MapSignalR(hubConfiguration);
It builds fine.
My client appear to connect OK.
I can send notifications between client & server and visa versa.
From the Redis-client, I can enter:
get BroadcasterExample
which returns: "3"
I assume that things are working, but...
A couple of question:
1) How can I tell that is actually working?
2) What can I examine on the Redis server (though the Redis-client)?
3) What is getting stored in what data structures (key/value pairs, lists, hashes, sets)?
I would like a little more in depth view as to what is going on.
I've looked at the commands on: http://redis.io/commands
Nothing is jumping out at me which will help me map what's really going on.
Can someone point me in the right direction here?
Thanks,
JohnB
1) I believe you have already verified that it was working when you ran "get BroadcasterExample" and it returned "3". BroadcasterExample is the name of the channel that SignalR will send messages over and I believe the 3 represents the number of messages that have been processed. As you send more messages with SignalR you should see that number increment.
2) A good way to tell that things are working is to subscribe to the BroadcasterExample channel with the redis client and watch the messages come through. From the client, run:
subscribe BroadcasterExample
3) SignalR will probably just store that one key, the "BroadcasterExample" key. SignalR is really just using the publish/subscribe functionality of Redis, not storing any data.
The answer from jaggedaz has useful info. I would also add that you can do a different tyope of test quite quickly by hosting your application twice, under 2 differents ports, using IIS Express. If you then connect 2 browser windows to these 2 different instances and start exchanging messages (like broadcasts to All), you will see them flow across both clients, which is possible only when the backplane is actually working.
I know there are various programs that sniff packets like WireShark, but I'm pretty sure you can only view the data. I want to know if it's possible to edit incoming packets. I'm not sure if packets are the right term. I just want to edit incoming data that is recieved through the internet and who's destination is a specific application. Let's say I am playing an online game. As it loads my computer, it is recieving information like "This person has 10 coins in their money pouch". Obviously not exactly like that but you get the point. I would like to be able to change the data so it is say 100 instead of 10. I know something like this would be possible if you were to do this: Imagine my computer is connected to the internet with an ethernet cord. There is a device attached to the ethernet cord which recieves the data and changes it and then lets it continue to my computer. I would just like to know if this is possible, and how it could be accomplished.
Thanks!
The way I do it, is one of 2 ways:
1.
If your application supports it set up a HTTP Proxy on your machine and you could software like burp / Fiddler to mess with the data
If not (the protocol is not HTTP) you could use either one of 2 options i'v tried [Both based on Hooking the API calls from the application to the OS]:
EchoMirage software that allow messing around with the packets
[Bit more advanced: ] There is a debugger named OllyDbg which has a plugin named Universal Hooker; it enables to hook any window API function and execute a python script on demend. the uHooker contains examples for how to hook WSASend and WSARecive (which are the API functions used in windows sockets).
I'm new to driver programming in general and also to USB. However, I managed to write a driver for Windows CE (6.0) and I also had access to an USB-Sniffer to read all traffic between the host and the device.
The problem now occurs on some boards (2 out of the 3 I have):
When the device has no data to send and I issue an Interrupt-In-Transfer the device sends an ACK.
So far this is expected. However, something (I guess either the USB-Controller or WinCE) seems to automatically issue more IN-Transfers (3 on one board, 4 on another) and I get subsequent ACK. This isn't a problem so far either.
But the next IN-Transfer will also result in an ACK, no matter if there is data to send or not, I receive zero bytes in the driver.
Yet, when I look at the USB-Sniffer the proper telegram was send, however 2 more IN-Transfers are automatically issued and are responded with an ACK. So it seems like the data is overwritten by the ACK.
I tried everything that came to my mind so far: Reset the pipe, close and reopen the connection, but nothing seems to work out properly. Resetting the Pipe solves the problem in about half of the cases though. I really ran out of ideas for solving the problem.
Is there a way to tell the USB-Controller (or WinCE or whatever causes this behaviour) to always only issue one single transfer?
EDIT
Turns out it was a threading issue. Unfortunately I wasn't the one who fixed it and I have no access to the working solution, thus I cannot give further details.
I made some code in vb.net which checks if a certain process is running, and returns a 1 if it is, or a 0 if it isn't. Now I want it to send a packet to my server or something which would log the IP of the client, or something similar.
What would be the easiest way to approach this?
There are a lot of different solutions to this task. First, which comes to my mind is WCF - maybe the easiest one as you do not think about opening ports, establishing the connections, parsing the input socket string and so on.
Here is on more link:
Introducing Windows Communication Foundation in .NET Framework 4