Jinzora is a web based media streaming and management system, written in PHP.
Streaming your media with Jinzora gives you quick and easy access to
your online music and video collection from any device with a web
browser.
Enjoy your media from your PC, notebook, PDA, Smart Phone, Xbox, PS3 or Wii.
Use
Jinzora in Jukebox Mode to control a hardware device like your stereo
set or Squeezebox and third-party software, including MPD, VLC and
Shoutcast.
Pre-installation
Before you can install Jinzora, you must set up a LAMP server first.
#yum install mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
#service httpd start
#service mysqld start
#mysql_secure_installation (set up root password)
#wget http://downloads.sourceforge.net/jinzora/jz280.tar.gz
#tar zxvf jinzora-3.0.tar.gz
#cd jinzora-3.0
#mv * /var/www/html/jinzora
#cd /var/www/html/jinzora
#sh config.sh
You are now in setup mode.
Please direct your web browser to the directory where you installed Jinzora
and load index.php - you will then be taken through the complete setup
http://yourdomain.com/
:)
Red Hat, Fedora, Gnome, KDE, MySQL, PostgreSQL, PostGIS, Slony, Zarafa, Scalix, SugarCRM, vtiger, CITADEL,OpenOffice, LibreOffice,Wine, Apache, hadoop, Nginx Drupla, Joomla, Jboss, Wordpress, WebGUI, Tomcat, TiKi WiKi, Wikimedia, SpamAssassin, ClamAV, OpenLDAP, OTRS, RT, Samba, Cyrus, Dovecot, Exim, Postfix, sendmail, Amanda, Bacula, DRBD, Heartbeat, Keepalived, Nagios, Zabbix, Zenoss,
Tuesday, October 19, 2010
Monday, October 18, 2010
vi and vim commands
Command mode ESC dd delete u undelete y yank (copy to buffer) p/P p before cursor/P after cursor Ctl-g show current line number shft-G end of file n shft-G move to line n /stuff/ search n repeat in same direction N repeat in opposite direction /return repeat seach forward ?return repeat seach backward "dyy Yank current line to buffer d "a7yy Yank next 7 lines to buffer a or :1,7ya a Yank [ya] lines 1,7 to buffer a :1,7ya b Yank [ya] lines 1,7 to buffer b :5 pu b Put [pu] buffer b after line 5 "dP Put the content of buffer d before cursor "ap Put the contents of buffer a after cursor :1,4 w! file2 Write lines 1,4 to file2 :1,3 :set nu Display line numbers :set nonum Turns off display :set ic Ignore Case :eEdit a file in a new buffer :g/ /p Print matching regular expression vim :split :split :sp :split new ctl-w To move between windows ctl-w+ ctl-w- To change size ctl+wv Split windows vertically ctl-wq Close window :only To view only 1 window vim dictionary - put the following command in ~/.vimrc set dictionary+=/usr/share/dict/words set thesaurus+=/usr/share/dict/words Now, after you type a word and to go back in the listing butter Scripting - you can script vi commands using ex. For example suppose you want to replace all occurrences of "one" with "two", then exit the file if there are changes. You would put the following in a file call script Contents of script %s/one/two/g|x If you want to run this on all files with the patten "example*" for i in $(ls example*); do ex - $i
What Network Services are Running
$ netstat -tanup or if you just want tcp services $ netstat -tanp or $ netstat -ap|grep LISTEN|less This can be helpful to determine the services running. Need stats on dropped UDP packets? $ netstat -s -u or TCP $ netstat -s -t or summary of everything $ netstat -s or looking for error rates on the interface? $ netstat -i Listening interfaces? $ netstat -l
awk - common awk commands.
Find device names "sd" or with major number 4 and device name "tty". Print the record number NR, plus the major number and minor number. $ awk '$2 == "sd"||$1 == 4 && $2 == "tty" { print NR,$1,$2}' /proc/devices Find device name equal to "sound". $ awk '/sound/{print NR,$1,$2}' /proc/devices Print the 5th record, first field, in file test $ awk 'NR==5{print $1}' test Print a record, skip 4 records, print a record etc from file1 $ awk '(NR-1) % 4 == 0 {print $1}' file1 Print all records except the last one from file1 $ tac file1|awk 'NR > 1 {print $0}'|tac Print A,B,C ..Z on each line, cycling back to A if greater than 26 lines $ awk '{ print substr("ABCDEFGHIJKLMNOPQRSTUVWXYZ",(NR-1)%26+1,1),$0}' file1 Number of bytes in a directory. $ ls -l|awk 'BEGIN{ c=0}{ c+=$5} END{ print c}' Remove duplicate, nonconsecutive line. As an advantage over "sort|uniq" you can eliminate duplicate lines in an unsorted file. $ awk '! a[$0]++' file1 Or the more efficient script $ awk '!($0 in a) {a[$0];print}' file1 Print only the lines in file1 that have 80 characters or more $ awk 'length < 80' file1 Print line number 25 on an extremely large file -- note it has to be efficient and exit after printing line number 25. $ awk 'NR==25 {print; exit}' verybigfile
Using the "find" Command.
List only directories, max 2 nodes down that have "net" in the name $ find /proc -type d -maxdepth 2 -iname '*net*' Find all *.c and *.h files starting from the current "." position. $ find . \( -iname '*.c' -o -iname '*.h' \) -print Find all, but skip what's in "/CVS" and "/junk". Start from "/work" $ find /work \( -iregex '.*/CVS' -o -iregex '.*/junk' \) -prune -o -print Note -regex and -iregex work on the directory as well, which means you must consider the "./" that comes before all listings. Here is another example. Find all files except what is under the CVS, including CVS listings. Also exclude "#" and "~". $ find . -regex '.*' ! \( -regex '.*CVS.*' -o -regex '.*[#|~].*' \) Find a *.c file, then run grep on it looking for "stdio.h" $ find . -iname '*.c' -exec grep -H 'stdio.h' {} \; sample output --> ./prog1.c:#include./test.c:#include Looking for the disk-hog on the whole system? $ find / -size +10000k 2>/dev/null Looking for files changed in the last 24 hours? Make sure you add the minus sign "-1", otherwise, you will only find files changed exactly 24 hours from now. With the "-1" you get files changed from now to 24 hours. $ find . -ctime -1 -printf "%a %f\n" Wed Oct 6 12:51:56 2010 . Wed Oct 6 12:35:16 2010 Linux_and_Open_Source.txt Or if you just want files. $ find . -type f -ctime -1 -printf "%a %f\n" Details on file status change in the last 48 hours, current directory. Also note "-atime -2"). $ find . -ctime -2 -type f -exec ls -l {} \; NOTE: if you don't use -type f, you make get "." returned, which when run through ls "ls ." may list more than what you want. Also you may only want the current directory $ find . -ctime -2 -type f -maxdepth 1 -exec ls -l {} \; To find files modified within the last 5 to 10 minutes $ find . -mmin +5 -mmin -10
Monitor all Network Traffic Except Your Current ssh Connection
$ tcpdump -i eth0 -nN -vvv -xX -s 1500 port not 22 Or to filter out port 123 as well getting the full length of the packet (-s 0), use the following: $ tcpdump -i eth0 -nN -vvv -xX -s 0 port not 22 and port not 123 Or to filter only a certain host say 192.168.158.205 $ tcpdump -i eth0 -nN -vvv -xX port not 22 and host 192.168.158.205 Just want ip addresses and a little bit of data, then, use this. The "-c 20" is to stop after 20 packets. $ tcpdump -i eth0 -nN -s 1500 port not 22 -c 20 If you're looking for sign of DOS attacks, the following show just the SYN packets on all interfaces: $ tcpdump 'tcp[13] & 2 == 2'
Speed up SSH
Try setting up ssh client with compression and
use arcfour/blowfish encryption instead. Also avoid ipv6 lookup and
reuse connections using
socket:
Add below to ~/.ssh/config
socket:
Add below to ~/.ssh/config
Host *
Ciphers arcfour,blowfish-cbc
Compression yes
AddressFamily inet
ControlMaster auto
ControlPath ~/.ssh/socket-%r@%h:%p
Friday, October 15, 2010
Install your own git server on Cent OS / RHEL /Fedora
i386:
Now we want to checkout a copy of the new repository from a different server.
To add a new file to the repo:
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
x86_64:rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
As root run this command:yum install git
Next I’m going to setup a new repository and make it accessible
over ssh:We’ll create a dummy file to get started. If you trying to clone (checkout) an empty git repository, you’ll just get errors:mkdir /home/rajat/repo #create directory for new repository
cd /home/rajat/repo
git init
touch firstfile
Add all files in this directory to your git repository:git add .
Commit the changes you’ve made to the repo:git commit
Next we’ll create a clone of the repo and configure it to
be public:you can copy your repo.git directory to where you want to make the repo publiccd /home/rajat
git clone --bare ./repo repo.git
touch repo.git/git-daemon-export-ok
Now we want to checkout a copy of the new repository from a different server.
git clone ssh://yourserveraddress/home/rajat/repo.git
You should now have a new directory labeled repo which contains the
file ‘firstfile’To add a new file to the repo:
Now we want to submit the changes back to the git server:cd repo
touch secondfile
git add .
git commit
git push
You’ll be prompted for your password.
:)
Linux / UNIX Delete or Remove Files With Inode Number
An inode identifies the file and its attributes such as file size, owner, and so on. A unique inode number within the file system identifies each inode. But, why to delete file by an inode number? Sure, you can use rm command to delete file. Sometime accidentally you creates filename with control characters or characters which are unable to be input on a keyboard or special character such as ?, * ^ etc. Removing such special character filenames can be problem. Use following method to delete a file with strange characters in its name:
Please note that the procedure outlined below works with Solaris, FreeBSD, Linux, or any other Unixish oses out there:
Find out file inode
First find out file inode number with any one of the following command:stat {file-name}
OR
ls -il {file-name}
Use find command to remove file:
Use find command as follows to find and remove a file:find . -inum [inode-number] -exec rm -i {} \;
When prompted for confirmation, press Y to confirm removal of the file.
Delete or remove files with inode number
Let us try to delete file using inode number.(a) Create a hard to delete file name:
$ cd /tmp
$
touch "\+Xy \+\8"
$ ls
(b) Try to remove this file with rm command:
$ rm \+Xy
\+\8
(c) Remove file by an inode number, but first find out the file inode number:
$ ls -il
Output:
981956 drwx------ 3 rajat admin 4096 2010-10-15 15:05 gconfd-viv 981964 drwx------ 2 rajat admin 4096 2010-10-15 15:05 keyring-pKracm 982049 srwxr-xr-x 1 rajat admin 0 2010-10-15 15:05 mapping-viv 981939 drwx------ 2 rajat admin 4096 2010-10-15 15:31 orbit-viv 981922 drwx------ 2 rajat admin 4096 2010-10-15 15:05 ssh-cnaOtj4013 981882 drwx------ 2 rajat admin 4096 2010-10-15 15:05 ssh-SsCkUW4013 982263 -rw-r--r-- 1 rajat admin 0 2010-10-15 15:49 \+Xy \+\8Note: 982263 is inode number.
(d) Use find command to delete file by inode:
Find and remove file using find command, type the command as follows:
$ find
. -inum 982263 -exec rm -i {} \;
Note you can also use add \ character before special character in filename to remove it directly so the command would be:
$ rm
"\+Xy \+\8"
If you have file like name like name "2009/12/31" then no UNIX or Linux command can delete this file by name. Only method to delete such file is delete file by an inode number. Linux or UNIX never allows creating filename like 2009/12/31 but if you are using NFS from MAC OS or Windows then it is possible to create a such file.
Remove Files and Directories with Special Characters
Today is going to be a practical tip. If you're managing many
Unix/Linux systems, sooner or later you come across files with
special characters – they can't be deleted with rm command
using standard approach and require a bit of trickery to be
successfully removed.
With filenames starting with hash (#), you'll get a different kind of error: your Unix shell will treat the rest of a filename (and anything that might follow it) as a comment because hashes are used to do it in shell scripts. That's why your cat command will not show any error but will not finish until you Ctrl+C it:
To make command ignore the leading dash (-) in a filename, use the — command line option:
So, if you start typing:
rajat-linux $ rm \#try
There's a few more tricks you can use for escaping special characters, but they're worth a separate post, so stay tuned! Until then, enjoy getting rid of annoying files with special characters in filenames!
Examples of files with special characters
Any language apart from English will probably have special characters in the alphabet, but for the purpose of today's exercise I'll give you more standard examples: files starting with dash (-) and hash (#) characters:rajat-linux$ ls -al -rw-r--r-- 1 rajat admin 0 Sep 25 05:50 #try -rw-r--r-- 1 rajat admin 0 Sep 25 05:48 -tryNow, if you try to access these files or remove them, you will get errors:
rajat-linux$ cat -try cat: invalid option -- r Try `cat --help' for more information. rajat-linux$ rm -try rm: invalid option -- t Try `rm ./-try' to remove the file `-try'. Try `rm --help' for more information.These errors happen because commands treat file names as command line options because they start with dash (-).
With filenames starting with hash (#), you'll get a different kind of error: your Unix shell will treat the rest of a filename (and anything that might follow it) as a comment because hashes are used to do it in shell scripts. That's why your cat command will not show any error but will not finish until you Ctrl+C it:
rajat-linux$ cat #try… and if you try removing such a file, you'll get a complaint from the rm command about missing command line parameters – because of the hash (#) sign, rm command receives no text as a parameter:
rajat-linux$ rm #try rm: missing operand Try `rm --help' for more information.
How to remove a file when filename starts with dash (-)
First I'm gonna show you how to make your Unix shell interpret any filename directly instead of trying to analyze it as a set of command line options.To make command ignore the leading dash (-) in a filename, use the — command line option:
rajat-linux$ rm -- -tryAs you can see, our file is gone:
rajat-linux$ ls -al -rw-r--r-- 1 rajat admin 0 Sep 25 05:50 #try
Using backslash to escape special characters in a filename
Another option we have is to use a backslash (\), which will make shell interpreter ignore the special functionality of a character which immediately follows it. To escape the hash (#) our second file has, we should therefore do the following:rajat-linux$ rm \#tryInteresting to know: bash shell has an auto-completion functionality built in. When you type a filename, just press Tab key to make it auto-complete the name for you. Speaking of special characters in particular, quite a few of them are recognized by auto-completion and get escaped automatically.
So, if you start typing:
rajat-linux $ rm #t… and then press Tab, bash will not only auto-complete the name, but escape the leading hash (#):
rajat-linux $ rm \#try
There's a few more tricks you can use for escaping special characters, but they're worth a separate post, so stay tuned! Until then, enjoy getting rid of annoying files with special characters in filenames!
Thursday, October 14, 2010
Xoops Installation on Cent OS/Fedora /RedHat with LAMP
What XOOPS stands for
XOOPS is an acronym of eXtensible Object Oriented Portal System. Though started as a portal system, XOOPS is in fact striving steadily on the track of Content Management System. It can serve as a web framework for use by small, medium and large sites.
A lite XOOPS can be used as a personal weblog or journal. For this purpose, you can do a standard install, and use its News module only. For a medium site, you can use modules like News, Forum, Download, Web Links etc to form a community to interact with your members and visitors. For a large site as an enterprise one, you can develop your own modules such as eShop, and use XOOP's uniform user management system to seamlessly integrate your modules with the whole system.
# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#yum install mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc phpmyadmin
#service httpd start
#service mysqld start
#/usr/bin/mysqladmin -u root password 'new-password'
#vi /etc/httpd/conf.d/phpMyAdmin.conf
http://youdomain.com/phpmyadmin
#wget http://sourceforge.net/projects/xoops/files/XOOPS%20Core%20%28stable%20releases%29/XOOPS%202.4.5/xoops-2.4.5.zip/download
#unzip xoops-2.4.5.zip -d /var/www/html/
#chmod 777 /var/www/html/xoops-2.4.5/htdocs/mainfile.php
#chmod 777 /var/www/html/xoops-2.4.5/htdocs/mainfile.dist.php
#chmod 777 /var/www/html/xoops-2.4.5/htdocs/uploads/
#chmod 777 /var/www/html/xoops-2.4.5/htdocs/include/license.php
#chmod 777 var/www/html/xoops-2.4.5/htdocs/xoops_data/caches/smarty_*
open firefox
http://yourdomain.com/xoops-2.4.5/htdocs/install/index.php
XOOPS is an acronym of eXtensible Object Oriented Portal System. Though started as a portal system, XOOPS is in fact striving steadily on the track of Content Management System. It can serve as a web framework for use by small, medium and large sites.
A lite XOOPS can be used as a personal weblog or journal. For this purpose, you can do a standard install, and use its News module only. For a medium site, you can use modules like News, Forum, Download, Web Links etc to form a community to interact with your members and visitors. For a large site as an enterprise one, you can develop your own modules such as eShop, and use XOOP's uniform user management system to seamlessly integrate your modules with the whole system.
# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#yum install mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc phpmyadmin
#service httpd start
#service mysqld start
#/usr/bin/mysqladmin -u root password 'new-password'
#vi /etc/httpd/conf.d/phpMyAdmin.conf
http://youdomain.com/phpmyadmin
#wget http://sourceforge.net/projects/xoops/files/XOOPS%20Core%20%28stable%20releases%29/XOOPS%202.4.5/xoops-2.4.5.zip/download
#unzip xoops-2.4.5.zip -d /var/www/html/
#chmod 777 /var/www/html/xoops-2.4.5/htdocs/mainfile.php
#chmod 777 /var/www/html/xoops-2.4.5/htdocs/mainfile.dist.php
#chmod 777 /var/www/html/xoops-2.4.5/htdocs/uploads/
#chmod 777 /var/www/html/xoops-2.4.5/htdocs/include/license.php
#chmod 777 var/www/html/xoops-2.4.5/htdocs/xoops_data/caches/smarty_*
open firefox
http://yourdomain.com/xoops-2.4.5/htdocs/install/index.php
Wednesday, October 13, 2010
ffmpeg commands
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec – the leading audio/video codec library. FFmpeg is free software and is licensed under the LGPL or GPL depending on your choice of configuration options.
FFmpeg supports most of the popular formats, we don’t need to worry a lot about that. Formats supported by FFmpeg include MPEG, MPEG-4 (Divx), ASF, AVI, Real Audio/Video and Quicktime. To see a list of all the codecs/formats supported by FFmpeg, run the following command:
0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable.
0.0
is display.screen number of your X11 server, same as the DISPLAY
environment variable. 10 is the x-offset and 20 the y-offset for the
grabbing.
Notice that `%d’ is replaced by the image number.
`img%03d.jpg' means the sequence `img001.jpg', `img002.jpg', etc…
If you have large number of pictures to rename, you can use the following command to ease the burden. The command, using the bourne shell syntax, symbolically links all files in the current directory that match
If you want to sequence them by oldest modified first, substitute
Then run:
The same logic is used for any image format that ffmpeg reads.
This
converts any media ffmpeg handles to flash. It would actually convert
anything to anything, it’s based on the file extension. It doesn’t do
ANY quality control, sizing, etc, it just does what it thinks is best.
Convert .flv to .3gp
Download YouTube videos as .flv and convert them to .3gp for your mobile phone.
Convert AVI to iPhone MP4
for 4:3 aspect:
for 16:9:
Create a video that is supported by youtube:
Takes an mpeg video and coverts it to a youtube compatible flv file.
The -r 25 sets the frame rate for PAL, for NTSC use 29.97
Adjust the bitrate (-ab) as necessary. If omitted FFmpeg will use a default of 64 kb/s.
Converting WMV to MP3 using FFMPEG
This will convert audio1.wmv file to audio1.mp3
Converting WMV to FLV using FFMPEG
This will convert audio1.wmv file to audio1.flv, this will generate only audio content
Converting AMR to MP3 using FFMPEG
This will convert audio1.amr file to audio1.mp3 having audio rate 22.05 Khz
Converting aac to mp3 using FFMPEG
This will convert audio1.aac to audio1.mp3 having audio rate 22.05 Khz and Audio BitRate 32Khz
Converting aac to mp3 using FFMPEG with MetaData
This
will convert audio1.aac to audio1.mp3 having audio rate 22.05 Khz and
Audio BitRate 32Khz and will copy the meta data from .aac file to .mp3
file
Dumping Audio stream from flv (using ffmpeg)
To record both audio and video run ffmpeg with arguments such as these:
-vcodec,
you choose what video codec the new file should be encoded with. Run
ffmpeg -formats E to list all available video and audio encoders and
file formats.
copy, you choose the video encoder that just copies the file.
-acodec, you choose what audio codec the new file should be encoded with.
copy, you choose the audio encoder that just copies the file.
-i originalfile, you provide the filename of the original file to ffmpeg
-ss 00:01:30, you choose the starting time on the original file in this case 1 min and 30 seconds into the film
-t 0:0:20, you choose the length of the new film
newfile, you choose the name of the file created.
Hence you may concatenate your multimedia files by first transcoding them to these privileged formats, then using the humble
Merge files
Merge and convert to avi
Notice
that you should either use -sameq or set a reasonably high bitrate for
your intermediate and output files, if you want to preserve video
quality.
Also notice that you may avoid the huge intermediate files by taking advantage of named pipes, should your platform support it:
This assumes that there is a 10.2 sec delay between the video and the audio (delayed).
To extract the original video into a audio and video composites look at the command on extracting audio and video from a movie
Here is more information of how to use ffmpeg:
http://www.ffmpeg.org/ffmpeg-doc.html
ffmpeg is a multiplatform, open-source library for video and audio files. Useful and amazing commands covering almost all needs: video conversion, sound extraction, encoding file for iPod or PSP, and more.
The following image formats are also availables : PGM, PPM, PAM, PGMYUV, JPEG, GIF, PNG, TIFF, SGI.
FFmpeg supports most of the popular formats, we don’t need to worry a lot about that. Formats supported by FFmpeg include MPEG, MPEG-4 (Divx), ASF, AVI, Real Audio/Video and Quicktime. To see a list of all the codecs/formats supported by FFmpeg, run the following command:
ffmpeg -formats
1. X11 grabbing
FFmpeg can grab the X11 display.ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg
ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg
ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg
2. Convert Pictures To Movie
First, rename your pictures to follow a numerical sequence. For example, img1.jpg, img2.jpg, img3.jpg,… Then you may run:ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
`img%03d.jpg' means the sequence `img001.jpg', `img002.jpg', etc…
If you have large number of pictures to rename, you can use the following command to ease the burden. The command, using the bourne shell syntax, symbolically links all files in the current directory that match
*jpg
to the `/tmp' directory in the sequence of `img001.jpg', `img002.jpg' and so on.x=1; for i in *jpg; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done
$(ls -r -t *jpg)
in place of *jpg
.Then run:
ffmpeg -f image2 -i /tmp/img%03d.jpg /tmp/a.mpg
3. Video Conversions
Quick and dirty convert to flvffmpeg -i inputfile.mp4 outputfile.flv
Convert .flv to .3gp
ffmpeg -i file.flv -r 15 -b 128k -s qcif -acodec amr_nb -ar 8000 -ac 1 -ab 13 -f 3gp -y out.3gp
Convert AVI to iPhone MP4
ffmpeg -i [source].avi -f mp4 -vcodec mpeg4 -b 250000 -s 480?320 -acodec aac -ar 24000 -ab 64 -ac 2 [destination].mp4
ffmpeg -i source-xvid.avi -s 480x320 -aspect 4:3 -b 768k -ab 64k -ar 22050 -r 30000/1001 OUT.mp4
ffmpeg -i source-xvid.avi -s 480x320 -aspect 16:9 -b 768k -ab 64k -ar 22050 -r 30000/1001 OUT.mp4
ffmpeg -i mymovie.mpg -ar 22050 -acodec libmp3lame -ab 32K -r 25 -s 320x240 -vcodec flv mytarget.flv
The -r 25 sets the frame rate for PAL, for NTSC use 29.97
4. Audio Conversion
Convert RM file to mp3ffmpeg -i input.rm -acodec libmp3lame -ab 96k output.mp3
Converting WMV to MP3 using FFMPEG
ffmpeg -i audio1.wmv audio1.mp3
Converting WMV to FLV using FFMPEG
ffmpeg -i audio1.wmv audio1.flv
Converting AMR to MP3 using FFMPEG
ffmpeg -i audio1.amr -ar 22050 audio1.mp3
Converting aac to mp3 using FFMPEG
ffmpeg -i audio1.aac -ar 22050 -ab 32 audio1.mp3
Converting aac to mp3 using FFMPEG with MetaData
ffmpeg -i audio1.aac -ar 22050 -ab 32 -map_meta_data audio1.mp3:audio1.aac audio1.mp3
5. Audio Extraction
ffmpeg -i video.avi -f mp3 audio.mp3
ffmpeg -i input.flv -f mp3 -vn -acodec copy ouput.mp3
6. Record Audio and Video from webcam
To record video run ffmpeg with arguments such as these:ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 out.mpg
ffmpeg -f oss -i /dev/dsp -f video4linux2 -s 320x240 -i /dev/video0 out.mpg
7. Copy Only A Part Of Video
Cut out a piece of film from a file. Choose an arbitrary length and starting time.ffmpeg -vcodec copy -acodec copy -i orginalfile -ss 00:01:30 -t 0:0:20 newfile
copy, you choose the video encoder that just copies the file.
-acodec, you choose what audio codec the new file should be encoded with.
copy, you choose the audio encoder that just copies the file.
-i originalfile, you provide the filename of the original file to ffmpeg
-ss 00:01:30, you choose the starting time on the original file in this case 1 min and 30 seconds into the film
-t 0:0:20, you choose the length of the new film
newfile, you choose the name of the file created.
8. Join Multiple Video Files
A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join video files by merely concatenating them.Hence you may concatenate your multimedia files by first transcoding them to these privileged formats, then using the humble
cat
command (or the equally humble copy
under Windows), and finally transcoding back to your format of choice.mkfifo orig1.mpg mkfifo orig2.mpg ffmpeg -i input1.avi -sameq -y orig1.mpg ffmpeg -i input2.avi -sameq -y orig2.mpg
cat orig1.mpg orig2.mpg | ffmpeg -f mpeg -i - -vcodec copy -acodec copy merged.mpg
cat orig1.mpg orig2.mpg | ffmpeg -f mpeg -i - -sameq -vcodec mpeg4 -acodec libmp3lame merged.avi
Also notice that you may avoid the huge intermediate files by taking advantage of named pipes, should your platform support it:
9. Removing Synchronization Problems Between Audio and Video
ffmpeg -i source_audio.mp3 -itsoffset 00:00:10.2 -i source_video.m2v target_video.flv
To extract the original video into a audio and video composites look at the command on extracting audio and video from a movie
Here is more information of how to use ffmpeg:
http://www.ffmpeg.org/ffmpeg-doc.html
ffmpeg is a multiplatform, open-source library for video and audio files. Useful and amazing commands covering almost all needs: video conversion, sound extraction, encoding file for iPod or PSP, and more.
Getting infos from a video file
ffmpeg -i video.avi
Turn X images to a video sequence
ffmpeg -f image2 -i image%d.jpg video.mpgThis command will transform all the images from the current directory (named image1.jpg, image2.jpg, etc…) to a video file named video.mpg.
Turn a video to X images
ffmpeg -i video.mpg image%d.jpgThis command will generate the files named image1.jpg, image2.jpg, …
The following image formats are also availables : PGM, PPM, PAM, PGMYUV, JPEG, GIF, PNG, TIFF, SGI.
Encode a video sequence for the iPpod/iPhone
ffmpeg -i source_video.avi input -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 320x180 -title X final_video.mp4Explanations :
- Source : source_video.avi
- Audio codec : aac
- Audio bitrate : 128kb/s
- Video codec : mpeg4
- Video bitrate : 1200kb/s
- Video size : 320px par 180px
- Generated video : final_video.mp4
Encode video for the PSP
ffmpeg -i source_video.avi -b 300 -s 320x240 -vcodec xvid -ab 32 -ar 24000 -acodec aac final_video.mp4Explanations :
- Source : source_video.avi
- Audio codec : aac
- Audio bitrate : 32kb/s
- Video codec : xvid
- Video bitrate : 1200kb/s
- Video size : 320px par 180px
- Generated video : final_video.mp4
Extracting sound from a video, and save it as Mp3
ffmpeg -i source_video.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.mp3Explanations :
- Source video : source_video.avi
- Audio bitrate : 192kb/s
- output format : mp3
- Generated sound : sound.mp3
Convert a wav file to Mp3
ffmpeg -i son_origine.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 son_final.mp3
Convert .avi video to .mpg
ffmpeg -i video_origine.avi video_finale.mpg
Convert .mpg to .avi
ffmpeg -i video_origine.mpg video_finale.avi
Convert .avi to animated gif(uncompressed)
ffmpeg -i video_origine.avi gif_anime.gif
Mix a video with a sound file
ffmpeg -i son.wav -i video_origine.avi video_finale.mpg
Convert .avi to .flv
ffmpeg -i video_origine.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv video_finale.flv
Convert .avi to dv
ffmpeg -i video_origine.avi -s pal -r pal -aspect 4:3 -ar 48000 -ac 2 video_finale.dvOr:
ffmpeg -i video_origine.avi -target pal-dv video_finale.dv
Convert .avi to mpeg for dvd players
ffmpeg -i source_video.avi -target pal-dvd -ps 2000000000 -aspect 16:9 finale_video.mpegExplanations :
- target pal-dvd : Output format
- ps 2000000000 maximum size for the output file, in bits (here, 2 Gb)
- aspect 16:9 : Widescreen
Compress .avi to divx
ffmpeg -i video_origine.avi -s 320x240 -vcodec msmpeg4v2 video_finale.avi
Compress Ogg Theora to Mpeg dvd
ffmpeg -i film_sortie_cinelerra.ogm -s 720x576 -vcodec mpeg2video -acodec mp3 film_terminée.mpg
Compress .avi to SVCD mpeg2
NTSC format:ffmpeg -i video_origine.avi -target ntsc-svcd video_finale.mpgPAL format:
ffmpeg -i video_origine.avi -target pal-svcd video_finale.mpg
Compress .avi to VCD mpeg2
NTSC format:ffmpeg -i video_origine.avi -target ntsc-vcd video_finale.mpgPAL format:
ffmpeg -i video_origine.avi -target pal-vcd video_finale.mpg
Multi-pass encoding with ffmpeg
ffmpeg -i fichierentree -pass 2 -passlogfile ffmpeg2pass fichiersortie-2
Find a webhost with ffmpeg enabled
Friday, October 8, 2010
Zimbra 6 on CentOS 5 Email and Calendars
Zimbra is a groupware system that provides email, calendaring, integrated antivirus
and spam filtering, and more for multiple domains. Available in several editions, this
guide will help you get the Open Source Edition installed on your CentOS 5
# yum install gmp compat-libstdc++-33 sysstat sudo libidn wget
Before proceeding, make sure your /etc/hosts file has valid entries. For reference, your file should resemble the following:
File: /etc/hosts
64 Bit OS
#wget http://files2.zimbra.com/downloads/6.0.8_GA/zcs-6.0.8_GA_2661.RHEL5_64.20100820052503.tgz
32 Bit OS
# wget http://files2.zimbra.com/downloads/6.0.8_GA/zcs-6.0.8_GA_2661.RHEL5.20100820051652.tgz
#tar -xzf zcs-6.0.8_GA_2661.RHEL5_64.20100820052503.tgz
#cd zcs-6.0.8_GA_2661.RHEL5_64.20100820052503
#./install.sh --platform-override
DNS ERROR resolving MX for archimedes.palegray.net It is suggested that the domain name have an MX record configured in DNS Change domain name? [Yes] No It is recommended (but not required) that the fully qualified domain name for your system (yeswedeal.com) have an MX record pointing to it. You may wish to visit your DNS control panel and add such a record now, or proceed if you won't be receiving mail for your FQDN on this system (for example, if you'll be receiving email for your base domain or others).
The install will continue, probably requiring a few minutes to perform various tasks. You'll be asked which components of the Zimbra package you'd like to install. For the purposes of this tutorial, choose the default values for each ("Y" or "N" depending on which letter is in the brackets).
Once the installation has completed, you'll be presented with an admin menu next.
After installation has completed, you'll need to start zimbra with the following command:
#service zimbra start
To have Zimbra start on every boot, enter the following command:
#chkconfig zimbra on
you may wish to reboot your Linode to make sure everything comes back up properly. After doing so, visit the Zimbra admin URL in your browser. It will be in the form https://yeswedeal.com:7071/. You'll need to accept the SSL certificate presented to access the admin panel, which you may then use to continue configuring your new Zimbra server. Enjoy!
# yum install gmp compat-libstdc++-33 sysstat sudo libidn wget
Before proceeding, make sure your /etc/hosts file has valid entries. For reference, your file should resemble the following:
File: /etc/hosts
127.0.0.1 localhost.localdomain localhost 10.30.56.8 mail.yeswedeal.com mail
64 Bit OS
#wget http://files2.zimbra.com/downloads/6.0.8_GA/zcs-6.0.8_GA_2661.RHEL5_64.20100820052503.tgz
32 Bit OS
# wget http://files2.zimbra.com/downloads/6.0.8_GA/zcs-6.0.8_GA_2661.RHEL5.20100820051652.tgz
#tar -xzf zcs-6.0.8_GA_2661.RHEL5_64.20100820052503.tgz
#cd zcs-6.0.8_GA_2661.RHEL5_64.20100820052503
#./install.sh --platform-override
You appear to be installing packages on a platform different than the platform for which they were built. This platform is CentOS5 Packages found: RHEL5 This may or may not work. Using packages for a platform in which they were not designed for may result in an installation that is NOT usable. Your support options may be limited if you choose to continue. Install anyway? [N] Y
You may receive a warning similar to the one shown below. Enter "Y" to proceed.
Before the install begins, you may receive a warning similar to the one shown below:
DNS ERROR resolving MX for archimedes.palegray.net It is suggested that the domain name have an MX record configured in DNS Change domain name? [Yes] No It is recommended (but not required) that the fully qualified domain name for your system (yeswedeal.com) have an MX record pointing to it. You may wish to visit your DNS control panel and add such a record now, or proceed if you won't be receiving mail for your FQDN on this system (for example, if you'll be receiving email for your base domain or others).
The install will continue, probably requiring a few minutes to perform various tasks. You'll be asked which components of the Zimbra package you'd like to install. For the purposes of this tutorial, choose the default values for each ("Y" or "N" depending on which letter is in the brackets).
Once the installation has completed, you'll be presented with an admin menu next.
Main menu 1) Common Configuration: 2) zimbra-ldap: Enabled 3) zimbra-store: Enabled +Create Admin User: yes +Admin user to create: admin@yeswedeal.com
******* +Admin Password UNSET +Enable automated spam training: yes +Spam training user: spam.abc@yeswedeal.com
+Non-spam(Ham) training user: ham.abcd@yeswedeal.com
+Global Documents Account: wiki@yeswedeal.com +SMTP host: yeswedeal.com
+Web server HTTP port: 80 +Web server HTTPS port: 443 +Web server mode: http +IMAP server port: 143 +IMAP server SSL port: 993 +POP server port: 110 +POP server SSL port: 995 +Use spell check server: yes +Spell server URL: http://yeswedeal.com:7780/aspell.php +Configure for use with mail proxy: FALSE +Configure for use with web proxy: FALSE 4) zimbra-mta: Enabled 5) zimbra-snmp: Enabled 6) zimbra-logger: Enabled 7) zimbra-spell: Enabled 8) Default Class of Service Configuration: r) Start servers after configuration yes s) Save config to file x) Expand menu q) Quit Address unconfigured (**) items (? - help) 3
Store configuration 1) Status: Enabled 2) Create Admin User: yes 3) Admin user to create: admin@yeswedeal.com
** 4) Admin Password UNSET 5) Enable automated spam training: yes 6) Spam training user: spam.abc@yeswedeal.com
7) Non-spam(Ham) training user: ham.abcd@yeswedeal.com
8) Global Documents Account: wiki@yeswedeal.com
9) SMTP host: yeswedeal.com 10) Web server HTTP port: 80 11) Web server HTTPS port: 443 12) Web server mode: http 13) IMAP server port: 143 14) IMAP server SSL port: 993 15) POP server port: 110 16) POP server SSL port: 995 17) Use spell check server: yes 18) Spell server URL: http://yeswedeal.com:7780/aspell.php 19) Configure for use with mail proxy: FALSE 20) Configure for use with web proxy: FALSE Select, or 'r' for previous menu [r] 4
You can configure various options here; but, the most important option is the one for setting the administrator password. Enter "4" to set it, choosing a strong password comprised of letters, numbers, and non-alphanumeric characters. After setting the admin password, enter "r" to return to the main menu. You will be asked to apply the new configuration. Type "a" and press enter. You may then allow the program to proceed with the remaining installation steps.
After installation has completed, you'll need to start zimbra with the following command:
#service zimbra start
To have Zimbra start on every boot, enter the following command:
#chkconfig zimbra on
you may wish to reboot your Linode to make sure everything comes back up properly. After doing so, visit the Zimbra admin URL in your browser. It will be in the form https://yeswedeal.com:7071/. You'll need to accept the SSL certificate presented to access the admin panel, which you may then use to continue configuring your new Zimbra server. Enjoy!
Monitor System Logs with Logwatch on Cent OS /RedHat /Fedora /Ubuntu
Logwatch is a utility used to monitor system logs and create reports. These
reports include failed login attempts, successful login attempts, and storage
space used/available.
For Fedora/CentOS/RedHat
#yum install logwatch
For Ubuntu
$sudo apt-get install logwatch
File: /usr/share/logwatch/default.conf/logwatch.conf
These directives tell Logwatch to email you reports in an HTML format.
The MailTo and MailFrom directives should be valid email addresses.
Issue the following command to test your logwatch installation:
For Fedora/CentOS/RedHat
#yum install logwatch
For Ubuntu
$sudo apt-get install logwatch
Configure Logwatch
Once you have installed Logwatch, you will need to configure it to email you the reports it generates. You are encouraged to look through the entire configuration, but you may safely use Logwatch after editing the lines below.File: /usr/share/logwatch/default.conf/logwatch.conf
Output = mail
Format = html
MailTo = rajat@yeswedeal.com
MailFrom = logwatch@yeswedeal.com
Issue the following command to test your logwatch installation:
logwatchOnce you have issued this command, you will need to check your email to make sure that logwatch is working. Be sure to check your spam folder as these emails may be seen as spam.
Adding a Cron Job for Logwatch
You can add a cron job for Logwatch in order to receive daily emails of new reports. You can add a new entry to your crontab by running crontab -e. The following example cron job runs Logwatch at 1 AM each day, issuing you an email report of the daily activity:# m h dom mon dow command 0 1 * * * /usr/sbin/logwatchCongratulations! You can now monitor system logs with Logwatch!
Thursday, October 7, 2010
Biggest installed packages in Fedora
Quick tip to see which are the biggest currently installed packages on your Fedora box:
You might also be interested in fslint:
It lists packages by size, and it will autoselect dependencies for packages you want to delete
rpm -qa --queryformat '%10{size}-%{name}-%{version}\n' | sort -k1,1n
You might also be interested in fslint:
yum install fslint
It lists packages by size, and it will autoselect dependencies for packages you want to delete
Linux Files and File Permission
- Character 1 is the type of file: - is ordinary, d is directory, l is link.
- Characters 2-4 show owner permissions. Character 2 indicates read permission, character 3 indicates write permission, and character 4 indicates execute permission.
- Characters 5-7 show group permissions. Character 5=read, 6=write, 7=execute
- Characters 8-10 show permissions for all other users.
Character 8=read, 9=write, 10=execute
- r = read - This is only found in the read field.
- w = write - This is only found in the write field.
- x = execute - This is only found in the execute field.
- s = setuid - This is only found in the execute field.
- If there is a "-" in a particular location, there
is no permission. This may be found in any field whether read,
write, or execute field.
Examples
Type "ls -l" and a listing like the following is displayed:total 10 | ||||||
drwxrwxrwx | 4 | rajat | team | 122 | Dec 12 18:02 | Projects |
-rw-rw-rw- | 1 | rajat | team | 1873 | Aug 23 08:34 | test |
-rw-rw-rw- | 1 | rajat | team | 1234 | Sep 12 11:13 | datafile |
Type and
|
# of | Files's | File's | Size in | Date of last | Filename |
Permission field
|
Links
|
Owner
|
Group
|
Bytes
|
modification
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drwxrwxrwx
|
4
|
rajat
|
team
|
122
|
Dec 12 18:02
|
Projects
|
- Type field: The first character in the field indicates a file type of one of the following:
- d = directory
- l = symbolic link
- s = socket
- p = named pipe
- - = regular file
- c= character (unbuffered) device file special
- b=block (buffered) device file special
- Permissions are explained above.
- Links: The number of directory entries that refer to the file. In our example, there are four.
- The file's owner in our example is rajat.
- The group the file belongs to. In our example, the group is team.
- The size of the file in bytes
- The last modification date. If the file is recent, the date and time is shown. If the file is not in the current year, the year is shown rather than time.
- The name of the file.
Set User Identification Attribute
The file permissions bits include an execute permission bit for file owner, group and other. When the execute bit for the owner is set to "s" the set user ID bit is set. This causes any persons or processes that run the file to have access to system resources as though they are the owner of the file. When the execute bit for the group is set to "s", the set group ID bit is set and the user running the program is given access based on access permission for the group the file belongs to. The following command:chmod +s myfile
sets the user ID bit on the file "myfile". The command:
chmod g+s myfile
sets the group ID bit on the file "myfile".
The listing below shows a listing of two files that have the group or user ID bit set.
-rws--x--x 1 root root 14024 Sep 9 2010 donefile -rwxr-sr-x 1 root mail 12072 Aug 16 2010 lockfileThe files donefile and lockfile are located in the directory "/usr/bin". The "s" takes the place of the normal location of the execute bit in the file listings above. This special permission mode has no meaning unless the file has execute permission set for either the group or other as well. This means that in the case of the lockfile, if the other users (world execute) bit is not set with permission to execute, then the user ID bit set would be meaningless since only that same group could run the program anyhow. In both files, everyone can execute the binary. The first program, when run is executed as though the program is the root user. The second program is run as though the group "mail" is the user's group.
For system security reasons it is not a good idea to set many program's set user or group ID bits any more than necessary, since this can allow an unauthorized user privileges in sensitive system areas. If the program has a flaw that allows the user to break out of the intended use of the program, then the system can be compromised.
Directory Permissions
There are two special bits in the permissions field of directories. They are:- s - Set group ID
- t - Save text attribute (sticky bit) - The user may delete or
modify only those files in the directory that they own or have write
permission for.
Save text attribute
The /tmp directory is typically world-writable and looks like this in a listing:drwxrwxrwt 13 root root 4096 Apr 15 08:05 tmpEveryone can read, write, and access the directory. The "t'' indicates that only the user (and root, of course) that created a file in this directory can delete that file.
To set the sticky bit in a directory, do the following:
chmod +t data
This option should be used carefully. A possible alternative to this is
- Create a directory in the user's home directory to which he or she can write temporary files.
- Set the TMPDIR environment variable using each user's login script.
- Programs using the tempnam(3) function will look for the
TMPDIR variable and use it, instead of writing to the /tmp
directory.
Directory Set Group ID
If the setgid bit on a directory entry is set, files in that directory will have the group ownership as the directory, instead of than the group of the user that created the file.This attribute is helpful when several users need access to certain files. If the users work in a directory with the setgid attribute set then any files created in the directory by any of the users will have the permission of the group. For example, the administrator can create a group called sample and add the users Tom and Jerry to the group sample. The directory sampledir can be created with the set GID bit set and Tom and Jerry although in different primary groups can work in the directory and have full access to all files in that directory, but still not be able to access files in each other's primary group.
The following command will set the GID bit on a directory:
chmod g+s sampledir
The directory listing of the directory "sampledir":
drwxrwsr-x 2 Tom sample 1674 Sep 17 1999 sampledir
The "s'' in place of the execute bit in the group permissions causes all files written to the directory "sampledir" to belong to the group "sample" .
Examples
Below are examples of
making changes to permissions:
chmod u+x myfile | Gives the user execute permission on myfile. |
chmod +x myfile | Gives everyone execute permission on myfile. |
chmod ugo+x myfile | Same as the above command, but specifically specifies user, group and other. |
chmod 400 myfile | Gives the user read permission, and removes all other permission. These permissions are specified in octal, the first char is for the user, second for the group and the third is for other. The high bit (4) is for read access, the middle bit (2) os for write access, and the low bit (1) is for execute access. |
chmod 764 myfile | Gives user full access, group read and write access, and other read access. |
chmod 751 myfile | Gives user full access, group read and execute permission, and other, execute permission. |
chmod +s myfile | Set the setuid bit. |
chmod go=rx myfile | Remove read and execute permissions for the group and other. |
Below are examples of
making changes to owner and group:
chown Jerry test1 | Changes the owner of the file test1 to the user Jerry. |
chgrp Jerry test1 | Changes the file test1 to belong to the group "jerry". |
Umask Settings
The umask command is used to set and determine the default file creation permissions on the system. It is the octal complement of the desired file mode for the specific file type. Default permissions are:- 777 - Executable files
- 666 - Text files
The permission for the creation of new executable files is calculated by subtracting the umask value from the default permission value for the file type being created. An example for a text file is shown below with a umask value of 022:
666 Default Permission for text file -022 Minus the umask value ----- 644 Allowed PermissionsTherefore the umask value is an expression of the permissions the user, group and world will not have as a default with regard to reading, writing, or executing the file. The umask value here means the group the file belongs to and users other than the owner will not be able to write to the file. In this case, when a new text file is created it will have a file permission value of 644, which means the owner can read and write the file, but members of the group the file belongs to, and all others can only read the file. A long directory listing of a file with these permissions set is shown below.
-rw-r--r-- 1 root workgrp 14233 Apr 24 10:32 textfile.txtA example command to set the umask is:
umask 022
The most common umask setting is 022. The /etc/profile script is where the umask command is usually set for all users.
Red Hat Linux has a user and group ID creation scheme where there is a group for each user and only that user belongs to that group. If you use this scheme consistently you only need to use 002 for your umask value with normal users.
Wednesday, October 6, 2010
How to identify Open Ports in Red Hat/CentOS/Fedora/Ubuntu server with nmap
Nmap is a utility for network exploration or security auditing. It
supports ping scanning (determine which hosts are up), many port
scanning techniques, version detection (determine service protocols and
application versions listening behind ports), and TCP/IP fingerprinting (remote host OS or device identification). Nmap also
offers flexible target and port specification, decoy/stealth scanning,
sunRPC scanning, and more. Most Unix and Windows platforms are supported
in both GUI and commandline modes. Several popular handheld devices are
also supported, including the Sharp Zaurus and the iPAQ.
Install nmap in Fedora /CentOS/ RedHat
#yum install nmap -y
Install nmap in ubuntu
$sudo apt-get install nmap
Nmap examples
Here are some Nmap usage examples, from the simple and routine to a little more complex and esoteric. Some actual IP addresses and domain names are used to make things more concrete. In their place you should substitute addresses/names from your own network.. While I don’t think port scanning other networks is or should be illegal, some network administrators don’t appreciate unsolicited scanning of their networks and may complain. Getting permission first is the best approach.
For testing purposes, you have permission to scan the host scanme.nmap.org. This permission only includes scanning via Nmap and not testing exploits or denial of service attacks. To conserve bandwidth, please do not initiate more than a dozen scans against that host per day. If this free scanning target service is abused, it will be taken down and Nmap will report Failed to resolve given hostname/IP: scanme.nmap.org. These permissions also apply to the hosts scanme2.nmap.org, scanme3.nmap.org, and so on, though those hosts do not currently exist.
#nmap -v scanme.nmap.org
Starting Nmap 5.21 ( http://nmap.org ) at 2010-10-06 18:02 IST
Initiating Ping Scan at 18:02
Scanning scanme.nmap.org (64.13.134.52) [4 ports]
Completed Ping Scan at 18:02, 0.00s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 18:02
Completed Parallel DNS resolution of 1 host. at 18:02, 0.29s elapsed
Initiating SYN Stealth Scan at 18:02
Scanning scanme.nmap.org (64.13.134.52) [1000 ports]
Discovered open port 21/tcp on 64.13.134.52
Discovered open port 143/tcp on 64.13.134.52
Discovered open port 53/tcp on 64.13.134.52
Discovered open port 22/tcp on 64.13.134.52
Discovered open port 443/tcp on 64.13.134.52
Discovered open port 25/tcp on 64.13.134.52
Discovered open port 110/tcp on 64.13.134.52
Discovered open port 80/tcp on 64.13.134.52
Discovered open port 8008/tcp on 64.13.134.52
Discovered open port 8010/tcp on 64.13.134.52
Discovered open port 119/tcp on 64.13.134.52
Completed SYN Stealth Scan at 18:03, 34.78s elapsed (1000 total ports)
Nmap scan report for scanme.nmap.org (64.13.134.52)
Host is up (0.043s latency).
Not shown: 986 filtered ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
25/tcp open smtp
53/tcp open domain
70/tcp closed gopher
80/tcp open http
110/tcp open pop3
113/tcp closed auth
119/tcp open nntp
143/tcp open imap
443/tcp open https
8008/tcp open http
8010/tcp open xmpp
31337/tcp closed Elite
Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 35.48 seconds
Raw packets sent: 3986 (175.360KB) | Rcvd: 71 (3024B
This option scans all reserved TCP ports on the machine scanme.nmap.org . The -v option enables verbose mode.
#nmap -sS -O scanme.nmap.org/24
Launches a stealth SYN scan against each machine that is up out of the 256 IPs on “class C” sized network where Scanme resides. It also tries to determine what operating system is running on each host that is up and running. This requires root privileges because of the SYN scan and OS detection.
#nmap -sV -p 22,53,110,143,4564 198.116.0-255.1-127
Launches host enumeration and a TCP scan at the first half of each of the 255 possible eight-bit subnets in the 198.116 class B address space. This tests whether the systems run SSH, DNS, POP3, or IMAP on their standard ports, or anything on port 4564. For any of these ports found open, version detection is used to determine what application is running.
#nmap -v -iR 100000 -Pn -p 80
Asks Nmap to choose 100,000 hosts at random and scan them for web servers (port 80). Host enumeration is disabled with -Pn since first sending a couple probes to determine whether a host is up is wasteful when you are only probing one port on each target host anyway.
Install nmap in Fedora /CentOS/ RedHat
#yum install nmap -y
Install nmap in ubuntu
$sudo apt-get install nmap
Nmap examples
Here are some Nmap usage examples, from the simple and routine to a little more complex and esoteric. Some actual IP addresses and domain names are used to make things more concrete. In their place you should substitute addresses/names from your own network.. While I don’t think port scanning other networks is or should be illegal, some network administrators don’t appreciate unsolicited scanning of their networks and may complain. Getting permission first is the best approach.
For testing purposes, you have permission to scan the host scanme.nmap.org. This permission only includes scanning via Nmap and not testing exploits or denial of service attacks. To conserve bandwidth, please do not initiate more than a dozen scans against that host per day. If this free scanning target service is abused, it will be taken down and Nmap will report Failed to resolve given hostname/IP: scanme.nmap.org. These permissions also apply to the
#nmap -v scanme.nmap.org
Starting Nmap 5.21 ( http://nmap.org ) at 2010-10-06 18:02 IST
Initiating Ping Scan at 18:02
Scanning scanme.nmap.org (64.13.134.52) [4 ports]
Completed Ping Scan at 18:02, 0.00s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 18:02
Completed Parallel DNS resolution of 1 host. at 18:02, 0.29s elapsed
Initiating SYN Stealth Scan at 18:02
Scanning scanme.nmap.org (64.13.134.52) [1000 ports]
Discovered open port 21/tcp on 64.13.134.52
Discovered open port 143/tcp on 64.13.134.52
Discovered open port 53/tcp on 64.13.134.52
Discovered open port 22/tcp on 64.13.134.52
Discovered open port 443/tcp on 64.13.134.52
Discovered open port 25/tcp on 64.13.134.52
Discovered open port 110/tcp on 64.13.134.52
Discovered open port 80/tcp on 64.13.134.52
Discovered open port 8008/tcp on 64.13.134.52
Discovered open port 8010/tcp on 64.13.134.52
Discovered open port 119/tcp on 64.13.134.52
Completed SYN Stealth Scan at 18:03, 34.78s elapsed (1000 total ports)
Nmap scan report for scanme.nmap.org (64.13.134.52)
Host is up (0.043s latency).
Not shown: 986 filtered ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
25/tcp open smtp
53/tcp open domain
70/tcp closed gopher
80/tcp open http
110/tcp open pop3
113/tcp closed auth
119/tcp open nntp
143/tcp open imap
443/tcp open https
8008/tcp open http
8010/tcp open xmpp
31337/tcp closed Elite
Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 35.48 seconds
Raw packets sent: 3986 (175.360KB) | Rcvd: 71 (3024B
This option scans all reserved TCP ports on the machine scanme.nmap.org . The -v option enables verbose mode.
#nmap -sS -O scanme.nmap.org/24
Launches a stealth SYN scan against each machine that is up out of the 256 IPs on “class C” sized network where Scanme resides. It also tries to determine what operating
#nmap -sV -p 22,53,110,143,4564 198.116.0-255.1-127
Launches host enumeration and a TCP scan at the first half of each of the 255 possible eight-bit subnets in the 198.116 class B address space. This tests whether the systems run SSH, DNS, POP3, or IMAP on their standard ports, or anything on port 4564. For any of these ports found open, version detection is used to determine what application is running.
#nmap -v -iR 100000 -Pn -p 80
Asks Nmap to choose 100,000 hosts at random and scan them for web servers (port 80). Host enumeration is disabled with -Pn since first sending a couple probes to determine whether a host is up is wasteful when you are only probing one port on each target host anyway.
Subscribe to:
Posts (Atom)