top_left top_right
bottom_left
Next Event: Unknown | Forum Rules | QGL Website | Event Registration
openFolder AusForums.com
iconwatfolderLineopenFolder LANs
iconwatfolderLineopenFolder QGL
iconwatfolderLineopenFolder QGL Forum
Author
Topic: Script - Reset account password
Grimy
Posts: 234
Location: Brisbane, Queensland
Anyone got a script handy to reset an account password to an auto-generated password? I will then get the password emailed to the admin account, thats the easy part, its just the first.

Any help?
system
--
myWhiteWolf
Posts: 2724
Location: Brisbane, Queensland
OS?
blahnana
Posts: 555
Location: Brisbane, Queensland
Are you sure emailing the password is the easy part? I mean, you won't want to just put it in a plain email and send it after all.

Comedy 'what password are you even talking about?' question.

Grimy
Posts: 235
Location: Brisbane, Queensland
My bad, Server 2003. A lazy admin at one of my customers doesn't want to login and change a password everyday then run around telling the powers that be so he put the question to me.
gimpy
Posts: 1851
Location: Brisbane, Queensland
Change the password everyday and email it around?

hahahaha wtf srsly
stinky
Posts: 2340
Location: Brisbane, Queensland
Set objUser = GetObject("LDAP://cn=RetardGuy,ou=Staff,dc=example,dc=com")
objUser.SetPassword("i5A2sj*!")

stinky
Posts: 2341
Location: Brisbane, Queensland
ps that was from the first google hit...
Grimy
Posts: 236
Location: Brisbane, Queensland
yeah i know that stinky, but he wants to autogenerate the password each day, not just have a static entry.
Xyzzy
Posts: 175
Location: Brisbane, Queensland
but he wants to autogenerate the password each day, not just have a static entry.


what?
thats the easy part.

You're looking for rand or some derivative.

google "<language> random number" and you'll get eleventy billion hits.
Mr Hardware
Posts: 2511
Location: Caloundra, Sunshine Coast, Queensland
just call a portion of the date or something not static
Xyzzy
Posts: 176
Location: Brisbane, Queensland
hey then you wouldn't even need to send it around via email.

"The password is the current date"
stinky
Posts: 2342
Location: Brisbane, Queensland
#!/usr/bin/perl
# This script goes out to all you perl lovers out there ( hi spook! )
# ps I haven't been tested.

use Net::SMTP;

my $password_length = $_[0];
if (!$password_length) {
$password_length = 10;
}

