Skip to content

Commit

Permalink
Fixed bug when creating monitor interfaces on kali 2
Browse files Browse the repository at this point in the history
  • Loading branch information
savio-code committed Nov 24, 2015
1 parent 90e4e92 commit d51c885
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
42 changes: 35 additions & 7 deletions Fern-Wifi-Cracker/core/fern.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from gui.main_window import *

__version__= 2.2
__version__= 2.3

#
# Main Window Class
Expand Down Expand Up @@ -58,7 +58,7 @@ def __init__(self):
self.connect(self.refresh_intfacebutton,QtCore.SIGNAL("clicked()"),self.refresh_interface)
self.connect(self.interface_combo,QtCore.SIGNAL("currentIndexChanged(QString)"),self.setmonitor)
self.connect(self,QtCore.SIGNAL("monitor mode enabled"),self.monitor_mode_enabled)
self.connect(self,QtCore.SIGNAL("monitor_error(QString,QString)"),self.display_monitor_error)
self.connect(self,QtCore.SIGNAL("monitor_failed()"),self.display_error_monitor)
self.connect(self,QtCore.SIGNAL("interface cards found"),self.interface_cards_found)
self.connect(self,QtCore.SIGNAL("interface cards not found"),self.interface_card_not_found)
self.connect(self.scan_button,QtCore.SIGNAL("clicked()"),self.scan_network)
Expand Down Expand Up @@ -458,10 +458,35 @@ def setmonitor(self):
self.animate_monitor_mode(False)


def killConflictProcesses(self):
process = commands.getstatusoutput("airmon-ng check")
status = process[0]
output = process[1]

if(status == 0):
for line in output.splitlines():
splitedLines = line.split()
if(len(splitedLines) >= 2):
prefix = str(splitedLines[0])
if(prefix.isdigit()):
pid = int(prefix)
killProcess(pid)



def set_monitor_thread(self,monitor_card,mac_setting_exists,last_settings):
status = str(commands.getoutput("airmon-ng start %s"%(monitor_card)))
self.killConflictProcesses()

if ('monitor mode enabled' in status) or ('monitor mode vif enabled' in status):
status = str(commands.getoutput("airmon-ng start %s"%(monitor_card)))
messages = ("monitor mode enabled","monitor mode vif enabled","monitor mode already")

monitor_created = False;

for x in messages:
if(x in status):
monitor_created = True

if (monitor_created):
monitor_interface_process = str(commands.getoutput("airmon-ng"))

regex = object()
Expand Down Expand Up @@ -495,13 +520,13 @@ def set_monitor_thread(self,monitor_card,mac_setting_exists,last_settings):
variables.monitor_mac_address = reader('/sys/class/net/' + self.monitor_interface + '/address').strip()
variables.wps_functions.monitor_mac_address = variables.monitor_mac_address
else:
self.emit(QtCore.SIGNAL("monitor_error(QString,QString)","red","problem occured while setting up the monitor mode of selected"))
self.emit(QtCore.SIGNAL("monitor_failed()"))



def display_monitor_error(self,color,error):
message = "<font color='%1'>%2</font>"
self.mon_label.setText(message.format(color,error))
message = "<font color='"+color+"'>"+error+"</font>"
self.mon_label.setText(message)
self.animate_monitor_mode(False)


Expand All @@ -511,6 +536,9 @@ def tip_display(self):
tips.exec_()


def display_error_monitor(self):
self.display_monitor_error("red","problem occured while setting up the monitor mode of selected")


def monitor_mode_enabled(self):
self.mon_label.setText("<font color=green>Monitor Mode Enabled on %s</font>"%(self.monitor_interface))
Expand Down
2 changes: 2 additions & 0 deletions Fern-Wifi-Cracker/core/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def line_count(filename):
count = sum(bl.count("\n") for bl in blocks(f))
return(count + 1)

def killProcess(processId):
os.system("kill " + str(processId))

######################## Font settings #######################
def font_size():
Expand Down
Binary file modified Fern-Wifi-Cracker/resources/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Fern-Wifi-Cracker/version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = 2.2
version = 2.3
total_files = 81

0 comments on commit d51c885

Please sign in to comment.