Showing posts with label A. Show all posts
Showing posts with label A. Show all posts

Tuesday, 26 April 2016

Using Aircrack and a Dictionary to Crack a WPA Data Capture Part 6 - Backtrack

Introduction To Kali and WiFi Pen Testing
How to Install Kali Linux
WEP Hacking
Kali Linux and Reaver
Getting a Handshake and a Data Capture, WPA Dictionary Attack
Using Aircrack and a Dictionary to Crack a WPA Data Capture
Cracking a WPA Capture with the GPU using HashCat
Creating a Dictionary / Wordlist with Crunch Part 8

Using Aircrack and a Dictionary to Crack a WPA Data Capture 

If you have a WPA handshake capture and cannot crack it yourself then there are services online that for a price will crack it for you.

To get started you should already have a WPA handshake file and Kali Linux running.

Getting a good dictionary can be hard but finding good ones, or creating them yourself with Crunch, is necessary to try and use this method. I have setup adownload section HERE with a WPA wordlist/Dictionaries that can be used if needed.

Keep in mind the dictionary file is only a simple text file that can be edited with any text editing program, such as notepad. Don’t use Microsoft Word or Open Office as they make changes that render a wordlist unusable.

If you know a person well enough you can try and type as many guesses as you can think of in a text file then use that as your dictionary.
Using Aircrack and a Dictionary to Crack a WPA Data Capture

The default storage for a WPA handshake is under /root and will be there under the name it was given when captured. Open a terminal window and type the command “ls” the data capture should be there. The file type we want to use is the .CAP file

The dictionary that we will use for this example is called dict.txt.
word list brute force attack Kali Linux

We will be using Aircrack to do the cracking and the command to do this is:

aircrack-ng (file name) -w (dictionary location)

Where the file name is the handshake file that was captured and the dictionary location is the path to the dictionary. The location of where these two files are and their names will be up to you.

The usual default location of the handshake file is under /root and is whatever name it was called when captured. We will be using a dictionary called dict.txt for this example that I copied to /root.

So the command for me to do this would be:

“aircrack-ng dlink.cap -w dict.txt”
tutorial Aircrack and a Dictionary to Crack a WPA Data Capture

If done right Aircrack should start and begin to try to crack the WPA handshake capture with the dictionary.
using a dictionary wordlist to crack wpa or wpa 2 wifi wireless
If the dictionary finds it, it will show as above with the “KEY FOUND” if not, then another dictionary will need to be used. For this example, I edited the text dictionary file and put the password in to show what it looks like when it is found.



Creating a Dictionary / Wordlist with Crunch Part 8 - Backtrack

Introduction To Kali and WiFi Pen Testing
How to Install Kali Linux
WEP Hacking
Kali Linux and Reaver
Getting a Handshake and a Data Capture, WPA Dictionary Attack
Using Aircrack and a Dictionary to Crack a WPA Data Capture
Cracking a WPA Capture with the GPU using HashCat
Creating a Dictionary / Wordlist with Crunch Part 8

Creating a Dictionary Wordlist with Crunch

Crunch is a useful program for creating and outputting wordlist or dictionaries to be used with brute force attacks. Crunch can send a wordlist to the screen, file, or another program.
Here is how to create a dictionary with Crunch.

The syntax will be:
crunch (min)(max)(charset) -t (pattern) – o (filename.lst)

min = minimum characters that you want to add in your dictionary
max = maximum characters that you want to add in your dictionary
Charset = Which characters you want to add in your wordlist such as abcd or 123456
Pattern = Some characters can be static or dynamic meaning you can specify letters to change or not change.

For example, if I want to create a minimum 7 digits, maximum 7 digits, qwer987 with pattern qwe@@@@ and to save the file in the desktop folder.

The command would be:
crunch 7 7 qwer987 -t qwr@@@@ -o /root/Desktop/ dictionary.txt


Cracking a WPA Capture with the GPU using HashCat Part 7 - Backtrack


Cracking a WPA Capture with the GPU using HashCat
After a WPA/WPA 2 Handshake Capture has been saved to a drive cracking it with current computers can be challenging. To speed this process up the GPU in some video cards can be utilized.

This can speed things up drastically when doing a brute force crack on a WPA data capture.

You will need to know the video card you are currently using and Google it to see if it is compatible.

In the instructions before this aircrack-ng was used to show how to crack a WPA capture with a dictionary.

 In this example a tool called oclHashCat will be used in order to utilize a video cards GPU.

dictionary file and the data capture are still needed only we will be using the video cards GPU to speed up the process. Always check to see if your card is compatible and the correct drivers are loaded.

