[ SEA-GHOST MINI SHELL]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>15.10. getpass — Portable password input — Python 2.7.5 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '2.7.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Python 2.7.5 documentation"
href="../_static/opensearch.xml"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="copyright" title="Copyright" href="../copyright.html" />
<link rel="top" title="Python 2.7.5 documentation" href="../index.html" />
<link rel="up" title="15. Generic Operating System Services" href="allos.html" />
<link rel="next" title="15.11. curses — Terminal handling for character-cell displays" href="curses.html" />
<link rel="prev" title="15.9. logging.handlers — Logging handlers" href="logging.handlers.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
<script type="text/javascript" src="../_static/copybutton.js"></script>
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="curses.html" title="15.11. curses — Terminal handling for character-cell displays"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="logging.handlers.html" title="15.9. logging.handlers — Logging handlers"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="http://www.python.org/">Python</a> »</li>
<li>
<a href="../index.html">Python 2.7.5 documentation</a> »
</li>
<li><a href="index.html" >The Python Standard Library</a> »</li>
<li><a href="allos.html" accesskey="U">15. Generic Operating System Services</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-getpass">
<span id="getpass-portable-password-input"></span><h1>15.10. <a class="reference internal" href="#module-getpass" title="getpass: Portable reading of passwords and retrieval of the userid."><tt class="xref py py-mod docutils literal"><span class="pre">getpass</span></tt></a> — Portable password input<a class="headerlink" href="#module-getpass" title="Permalink to this headline">¶</a></h1>
<p>The <a class="reference internal" href="#module-getpass" title="getpass: Portable reading of passwords and retrieval of the userid."><tt class="xref py py-mod docutils literal"><span class="pre">getpass</span></tt></a> module provides two functions:</p>
<dl class="function">
<dt id="getpass.getpass">
<tt class="descclassname">getpass.</tt><tt class="descname">getpass</tt><big>(</big><span class="optional">[</span><em>prompt</em><span class="optional">[</span>, <em>stream</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#getpass.getpass" title="Permalink to this definition">¶</a></dt>
<dd><p>Prompt the user for a password without echoing. The user is prompted using the
string <em>prompt</em>, which defaults to <tt class="docutils literal"><span class="pre">'Password:</span> <span class="pre">'</span></tt>. On Unix, the prompt is
written to the file-like object <em>stream</em>. <em>stream</em> defaults to the
controlling terminal (/dev/tty) or if that is unavailable to <tt class="docutils literal"><span class="pre">sys.stderr</span></tt>
(this argument is ignored on Windows).</p>
<p>If echo free input is unavailable getpass() falls back to printing
a warning message to <em>stream</em> and reading from <tt class="docutils literal"><span class="pre">sys.stdin</span></tt> and
issuing a <a class="reference internal" href="#getpass.GetPassWarning" title="getpass.GetPassWarning"><tt class="xref py py-exc docutils literal"><span class="pre">GetPassWarning</span></tt></a>.</p>
<p>Availability: Macintosh, Unix, Windows.</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 2.5: </span>The <em>stream</em> parameter was added.</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 2.6: </span>On Unix it defaults to using /dev/tty before falling back
to <tt class="docutils literal"><span class="pre">sys.stdin</span></tt> and <tt class="docutils literal"><span class="pre">sys.stderr</span></tt>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you call getpass from within IDLE, the input may be done in the
terminal you launched IDLE from rather than the idle window itself.</p>
</div>
</dd></dl>
<dl class="exception">
<dt id="getpass.GetPassWarning">
<em class="property">exception </em><tt class="descclassname">getpass.</tt><tt class="descname">GetPassWarning</tt><a class="headerlink" href="#getpass.GetPassWarning" title="Permalink to this definition">¶</a></dt>
<dd><p>A <a class="reference internal" href="exceptions.html#exceptions.UserWarning" title="exceptions.UserWarning"><tt class="xref py py-exc docutils literal"><span class="pre">UserWarning</span></tt></a> subclass issued when password input may be echoed.</p>
</dd></dl>
<dl class="function">
<dt id="getpass.getuser">
<tt class="descclassname">getpass.</tt><tt class="descname">getuser</tt><big>(</big><big>)</big><a class="headerlink" href="#getpass.getuser" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the “login name” of the user. Availability: Unix, Windows.</p>
<p>This function checks the environment variables <span class="target" id="index-0"></span><tt class="xref std std-envvar docutils literal"><span class="pre">LOGNAME</span></tt>,
<span class="target" id="index-1"></span><tt class="xref std std-envvar docutils literal"><span class="pre">USER</span></tt>, <span class="target" id="index-2"></span><tt class="xref std std-envvar docutils literal"><span class="pre">LNAME</span></tt> and <span class="target" id="index-3"></span><tt class="xref std std-envvar docutils literal"><span class="pre">USERNAME</span></tt>, in order, and returns
the value of the first one which is set to a non-empty string. If none are set,
the login name from the password database is returned on systems which support
the <a class="reference internal" href="pwd.html#module-pwd" title="pwd: The password database (getpwnam() and friends). (Unix)"><tt class="xref py py-mod docutils literal"><span class="pre">pwd</span></tt></a> module, otherwise, an exception is raised.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="logging.handlers.html"
title="previous chapter">15.9. <tt class="docutils literal"><span class="pre">logging.handlers</span></tt> — Logging handlers</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="curses.html"
title="next chapter">15.11. <tt class="docutils literal"><span class="pre">curses</span></tt> — Terminal handling for character-cell displays</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">Report a Bug</a></li>
<li><a href="../_sources/library/getpass.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="curses.html" title="15.11. curses — Terminal handling for character-cell displays"
>next</a> |</li>
<li class="right" >
<a href="logging.handlers.html" title="15.9. logging.handlers — Logging handlers"
>previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="http://www.python.org/">Python</a> »</li>
<li>
<a href="../index.html">Python 2.7.5 documentation</a> »
</li>
<li><a href="index.html" >The Python Standard Library</a> »</li>
<li><a href="allos.html" >15. Generic Operating System Services</a> »</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 1990-2020, Python Software Foundation.
<br />
The Python Software Foundation is a non-profit corporation.
<a href="http://www.python.org/psf/donations/">Please donate.</a>
<br />
Last updated on Oct 13, 2020.
<a href="../bugs.html">Found a bug</a>?
<br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
SEA-GHOST - SHELL CODING BY SEA-GHOST