|
![]() |
|
| Author |
|
|||||||
|
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? |
|||||||
| #0 02:00pm 18/02/08 |
|
|||||||
|
system
|
--
|
|||||||
| #0 |
|
|||||||
|
myWhiteWolf
Posts: 2724
Location: Brisbane, Queensland
|
OS?
|
|||||||
| #1 02:05pm 18/02/08 |
|
|||||||
|
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. |
|||||||
| #2 02:07pm 18/02/08 |
|
|||||||
|
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.
|
|||||||
| #3 02:20pm 18/02/08 |
|
|||||||
|
gimpy
Posts: 1851
Location: Brisbane, Queensland
|
Change the password everyday and email it around?
hahahaha wtf srsly |
|||||||
| #4 02:29pm 18/02/08 |
|
|||||||
|
stinky
Posts: 2340
Location: Brisbane, Queensland
|
Set objUser = GetObject("LDAP://cn=RetardGuy,ou=Staff,dc=example,dc=com")
objUser.SetPassword("i5A2sj*!") |
|||||||
| #5 02:43pm 18/02/08 |
|
|||||||
|
stinky
Posts: 2341
Location: Brisbane, Queensland
|
ps that was from the first google hit...
|
|||||||
| #6 02:44pm 18/02/08 |
|
|||||||
|
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.
|
|||||||
| #7 02:56pm 18/02/08 |
|
|||||||
|
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. |
|||||||
| #8 03:02pm 18/02/08 |
|
|||||||
|
Mr Hardware
Posts: 2511
Location: Caloundra, Sunshine Coast, Queensland
|
just call a portion of the date or something not static
|
|||||||
| #9 03:03pm 18/02/08 |
|
|||||||
|
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" |
|||||||
| #10 03:05pm 18/02/08 |
|
|||||||
|
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; |
|||||||
| #11 03:29pm 18/02/08 |
|
|||||||
|
Xyzzy
Posts: 179
Location: Brisbane, Queensland
|
sh# chmod a+r reset_passwd.pl
chmod: Invalid Command. Write only language. |
|||||||
| #12 04:22pm 18/02/08 |
|
|||||||
|
Jim
Posts: 7396
Location: Brisbane, Queensland
|
why not just remove the password altogether?
|
|||||||
| #13 04:24pm 18/02/08 |
|
|||||||
|
typo
Posts: 5971
Location: Other International
|
What's the point of having a password if you're emailing it around?
|
|||||||
| #14 04:40pm 18/02/08 |
|
|||||||
|
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 ... |
|||||||
| #15 05:16pm 18/02/08 |
|
|||||||
|
blahnana
Posts: 557
Location: Brisbane, Queensland
|
Good point stinky. Maybe you should think before you speak next time Jim
|
|||||||
| #16 05:25pm 18/02/08 |
|
|||||||
|
stinky
Posts: 2344
Location: Brisbane, Queensland
|
How can you hate a language that comes up with brilliance like this :
|
|||||||
| #17 05:25pm 18/02/08 |
|
|||||||
|
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 = 33That 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 |
|||||||
| #18 06:03pm 18/02/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. |
|||||||
| #19 05:55pm 18/02/08 |
|
|||||||
|
Spook
Posts: 20936
Location: Brisbane, Queensland
|
srand;for(0..5){$r[$_]=chr 65+rand 8}sub d{print$/x6;for(0..335) 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 |
|||||||
| #20 05:58pm 18/02/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 |
|||||||
| #21 05:59pm 18/02/08 |
|
|||||||
|
Strange Rash
Posts: 745
Location:
|
i think you meant
while(<FILE>) { print ; } |
|||||||
| #22 08:15pm 18/02/08 |
|
|||||||
|
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 |
|||||||
| #23 08:29pm 18/02/08 |
|
|||||||
|
Xyzzy
Posts: 176
Location: Brisbane, Queensland
|
Strange Rash, probably.
That doesn't make it any more comprehensible FYI. |
|||||||
| #24 08:40pm 18/02/08 |
|
|||||||
|
system
|
--
|
|||||||
| #24 |
|
|||||||
|
| ||||||||