Airodump not writing handshake to file

1.5k Views Asked by At

I am working on a project for college the project is a GUI wrapper around the aircrack-ng suite, we are implementing the project in Python 3

I seem to be having a problem with the script, when I run the commands manually as in I run airodump-ng write to a .cap file and run a deauth attack using aireaply-ng to help capture the handshake it works fine, I then run a wordlist against the .cap file to successfully get my wifi password, but when I implement this in a python script it does not work,

I have two threads one for each process which run concurrently, one is used to run airodump-ng for the writing of the capture file and the second thread is used for the aireaply deauth attack, maybe it's a problem with my threads? but to me my threads look fine they both seem to be somewhat in sync.

(MAC address is not my real MAC address just a randomised one used for this thread but when I run it real MAC used)

def execute_command_terminate(self,command,count):
    process = Popen(command,stdout =PIPE,stderr = PIPE)
    time.sleep(count) 
    process.terminate()


def crack_network(self):
    handshake_file = 'files/wpa_handshake'

    #run airodump-ng
    command = ['airodump-ng', "wlan0", '--write', handshake_file, '--bssid','70:55:21:24:6B:A3'
    ,'--channel','11']
    thread =threading.Thread(target=self.execute_command_terminate,args=(command, 60))
    thread.start()
    thread.join(20)
    # run deauth
    cmd = (['aireplay-ng','--deauth','4',
    '-a','70:55:21:24:6B:A3','-c','C0:75:02:72:6A:BA','wlan0'])
    deauth_thread = threading.Thread(target=self.execute_command_terminate,args=(command,10))
    deauth_thread.start()
    deauth_thread.join()
    print("cracking over")
2

There are 2 best solutions below

0
On

I had the same issue.

Changing the following

process = Popen(command,stdout=PIPE,stderr = PIPE)

to

process = Popen(command,stdout=PIPE,stderr = PIPE, shell=False)

fixed the problem for me.

0
On

I would perhaps have the writing of packets running in a seperate process altogether to avoid any issues with threading. Path of least resistance :) then deuthenticated whenever you'd like