Commit a75cd4c3 authored by Mohammad Imran Syed's avatar Mohammad Imran Syed
Browse files

Modify interface name

parent 8b28da80
......@@ -94,14 +94,14 @@ class Fake_AP():
def main():
p = subprocess.Popen(['sudo', '/sbin/ifconfig', 'wlan1', 'down'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p = subprocess.Popen(['sudo', '/sbin/ifconfig', interface_name, 'down'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p.wait()
p.terminate()
stdout, stderr = p.communicate()
if stderr:
print('Bringing wlan1 interface down error: ', stderr)
p = subprocess.Popen(['sudo', '/sbin/iw', 'dev', 'wlan1', 'set', 'type', 'monitor'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p = subprocess.Popen(['sudo', '/sbin/iw', 'dev', interface_name, 'set', 'type', 'monitor'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p.wait()
p.terminate()
stdout, stderr = p.communicate()
......@@ -113,7 +113,7 @@ def main():
p.wait()
p.terminate()
p = subprocess.Popen(['sudo', '/sbin/ifconfig', 'wlan1', 'up'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p = subprocess.Popen(['sudo', '/sbin/ifconfig', interface_name, 'up'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
stdout, stderr = p.communicate()
if stderr:
print('Bringing monitor interface up error: ', stderr)
......@@ -125,12 +125,12 @@ def main():
does not work directly for 2.4 GHz band channels. Therefore, we had to one extra command where
we switch the device to 5 GHz band channel and switch it back to the desired 2.4 GHz band channel
"""
p = subprocess.Popen(['sudo', '/sbin/iw', 'dev', 'wlan1', 'set', 'channel', '52'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p = subprocess.Popen(['sudo', '/sbin/iw', 'dev', interface_name, 'set', 'channel', '52'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p.wait()
p.terminate()
stdout, stderr = p.communicate()
p = subprocess.Popen(['sudo', '/sbin/iw', 'dev', 'wlan1', 'set', 'channel', channel], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p = subprocess.Popen(['sudo', '/sbin/iw', 'dev', interface_name, 'set', 'channel', channel], stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p.wait()
p.terminate()
stdout, stderr = p.communicate()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment