/usr/sbin/smbios-passwd is in smbios-utils 2.2.28-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #! /usr/bin/python
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:tw=0
#############################################################################
#
# Copyright (c) 2005 Dell Computer Corporation
# Dual Licenced under GNU GPL and OSL
#
#############################################################################
"""smbios-passwd"""
from __future__ import generators
# import arranged alphabetically
import gettext
import locale
import os
import sys
import traceback
# the following vars are all substituted on install
# this bin isnt byte-compiled, so this is ok
__VERSION__="2.2.28"
pythondir="/usr/lib/python2.7/dist-packages"
clidir="/usr/share/smbios-utils"
# end vars
# import all local modules after this.
sys.path.insert(0,pythondir)
sys.path.insert(0,clidir)
import cli
from libsmbios_c import smi, localedir, GETTEXT_PACKAGE
from libsmbios_c.trace_decorator import decorate, traceLog, getLog
locale.setlocale(locale.LC_ALL, '')
gettext.install(GETTEXT_PACKAGE, localedir, unicode=1)
moduleLog = getLog()
verboseLog = getLog(prefix="verbose.")
class CmdlineError(Exception): pass
def command_parse():
parser = cli.OptionParser(usage=__doc__, version=__VERSION__)
parser.add_option('--info', action="store_const", const="info", dest="action", default=None, help= _("Show password information"))
cli.addStdOptions(parser, passwordOpts=True, securityKeyOpt=False)
return parser.parse_args()
def info(options):
format_strings = (
("DELL_SMI_PASSWORD_FMT_SCANCODE", _("Keyboard Scancodes")),
("DELL_SMI_PASSWORD_FMT_ASCII", _("ASCII")),
)
for label, tag in (
(_("User password"), "DELL_SMI_PASSWORD_USER"),
(_("Admin password"), "DELL_SMI_PASSWORD_ADMIN"),
(_("Owner password"), "DELL_SMI_PASSWORD_OWNER")):
whichpass = getattr(smi, tag)
sys.stdout.write("%s\n" % label)
fmt = smi.password_format(whichpass)
for i in format_strings:
if fmt == getattr(smi, i[0]):
sys.stdout.write("\tPassword stored as: %s\n" % i[1])
sys.stdout.write("\tPassword MAX length: %s\n" % smi.password_max_len(whichpass))
passToTry = options.password_ascii
if fmt == smi.DELL_SMI_PASSWORD_FMT_SCANCODE:
passToTry = options.password_scancode
if smi.is_password_present(whichpass):
sys.stdout.write("\tinstalled\n");
else:
sys.stdout.write("\tNOT installed\n");
continue
if smi.password_verify(whichpass, passToTry):
sys.stdout.write("\tPassword entered MATCHED\n")
sys.stdout.write("\tSECURITY KEY: 0x%04x\n" % smi.get_security_key(passToTry))
else:
sys.stdout.write("\tPassword did not match\n")
def main():
exit_code = 0
(options, args) = command_parse()
cli.setup_std_options(options)
try:
# first check we can actuall run SMIs (perms, etc)
s = smi.DellSmi() # we dont actually do anything with this
if options.action == "info":
info(options)
except (smi.SmiCreateError,), e:
exit_code=3
moduleLog.info( _("ERROR: Could not parse system SMBIOS table.") )
verboseLog.info( _("The smbios library returned this error:") )
verboseLog.info( str(e) )
moduleLog.info( cli.standardFailMessage )
return exit_code
if __name__ == "__main__":
sys.exit( main() )
#message reference:
#
# cerr << "BIOS Password encoding has been detected as SCAN CODE format." << endl;
# cerr << "Automatically changing password from ASCII coding to en_US scancode format." << endl;
# cerr << "Use the --rawpassword option to disable this, for example, if you have " << endl;
# cerr << "another language keyboard, then manually convert the ASCII password to" << endl;
# cerr << "scan code format." << endl;
#
# cerr << endl;
# cerr << "An Error occurred, cannot continue. The Error message is: " << endl;
# cerr << " " << e.what() << endl;
# cerr << endl;
# cerr << "Could not verify password. Common problems are:" << endl;
# cerr << " -- Insufficient permissions to perform operation." << endl;
# cerr << " Try running as a more privileged account." << endl;
# cerr << " Linux : run as 'root' user" << endl;
# cerr << " Windows: run as 'administrator' user" << endl;
# cerr << endl;
# cerr << " -- dcdbas device driver not loaded." << endl;
# cerr << " Try loading the dcdbas driver" << endl;
# cerr << " Linux : modprobe dcdbas" << endl;
# cerr << " Windows: dcdbas driver not yet available." << endl;
|