Wednesday, August 27, 2014

Using nc and ncat with tor without torify/torsocks

If you have a little headache using torify/torsocks inside of a script with nc and ncat,  you have some interesting parameters to use and they are very very easy.

For example, when you have a tor socks proxy in localhost, using netcat (nc), it would be  similar to:
nc -v -X5 -x localhost:9050 <server> <port>

and for ncat:

ncat -v --proxy localhost:9050 --proxy-type socks5 <server> <port>

Of course, you can use any proxy. It is very useful for scripting ;)

Tuesday, August 5, 2014

iperf as a daemon to test the bandwidth (in RHEL6)

Update: Check the Jason's comments to discover new updates for iperf v3.

Do you need to check the connectivity between your server and your customers? Do you have different customers with different OS? Take a look to iperf.


Iperf features

  • TCP
    • Measure bandwidth
    • Report MSS/MTU size and observed read sizes.
    • Support for TCP window size via socket buffers.
    • Multi-threaded if pthreads or Win32 threads are available. Client and server can have multiple simultaneous connections.
  • UDP
    • Client can create UDP streams of specified bandwidth.
    • Measure packet loss
    • Measure delay jitter
    • Multicast capable
    • Multi-threaded if pthreads are available. Client and server can have multiple simultaneous connections. (This doesn't work in Windows.)
  • Where appropriate, options can be specified with K (kilo-) and M (mega-) suffices. So 128K instead of 131072 bytes.
  • Can run for specified time, rather than a set amount of data to transfer.
  • Picks the best units for the size of data being reported.
  • Server handles multiple connections, rather than quitting after a single test.
  • Print periodic, intermediate bandwidth, jitter, and loss reports at specified intervals.
  • Run the server as a daemon.
  • Run the server as a Windows NT Service
  • Use representative streams to test out how link layer compression affects your achievable bandwidth.

There are pre-compiled binaries for a lot of platforms.

Perhaps you want to leave a daemon running in your server. Great!.
RHEL6 Installation:

  • EPEL repository installed.
  • yum install iperf
  • Open a port in your firewall.
  • Save this init script in /etc/init.d:

  • chmod 755 /etc/init.d/iperfd
  • chkconfig add iperfd 
  • chkconfig --on iperfd
  • And you don't forget to change the port variable in the script ;)