ALT_IMG

Tutorials

Featuring short lessons and techniques, covering languages viz. PHP, MySQL, CSS, HTML, JavaScript, Java. The latest methods of developing web applications and basic tutorials of Java technology. You'll find free codes available in the post added with some video tutorials wherever applicable. Readmore...

ALT_IMG

How-To's

There went a rumour about the announcement of the Sony Xperia S and also we have seen some leaked photos of the model many time before. The latest leak photos had Sony Ericsson logo wearing on it but this final product image from CES has a Sony logo on the top Readmore..

Alt img

Tips and Tricks

Sony announces its very first mobile phone ‘Sony Xperia Ion’ in 10 years after it is being seperated from Ericsson at the CES 2012. Now the new products and devices is back with its brand logo of Sony instead of Sony Ericsson. is the first operator to have a Sony phone in the assortment Readmore...

ALT_IMG

Hacking Tricks

In the past few months we saw so many ultrabooks budding up in the electronic market. The Apple’s trendy MacBook Air gave the PC makers a cause to be anxious, since it is obvious that these thin-and-light laptops seems to be in a tough competiton with them. In general, Ultrabooks are the small, light, powerful Readmore...

ALT_IMG

Gadgets

The minute you get your hands on the Droid Xyboard, it is clear that this is a higher-caliber Android tablet while comparing with almost everything else available today. The tablet is sleek, properly balanced and felt comfortable in our hands. A completely new look, significantly enhanced performance and Readmore...

ALT_IMG

Internet Tweaks

There went a rumour about the announcement of the Sony Xperia S and also we have seen some leaked photos of the model many time before. The latest leak photos had Sony Ericsson logo wearing on it but this final product image from CES has a Sony logo on the top Readmore..

ALT_IMG

Tech News

There went a rumour about the announcement of the Sony Xperia S and also we have seen some leaked photos of the model many time before. The latest leak photos had Sony Ericsson logo wearing on it but this final product image from CES has a Sony logo on the top Readmore..

ALT_IMG

Downloads

There went a rumour about the announcement of the Sony Xperia S and also we have seen some leaked photos of the model many time before. The latest leak photos had Sony Ericsson logo wearing on it but this final product image from CES has a Sony logo on the top Readmore..

Showing posts with label Internet hack. Show all posts
Showing posts with label Internet hack. Show all posts
Thursday, 27 September 2012

How To Use Captcha in HTML Forms

0 comments


HTML forms are the essential needs of almost any website viz. contact us form. A contact us form is very useful as it aids your visitors to communicate easily in a simple way. A simple form, without a captcha on it are the chief look-outs of hackers and spammers. It is essential to secure your form against all 'holes' that those hackers are searching for.


How does the spammers/hackers exploit HTML forms?

1) As a relay for sending bulk unsolicited emails.

If you are not validating your form fields (on the serve side) before sending the emails, then hackers can alter your email headers to send the bulk unsolicited emails. (also known as email injection)


2) For sending spam messages to you.

There are programs known as 'spam-bots' that leech through the web pages looking for web forms. When found, those 'bots' just fills the fields with a spam message and submits. Eventually you will start getting many hundred submissions send by those spam bots and you will find it difficult to separate genuine submissions from spam messages.

The solution for this problem is to use a mechanism to identify human submitters from 'bots'. CAPTCHA is one of such tests.


Adding Captcha


Captcha is an image with a code written on it. The website visitor is required to read the code on the image and enter the value in a text field. If the word entered is wrong, the form submission is not processed. As CAPTCHA is a smartly blurred image, the spam bot can't read it. So the form cannot be auto-submitted by a 'bot'.



Contact form with Captcha


<form method="POST" name="contact_form"
action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
<label for="name">Name: </label>
<input type="text" name="name"
value="<?php echo htmlentities($name) ?>">
<label for="email">Email: </label>
<input type="text" name="email"
value="<?php echo htmlentities($visitor_email) ?>">
<label for="message">Message:</label>
<textarea name="message" rows=8 cols=30>
<?php echo htmlentities($user_message) ?></textarea>
<img src="captcha_code_file.php?rand=<?php echo rand(); ?>"
id="captchaimg" >
<label for="message">Enter the code above here :</label>
<input id="6_letters_code" name="6_letters_code" type="text">
<input type="submit" value="Submit" name="submit">
</form>


The HTML form above contains the fields for name, email and message. In addition, we have the CAPTCHA image. The <img> tag for the CAPTCHA image points to the script captcha_code_file.php. The PHP script in 'captcha_code_file.php' creates the image for the captcha and saves the code in a session variable named '6_letters_code'.



Validating the CAPTCHA


