Wednesday, January 31, 2007

Netcat

2 comments :

Taken from : http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/


One of the Linux command line tools I had initially under-estimated is netcat or just nc. By default, netcat creates a TCP socket either in listening mode (server socket) or a socket that is used in order to connect to a server (client mode). Actually, netcat does not care whether the socket is meant to be a server or a client. All it does is to take the data from stdin and transfer it to the other end across the network.

The simplest example of its usage is to create a server-client chat system. Although this is a very primitive way to chat, it shows how netcat works. In the following examples it is assumed that the machine that creates the listening socket (server) has the 192.168.0.1 IP address. So, create the chat server on this machine and set it to listen to 3333 TCP port:

$ nc -l 3333

On the other end, connect to the server with the following:

$ nc 192.168.0.1 3333

In this case, the keyboard acts as the stdin. Anything you type in the server machine’s terminal is transfered to the client machine and vice-versa.

Transfering Files

In the very same way it can be used to transfer files between two computers. You can create a server that serves the file with the following:

$ cat backup.iso | nc -l 3333

Receive backup.iso on the client machine with the following:

$ nc 192.168.0.1 3333 > backup.iso

As you may have noticed, netcat does not show any info about the progress of the data transfer. This is inconvenient when dealing with large files. In such cases, a pipe-monitoring utility like pv can be used to show a progress indicator. For example, the following shows the total amount of data that has been transfered in real-time on the server side:

$ cat backup.iso | pv -b | nc -l 3333

Of course, the same can be implemented on the client side by piping netcat’s output through pv:

$ nc 192.168.0.1 3333 | pv -b > backup.iso
Other Examples

Netcat is extremely useful for creating a partition image and sending it to a remote machine on-the-fly:

$ dd if=/dev/hdb5 | gzip -9 | nc -l 3333

On the remote machine, connect to the server and receive the partition image with the following command:

$ nc 192.168.0.1 3333 | pv -b > myhdb5partition.img.gz

Another useful thing is to compress the critical files on the server machine with tar and have them pulled by a remote machine:

$ tar -czf - /etc/ | nc -l 3333

As you can see, there is a dash in the tar options instead of a filename. This is because tar’s output needs to be passed to netcat.

On the remote machine, the backup is pulled in the same way as before:

$ nc 192.168.0.1 3333 | pv -b > mybackup.tar.gz

Security

It is obvious that using netcat in the way described above, the data travels in the clear across the network. This is acceptable in case of a local network, but, in case of transfers across the internet, then it would be a wise choice to do it through an SSH tunnel.

Using an SSH tunnel has two advantages:

  1. The data is transfered inside an encrypted tunnel, so it is well-protected.
  2. You do not need to keep any open ports in the firewall configuration of the machine that will act as the server, as the connections will take place through SSH.

You pipe the file to a listening socket on the server machine in the same way as before. It is assumed that an SSH server runs on this machine too.

$ cat backup.iso | nc -l 3333

On the client machine connect to the listening socket through an SSH tunnel:

$ ssh -f -L 23333:127.0.0.1:3333 me@192.168.0.1 sleep 10; \
nc 127.0.0.1 23333 | pv -b > backup.iso

This way of creating and using the SSH tunnel has the advantage that the tunnel is automagically closed after file transfer finishes. For more information and explanation about it please read my article about auto-closing SSH tunnels.

Telnet-like Usage

Netcat can be used in order to talk to servers like telnet does. For example, in order to get the definition of the word “server” from the “WordNet” database at the dict.org dictionary server, I’d do:

$ nc dict.org 2628
220 ..............some WELCOME.....
DEFINE wn server
150 1 definitions retrieved
151 "server" wn "WordNet (r) 2.0"
server
n 1: a person whose occupation is to serve at table (as in a
restaurant) [syn: {waiter}]
2: (court games) the player who serves to start a point
3: (computer science) a computer that provides client stations
with access to files and printers as shared resources to a
computer network [syn: {host}]
4: utensil used in serving food or drink
.
250 ok [d/m/c = 1/0/18; 0.000r 0.000u 0.000s]
QUIT
221 bye [d/m/c = 0/0/0; 16.000r 0.000u 0.000s]

Works as a Port Scanner too

A useful command line flag is -z. When it is used, netcat does not initiate a connection to the server, but just informs about the open port it has found. Also, instead of a single port, it can accept a port-range to scan. For example:

$ nc -z 192.168.0.1 80-90
Connection to 192.168.0.1 80 port [tcp/http] succeeded!

In this example, netcat scanned the 80-90 range of ports and reported that port 80 is open on the remote machine.

The man page contains some more interesting examples, so take the time to read it.

Notes

All the above examples have been performed on Fedora 5/6. Netcat syntax may vary slightly among Linux distributions, so read the man page carefully.

Netcat provides a primitive way to transfer data between two networked computers. I wouldn’t say it’s an absolutely necessary tool in the everyday use, but there are times that this primitive functionality is very useful.

Read More

Tuesday, January 30, 2007

How do I configure my free Yahoo Mail account to Outlook

No comments :

Taken somewhere from net.

This article explains how to configure your free Yahoo email account to Outlook

Yahoo! had revoked the facility of viewing free Yahoo! Mail account emails through email clients (Outlook/Outlook Express/Mozilla etc) in April 2002. It is now offering the facility only to subscribers of its premium account i.e., Yahoo! Mail Plus.

