How to use WinPcap in Xamarin (Forms) - xamarin.forms

There are many .Net wrappers in C# for WinPcap like SharpPcap and PcapDotNet
I have tried to add these Nuget packages to my Xamarin Forms projects but it does not work. I want to create a wifi/packet scanner but I am not sure how to do this in Xamarin. Is it even possible?
When I clone the GitHub repo and build my own version of SharpPcap, the application runs, but I get the error:
System.DllNotFoundException: wpcap
The wpcap.dll is the dll that all these packages are wrapped around and use [DllImport("wpcap.dll")] to work. This wont work in Xamarin (I think).
Another way to use dll's is when you embed them as an application resource, is there any library which I can use that does that?

WinPcap consists of a driver, that extends the operating system to
provide low-level network access, and a library that is used to easily
access the low-level network layers. This library also contains the
Windows version of the well known libpcap Unix API.
Source: https://www.winpcap.org/
There is nothing impossible, however in mobile world you don't have that low level access to drivers and etc. unless you have a root on your device. It is unclear what exactly you want to build. But I know that on both iOS & Android there is an app called Fing. It scans your WiFi network for connected devices. It is written natively per platform. On Android there used to be many different applications that used MITM technique. For example DroidSheep. But I am not aware of any cross-platform solution that is able to scan the network or sniff packages.

Related

Only UWP apps can't handle my webcam

I spotted a strange thing. I have a webcam (a4tech p-635, pretty old) which is not recognized by any UWP app, like modern skype. With standard apps, everything works like a charm. I will say even more; same code in Qt compiled with MinGW can handle this camera, but compiled as UWP, can't detect her.
Have you any ideas? I can't find anything which could be a cause. Thanks.
That is most likely caused by the camera drivers. UWP app API is great at abstracting devices and access them via the simple API, but if the webcamera is not recognized, it must be that the drivers for the camera are not providing the right interface that UWP can use.
Please check if there are newer drivers available and if you cannot install some generic driver that would make the camera work.

Could Native Client web application create windows and common controls while runtime?

I talking about Native Client thing for google chrome...
Developers claim it can run native code compiled from c / c++ in browser's sandbox.
They describe a lot of things, but never point at what I need... So, if I create window in my application with CreateWindow, would this window appear when my Native Client application loaded into browser?
In short, no. Two key things to know about apps that use Native Client in Chrome:
They are platform independent (platform-specific calls are
disallowed).
They are still web apps with the restrictions and possibilities that come with that.
If Native Client allowed operating system-specific calls like CreateWindow, it would no longer be platform independent (and it would also present a security risk).
Instead Native Client provides a set of platform-independent APIs called Pepper or PPAPI that work the same for all supported operating systems (currently that's Mac OS, Windows, Linux, and Chrome OS). As mentioned, apps that use Native Client are still web apps, so Pepper gives the same possibilities and restrictions that you'd expect from JavaScript. E.g., you can fetch URLs or ask the user for fullscreen permission, but you cannot access any random file from the local file system (app-specific isolated local storage is possible; as is having the user upload a file for the app to use).
Moving an existing C or C++ codebase to Native Client is very much like porting to a different operating system. Instead of using, say, Windows API calls, your app should use Pepper API calls.
For additional background it may be worth noting that Chrome Packaged Apps can request access to a much wider set of APIs in the chrome.* namespace. These APIs include USB, sockets, opening new windows, and more. A Chrome Packaged App will still not be allowed to make OS-specific calls, but they have access to quite a few more APIs, all of which are platform-independent.
In short, if your app can be made to work with the Pepper API plus the chrome.* APIs, you could write it in Native Client and JavaScript, and you'd have an app that worked the same way across the four operating systems mentioned above. If your app cannot be made to work with those APIs, Native Client in Chrome is not the right choice.
Seems not.
This is a bit related: http://ssj-gz.blogspot.com/2013/01/emscripten-qt-progress-faster-better.html. It's translated to javascript, though, and only for QT. And slow.

Writing a cross platform GUI/service

I'm working on a project that requires a desktop client to scan certain directories on a users computer at set intervals. My plan is to separate the actual directory scanning code out of the GUI and into a service so that it can run even when the GUI isn't open. Does this sound like the right way to do this? Additionally I'd like all this to be cross platform. I'm using QT to create the GUI. Is it possible to write cross platform services? I've looked into QTService a bit. The documentation for QTService says it's for implementing Windows services and Unix daemons. I assume the Unix portion means support for both linux and mac systems? Any other suggestions?
Yes ,Qt definitely seems a good option for developing cross platform applications.You can write once and recompile it for windows ,Mac and linux.A Qt app will actually look like a native app because it uses the native look and feel to decorate its widgets.
You can alter the build process to build a GUI app or a console application that can be invoked from commandline.
EDIT
QtService is not part of the standard SDK . It is available here

How to use Nokia Qt to launch another mobile application within an application based upon a MIME type?

I am using Qt Nokia for mobile development (I'm currently testing on a Nokia C7) and would like to launch an application from another an application based upon a MIME type.
For example, I might have a file, and I would like to be able to open another application from the original application without specifying the application but using the MIME type of that file. On the other application opening it would load the file and perhaps be given an additional message or payload.
If this sounds a little strange it might help to know that I have come from a J2ME background and would have used the CHAPI API.
I need to use Qt Nokia so that I can build the application for the Symbian or Maemo platform. So far I have only been able to find documentation showing you how to do it under Symbian.
Can I do what I require by using Qt Nokia? I am just not looking the right places?
QDesktop::openUrl may be a good candidate.
This HowTo may be helpful.

scanning a system for shared folders in lan

I am developing an application in flex 3 using action script 3.........
I have some range of ip address in LAN(wired or wireless both).....i want to check which all the systems available...and also want to see their shared folders.....can anyone give some code or reference in action script....
Thanks to everyone...
Actually, I don't think it's possible at all with Flex due to sandbox violation of the Flash Player and/or not supporting it.
I don't know if Air supports network access in this way. Check this out for more information on Adobe Air.
MysticEarth is right, Flex cannot access the operating system directly because of security issues that might arise.
However, you can solve it in two ways:
Adobe AIR 2.0 Command-Line Integration:
Server-side script
Adobe AIR 2.0 can now run native processes! So you could have it access your operating system, check the systems available, shared folders, etc. Here's an example on how to execute native processes with AIR 2.0
The current standard is to just use Flex and HTTP to a server side script. To do something like what you're describing, I would create a ruby/php/python script or whatever, send a restful GET HTTP request to that script (say GET /shared_folders), and have that search the OS for what it needs, and return it as XML. Then you can use Flex. If you don't want to do that, AIR 2.0 is the only option.

Resources