def read_ip_mac_tuple(interface):
	'''Read an interfaces IP and MAC address.

	ARGS:
	@interface 			-- The interfaces IP and MAC to be read. Ex. Bat0, Eth0

	RETURNS:
	@ip 				-- The interfaces IP as a STRING.
	@mac 				-- The interfaces MAC as a STRING.
	'''
	from read_ip_address import read_ip_address
	from read_mac_address import read_mac_address
	ip = read_ip_address(interface)
	mac = read_mac_address(interface)

	return (ip, mac)
Ejemplo n.º 2
0
def join():
	import requests
	import webbrowser
	from sockets import TCPSocket
	from run_command import run_command
	from read_mac_address import read_mac_address
	from join_batman_network import join_batman_network

	error = None
	try:
		from 
		from run_command import run_command
		from sockets import TCPSocket
		from join_batman_network import join_batman_network
		ssid = request.form['ssid']
		publickey = request.form['publickey']
		mac = request.form['mac']
		password = request.form['admin_password']
		interface = request.form['interfaces']

		join_batman_network(password = password,
				    interface = interface,
				    network_name = ssid,
				    ap_mac = mac)

		if_mac = read_mac_address(interface)
		sock = TCPSocket()
		sock.connect('192.168.2.15', 5005)
		sock.write('DHCP ' + if_mac + '/n')

		response = socket.read()
		run_command('sudo ifconfig bat0 ' + response, password)		
		
		print 'Successfully Joined Network'
	except StormpathError, err:
		error = err.message