예제 #1
0
파일: main.py 프로젝트: sececter/hotspotd
def check_dependencies():
	#CHECK FOR DEPENDENCIES
	if len(cli.check_sysfile('hostapd'))==0:
		print 'hostapd executable not found. Make sure you have installed hostapd.'
		return False
	elif len(cli.check_sysfile('dnsmasq'))==0:
		print 'dnsmasq executable not found. Make sure you have installed dnsmasq.'
		return False
	else:
		return True
예제 #2
0
def check_dependencies():
    #CHECK FOR DEPENDENCIES
    if len(cli.check_sysfile('scapy')) == 0:
        print 'scapy executable not found. Make sure you have installed scapy (pip install scapy) or this wont work.'
        return False
    if len(cli.check_sysfile('airmon-ng')) == 0:
        print 'airmon-ng executable not found. Make sure you have installed scapy (pip install scapy) or this wont work.'
        return False
    else:
        return True
예제 #3
0
def check_dependencies():
	#CHECK FOR DEPENDENCIES
	if len(cli.check_sysfile('scapy'))==0:
		print 'scapy executable not found. Make sure you have installed scapy (pip install scapy) or this wont work.'
		return False
	if len(cli.check_sysfile('airmon-ng'))==0:
		print 'airmon-ng executable not found. Make sure you have installed scapy (pip install scapy) or this wont work.'
		return False
	else:
		return True
예제 #4
0
def check_dependencies():
    #CHECK FOR DEPENDENCIES
    errors = int(0)
    if len(cli.check_sysfile('scapy')) == 0:
        print 'scapy executable not found. Make sure you have installed scapy (pip install scapy) or this wont work.'
        errors = errors + 1
    if len(cli.check_sysfile('tcpdump')) == 0:
        print 'tcpdump executable not found. Make sure you have installed tcpdump or this wont work.'
        errors = errors + 1
    if errors > 0:
        return False
    else:
        return True
예제 #5
0
def main(args):
	global wlan, ppp, IP, Netmask
	#the_version = open("VERSION").read().strip()
	the_version = "0.1.7"
	print "****"
	print "Hotspotd " + the_version
	print "A simple daemon to create wifi hotspot on Linux!"
	print "****"
	print "Copyright (c) 2014-2016"
	print "Prahlad Yeri<*****@*****.**>\n"
	
	scpath = os.path.realpath(__file__)
	realdir = os.path.dirname(scpath)
	os.chdir(realdir)

	#cli.arguments = args #initialize
	cli.arguments = type('', (object,),{"verbose":False})()

	newconfig = False

	if not os.path.exists('hotspotd.json'):
		configure()
		newconfig=True

	if len(cli.check_sysfile('hostapd'))==0:
		print "hostapd is not installed on your system. This package will not work without it.\nTo install hostapd, run 'sudo apt-get install hostapd'\nor refer to http://wireless.kernel.org/en/users/Documentation/hostapd after this installation gets over."
		time.sleep(2) 

	dc =json.load(open('hotspotd.json'))
	wlan = dc['wlan']
	ppp = dc['inet']
	IP=dc['ip']
	Netmask=dc['netmask']
	SSID = dc['SSID']
	password = dc['password']
	
	if args == 'configure':
		if not newconfig: configure()
	elif args == 'stop':
		stop_router()
	elif args == 'start':
		if (cli.is_process_running('hostapd') != 0 and cli.is_process_running('dnsmasq') != 0):
			print 'hotspot is already running.'
		else:
			start_router()
예제 #6
0
파일: main.py 프로젝트: sececter/hotspotd
def main(args):
	global wlan, ppp, IP, Netmask

		
	scpath = os.path.realpath(__file__)
	realdir = os.path.dirname(scpath)
	os.chdir(realdir)
	#print 'changed directory to ' + os.path.dirname(scpath)
	#if an instance is already running, then quit
	#const.verbose = args.verbose
	#const.command = args.command
	#const.blocking = args.blocking
	#const.argv = [os.getcwd() + '/server.py'] + sys.argv[1:]
	cli.arguments = args #initialize

	newconfig = False
	if not os.path.exists('hotspotd.json'):
		configure()
		newconfig=True
	if len(cli.check_sysfile('hostapd'))==0:
		print "hostapd is not installed on your system.This package will not work without it.To install it, try 'sudo apt-get install hostapd' or http://wireless.kernel.org/en/users/Documentation/hostapd after this installation gets over."
		time.sleep(2) 
	dc =json.load(open('hotspotd.json'))
	wlan = dc['wlan']
	ppp = dc['inet']
	IP=dc['ip']
	Netmask=dc['netmask']
	SSID = dc['SSID']
	password = dc['password']
	
	if args.command == 'configure':
		if not newconfig: configure()
	elif args.command == 'stop':
		stop_router()
	elif args.command == 'start':
		if (cli.is_process_running('hostapd') != 0 and cli.is_process_running('dnsmasq') != 0):
			print 'hotspot is already running.'
		else:
			start_router()