Premetto che non sono un programmatore e che ,anche se mi piacerebbe,non ne sò nulla.
Il mio problema è che ho uno script in perl che deve girare su Windows 2003 64 bit per esportare in un file ldfi (formato per OpenLDAP)gli utenti di Active Directory.
Lo script funziona ed inserisce anche gli hash delle password di tutti gli utenti precedentemente esportate su un file di testo con pwdump.
Il problema è che inserisce degli spazi e dei caratteri asci che non centrano nulla e che fanno fallire l'importazione del fiel ldfi.
Ho provato sia installando Active-Perl che Strawberry-Perl su windows 2003 ottenendo gli stessi risualtati,ho provato a fare dei cambiamenti allo script ma nulla.
Questo è lo script che si chiama migrate.pl
e dando questo comandocodice:# Copyright (c) 2000, Norbert Klasen. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # o Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # o Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # o Neither the name of the Universitaet Tuebingen nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. use strict; use Getopt::Std; use vars qw/ $opt_u $opt_g $opt_d $opt_s $opt_b $gidNumber $homeDirectoryBase $loginShell $basedn/; if (!getopts('uig:d:s:b:')) { print "migrate_pwdump: converts Windows SAM dump to rfc2307 ldif file\n"; print "usage: [-u] [-g group] [-d homebase] [-s shell] [-b basedn] pwdump-file\n"; print " -u generate ldif file for changing userPassword attribute only\n"; exit; } if ( $opt_g ) { $gidNumber = $opt_g; } else { $gidNumber = 100; } if ( $opt_d ) { $homeDirectoryBase = $opt_d; } else { $homeDirectoryBase = "/home/"; } if ( $opt_s ) { $loginShell = $opt_s; } else { $loginShell = "/bin/bash"; } if ( $opt_b ) { $basedn = $opt_b; } else { $basedn = "ou=Users,dc=test,dc=net"; } while ( <> ) { my ($name, $uidNumber, $lanmanger_hash, $nt_hash, $account_flags, $last_change_time, $remainder) = split /:/, $_; next if $name =~ /\$$/; #computer accounts shouldn't be included print "dn: uid=$name,$basedn\n"; if ( $opt_u ) { print "changetype: modify\n"; print "replace: userPassword\n"; print "userPassword: {lanman}$lanmanger_hash\n"; } else { print "objectclass: top\n"; print "objectclass: account\n"; print "objectclass: posixAccount\n"; #posixAccount MUST print "cn: $name\n"; print "uid: $name\n"; print "uidNumber: $uidNumber\n"; print "gidNumber: $gidNumber\n"; #print "homeDirectory: $homeDirectoryBase$name\n"; #posixAccount MAY print "userPassword: {lanman}$lanmanger_hash\n"; #print "loginShell: $loginShell\n"; } print users "\n"; }
Dove pwd.txt è il file di testo con gli hash delle password degli utenti ottengo un file dove i valori presi letti o da active directory o dal file con gli hash,hanno degli spazi per esempio il file letto su linux con nano riporta questo.codice:migrate.pl -b dc=test,dc=net pwd.txt > users.ldif
La cosa strana è che dove con nano vedo ^@ con altri editor vedo un quadrato,con altri uno spazio vuoto....codice:dn: uid=��k^@i^@o^@t^@^@r^@o^@o^@t^@,dc=test,dc=net objectclass: top objectclass: account objectclass: posixAccount cn: ��k^@i^@o^@t^@o^@r^@o^@o^@t^@ uid: ��k^@i^@o^@t^@o^@r^@o^@o^@t^@ uidNumber: ^@5^@0^@0^@ gidNumber: 100 userPassword: {lanman}^@8^@0^@2^@5^@6^@3^@F^@C^@E^@4^@C^@8^@4^@4^@F^@2^@B^@5^@B^@3^@9^@7^@F^@3^@F^@C^@6^@8^@C^@3^@C^@C^@ dn: uid=^@G^@u^@e^@s^@t^@,dc=test,dc=net objectclass: top objectclass: account objectclass: posixAccount cn: ^@G^@u^@e^@s^@t^@ uid: ^@G^@u^@e^@s^@t^@ uidNumber: ^@5^@0^@1^@ gidNumber: 100 userPassword: {lanman}^@N^@O^@ ^@P^@A^@S^@S^@W^@O^@R^@D^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@ dn: uid=^@k^@r^@b^@t^@g^@t^@,dc=test,dc=net objectclass: top objectclass: account objectclass: posixAccount cn: ^@k^@r^@b^@t^@g^@t^@ uid: ^@k^@r^@b^@t^@g^@t^@ uidNumber: ^@5^@0^@2^@ gidNumber: 100 userPassword: {lanman}^@N^@O^@ ^@P^@A^@S^@S^@W^@O^@R^@D^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@*^@
Se qualcuno mi potesse dare una mano......

Rispondi quotando