my @chars = split(" ",
"a b c d e f g h i j k l m n o
p q r s t u v w x y z - _ % # |
0 1 2 3 4 5 6 7 8 9");

srand;

for (my $i=0; $i <= $password_length ;$i++) {
$_rand = int(rand 41);
$password .= $chars[$_rand];
}


open (TXT,"> reset_pass.vbs");
print TXT "Set objUser = GetObject(\"LDAP://cn=RetardGuy,ou=Staff,dc=example,dc=com\")\n";
print TXT "objUser.SetPassword(\"$password\")\n";
close (TXT);

system "cscript //nologo reset_pass.vbs";


$smtp = Net::SMTP->new('mailhost');

$smtp->mail('auto_password@domain.com');
$smtp->to('admin@domain.com');

$smtp->data();
$smtp->datasend("Subject: new password for RetardGuy\n");
$smtp->datasend("\n");
$smtp->datasend("Password is $password\n");
$smtp->dataend();
$smtp->quit;
Xyzzy
Posts: 179
Location: Brisbane, Queensland
sh# chmod a+r reset_passwd.pl
chmod: Invalid Command. Write only language.
Jim
Posts: 7396
Location: Brisbane, Queensland
why not just remove the password altogether?
typo
Posts: 5971
Location: Other International
What's the point of having a password if you're emailing it around?
stinky
Posts: 2343
Location: Brisbane, Queensland
why not just remove the password altogether?


Huh? They're changing password daily and emailing to everyone for extra security, removing the password wouldn't be very secure now would it ...
blahnana
Posts: 557
Location: Brisbane, Queensland
Good point stinky. Maybe you should think before you speak next time Jim
stinky
Posts: 2344
Location: Brisbane, Queensland

sh# chmod a+r reset_passwd.pl
chmod: Invalid Command. Write only language.


How can you hate a language that comes up with brilliance like this :


srand;for(0..5){$r[$_]=chr 65+rand 8}sub d{print$/x6;for(0..335)
{print$_<27&$_>13?'-':$_%14>12?"\n":$_<6?$_[0]?$r[$_]:
'O': $_%14==6?'|':(split//,$b[int$_/14])[$_%14]||$"}print"$/Enter
m/[A-Ha-h]{6}/\n"}sub c{return if/[^A-H]/||length()-6;@c=split//,
${$f=\($b[24-++$w]=uc.$")};$w>21&&return 1;for(-6..35){($p[$h]=1)
&($q[$h]=1)&($$f.="*")&$n++if$_<0&&$c[$h=$_+6]eq$r[$h];
!$p[$b]&&!$q[$d]&&($p[$b]=1)&($q[$d]=1)&($$f.="+")
if$c[$d=$_%6]eq$r[$b=$_/6]&&$_>-1}(d$])&die"Done$/"if$n>5;
$n=@p=@q=()}while(!c){d|chop($_=uc<>)}d$/;print"$/Looser!$/"
Twisted
Posts: 10087
Location: Brisbane, Queensland

Well depending what characters you want to assume. Could probably do it easier in powershell (similar to that complete gay perl s***). But assuming you're most likely not using that you could use VBS.
Low = 33
High = 126
Randomize()
PwdLength = 12
arrPwd = Array()

For i = 0 To PwdLength-1
ReDim Preserve arrPwd(i)
arrPwd(i) = Chr((Int((high-low+1)*Rnd+Low)))
Next

For Each item In arrPwd
strPassword = strPassword & item
Next
That will just generate a random password using lower case, uppercase, numbers and a few of the symbols (#, $, etc) up to a length of 12 characters. Then just use ADO or whatever you want to connect and change the pwd.

As for generating the email...this is a completely gay idea and you shouldn't do it. Unless you're encrypting your email it is going out in plain text...

last edited by Twisted at 17:46:28 18/Feb/08

last edited by Twisted at 18:03:42 18/Feb/08
typo
Posts: 5972
Location: Other International
How can you hate a language that comes up with brilliance like this :


Because it's the language of choice for homo's.
Spook
Posts: 20936
Location: Brisbane, Queensland
srand;for(0..5){$r[$_]=chr 65+rand 8}sub d{print$/x6;for(0..335)
{print$_<27&$_>13?'-':$_%14>12?"\n":$_<6?$_[0]?$r[$_]:
'O': $_%14==6?'|':(split//,$b[int$_/14])[$_%14]||$"}print"$/Enter
m/[A-Ha-h]{6}/\n"}sub c{return if/[^A-H]/||length()-6;@c=split//,
${$f=\($b[24-++$w]=uc.$")};$w>21&&return 1;for(-6..35){($p[$h]=1)
&($q[$h]=1)&($$f.="*")&$n++if$_<0&&$c[$h=$_+6]eq$r[$h];
!$p[$b]&&!$q[$d]&&($p[$b]=1)&($q[$d]=1)&($$f.="+")
if$c[$d=$_%6]eq$r[$b=$_/6]&&$_>-1}(d$])&die"Done$/"if$n>5;
$n=@p=@q=()}while(!c){d|chop($_=uc<>)}d$/;print"$/Looser!$/"


come here stinky and give us a kiss, im so hawt for oyu right now

also

f*** yuo tpyo

last edited by Spook at 17:58:33 18/Feb/08
Xyzzy
Posts: 182
Location: Brisbane, Queensland
How can you hate a language that comes up with brilliance like this


Perl is dead to me.
Python forever.

personally the one that i like the most was something along the lines of:- (it's been a good 6 years... the healing has begun)

$FILE = "file.txt";
open FILE;
while(FILE) {print;}
close FILE;

it's not obfuscated like that solid wall of crap you do but a pretty printer will make that mostly intelligible. NOTHING helps on that little snippet (other than knowing about $_ of course). Oh and of course you can add regex to that snippet for extra points
Strange Rash
Posts: 745
Location:
i think you meant
while(<FILE>) { print ; }
Twisted
Posts: 10088
Location: Brisbane, Queensland

Much prettier in PowerShell :)

$rnd=New-Object -comObject System.Random
1..12|%{$strPwd=$strPwd+[char]$rnd.Next(33,126)}
$objUser=[ADSI]"LDAP://cn=whatever,ou=whatever,ou=whatever,dc=qgl,dc=org"
$objUser.SetPassword($strPwd)
$objUser.SetInfo
Xyzzy
Posts: 176
Location: Brisbane, Queensland
Strange Rash, probably.

That doesn't make it any more comprehensible FYI.
system
--
Not a new post since your last visit.
New Post Since your last visit
Back To Forum
Advertise with Us | Privacy Policy | Contact Us
© Copyright 2001-2026 AusGamers Pty Ltd. ACN 093 772 242.
Hosted by Mammoth Networks - Australian VPS Hosting
Web development by Mammoth Media.