Packet loss Simulator - wireless

I'm developing a file transfer software.
And I want to test it in bad connection environment(packet loss with a certain probability).
I need a program to simulate this environment.
Please help me. Thanks so much

If you're using Mac OSX, a simple (but easy way) is to Grab Apple's Network Link Conditioner (part of developer tools) which allows you to control uplink/downlink packet loss and delays from a convenient system preference pane.

Related

Mimic Low Bandwidth for UI Testing?

How do you mimic low bandwidth for testing HTML rendering on slow computers? I'm using Safari 4 on a Mac.
Found the SpeedLimit preference tool mentioned in another SO answer. Works for me and is very unobtrusive to use (no application, no command line, no Java).
You're probably looking for traffic shaping, in MacOS X it's included in the kernel. Take a look at http://www.macgeekery.com/hacks/software/traffic_shaping_in_mac_os_x
If you have an Apple Developer account, look for the "Hardware IO Tools for Xcode" download. There is a Network Link Conditioner pref-pane included just for that with some good presets for
3G (Average/Good/Lossy)
Edge (Average/Good/Lossy)
WiFi (Average/Good/Lossy)
Cable
DSL
Also have a look at this answer
I'm a big fan of using the Charles Web Debugging Proxy. It allows you to throttle your own bandwidth to simulate different connection speeds (and a whole mess of other stuff, too). Highly recommended.
You could set up a local webserver (ie Apache) and use the traffic shaping capabilities thereof.
An article on Apache throttling
I guess most popular webservers support this.
edit:Typos
There is a program by Intrarts called "throttled", and the command-line version seems to be free (price):
throttled is a bandwidth shaping
application for Mac OS X and FreeBSD
which allows you to cap your upstream
bandwidth, prioritize ACK packets, and
keep your download speeds high even
when your server is sending out at
full speed.
...which seems to be a little tangential to your needs, but might be able to be configured to do what you want.
I wrote a post on using waterroof to limit bandwidth a while ago.
It uses ipfw under the covers, but has a nice UI for this kind of thing.
One option is Trickle for Mac.
Alternatively, if you don't have to use Safari, you could use Firefox with the Firefox Throttle plugin.

How can I simulate TCP/IP errors?

On a multi-tier application, I need to simulate various TCP/IP errors to test some reconnection code. Does anyone know of any tools (Windows based) I can use for this purpose? Thanks.
Scapy allows you to control every aspect of the packets, and randomly modify ("fuzz") the ones you don't want to control. If you're a command-line kind of guy, it's a great tool.
Try netwox (formerly lcrzoex.) If it won't do it, it can't be done. It contains >200 tools.
On FreeBSD, the best tool, by far, is dummynet, "a tool originally designed for testing networking protocols, and since then used for a variety of applications including bandwidth management. It simulates/enforces queue and bandwidth limitations, delays, packet losses, and multipath effects."
On Linux, you will have to use netem. (It seems there is now a port of dummynet but I never tried it.)
More details (in French) in my article.
Clumsy is a good tool for TCP error simulation on Windows. It can simulate (copy-pasted from link above):
Lag, hold the packets for a short period of time to emulate network
lagging.
Drop, randomly discard packets.
Throttle, block traffic for a given time frame, then send them in a single batch.
Duplicate, send cloned packets right after to the original one.
Out of order, re-arrange the order of packets.
Tamper, nudge bits of packet's content.
No tools that I'm aware of, but most of TCP errors can be emulated by a custom LSP filter. This article can get you started writing one

How do I hook the TCP stack in Windows to sniff and modify packets?

