Skip to content

Commit

Permalink
database should not terminate supplicant #6
Browse files Browse the repository at this point in the history
  • Loading branch information
B34MR committed Oct 22, 2018
1 parent 81e89c7 commit 0ea07db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 6 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
10/22/2018
------------
- Version 1.10222018
- Refactored & Linted wifisuite.py
- Fixed issue #6, database should not terminate supplicant.

17 changes: 8 additions & 9 deletions wifisuite/wifisuite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python2
"""WiFiSuite Entry Point."""
try:
import createdb
import core
Expand All @@ -12,6 +13,7 @@


def kill_process(proc_name):
"""Kill specified process."""
try:
pid = int(check_output(['pidof', proc_name]))
if proc_name == 'NetworkManager':
Expand Down Expand Up @@ -41,34 +43,31 @@ def kill_process(proc_name):
returncode = 0
except CalledProcessError as ex:
o = ex.output
print(o)
returncode = ex.returncode
# Another Error Occured
if returncode != 1:
raise


def sanity_check():
"""Runs sanity checks prior to launching core."""

# ADD if db exists, option to overwrite
def run():
"""Run sanity checks, then launch core."""
createdb.dbcheck()
# Kill network manager service, if running.
kill_process('NetworkManager')
# EvilTwin process sanitization.
# Kill hostapd-wpe processes, if running.
kill_process('hostapd-wpe')
# Detect existing WiFiSuite processes.
script_name = os.path.basename(__file__)
wifisuite_pid = commands.getstatusoutput("ps aux | grep -e '%s' | grep -v grep | awk '{print $2}'" % script_name)
num_process = len(wifisuite_pid[1]) / 4
print(' [i] Wifisuite processes detected: %s' % (num_process))
# If another WiFiSuite instance is running, do not kill wpa_supplicant.
# If another WiFiSuite instance is running other than this instance, do not kill wpa_supplicant.
if num_process == 1:
kill_process('wpa_supplicant')
print(' [i] wpa_supplicant service stopped.')
print(' [i] Sanity checks completed.')


def run():
sanity_check()
core.main()

if __name__ == '__main__':
Expand Down

0 comments on commit 0ea07db

Please sign in to comment.