Python Forum
Python threads and aircrack-ng
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python threads and aircrack-ng
#1
Hi guys,

I'm working on a college project the project is basically a GUI wrapper around the infamous password/wifi key cracking tool aircrack-ng, I have been working on the project for about 5-6 hours today and have got no further with it,

the problem is the crack network method/function does not seem to be capturing the hand shake. When I run the commands normally in the terminal(two separate terminals,one running a deauth attack targeted at my phone and another terminal listening for the handshake which is airodump-ng) when I do this manually I successfully capture the handshake 10/10 times

but when I run the Python script the handshake does not seem to get captured, I try to capture the handshake in with the code and then I manually use aircrack-ng but no luck what so ever.

The issue may lie with the threads I have running, I have one thread capturing traffic(airodump-ng) and writing that data to a file, and the other thread is running aireplay-ng

any ideas as to why the handshake is not being captured? or any theories? , the code looks perfectly fine to me and the running time of the threads also seems to be in sync

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")
thanks
Reply
#2
You write something to a file, but then never read the file or use it. Is that intentional?

Also, the second thread might never finish, since you don't call it's .join() method (it's missing parentheses).

Is there a reason you're using threads at all? If they'll never run concurrently, why not just use functions?
Reply
#3
(Apr-01-2019, 08:30 PM)nilamo Wrote: You write something to a file, but then never read the file or use it. Is that intentional? Also, the second thread might never finish, since you don't call it's .join() method (it's missing parentheses). Is there a reason you're using threads at all? If they'll never run concurrently, why not just use functions?
Thanks for the reply Nilamo,

yes sorry I forgot to put the parenthesis around the join function in the code it does have the parenthesis just a typo on my part while copying the code

the reason I use two separate threads is because I will need two separate processes running concurrently one running aireplay-ng and one running airodump-ng

and yes I don't use it just for testing all I am doing is creating a .cap file and manually use this against a wordlist, I run the aircrack-ng manually for now(for testing purposes)

I still have no idea why it's not working,

thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Update old Python version because of security threads SanderV 2 1,556 Jun-06-2022, 07:49 PM
Last Post: SanderV
  How to get a count of -Python- threads from the outside (or via code instrumentation) dstromberg 0 1,823 Jul-15-2019, 06:58 PM
Last Post: dstromberg
  Python - Make Json objects to work concurrently through Threads? WeInThis 0 2,615 Sep-22-2017, 11:31 AM
Last Post: WeInThis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020