I'd like to write a packet sniffer and editor for Windows. I want to able to see the contents of all packets entering and leaving my system and possibly modify them. Any language is fine but I'd like it to run fast enough that it won't burden the system.
I've read a little about WinPcap but the documentation claims that you can't use WinPcap to create a firewall because it can't drop packets. What tools will help me write this software?
Been there, done that :-) Back in 2000 my first Windows program ever was a filter hook driver.
What I did was implementing the filter hook driver and writing a userspace application that prepared a filter table on what to allow and what to disallow. When you get around your initial set of blue screens (see below for my debug tip in kernel mode) the filter mode driver is quite easy to use ... it gives each packet to a function you wrote and depending on the return code drops it or lets it pass.
Unfortunatley packets at that level are QUITE raw, fragments are not reassembled and it looks more like the "network card" end of things (but no ethernet headers anymore). So you'll have quite a bad time decoding the packets to filter with that solution.
There also is the firewall hook driver, as discussed in this codeproject article.
If you are on Vista or Server 2008 you'd better have a look at WFP (Windows Filtering Platform) instead, that seems to be the mandated API of the day for writing firewalls.
I don't know about it other than google turing it up some minutes ago when I googled for the filter hook driver.
Update: Forgot the debug tip:
Sysinternals DbgView shows kernel-mode DbgPrint output, and more important - it can also read them from the dump file your last blue screen produced. So sprinkle your code with dbgprint and if it bluescreens just load the dump into dbgview to see what happened before it died ... VERY useful. Using this I managed without having a kernel debugger.
I'm pretty sure you'd need to write a filter driver. http://en.wikipedia.org/wiki/Filter_driver I don't know much more than that :). It would definitely be a C/C++ Win32 app and you'd likely being doing some kernel side work. Start by downloading the DDK and finding some of the sample filter drivers.
If you just want to monitor what goes in and out of IIS, consider an ISAPI filter. Still C/C++ in Win32, but relatively easier than writing a device driver.
C# code to do this is here
I actually did this, several years ago. I'm hazy on the details at this point, but I had to develop a filter/pass-thru/intermediate driver using the Windows DDK. I got a lot of good information from pcausa. Here's a url which points to their product that does this: http://www.pcausa.com/pcasim/Default.htm
If you're doing this for practical reasons, and not just for fun, then you should take a look at Microsoft Network Monitor. The home page talks about the version 3.3 beta, but you can download version 3.2 from the Downloads page. There is also an SDK for NM, and the ability to write parsers for your own network protocols.
There's a question you need to ask which you don't know you need to ask; do you want to know which applications sockets belong to? or are you happy to be restricted to the IP:port quad for a connection?
If you want to know applications, you need to write a TDI filter driver, but that makes handling the receive almost impossible, since you can't block on the receive path.
If you're happy with IP:port, go in at the NDIS level, and I believe you can block on receive to your hearts content.
A word of warning; if you have no prior kernel experience, writing either of these drivers (although TDI is significantly harder) will take about two years, full time.
this:
TdiFw is a simple TDI-Based Open Source Personal Firewall for Windows NT4/2000/XP/2003
http://tdifw.sourceforge.net/
may help you

A Good, Free screen sharing program for pair programming?

I am looking for a good, free (preferred) screen sharing program that works well for pair programming and code review sessions for Windows (Vista x64, Server 2008). It should allow either person take control of the screen and be fairly responsive for text editing over decent broadband connections. Additional features like the ability to draw/mark/annotate the other persons screen would be nice.
Edit: This will be used by developers in remote locations.
TeamViewer from http://www.teamviewer.com/ works very well. We use it for pair programming between London and Ukraine.
Notes:
We use Skype for voice.
TeamViewer uses extremely low bandwidth - 4kbyte/sec on average for programming in Visual Studio 2008 # 1024x768 resolution.
Can swap roles from hotseat to viewer with a button.
The remote view of the screen can be resized to fit in a smaller area with no loss in usability.
Windows Shared View works for me. It allows you to only share certain windows and even shows where your "attendees" mouse is. It would be best to use that in connection with some sort of voip connection so that you don't have to type questions/responses back and forth.
I have checked some hours now for a good one.
Best and the simplest thing i have found.
http://www.screenleap.com/
Free, no strings found so far.
No need to waste time installing or registering anything.
Works perfect with "share are only" if you have multimontor setup.
Most other software shares full screen default, and you cannot choose which monitor you share.
You need to be aware that it does not encrypt data. Check FAQ.
But if you have to run voice over Skype/Mymble/Whatever separate anyway..
What harm can a hacker do by simply getting 50% of the conference ?
Pff.. Oh you wished for screen sharing.. this one does not have it.
So try: http://www.mingleview.com/
It has that multimonitor "bug" and you need to install a simple pluginlike thing.
But "take control" is there and it's very simple also.
Most other software has bundled unneccesary functions like calendaring, document system, filesharing which i already have solutions for.
It's like developing games on excel macros..
unneccesary.. developers please learn that already !
I haven't actually tried it yet, but it looks promising. Check out DimDim. They have a free web service and a VMWare image on Sourceforge.
If you're using eclipse, you might wanna try ECF. There's a video presentation available here.
Try Mikogo at www.mikogo.com
very easy to setup. no problems with Firewalls etc etc
And my final suggestion, but this is not one I've tried. Go to Crossloop
On OSX, I've used vim and a multi-user GNU screen session - this gives much better responsiveness than VNC, screen-sharing, etc. I guess you could use these with Cygwin?
I like to use Screen Hero, which allows both users to use the mouse on the shared screen: http://screenhero.com/
or Zoom: http://zoom.us/
For a poor-man's solution, you can use the free edition of RealVNC. On the server, un-check all of these boxes:
(source: realvnc.com)
Would a VNC client not do the trick, combined with a one of those screen overlay apps people use for presentations (screenpen rings a bell)?
Another option is to use VNC, but use reverse connections. Have a look at this I use this in conjunction with No-IP to get a fixed address.
Do you need this to be remote?
You could just have two monitors set to mirror and 2 USB keyboards/mice
If it is remote then VNC is the way to go, I would use UltraVNC if you are looking for a free version, it has more features (chat, file transfer) than the free version of VNC - it also has a video driver hook that means it suffers less from any weird screen issues than regualr VNC.
If firewalls are a problem you can simply set up a VPN (which is probably a good idea anyway - although ultra can do encryption).
How about any of the services like Joel's https://www.copilot.com/?
Have you looked at the collaboration module that comes with netbeans? Its very useful for pair programming!
For multi-platform simplicity, I would suggest
https://join.me/ for screen share (you can even view a remote
screen using iOS!)
getting a phone headset, and using the phone for audio.

