sys.Exit

Here are the examples of the python api sys.Exit taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

Example 1

Project: raspberry_pwn Source File: libDumpParse.py
Function: airdumpopen
	def airDumpOpen(self,file):
		"""
		Takes one argument (the input file) and opens it for reading
		Returns a list full of data
		"""
		try:
			openedFile = open(file, "r")
		except IOError:
			print "Error Airodump File",file,"does not exist"
			Exit(1)
		data = openedFile.xreadlines()
		cleanedData = []
		for line in data:
			cleanedData.append(line.rstrip())
		openedFile.close()
		return cleanedData

Example 2

Project: raspberry_pwn Source File: libDumpParse.py
Function: airdumpopen
    def airDumpOpen(self,file):
        """
        Takes one argument (the input file) and opens it for reading
        Returns a list full of data
        """
        try:
            openedFile = open(file, "r")
        except IOError:
            print "Error Airodump File",file,"does not exist"
            Exit(1)
        data = openedFile.xreadlines()
        cleanedData = []
        for line in data:
            cleanedData.append(line.rstrip())
        openedFile.close()
        return cleanedData

Example 3

Project: raspberry_pwn Source File: libDumpParse.py
Function: airdumpparse
	def airDumpParse(self,cleanedDump):
		"""
		Function takes parsed dump file list and does some more cleaning.
		Returns a list of 2 dictionaries (Clients and APs)
		"""
		try: #some very basic error handeling to make sure they are loading up the correct file
			try:
				apStart = cleanedDump.index('BSSID, First time seen, Last time seen, Channel, Speed, Privacy, Power, # beacons, # data, LAN IP, ESSID')
			except Exception:
				apStart = cleanedDump.index('BSSID, First time seen, Last time seen, channel, Speed, Privacy, Cipher, Authentication, Power, # beacons, # IV, LAN IP, ID-length, ESSID, Key')
			del cleanedDump[apStart] #remove the first line of text with the headings
			try:
				stationStart = cleanedDump.index('Station MAC, First time seen, Last time seen, Power, # packets, BSSID, Probed ESSIDs')
			except Exception:
				stationStart = cleanedDump.index('Station MAC, First time seen, Last time seen, Power, # packets, BSSID, ESSID')
		except Exception:
			print "You Seem to have provided an improper input file please make sure you are loading an airodump txt file and not a pcap"
			Exit(1)
	
		del cleanedDump[stationStart] #Remove the heading line
		clientList = cleanedDump[stationStart:] #Splits all client data into its own list
		del cleanedDump[stationStart:] #The remaining list is all of the AP information
		apDict = self.apTag(cleanedDump)
		clientDict = self.clientTag(clientList)
		resultDicts = [clientDict,apDict] #Put both dictionaries into a list
		return resultDicts

Example 4

Project: raspberry_pwn Source File: libDumpParse.py
Function: airdumpparse
    def airDumpParse(self,cleanedDump):
        """
        Function takes parsed dump file list and does some more cleaning.
        Returns a list of 2 dictionaries (Clients and APs)
        """
        try: #some very basic error handeling to make sure they are loading up the correct file
            try:
                apStart = cleanedDump.index('BSSID, First time seen, Last time seen, Channel, Speed, Privacy, Power, # beacons, # data, LAN IP, ESSID')
            except Exception:
                apStart = cleanedDump.index('BSSID, First time seen, Last time seen, channel, Speed, Privacy, Cipher, Authentication, Power, # beacons, # IV, LAN IP, ID-length, ESSID, Key')
            del cleanedDump[apStart] #remove the first line of text with the headings
            try:
                stationStart = cleanedDump.index('Station MAC, First time seen, Last time seen, Power, # packets, BSSID, Probed ESSIDs')
            except Exception:
                stationStart = cleanedDump.index('Station MAC, First time seen, Last time seen, Power, # packets, BSSID, ESSID')
        except Exception:
            print "You Seem to have provided an improper input file please make sure you are loading an airodump txt file and not a pcap"
            Exit(1)
    
        del cleanedDump[stationStart] #Remove the heading line
        clientList = cleanedDump[stationStart:] #Splits all client data into its own list
        del cleanedDump[stationStart:] #The remaining list is all of the AP information
        self.apDict = self.apTag(cleanedDump)
        self.clientDict = self.clientTag(clientList)
        return