So,if you have a Yahoo! premium account i.e., Yahoo! Mail Plus subscription, then click here for setup instructions.

There is a solution that you still can use Outlook Express to view and reply your emails through Yahoo! Mail.

It is very simple!

First, you need to download and install a software called YPOPs!. This free software provides easy to use and secure access to your Yahoo! Mail account in any email client.

  • To Download and Install YPOPs!, click here. (Make sure this software is running before you start Outlook. Note:It should be started before you start Outlook all the time)

Open Outlook


Click on Tools > E-mail Accounts.


  1. In the Email Accounts window, select the button Add a new e-mail account.
  2. Click Next.



  3. Select POP3 and click Next.
    1. User Information:
      • Type your name (This name would show up to others when they receive your email)
      • E-mail address should be your yahoo email address. Type your existing Yahoo ID including "@yahoo.com"
    2. Logon Information:
      • Type just the the yahoo ID (for ex:- if your yahoo ID is "example@yahoo.com", you need to type "example" as your user ID)
      • Password is your Yahoo! Mail password. (Ensure you are entering the correct password)
    3. Server Information:
      • Type "localhost" for both Incoming (POP3) and Outgoing mail (SMTP) servers.
  4. Click More Settings.


  5. Click on Outgoing Server tab, check My outgoing server (SMTP) requires authentication.

    Select Use same settings as my incoming mail server.


  6. Click OK.
  7. Click Next.
  8. Click Finish.
You should now be able to access your free Yahoo! Mail account.
copyright © 2006, ZOLVED
Read More

Monday, January 29, 2007

copying DVD movies to ipod

No comments :

Taken from http://howto.diveintomark.org/ipod-dvd-ripping-guide/

HOWTO Rip DVD Movies To Your iPod Using Free Software


Last updated: Tuesday, October 25, 2005



  1. Download Handbrake.



  2. Insert a DVD of your choice. If DVD Player opens, quit it.



  3. Run Handbrake. Select Detected volume, as shown in Figure 1.



    [Handbrake source selection dialog]


    Figure 1. Selecting the video source in Handbrake




  4. Click Open. Handbrake will detect all the titles on the DVD.
    If you’re ripping a movie, just select the longest title in the list.
    If you’re ripping a TV show or something with multiple episodes on one
    disc, then select the episode you want, as shown in Figure 2.



    [Handbrake title selection menu]


    Figure 2. Selecting a title




  5. In the Destination section, set File Format to MP4 file, as shown in Figure 3.



    [Handbrake file format menu]


    Figure 3. Selecting the proper file format




  6. Set Codecs to MPEG-4 Video / AAC Audio, as shown in Figure 4.



    [Handbrake codecs selection menu]


    Figure 4. Selecting the proper codec



    Note: A previous version of this
    guide suggested using the “AVC/H.264 Video” codec, but that does not
    work because the video iPod can not play the H.264 files that Handbrake
    produces. I have first-hand reports that the MPEG-4 Video codec works correctly. As an added bonus, MPEG-4 encoding is much faster.



  7. For File, enter the full pathname where you want to save your movie, as shown in Figure 5.



    [Handbrake output filename box]


    Figure 5. Setting the output filename




  8. In the Video section, set Quality to Average bitrate and enter 400. This can be as high as 768, but unless you squint you probably won’t see much difference. Higher bitrate = higher quality video = larger file size.



    [Handbrake video quality box]


    Figure 6. Setting the video quality




  9. Optional - Under Quality, select 2-pass encoding,
    as shown in Figure 7. This takes twice as long to encode, but it
    improves the video quality and doesn’t make the file any larger.



    [Handbrake 2-pass encoding setting]


    Figure 7. Enabling 2-pass encoding




  10. In the Audio section, for Language 1, select the audio track in your preferred language, as shown in Figure 8. Given the choice between MPEG and LPCM, choose MPEG.



    [Handbrake audio language menu]


    Figure 8. Setting the primary language




  11. The Sample rate is entirely up to you. Higher sample rate =
    higher quality audio = larger file size. The video iPod is compatible
    with any of the sample rates supported by Handbrake.



    [Handbrake sample rate menu]


    Figure 9. Setting the audio sample rate




  12. For Bitrate, you can keep the default of 128, or select a rate up to 160. Higher rate = higher audio quality = larger file size.



    [Handbrake bitrate menu]


    Figure 10. Setting the audio bitrate




  13. Click Picture Settings. In the Picture Settings dialog, decrease Width until either it reads 320. Handbrake will auto-adjust the height to match. For a full-screen movie, the height will end up at 240; for wide-screen movies, it will be lower.



    [Handbrake resize picture settings]


    Figure 11. Resizing the movie




  14. Close the Picture Settings dialog and click Rip. Encoding time depends on the speed of your Mac, the length of the movie, and whether you selected 2-pass encoding. Handbrake will display a progress bar, as shown in Figure 12.



    [Handbrake progress bar]


    Figure 12. Encoding progress



    When encoding is finished, quit Handbrake.



  15. Run iTunes. Find the .mp4 file that Handbrake created and drag it into your iTunes library, or select Add to Library… from the File menu and select the encoded movie.




--------------------------------------------------------------------------------------------------





powered by performancing firefox

Read More