Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script to generate SambaSamAccount necessary informations
# cat /tmp/Crypt-SmbHash-0.12/
use Crypt::SmbHash;
$username = $ARGV[0];
$password = $ARGV[1];
if ( !$password ) {
print "Not enough arguments\n";
print "Usage: $0 username password\n";
exit 1;
$uid = (getpwnam($username))[2];
my ($login,undef,$uid) = getpwnam($ARGV[0]);
ntlmgen $password, $lm, $nt;
printf "%s:%d:%s:%s:[%-11s]:LCT-%08X\n", $login, $uid, $lm, $nt, "U", time;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment