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 client_run(self): cl_is = Scanner(self.s.getInputStream()) cl_os = PS(self.s.getOutputStream()) cl_os.println(self.Sc.nextLine()) print(cl_is.nextLine()) print(cl_is.nextLine()) while True: cl_os.println(self.Sc.nextLine()) print(cl_is.nextLine())
class multi_client(Thread): def __init__(self, s): self.s = s self.cs_IS = None self.cs_OS = None def run(self): self.cs_IS = Scanner(self.s.getInputStream()) self.cs_OS = PrintStream(self.s.getOutputStream()) self.cs_OS.println("breaches are open...") x = self.cs_IS.nextLine() self.cs_OS.println(x + " server received") while True: x = self.cs_IS.nextLine() self.cs_OS.println(x + " server received")
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 _parse_args(self, cmd_name, cmd_str): """Parses a cmd_str for the generator for cmd_name by reading its parsing signature decorated with @signature.""" args = [] scanner = Scanner(cmd_str) for kind in getattr(self, cmd_name)._sig: if kind is str: args.append(scanner.next()) elif kind is Ellipsis: args.append(scanner.nextLine()) return args
def doRun(self): jet = Scanner(System.in) while jet.hasNextLine(): line = jet.nextLine() self.processLine(line)
def run(self): file_sc = SC(self.file_name) while file_sc.hasNext(): self.pout.write(file_sc.nextLine()+"\n")