When the form is submitted, we compare the value in the session variable(6_letters_code) with the submitted CAPTCHA code( the value in the text field 6_letters_code). If the codes match, then we proceed with emailing the form submission. Else we display an error.

Here is the code that does the server side processing:


if(isset($_POST['submit']))
{
  if(empty($_SESSION['6_letters_code'] ) ||
    strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
  {
   //Note: the captcha code is compared case insensitively.
   //if you want case sensitive match, update the check above to
   // strcmp()
    $errors .= "\n The captcha code does not match!";
  }
  if(empty($errors))
  {
    //send the email
    $to = $your_email;
    $subject "New form submission";
    $from = $your_email;
    $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
    $body = "A user  $name submitted the contact form:\n".
    "Name: $name\n".
    "Email: $visitor_email \n".
    "Message: \n ".
    "$user_message\n".
    "IP: $ip\n";
    $headers = "From: $from \r\n";
    $headers .= "Reply-To: $visitor_email \r\n";
    mail($to, $subject, $body, $headers);
    header('Location: thank-you.html');
  }
}



Customizing the CAPTCHA

The CAPTCHA script in the sample code download can be customized. If you open the script, you can see the first few lines of the code as shown below:



$image_width = 120;
$image_height = 40;
$characters_on_image = 6;
$font = './monofont.ttf';
//The characters that can be used in the CAPTCHA code.
//avoid confusing characters (l 1 and i for example)
$possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
$random_dots = 0;
$random_lines = 20;
$captcha_text_color = "0x142864";
$captcha_noise_color = "0x142864";


You can change the size of the CAPTCHA by changing $image_width & $image_height. The number of characters in the CAPTCHA can be changed by updating $characters_on_image. Similarly, the text color of the CAPTCHA can be customized by updating $captcha_text_color. The code adds some 'noise' in the image by adding random lines and dots. you can increase or decrease the noise. Please note that increasing the noise may make it difficult for your genuine visitors to read the code.







Screenshot -




Continue reading →
Sunday, 8 April 2012

How to get back your Hacked GMail, Orkut, Google Account

0 comments


This is my official reply to all mails/comments/scraps asking me how to get back hacked Gmail/Orkut/Google Account. Everyone should read this no matter how safe you think you are! 
As Google Account is a single account used across all Googles services like Gmail, Google+, Orkut, Blogger, Adsense, Checkout. etc, it can turn out to be our worst nightmare if it gets hacked!

Like many other online services Google tries to protect your account with secret question as well as optional secondary email address. But there is one more official option which only Google Provides!

Now lets go step-by-step…

1) Note Down the Verification Code

Whenever any account is registered with GOOGLE, it gives some confirmation messages and provide you a verification ID. Note down that verification id . If you are having that, recovering your account is just easy as burning a match stick.

2) Trying "Forget Password" option

 I know this will not work in most cases, as options like forget password rely on secondary email address and security question, both of which can be easily changed once a account gets hacked. Still you should try atleast once as most password gets hacked by script kiddies and not by real hackers.
So go to Forget Password form first!

3) What if "Forget Password" option FAILS

 You can submit a form to Google in which you can provide details about your Google Account usage.
Details include information which most likely only real owner can provide. Here are few things for example…

  • Last successful login date
  • Account creation date
  • Google products you used with this account and the date you started using each one
  • Details about Orkut account (if you use Orkut)
  • Details about Blogger account (if you use Blogger)

Now most important part is what they quoted on the form,
“Please answer each question as thoroughly and accurately as possible. If you’re not certain about some of the information, provide your closest estimate. Whether or not we can return your account depends on the strength and accuracy of your responses.”

So I will suggest following things…


• Your goal should be to give Google maximum & accurate data! So take your time and submit form with maximum amount of information possible. You can consult your trusted friends if you are not sure. As an example it could be Sam or Bob who invited you on orkut. If you are not sure call them up and ask it!

Submit only one form! Yes this should be common sense. Do not submit multiple forms. A person who uses around 10-15 Google products asked me if he can submit multiple forms mentioning different Google products.

• Submit form from the place which you use most often to access your account like PC at home! Although they haven’t mentioned this explicitly, line above submit button says, “Please note that we need your IP address in order to resolve this issue. Your IP address will be captured automatically when you submit this form.”

Finally Contact Form is here!!!

I advise everyone to have a look at this form and information it asks. You can prepare a document about secret info, may be in cell phone or pen down it on a paper. This will come handy if something goes wrong in future! 
I guess I have offered my best possible help on the issue. It may or may not work but thats all I can do.

If you don’t remember any detail required in the form or you just don’t get any reply from Google after submitting the form, please create a new account. There is no other option. Sorry.


Continue reading →