Free Network Monitor

I am having trouble integrating two products, one of which is mine and they appear not to be talking. So I want to make sure they are communicating correctly. I had a look around for network monitor and found TCP Spy. This works but only shows 1 side of the conversation at a time (it has to run locally) I would ideally like to see both sides at the same time - but you can't run two copies of TCP Spy.
I've hit Sourceforge, but nothing seems to jump out - I'm a Windows developer, I don't have perl installed.
I've found a couple of others which are cripple-ware and totally useless, so I was wondering what do the SO guys use for watching the TCP conversation?
BTW - the 'not-written-here' product is not a browser.
Wireshark is a really good and mature network sniffer. It's been around for years.
Deep inspection of hundreds of protocols, with more being added all the time
Live capture and offline analysis
Decryption support for many protocols, including IPsec, ISAKMP, Kerberos, SNMPv3, SSL/TLS, WEP, and WPA/WPA2
Coloring rules can be applied to the packet list for quick, intuitive analysis
Output can be exported to XML, PostScript®, CSV, or plain text
I'm not sure if it does everything you want, but have you seen WireShark and the Microsoft Network Monitor?
Wireshark (previously Ethereal)
Wireshark is an award-winning network protocol analyzer developed by an international team of networking experts.
I use wireshark. Very good and free.
Wireshark, aka Ethereal comes with a fair amount of TCP sniffing functionality.
http://www.wireshark.org/
With respect to using Windows and lacking Perl: Why not try Strawberry Perl? It's a free Perl distribution that's run by the Perl community (specifically Adam Kennedy at the core), is easy to install, and wields the full power of CPAN out of the box.
Strange that I did not see WireShark when I visited SourceForge. The top result of the 60 returned was a bizarre german thing.
Wireshark is great.. but another option would be via PowerShell. I've used the Get-Packet script from Jeff Hicks at Sapien Technologies as a really lightweight packet sniffer. You get custom objects representing your packets and can do whatever filtering you need to via PowerShell. The other script in the pair is Analyze-Packet, which can summarize the results of a packet capture.
I tried Wireshark and Microsoft Network Monitor, but neither detected my (and the program I am trying to communicate with) transfer. If I had a day to sit and configure it I probably could get it working but I just wanted the bytes sent and, more specifically, bytes received.
In the end I found HHD Software's Accurate Network Monitor software which did what I wanted it to, even if it was slight clunky.
Take a look at Tcpdump It is not a full fledged GUI network analyzer (not at all) but it is usable in scripts. Since I am more a Linux person, I use it with Bash and Python, but you should be able to call it from powershell.

Resources