Build libpcap for Python 2.7.x in windows 7 - python-2.7

I've tried several different things and crawled around on lots of forums looking for an answer to this question.
My goal is to simply parse through a wireshark .pcap-ng trace file using Python. From what I can gather, it seems like I need a libpcap wrapper for Python or perhaps WinCap (PyCapy?)
I'm relatively new to Python, so if you all have any pointers on how to install this module please let me know. Earlier I had a 32bit version of Python installed and found a win32 installer and was able to parse through .pcap files but I really want to be able to parse through the .pcapng files. Thanks guys,
~Kyte

Sadly, this is Windows, so WinPcap won't help; libpcap 1.1.0 and later can read pcap-ng files, but there is currently no version of WinPcap based on a version of libpcap with pcap-ng support.
I.e., currently, the first piece of software to try would be VirtualBox, Parallels Workstation, or VMware Workstation, and the next piece of software to try would be some Linux distribution running on your Windows machine under the virtualization software. Sorry.
(Yes, I have to find the time to do some libpcap infrastructure work to make it easier for the WinPcap people to make their remote capture support work with newer versions of libpcap. Sadly, there are only 24 hours in a day, and a ton of other things to do competing for the hours that remain after such frivolities as eating and sleeping. :-))
A workaround for that particular issue would be either to save a capture from Wireshark in pcap format rather than pcap-ng format or to use Wireshark tools such as editcap (which can handle pcap-ng files on Windows, as they don't use libpcap/WinPcap to read capture files) to convert from pcap-ng to pcap.
There are a couple of Python wrappers for libpcap/WinPcap - python-libpcap and Pcapy. The python-libpcap page has a daemon and a penguin on it, so they're only advertising BSD and Linux support; it might work on other UN*Xes, as there shouldn't be major differences in the way you hook into libpcap, but might not work on Windows. Pcapy, however, explicitly mentions WinPcap and Win32 binaries.

Do try out the pcap binary that #dirkloss compiled for Python 2.7 | Windows.
Here
I tried it , but I'm getting this error- SO qn

Related

how to call memcached api in Windows C++

I am trying to use memcached for my windows C++ application, aiming to cache large table contents for performance optimization
This is first time for me to implement caching with open source library, and most memcahed source I have found online are either for Linux only or for 32-bit windows (very out of date), also need docker.
Please let me know if there is any good Windows Memcached source easy to use
One possible resource I have found is: https://github.com/jefyt/memcached-windows
But README just telling you how to install & run memcached from cmd line, there is no hint for how to build and use as an C++ client library in windows, plus, I could not find any example code also
Can anyone point me a direction for how to add memcached as client library to be called in my C++ code on Windows (something like #include <memcached/...> )
Thanks a lot
K

/dev/dsp not found error while audio playback in centOS 6.x

I am trying develop an application using C++ which will record audio data from mic and will playback the data. But while trying audio capture I am getting following error message.
cannot open /dev/dsp
Can anyone advise me on this?
As far as I know /dev/dsp has been obsoleted. Latest CentOS uses ALSA(Advance Linux Sound Architecture) instead of that. You can check the implementation of pulse audio. I have used the code from the given link to develop an application similar to yours. Hope it will help you.
older softwares like dosemu , some (VERY) old ham softwares actually require /dev/dsp be present.There is a package or config that you are missing. Googling for it might help, I forget the exact page that I found the solution on.This applies to fedora and most modern debian based distros as well.

USB Programming with Qt

Is there anyway I can do USB programming in Qt? I am using Qt Creator 2.6 which is based on Qt version 5.0.0 and it is the latest Qt Creator which works with the Microsoft Visual Studio 2010 compiler.
I have the toy called "Dreamcheeky Thunder Missile Launcher" and I need to program this USB based device.
I have tried LibUSB but it messed up everything. It even renamed the device port and I had to undo everything using USBDview software. But I guess I installed it incorrectly. I followed these instructions. It is instructions for 64 bit, but I got 32 bit and since the instructions seems not to have big difference (instead the download file) I followed it. This is what I downloaded - libusb-win32-bin-1.2.6.0.zip
Whatever the API you recommend it doesn't matter, even libusb, but please be kind enough to tell me how to install it properly.
My OS is windows 7 ultimate 32 bit.
ollo's answer is out of date. TL;DR is use libusb.info. A bit of explanation:
Originally there was libusb-0.1. Later they updated the API to libusb-1.0, but since libusb-0.1 had been around so long many projects didn't bother switching (kind of like Python 2/3). libusb-0.1 was not available for Windows, but libusb-1.0 is now available for all major platforms.
libusb-win32 is a port of libusb-0.1 to Windows. You shouldn't use it for new code.
libusb.org is the old website for libusb. The latest release is from 2012 and there are no Windows downloads.
libusb.info is the current website for libusb. It contains libusb-1.0 downloads for all platforms and you should use this for new code.
To further confuse things, the sourceforge libusb-win32 mailing list is still used for libusb.info's development.
There's another good instruction for libusb here: http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/
libusb:
libusb
libusb-win32 (windows port - use this on windows!)
If you stay on windows you can use
WinUSB:
WinUSB API
Example
Installation
For windows you can use both, but if your program has to be cross-platform you should use libusb.

Tools for Unix <-> Windows C++ development

I am doing some C++ cross development - been doing that for a while on Windows and recently started on Unix.
I suppose what I am after is to simplify Unix development experience - I have a local windows box I do development on, and a remote Solaris box which I use to compile and test code on unix environment.
What I do now - I develop, compiled and test code on Windows (VC++) and once it is done, I move code to Solaris box using Filezilla over SSH. I also use Putty to connect to Solaris box and execute shell commands.
Since I am quite new to unix development - I suppose what I do is by far not optimal and the tools/technics I use not optimal too.
Can you recommend me a better tools - how to move code around more easily and may be a replacement for Putty (which looks quite outdated anyway).
Thanks.
If by any chance you want to run the same C++ IDE on both Windows and Solaris, I recommend taking a look at Code::Blocks. Also, as I suggested to Charles, running an X server on the Windows box gives you a lot more flexibility than running Putty or similar.
Is there any reason that You can't test software on Solaris using Virtual Machine? They can share folders so there is no need to uploading code to remote machine.
Second: use svn or git or mercurial. In one machine You check in your code, on other you checkout plus You have history of changes. No need to use Filezilla over SSH.
edit:
Also, I think that it would be good to use cmake (or scons - but I don't used it) to generating build files. For example - cmake generates Makefiles or project files for Your IDE, so You don't need to maintaint few different files that build Your code on different platforms.
You might want to look into Samba, so you can work directly with the Windows file explorer to move files to and from Windows/Unix environments, rather than using FTP.
But for UNIX shell access via Windows, you really can't beat Putty.
I recommend mercurial.
Just use a version control system such as Subversion or Mercurial. I strongly recommend the latter because it's distributed so you don't need to have a server per say and you can work offline. Every time you want to shove your Windows code to the unix machine you just need to do 'hg push' and off you go. To sort out the build you can with good old Make or just use SCons (again I prefer the latter because it comes with the power of Python).
I actually, very recently developed a cross platform project in C++ using wxWidgets and GraphicsMagick. I wrote it all in Mac OS X and then compiled both in Windows and Linux. One thing I'd like to point out is that GCC seems to be more pedantic about compile warnings and errors than Microsoft's compiler so if you grow to like the Unix environment I'd recommend to develop there and then compile in Windows (maybe even using a VMWare image).
Instead of moving your source code around manually, consider using a version control system. Not necessarily a distributed VCS such as git or mercurial, but you should use version control nonetheless.
Sooner or later, you'll need to use a debugger on the Unix machine, and if you prefer using a graphic debugger, you should install a local X server on your Windows machine.
IMHO vim is quite good editor ;)
gcc, nm, ld for compilation/build/diagnosis
makefile for builds
gdb as debugger, if you prefer GUI check ddd (if you want to stick
with Visual Studio for debugging
check www.vsbridge.com or
www.wingdb.com - they both
depends on gdb as back-end)
other commercial debugger for Unixes
is TotalView
(http://www.roguewave.com/products/totalview.aspx the price is
high, although they have their own
engine instead of gdb)
CVS, SVN as source control
If you want to edit files in VisualStudio you can use e.g. Samba as "transparent file system" ;)
By the way VirtualBox may be very helpful (I debug (Open)Solaris or Linux as VBox machines very frequently).
ps
yet another environment you may be interested in is Magic C++ www.magicunix.com/

C++ development for Linux on Windows

I am trying to setup a development environment for Linux C++ application. Because I'm limited to my laptop (vista) which provides essential office applications, I want to program and access email, word at the same time.
I'd prefer a local Windows IDE. SSH to a company linux server and using VI doesn't seem productive to me. Even using some IDE installed on the linux server doesn't seem good to me, because I can't do the work at home.
So does Eclipse CDT + MinGW work for me, or is there any other choice?
Thanks.
ZXH
Why not install a Linux virtual machine on your laptop, in VMware or similar? That way you can test while you're developing too.
You can also try http://cygwin.com/
Is it a GUI app? And do you have to target Linux specifically? If not, Qt (http://trolltech.com/) may be something that you can use. It would allow you to more or less develop your whole application on Windows, and then spend a few hours on a linux machine getting the whole thing ported...
Qt is the best choice. I develop with tis tool for a long time. And you can develop with the same ide : QtCreator and the same framework : Qt on MacOS, Linux based or Windows plateform...
Moreover, specifically on Linux, Qt is well integrated with Kdevelop !
If you have Visual Studio, which I feel is an excellent IDE, you can try to set it up to use GCC/G++. I've done this before, back in the Visual Studio 6 days. As long as you aren't using any Windows-specific libraries and write portable C++, you can compile and test on Windows, then periodically ensure that the code also compiles properly for Linux.
Another approach, one that I actually prefer, is to host your source and make files on the Linux box, share the files through Samba, then use your Windows IDE/text editor to edit those files. Then, you can do the compiling through an SSH terminal. Sure, you'd lose the convenience of being able to compile through your IDE, but at least you wouldn't have to muck around getting the compiler set up on Windows.
If you have a linux server available to you, you could also use NX to log in graphically, and use a Linux IDE there like Code::Blocks, or shudder Eclipse. Of course, there's nothing unproductive about shelling in and using VIM. I find it's a good way to shake out the IDE-induced cobwebs every now and again. Happy coding however you end up doing so!
I use (and recommend) Netbeans for C/C++ Development together with Cygwin to develop POSIX applications on Windows that will run on Linux/Solaris later on.
It is pretty easy to setup as long as you stick to the stable version of Cygwin.
I was in a similar position 2-3 years ago and tried several approaches, but the only one that really worked wor me was vim+ssh (+gdb, make, svn, etc). But again, I use vim even for Windows development.
This slideshow (PDF) walks through how to set up a cross compiler from Windows to Linux.