Nvidia and AMD/ATI Video cards use two separate hashcat names.

The two main versions of HashCat are:
oclHashCat for AMD/ATI graphics cards
cudaHashCat for Nvidia graphics cards

You can download both from here http://hashcat.net/files/oclHashcat-plus-0.14.7z

Extract it with 7z x oclHashcat-plus-0.14.7z (Don’t use 7x e as it will not preserve the directory structure.)

To use hashcat the .cap file needs to be converted to ahccap file to do this use air-crack-ng.

aircrack-ng (out.cap) -J (out.hccap)

Run hashcat against your new capture file using the correct version.

cudaHashcat-plus32.bin -m 2500 (filename).hccap (wordlist)



Friday, 22 April 2016

5 Ways To Reverse A String In Java With Example

In this tutorial we will discuss  how to reverse a string in java . Although there are many ways to get the solution but we are sharing 5 different ways to  reverse a string. This question is frequently asked in the technical interview of java.This question is easy , but please mark this question in your to do list before attending any technical interview in java. First we will understand the question by writing example.

Input :   malayalam
Output: malayalam

Input : akbar
Output : rabka

Points to Keep in Mind Before attempting the Solution:

1. String class in java do not have reverse() method , StringBuilder class does have built in reverse() method.
2. StringBuilder class do not have toCharArray() method , while String class does have toCharArray() method.

Pseudo Code for Reverse String Method 1:

1. The user will input the string to be reversed.
2. First we will convert String to character array by using the built in java String class method toCharArray().

3. Then , we will scan the string from end  to start,  and print the character one by one.


import java.io.*;
import java.util.*;

public class reverseString {
    public static void main(String[] args) {
        String input="";
        System.out.println("Enter the input string");
        try
        {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            input = br.readLine();
            char[] try1= input.toCharArray();
            for (int i=try1.length-1;i>=0;i--)
            System.out.print(try1[i]);
        }
        catch (IOException e) {
            e.printStackTrace();
        }
}}

Pseudo Code for Reverse String Method 2:

1.  In the second method , we will use the built in reverse() method of the StringBuilder class ,.
Note :  String class does not have reverse() method . So we need to convert the input string to StringBuilder , which is achieved by using the append method of the StringBuilder.

2.  After that print out the characters of the reversed string  by scanning from the first till the last index.


import java.io.*;
import java.util.*;

public class reverseString {
 public static void main(String[] args) {
  String input="AliveisAwesome";
  StringBuilder input1 = new StringBuilder();
  input1.append(input);
  input1=input1.reverse(); 
  for (int i=0;i<input1.length();i++)
  System.out.print(input1.charAt(i));  
 }}
  



Pseudo Code for Reverse String Method 3:

1. Convert the input string into character array by using the toCharArray() built in method of the String Class .
2. In this method we will scan the character array from both sides , that is from the start index (left) as well as from last index(right) simultaneously.
3. Set the left index equal to 0 and right index equal to the length of the string -1.
4. Swap the characters of the start index scanning with the last index scanning  one by one .After that  increase the left index by 1 (left++) and decrease the right by 1 i.e (right--) to move on to the next characters in the character array .
5. Continue till left is less than or equal to the right .


import java.io.*;
import java.util.*;

public class reverseString {
 public static void main(String[] args) {
    String input = "Be in present";
    char[] temparray= input.toCharArray();
    int left,right=0;
    right=temparray.length-1;
    for (left=0; left < right ; left++ ,right--)
    {
     // Swap values of left and right 
     char temp = temparray[left];
     temparray[left] = temparray[right];
     temparray[right]=temp;
    }
    for (char c : temparray)
     System.out.print(c);
    System.out.println();
   }}
  

Pseudo Code for Reverse String Method  4:

1. Convert the input string into the character array by using toCharArray() built in method.
reverse a string in java with example
2. Then add the characters of the array into the LinkedList object . We used LinkedList because it maintains the insertion order of the input values.
3. Java also has  built  in reverse() method for the Collections class . Since Collections class reverse() method takes a  list object , to reverse the list , we will pass the LinkedList object which is a type of list of characters.
4. We will create the ListIterator object by using the listIterator() method on the LinkedList object.
ListIterator object is used to iterate over the list.
5. ListIterator object will help us to iterate over the reversed list and print it one by one to the output screen.


import java.io.*;
import java.util.*;

