Python sys.__stdin__() Examples
The following are 30
code examples of sys.__stdin__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sys
, or try the search function
.
Example #1
Source File: getpass.py From meddle with MIT License | 7 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #2
Source File: getpass.py From ironpython3 with Apache License 2.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putwch(c) pw = "" while 1: c = msvcrt.getwch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putwch('\r') msvcrt.putwch('\n') return pw
Example #3
Source File: dill.py From dagbldr with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _save_file(pickler, obj, open_): obj.flush() if obj.closed: position = None else: if obj in (sys.__stdout__, sys.__stderr__, sys.__stdin__): position = -1 else: position = obj.tell() if is_dill(pickler) and pickler._fmode == FILE_FMODE: f = open_(obj.name, "r") fdata = f.read() f.close() else: fdata = "" if is_dill(pickler): strictio = pickler._strictio fmode = pickler._fmode else: strictio = False fmode = 0 # HANDLE_FMODE pickler.save_reduce(_create_filehandle, (obj.name, obj.mode, position, obj.closed, open_, strictio, fmode, fdata), obj=obj) return
Example #4
Source File: dill.py From dagbldr with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _save_file(pickler, obj, open_): obj.flush() if obj.closed: position = None else: if obj in (sys.__stdout__, sys.__stderr__, sys.__stdin__): position = -1 else: position = obj.tell() if is_dill(pickler) and pickler._fmode == FILE_FMODE: f = open_(obj.name, "r") fdata = f.read() f.close() else: fdata = "" if is_dill(pickler): strictio = pickler._strictio fmode = pickler._fmode else: strictio = False fmode = 0 # HANDLE_FMODE pickler.save_reduce(_create_filehandle, (obj.name, obj.mode, position, obj.closed, open_, strictio, fmode, fdata), obj=obj) return
Example #5
Source File: framework.py From pentestly with GNU General Public License v3.0 | 6 votes |
def onecmd(self, line): cmd, arg, line = self.parseline(line) if not line: return self.emptyline() if line == 'EOF': # reset stdin for raw_input sys.stdin = sys.__stdin__ Framework._script = 0 Framework._load = 0 return 0 if cmd is None: return self.default(line) self.lastcmd = line if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg) # make help menu more attractive
Example #6
Source File: main.py From urh with GNU General Public License v3.0 | 6 votes |
def fix_windows_stdout_stderr(): """ Processes can't write to stdout/stderr on frozen windows apps because they do not exist here if process tries it anyway we get a nasty dialog window popping up, so we redirect the streams to a dummy see https://github.com/jopohl/urh/issues/370 """ if hasattr(sys, "frozen") and sys.platform == "win32": try: sys.stdout.write("\n") sys.stdout.flush() except: class DummyStream(object): def __init__(self): pass def write(self, data): pass def read(self, data): pass def flush(self): pass def close(self): pass sys.stdout, sys.stderr, sys.stdin = DummyStream(), DummyStream(), DummyStream() sys.__stdout__, sys.__stderr__, sys.__stdin__ = DummyStream(), DummyStream(), DummyStream()
Example #7
Source File: getpass.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return default_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #8
Source File: getpass.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return default_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #9
Source File: getpass.py From medicare-demo with Apache License 2.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return default_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #10
Source File: getpass.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) for c in prompt: msvcrt.putwch(c) pw = "" while 1: c = msvcrt.getwch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putwch('\r') msvcrt.putwch('\n') return pw
Example #11
Source File: builderMain.py From universalSmashSystem with GNU General Public License v3.0 | 6 votes |
def Main(): try: sys.stderr.write("\n") sys.stderr.flush() except IOError: class dummyStream: ''' dummyStream behaves like a stream but does nothing. ''' def __init__(self): pass def write(self,data): pass def read(self,data): pass def flush(self): pass def close(self): pass # and now redirect all default streams to this dummyStream: sys.stdout = dummyStream() sys.stderr = open("errors.txt", "w", 0) sys.stdin = dummyStream() sys.__stdout__ = dummyStream() sys.__stderr__ = dummyStream() sys.__stdin__ = dummyStream() builder.builderWindow.MainFrame()
Example #12
Source File: main.py From universalSmashSystem with GNU General Public License v3.0 | 6 votes |
def main(debug = False): try: sys.stderr.write("\n") sys.stderr.flush() except IOError: class dummyStream: ''' dummyStream behaves like a stream but does nothing. ''' def __init__(self): pass def write(self,data): pass def read(self,data): pass def flush(self): pass def close(self): pass # and now redirect all default streams to this dummyStream: sys.stdout = dummyStream() sys.stderr = open("errors.txt", "w", 0) sys.stdin = dummyStream() sys.__stdout__ = dummyStream() sys.__stderr__ = dummyStream() sys.__stdin__ = dummyStream() menu.mainMenu.Menu()
Example #13
Source File: getpass.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #14
Source File: framework.py From EasY_HaCk with Apache License 2.0 | 6 votes |
def onecmd(self, line): cmd, arg, line = self.parseline(line) if not line: return self.emptyline() if line == 'EOF': # reset stdin for raw_input sys.stdin = sys.__stdin__ Framework._script = 0 Framework._load = 0 return 0 if cmd is None: return self.default(line) self.lastcmd = line if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg) # make help menu more attractive
Example #15
Source File: framework.py From Galileo with GNU General Public License v3.0 | 6 votes |
def onecmd(self,line): cmd,arg,line = self.parseline(line) if not line: return self.emptyline() if line == 'EOF': sys.stdin = sys.__stdin__ self._script = self._loaded = 0 return 0 if cmd is None: return self.default(line) # cmd.Cmd().lastcmd self.lastcmd = line if cmd == '': return self.default(line) else: try: # find functions with getattr function = getattr(self, "do_" + cmd) except AttributeError as e: return self.default(line) return function(arg)
Example #16
Source File: runner.py From kitty with GNU General Public License v3.0 | 6 votes |
def launch(args: List[str]) -> None: config_dir, kitten = args[:2] kitten = resolved_kitten(kitten) del args[:2] args = [kitten] + args os.environ['KITTY_CONFIG_DIRECTORY'] = config_dir from kittens.tui.operations import clear_screen, reset_mode set_debug(kitten) m = import_kitten_main_module(config_dir, kitten) try: result = m['start'](args) finally: sys.stdin = sys.__stdin__ print(reset_mode('ALTERNATE_SCREEN') + clear_screen(), end='') if result is not None: import json data = json.dumps(result) print('OK:', len(data), data) sys.stderr.flush() sys.stdout.flush()
Example #17
Source File: getpass.py From Imogen with MIT License | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) for c in prompt: msvcrt.putwch(c) pw = "" while 1: c = msvcrt.getwch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putwch('\r') msvcrt.putwch('\n') return pw
Example #18
Source File: getpass.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return default_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #19
Source File: getpass.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return default_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #20
Source File: getpass.py From ironpython2 with Apache License 2.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #21
Source File: getpass.py From canape with GNU General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #22
Source File: getpass.py From BinderFilter with MIT License | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #23
Source File: getpass.py From android_universal with MIT License | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) for c in prompt: msvcrt.putwch(c) pw = "" while 1: c = msvcrt.getwch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putwch('\r') msvcrt.putwch('\n') return pw
Example #24
Source File: getpass.py From unity-python with MIT License | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #25
Source File: getpass.py From oss-ftp with MIT License | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #26
Source File: getpass.py From PokemonGo-DesktopMap with MIT License | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #27
Source File: getpass.py From RevitBatchProcessor with GNU General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) import msvcrt for c in prompt: msvcrt.putch(c) pw = "" while 1: c = msvcrt.getch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putch('\r') msvcrt.putch('\n') return pw
Example #28
Source File: CLI.py From pycopia with Apache License 2.0 | 6 votes |
def _do_backtick(self, c, fsm): if fsm.arg: self.arg_list.append(fsm.arg) fsm.arg = '' io = StringIO() sys.stdout.flush() sys.stdout = sys.stdin = io try: subcmd = self._cmd.subshell(io) subparser = CommandParser(subcmd, self._logfile) try: subparser.feed(self.arg_list.pop()+"\n") except: ex, val, tb = sys.exc_info() print >>sys.stderr, " *** %s (%s)" % (ex, val) finally: sys.stdout = sys.__stdout__ sys.stdin = sys.__stdin__ fsm.arg += io.getvalue().strip() # get a cli built from sys.argv
Example #29
Source File: CLI.py From pycopia with Apache License 2.0 | 6 votes |
def _do_backtick(self, c, fsm): if fsm.arg: self.arg_list.append(fsm.arg) fsm.arg = '' io = BytesIO() sys.stdout.flush() sys.stdout = sys.stdin = io try: subcmd = self._cmd.subshell(io) subparser = CommandParser(subcmd, self._logfile) try: subparser.feed(self.arg_list.pop()+"\n") except: ex, val, tb = sys.exc_info() print(" *** %s (%s)" % (ex, val), file=sys.stderr) finally: sys.stdout = sys.__stdout__ sys.stdin = sys.__stdin__ fsm.arg += io.getvalue().strip() # get a cli built from sys.argv
Example #30
Source File: getpass.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def win_getpass(prompt='Password: ', stream=None): """Prompt for password with echo off, using Windows getch().""" if sys.stdin is not sys.__stdin__: return fallback_getpass(prompt, stream) for c in prompt: msvcrt.putwch(c) pw = "" while 1: c = msvcrt.getwch() if c == '\r' or c == '\n': break if c == '\003': raise KeyboardInterrupt if c == '\b': pw = pw[:-1] else: pw = pw + c msvcrt.putwch('\r') msvcrt.putwch('\n') return pw