File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
3+
4+ from .dependency import Dependency
5+ from ..util .process import Process
6+
7+ class Hostapd (Dependency ):
8+ dependency_required = False
9+ dependency_name = 'hostapd'
10+ dependency_url = 'apt-get install hostapd'
11+
12+ @classmethod
13+ def run (slef , iface , target ):
14+
15+ fout = open ('/tmp/hostapd.conf' ,'w' )
16+ fout .write ('interface=' + iface + '\n ' )
17+ fout .write ('ssid=' + target .essid + '\n ' )
18+ fout .write ('channel=' + target .channel + '\n ' )
19+ fout .write ('driver=nl80211\n ' )
20+ fout .close ()
21+
22+ command = [
23+ 'hostapd' ,
24+ '/tmp/hostapd.conf'
25+ ]
26+ process = Process (command )
27+
28+ return None
29+
30+ @classmethod
31+ def stop (self ):
32+ if hasattr (self , 'pid' ) and self .pid and self .pid .poll () is None :
33+ self .pid .interrupt ()
34+ return None
You can’t perform that action at this time.
0 commit comments