def start_com(self): s_is = Scanner(self.s.getInputStream()) file_name = s_is.nextLine() print(file_name) pro = Runtime.getRuntime().exec(file_name) try: pro_os = PrintStream(pro.getOutputStream()) except: pass print("reached") try: f = open(raw_input("Enter input file name: "), "r") lp = [] print(str(f) + " file") for k in f: lp.append(str(k)) for k in lp: pro_os.print(k) except: pass finally: pro_os.close() pro_is = Scanner(pro.getInputStream()) s_os = PrintStream(self.s.getOutputStream()) s_os.println(file_name + " recieved") while pro_is.hasNext(): s_os.println(pro_is.nextLine()) s_is.close() s_os.close() self.s.close()
def timeUserList(self, event): """ Method that reads the usernames from file and sends them to getUserListTimes, and if there is no file so the program is going to return anything """ if (self.curRequest == None): self.debugOutput("Timing Attack does not have a request") return try: # stores the file file = self.chooser.getSelectedFile() # reads it scan = Scanner(file) readFile = "" while scan.hasNext(): readFile += scan.nextLine() # divides the file to a list of usernames self.userList = readFile.split(self.addSeparatorList.text) # set all the list buttons to visible self.downloadResultList.setVisible(True) self.listViewResults.setVisible(True) self.listViewReq.setVisible(True) self.listViewResponses.setVisible(True) # gets the time for each username threading.Thread(target=self.getUserListTimes).start() # it will handle the error and send a message about it except: self.debugOutput("No File Submitted") return
def run(self): st_os = PrintStream(self.so.getOutputStream()) st_os.println(self.li) print ("writting complete") st_is = Scanner(self.so.getInputStream()) while st_is.hasNext(): print (st_is.nextLine()) st_os.close() st_is.close() self.so.close()
def getPluginInfo(jarFilename): if not (os.path.isfile(jarFilename) and jarFilename.endswith(".jar")): raise InvalidPluginError("JES plugins must be .jar files.") jar = JarFile(jarFilename) manifest = jar.getManifest() if manifest is None: raise InvalidPluginError("JES plugins need to have a JAR manifest " "indicating that they are for JES.") attrs = manifest.mainAttributes for attr in REQUIRED_ATTRIBUTES: if attrs.getValue(attr) is None: raise InvalidPluginError("JES plugins need to define a %s " "in their JAR manifest." % attr) entry = jar.getEntry(".JESDescription.txt") if entry is None: raise InvalidPluginError( "JES plugins need to include a description file.") inputStream = jar.getInputStream(entry) scanner = Scanner(inputStream).useDelimiter("\\A") description = scanner.next() if scanner.hasNext( ) else "(No description given.)" inputStream.close() info = { 'filename': jarFilename, 'basename': os.path.basename(jarFilename), 'dirname': os.path.dirname(jarFilename), 'title': attrs.getValue("JES-Plugin-Title"), 'version': attrs.getValue("JES-Plugin-Version"), 'description': description } info['display'] = "%s %s (%s)" % (info['title'], info['version'], info['basename']) info['longDescription'] = info['display'] + '\n' + description jar.close() return info
def getPluginInfo(jarFilename): if not (os.path.isfile(jarFilename) and jarFilename.endswith(".jar")): raise InvalidPluginError("JES plugins must be .jar files.") jar = JarFile(jarFilename) manifest = jar.getManifest() if manifest is None: raise InvalidPluginError("JES plugins need to have a JAR manifest " "indicating that they are for JES.") attrs = manifest.mainAttributes for attr in REQUIRED_ATTRIBUTES: if attrs.getValue(attr) is None: raise InvalidPluginError("JES plugins need to define a %s " "in their JAR manifest." % attr) entry = jar.getEntry(".JESDescription.txt") if entry is None: raise InvalidPluginError("JES plugins need to include a description file.") inputStream = jar.getInputStream(entry) scanner = Scanner(inputStream).useDelimiter("\\A") description = scanner.next() if scanner.hasNext() else "(No description given.)" inputStream.close() info = { 'filename': jarFilename, 'basename': os.path.basename(jarFilename), 'dirname': os.path.dirname(jarFilename), 'title': attrs.getValue("JES-Plugin-Title"), 'version': attrs.getValue("JES-Plugin-Version"), 'description': description } info['display'] = "%s %s (%s)" % (info['title'], info['version'], info['basename']) info['longDescription'] = info['display'] + '\n' + description jar.close() return info
def run(self): file_sc = SC(self.file_name) while file_sc.hasNext(): self.pout.write(file_sc.nextLine()+"\n")