Sunday, September 25, 2011

// // Leave a Comment

Facebook's New Timeline is A New Gift For Hackers

















Hi Guys Here I am With a blasting news of facebook. According to Facebook CEO Mark Zuckerberg, Timeline is “the story of your life,” But According To me Facebook’s New Timeline Is A New Gift For Hackers
Facebook’s new Timeline will make it even easier for criminals and others to mine the social network for personal information they can use to launch malicious attacks and steal passwords, a researcher said today.
Timeline, which Facebook unveiled yesterday at a developer conference and plans to roll out to users in a few weeks, summarizes important past events in a one-page display.
According to Facebook CEO Mark Zuckerberg, Timeline is “the story of your life,”
That has experts at U.K.-based Sophos concerned.
“Timeline makes it a heck of a lot easier [for attackers] to collect information on people,” said Chet Wisniewski, a Sophos security researcher. “It’s not that the data isn’t already there on Facebook, but it’s currently not in an easy-to-use format.”
Cybercriminals often unearth personal details from social networking sites to craft targeted attacks, noted Wisniewski, and Timeline will make their job simpler.
“And Facebook encourages people to fill in the blanks [in the Timeline],” said Wisniewski, referring to the new tool’s prompting users to add details to sections that are blank.
Because people often use personal information to craft passwords or the security questions that some sites and services demand answered before passwords are changed, the more someone adds to Timeline, the more they put themselves at risk, said Wisniewski.
“Remember the hack of [former Alaska governor] Sarah Palin’s account?” asked Wisniewski. “That hacker found the answers to her security questions online.”
A former University of Tennessee student who bragged it took him just 45 minutes of research to reset Palin’s Yahoo Mail account password was convicted on multiple federal felony counts last year.
Hackers can also use what they find on Facebook and elsewhere to craft convincing emails that include malware or links to malicious sites, noted Wisniewski, even if the individual is not the target.
“It may be about the fact that you work for RSA [Security],” he said, referring to the emails sent to low-level employees at that firm earlier this year. Those emails, which included malware embedded in Excel spreadsheets, gave attackers a foothold on RSA’s network. The criminals then scoured RSA’s systems and stole confidential information about its popular SecurID authentication token technology.
Others, not strictly hackers, could use Timeline to quickly dig up dirt as well, said Wisniewski.
“Someone could use it to gather information to harass you, or someone at work competing for your job could use it,” he said.
“The more you put in there to make it complete — and we’ve been conditioned to finish forms — the easier it is for someone with ill intent to gather information about you,” said Wisniewski.


Read More
// // Leave a Comment

Database Connection With PHP


This tutorial will help you make connection to your database with PHP. It’s very simple process but I know how difficult can be for someone who is only starting to learn PHP. To test this example you should download and install Apache server, MySQL database server and PHP. You can find detailed guide and all mentioned components here.

Creating config.php

If you want to use a database in your application, you have to make config.php file which will contain basic database data. Here we will declare database path, username, password, database name and create connection string. We’ll make local database connection for a start. Put the code below into config.php file and put it in the root folder of your project.
<?php
$host = "localhost"; //database location
$user = "bitis"; //database username
$pass = "kaka"; //database password
$db_name = "bitis"; //database name
//database connection
$link = mysql_connect($host, $user, $pass);
mysql_select_db($db_name);
//sets encoding to utf8
mysql_query("SET NAMES utf8");
?>
First 4 lines are basic database data. 2 lines below is connection string which connects to server and then mysql_select_db selects database. The last line is optional but I like to include it to be sure the data will be in utf8 format. Now we have config.php file created and saved in the root folder of our project.

Include config.php in application

Don’t be distracted with me calling website an application. I call it because you can use this methods in any application. It doesn’t necessarily has to be a website.
To include config.php into application (lets say it’s a website) simply put next line on the top of the source code of index.php.
<?php include 'config.php'; ?>

That’s it. You only need this code and you’ll have your first database driven application. Hope this tutorial helped you.
If you know a better way of doing this, post it in a comment.
Read More

Saturday, September 24, 2011

// // Leave a Comment

Searching for files/text using SSH

In some cases you would need to find the location of a given file or to search for a certain text in all files under a directory. SSH provides two different commands, which can be used to accomplish this.

In order to search for a file location you can use the find command. Find is a very powerful tool and accepts various arguments allowing you to specify the exact search term (i.e search by name, by type or even by modified time).
For example, to search for a file called myFile.txt under the current folder (and all subfolders), you would need to use the following command:
find . -name myFile.txt
If you are uncertain about the file name or would like to match a part of the name, you can use a wildcard pattern:
find . -name “myFile*”
If you would like to list only directories and leave all files out of the result:
find . -type d
Or if you want to filter only files modified for the last 2 days, you would need to use:
find . -mtime -2

You can also search for a given text in the files content as well. The command you should be using in this case is ‘grep’ . Grep is a very powerful tool and accepts various command line arguments. For a full list it is recommended to check the manual pages by typing ‘man grep’.
An example of using grep to find a certain text can be found below:
grep  “database” configuration.php
The above command instructs grep to look for the string “database” in configuration.php file and display the containing line.  If you don’t know which file contains the text, you can use:
grep -r -H “database” *
This will make grep look recursively (-r option) and provide the result in human readable format (-H option) for the string “database” in all (*) files under the current working directory.
To only list the file names containing the string you are searching but omit the line containing it, you can use the -l argument:
grep -l “database” *
This will display the filenames containing the word database, but will not actually list the line containing it.
Grep can also be used to filter the results from other commands. For example, the line below will only output configuration.php result:
ls -la | grep configuration.php
In some rare cases, you would not like to use find or grep. For example, to find a certain file in the whole server, it would be best to use an alternative command -- whereis or which:
whereis perl
or
which perl
The execution of the above commands will locate the perl binary and display the full path(s) to it.
Read More
// // Leave a Comment

Move and copy files using SSH

Often you will need to move one or more files/folders or copy them to a different location. You can do so easily using an SSH connection. The commands which you would need to use are mv (short from move) and cp (short from copy).
The mv command syntax looks like this:
mv configuration.php-dist configuration.php
By issuing the above command we will move (rename) the file configuration.php-dist to configuration.php. 
You can also use mv to move a whole directory and its content:
mv includes/* ./
This will move all files (and folders) in the includes/ directory to the current working directory.
In some cases however, we will need to only update the files and move only files that were changed, which we can do by passing ‘-u’ as argument to the command:
mv -u includes/* admin/includes
The copy (cp) command works the same way as mv, but instead of moving the files/folders it copies them. For example:
cp configuration.php-dist configuration.php
The command will copy the configuration.php-dist file to configuration.php and will preserve the original file (the file will NOT be removed after it is copied).
cp also accepts various arguments:
cp -R includes/ includes_backup/
-R instructs cp to copy files recursively (for example, a whole directory). To overwrite already existing files you should use the -f argument:
cp -Rf includes/ admin/includes/

A more convenient way to copy files/folders is to use a 3rd party application, such as Midnight Commander. All our servers have mc (midnight commander) installed and it is available by executing the appropriate (mc) command using the command prompt.  Once inside the application you will see two sections - left and right. You can easily copy/move files from the left side directory to the right side using a semi-visual approach. You can even use your mouse to select files and function keys to execute commands.
You can see a picture of it below:
Midnight commander













 As you can see on the screenshot, there are numbers from 1 to 10 at the bottom of the console screen. These represents shortcuts to certain commands and are activated using the corresponding function key (i.e F1 for help, F5 to copy, etc).
Read More
// // Leave a Comment

How To Recover root password under linux with single user mode

It happens sometime that you can't remember root password. On Linux, recovering root password can be done by booting Linux under a specific mode: single user mode.
This tutorial will show how to boot Linux in single user mode when using GRUB and finally how to change root password.
During normal usage, a Linux OS runs under runlevels between 2 and 5 which corresponds to various multi-user modes. Booting Linux under runlevel 1 will allow one to enter into a specific mode, single user mode. Under such a level, you directly get a root prompt. From there, changing root password is a piece of cake.

1. Entering runlevel 1

Some Linux distribution, such as Ubuntu for instance, offer a specific boot menu entry where it is stated "Recovery Mode" or "Single-User Mode". If this is your case, selecting this menu entry will boot your machine into single user mode, you can carry on with the next part. If not, you might want to read this part.
Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:
  • use the arrows to select the boot entry you want to modify.
  • press e to edit the entry
  • use the arrows to go to kernel line
  • press e to edit this entry
  • at the end of the line add the word single
  • press ESC to go back to the parent menu
  • press b to boot this kernel
The kernel should be booting as usual (except for the graphical splash screen you might be used to), and you will finally get a root prompt (sh#).
Here we are, we have gained root access to the filesystem, let's finally change the password.

2. Changing root password

As root, changing password does not ask for your old password, therefore running the command:
# passwd
will prompt you for your new password and will ask you to confirm it to make sure there is no typo.
That's it, you can now reboot your box and gain root access again
Read More
// // Leave a Comment

How to edit a file via ssh

To edit a file via ssh we have the following editors: 

  • nano / pico
  • vim
  • vi
  • touch











Suppose we want to edit a file /home/w3tools/index.html using vim editor.


To edit this file use the following steps:


        1. Log in to server via ssh using any client (recommended: Putty)


        2. Run the following commands.
vim /home/w3tools/index.html
        3. Now the file index.html will be opened. To edit the file press i. Now make changes in the file.
     
        4. To save the file Press Esc then wq .


Your file will be updated successfully.
If index.html doesn't  exist it will be created automatically.


Note: To exit file editor without saving the file press Esc then q.
         



Read More
// // Leave a Comment

How to change root password via ssh.

To change the root password via ssh, use the following steps:

1. Log in to ssh by using any client(recommended: Putty).

2. Run these commands after it
su - root
passwd
3. Enter your new password for root. Confirm your password by re-entering it.

DONE...!! YOUR PASSWORD FOR ROOT IS NOW UPDATED.

Read More
// // Leave a Comment

PHP - lame encoder mp3 conversion

Uses PHP - lame to change ID3 tags and convert bitrate of a mp3 file.

You can change album,artist,trackno,genre,year,comment,artist,art and bitrate.



Link to lame encoder : Click here

Enjoy guys !


Source: TechnosLab
Read More
// // Leave a Comment

How to add tags/labels to bloggers posts via Gdata api

Read More
// // Leave a Comment

HTTP authentication via PHP

Here's a small snippet that let's you implement htaccess style http authentication in your PHP scripts. Just define user and password and you are ready to go !







Go Here To download the code: http://pastebin.com/9Xu02jLD

Make sure that this code block is present in topmost of your scripts or it'll give errors and authentication will be messed up.
Read More