WELCOME GUEST ENJOY YOUR STAY HERE...

TELL A FRIEND ABOUT US.. Share/Save/Bookmark
Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Tuesday, August 25, 2009

Automated scp on Linux

Scenario You would like to automate the export of SQL dump files from one Linux server to another using scp. These dump files are to be generated and exported once every two weeks. You also wish to archive these dump files on the source server. So let’s say the servers and directories are as follows: Source Hostname: perak
Username: nazham
Dump file directory: /home/nazham/data_export/current
Archive directory: /home/nazham/data_export/archive/yyyymmdd Target Hostname: selangor
Username: romantika
Target directory: /home/romantika/data_import Passwordless scp First you need to set it up so that you don’t need to enter a password for scp. The overall picture is as follows:
At the source server, generate a pair of public and private keys [1] using RSA.
Store the private key in a specific place in the source server.
Store the public key in a specific place in the destination server.
And that’s it! Now you’ll no longer be prompted for a password when using scp.
One-off steps # login to perak with username nazham
ssh-keygen -t rsa
# choose default location, no passphrase - just press enter at all prompts
scp ~/.ssh/id_rsa.pub romantika@selangor:/home/romantika/.ssh/authorized_keys
# I'm assuming the file authorized_keys does not exist!
# otherwise, you need to append the contents of id_rsa.pub to it.
crontab -e
# add the following:
# 1 0 1,15 * * nazham /home/nazham/run_data_export >> /dev/null 2>&1
# which means, run at 12:01 am every 1st and 15th of the month
mkdir ~/data_export
mkdir ~/data_export/current
mkdir ~/data_export/archive The run_data_export script todaysDate=`date +%Y%m%d`
oldDate=`date -d '1 year ago' +%Y%m%d`
exportDir=data_export
mysqldump -u username -ppassword -r ~/$exportDir/current/filename dbname tablenames
echo $todaysDate > ~/$exportDir/current/importdate.txt
scp ~/$exportDir/current/* romantika@selangor:/home/romantika/data_import
mkdir ~/$exportDir/archive/$todaysDate
rm ~/$exportDir/current/importdate.txt
mv ~/$exportDir/current/* ~/$exportDir/archive/$todaysDate
if [ -d ~/$exportDir/archive/$oldDate ]; then rm -r ~/$exportDir/archive/$oldDate; fi The Linux date command I’m very impressed by the Linux date command. This might be old news to some, but the fact that I’m able to say date -d '1 year ago' or date -d '30 days ago' completely blows the mind. Notes [1] From Pass on Passwords with scp: “If you’re not familiar with public key cryptography, here’s the 15-second explanation. In public key cryptography, you generate a pair of mathematically related keys, one public and one private. You then give your public key to anyone and everyone in the world, but you never ever give out your private key. The magic is in the mathematical makeup of the keys; anyone with your public key can use it to encrypt a message, but only you can decrypt it with your private key.”

Friday, August 21, 2009

Send fake emails from anonymous account...

Here, you will learn about sending fake emails...by using command prompt....
ok, step one to sending fake emails is to search for a mail server.
You can do this by:
1) open up Command Prompt
2) type 'nslookup' - because we are looking for something on the internet
2) type 'set q=mx' - this will well it to look for mail servers only
Now you have told the computer to search for mail servers. Next step is to tell it
what site you want it to search for mail servers.
So you now should have something like this on your screen:
________________________ ________________________ _____________
Default Server: cache1.yourhost.com
Address: XXX.XXX.XXX.XXX
> set q=mx
>
________________________ ________________________ _____________
Now type a name of a website or host, without using the www.
So to search for hotmail mail servers, you should type 'hotmail.com'.
Now a whole list of servers will be displayed.
This works for every website that has a mail server.
Now you have found your mail server, the next step is to fake a email.
To do this you need to:
1) Open Command Prompt - start > run > cmd
2 ) type 'telnet yourmailserver.com 25 '- example "telnet mail.hotmail.com 25"
How you should have a blank screen if you are connected.
3) type 'hello' - this tells the mailserver to accept your connection
Now the server should respond with a welcome message, the message depends on which server your connected to.
So now you are connected you want to send your fake email!!
To do this you must specify who it's from, who it's too etc..
1) type 'MAIL FROM: email@email.com' - who the email is from
Now you should get a message: Sender ok
2) type 'RCPT TO: victim@victim.com' - who the email is sent to
Now you should get a message: Recipient ok
3) type 'DATA your email message' - this is the text thats in the email
4) type '.' - this ends the email message(Important..often neglected..)
Now you should get a message: 250 Mail accepted
5) type 'QUIT' - exits mail server and sends your email
an example would be:
________________________ ________________________ _________________
>helo
Welcome XXX.XXX.XXX.XXX to our mail server
>MAIL FROM: example@server.com
Sender ok
>RCPT TO: victim@server.com
Recipient ok
>DATA hello you do not know who i am and i think you smell
>.
250 Mail accepted
>QUIT
Message Delivered

Tuesday, August 18, 2009

Stop A Restart Process In 3steps

Some times we need to stop some restart process quickly. In windows XP/Vista/7 /2008 some times it gives auto restart warning and here is good solution for it.
1. Go to Start menu
2. Click on RUN
3. Enter the following command excluding hashcodes "shutdown -a"
its Done.
It is short but usefull

Follow Me... Stay Connected

MY STATS

Top Blogs

Learn hacking tips tricks earn online hints cheats

Blog Directory & Search engine

blogarama - the blog directory

BlogsByCategory.com

Technology Blogs - Blog Rankings

Visit blogadda.com to discover Indian blogs

Computers

Computers Blogs