send the commands through subprocess
(command, is_msf=True)
| 305 | |
| 306 | |
| 307 | def cmdline(command, is_msf=True): |
| 308 | """ |
| 309 | send the commands through subprocess |
| 310 | """ |
| 311 | |
| 312 | lib.output.info("Executing command '{}'".format(command.strip())) |
| 313 | split_cmd = [x.strip() for x in command.split(" ") if x] |
| 314 | |
| 315 | sys.stdout.flush() |
| 316 | stdout_buff = [] |
| 317 | |
| 318 | try: |
| 319 | proc = Popen(split_cmd, stdout=PIPE, bufsize=1) |
| 320 | for stdout_line in iter(proc.stdout.readline, b''): |
| 321 | stdout_buff += [stdout_line.rstrip()] |
| 322 | if is_msf: |
| 323 | print("(msf)>> {}".format(stdout_line).rstrip()) |
| 324 | else: |
| 325 | print("{}".format(stdout_line).rstrip()) |
| 326 | except OSError as e: |
| 327 | stdout_buff += "ERROR: " + str(e) |
| 328 | |
| 329 | return stdout_buff |
| 330 | |
| 331 | |
| 332 | def check_for_msf(): |