public class reverseString {
 public static void main(String[] args) {
     String input = "Be in present";
     char[] hello=input.toCharArray();
     List<Character> trial1= new LinkedList<>();
     for(char c: hello)
     trial1.add(c);
     Collections.reverse(trial1);
     ListIterator li = trial1.listIterator();  
     while(li.hasNext())
    {System.out.print(li.next());}  
   }}
  

Pseudo Code for Reverse String Method 5 :

1. The last method is converting string into bytes .  getBytes()  method  is used to convert the input string into bytes[].
2. Then we will create a temporary byte[]  of length equal to the length of the input string.
3. We will store the bytes(which we get by using getBytes() method) in reverse order   into the temporary byte[] .


package ctci;
import java.io.*;
import java.util.*;

public class reverseString {
 public static void main(String[] args) {
  String input = "Be in present";
  byte [] strAsByteArray = input.getBytes();
  byte [] result = new byte [strAsByteArray.length];
   
  for(int i = 0; i<strAsByteArray.length; i++){
  result[i] = strAsByteArray[strAsByteArray.length-i-1];
  }
  System.out.println( new String(result));
   }}

Tuesday, 19 April 2016

3 Basic Tips To Prevent A DDoS Attack :- Hacking

 DDoS Attack

Distributed denial-of-service (DDoS) attacks are always in top headlines worldwide, as they are plaguing websites in banks, and virtually of almost every organization having a prominent online presence. The main cause behind the proliferation of DDoS attacks is that there is a very low-cost that the attacker has to incur to put such attack in motion. Fortunately, today various prevention methods have been developed to tackle such attacks. Before delving further into understanding about the ways to prevent DDoS attack, let’s first understand what exactly a DDoS attack is!

Understanding DDOS Attack

 DDoS Attack bot
A DDoS (distributed denial-of-service) attack is an attempt made by attackers to make computers’ resources inaccessible to its anticipated user. In order to carry out a DDOS attack the attackers never uses their own system; rather they create a network of zombie computers often called as a “Botnet” – that is a hive of computers, to incapacitate a website or a web server.

Let’s understand the basic idea! Now, the attacker notifies all the computers present on the botnet to keep in touch with a particular site or a web server, time and again. This increases traffic on the network that causes in slowing down the speed of a site for the intended users. Unfortunately, at times the traffic can be really high that could even lead to shutting a site completely.

3 Basic Tips to Prevent a DDoS Attack

There are several ways to prevent the DDOS attack; however, here in this guest post I’ll be covering three basic tips that will help you to protect your website from the DDoS attack.

1. Buy More Bandwidth.

 DDoS Attack bandwidth
One of the easiest methods is to ensure that you have sufficient bandwidth on your web. You’ll be able to tackle lots of low-scale DDOS attacks simply by buying more bandwidth so as to service the requests. How does it help? Well, distributed denial of service is a nothing more than a game of capacity. Let’s suppose you have 10,000 computer systems each distributing 1 Mbps directed towards your way. This means you’re getting 10 GB of data that is hitting your web server every second. Now, that’s causes a lot of traffic!

So to avoid such issue, you need to apply the same rule intended for normal redundancy. According to this technique, if you wish to have more web servers just multiply around diverse datacenters and next make use of load balancing. By spreading your traffic to various servers will help you balance the load and will most likely create large space adequate to handle the incessant increase in traffic.
However, there’s a problem with this method that is buying more bandwidth can be a costly affair. And as you’ll know that the current DDoS attacks are getting large, and can be a lot bigger exceeding your budget limit.

2. Opt for DDoS Mitigation Services.

A lot of network or Internet-service providers render DDoS mitigation capabilities. Look for an internet service provider having the largest DDoS protection and mitigation network, automated tools, and a pool of talented anti-DDoS technicians with the wherewithal to take action in real-time as per the varying DDoS attack characteristics. A viable alternative is to utilize a DDoS prevention appliance, which is specifically intended to discover and prevent distributed denial-of-service attacks.

3. Restricted Connectivity.

 DDoS Attack
In case you have computer systems that are connected to the web directly, a better idea is to properly install/configure your routers and firewall so as to limit the connectivity. For an instance, while receiving some data from a client machine you can only allow traffic to pass from the machine only on a few chosen ports (like HTTP, POP, SMTP etc.) via the firewall.

Wrapping Up!


Websites are largely getting attacked by hackers every second. Denial-of-service attack is insanely getting huge and is creating a lot of problems for business organizations having strong online vicinity. In this guest post you’ll not only understand what a DDoS attack actually means, but will also come to know about a few type of methods to prevent DDoS attacks. Aforementioned are three tips that I’ll recommend you to run through to at least understand where to get started towards building a resilient web network with chances of surviving a DDoS attack.