# I need a help of a vb developer ..



## TheLord (Jan 29, 2005)

Hi guys,
i'm a network admin, i would like to have a file that generates random passwords of 8 characters containing letters, digits, symbols...it should generate 100 unique passwords everytime i press the generate button.. my purpose of this is to use it for local administrator account on each pc within my company..
i think it's possible and doable by vb developer..

hope some one can help me out.

Your help is much appreciated..
thanks


----------



## coderitr (Oct 12, 2003)

Yes it's possible. Do you want to always have the password contain upper and lower case letters AND symbols AND numbers?


----------



## TheLord (Jan 29, 2005)

only lower case letters, and yes, it should be a mix of all, always. thnx alot for ur help..


----------



## coderitr (Oct 12, 2003)

Where should the output be directed?


----------



## TheLord (Jan 29, 2005)

output shud be in a text window, where i'll be able to highlight and copy the text.. 
i attached an image i made, it's possible to be in this way.. 

thanks

to give u credit for it, place ur name and email address if u want..

cheerz


----------



## Mosaic1 (Aug 17, 2001)

Should you also compare it to the Passwords which already exist so you don't duplicate?


----------



## TheLord (Jan 29, 2005)

will, there shouldn't be duplicates .. thnx


----------



## Mosaic1 (Aug 17, 2001)

I mean dupes of already existing passwords in use.


----------



## Rollin_Again (Sep 4, 2003)

Here is a sample password generator I made. It will create a password of whatever length you choose and will include 2 numbers and letters. If you want to check for duplicate passwords, you will need to store you existing passwords in a database or excel file and check for matches against the password that is generated by the program.

Rollin


----------



## coderitr (Oct 12, 2003)

This program generates a random number between 1 and 3 then:

1 = alphabetic characters
2 = symbols
3 = numerics

Generates a random number to select one character from the approprriate set and repeats until it has generated an 8 character string. Then 100 passwords are generated and displayed in the list box. The program does not enforce that each password must contain at least one element from each group nor does it check for a duplicate in the list box but the laws of probablity suggest that both items will be in compliance with your requirements. The first character of each password must be alphabetic and there may be characters in the symbols that are invalid -- I haven't spent the time to test each one. I've included the source code so if there are invalid characters you may remove them.


----------



## Rollin_Again (Sep 4, 2003)

Coder,

Is it possible for you to post your code? I don't have VB installed on my home machine and would like to see the source.

Rollin


----------



## coderitr (Oct 12, 2003)

```
Option Explicit
Const alphas = "abcdefghijklmnopqrstuvwxyz"
Const symbols = "~_`[email protected]#$%^&*()+=><:;][}{"
Const numbers = "0123456789"
Private Sub Form_Resize()
   List1.Height = Me.ScaleHeight
   List1.Width = Me.ScaleWidth
End Sub
Private Sub mnuAbout_Click()
   frmAbout.Show vbModal
End Sub

Private Sub mnuExit_Click()
   Unload Me
End Sub
Private Function GenerateRandomStrongPassword() As String
   Dim strLocal As String
   Dim intSeed As Integer
   Dim intIndex As Integer
   Dim count As Integer
   
   strLocal = ""
   
   count = 0
   Do Until count > 7
      If count = 0 Then intSeed = 1 Else intSeed = GetRandomNumber(3)
      
      Select Case intSeed
         Case 1
            strLocal = strLocal & Mid(alphas, GetRandomNumber(Len(alphas)), 1)
         Case 2
            strLocal = strLocal & Mid(symbols, GetRandomNumber(Len(symbols)), 1)
         Case 3
            strLocal = strLocal & Mid(numbers, GetRandomNumber(Len(numbers)), 1)
      End Select
      count = count + 1
   Loop
   
   GenerateRandomStrongPassword = strLocal
End Function
Private Sub mnuGenerate_Click()
   Dim count As Integer
   count = 0
   List1.Clear
   
   Do Until count > 99
      List1.AddItem GenerateRandomStrongPassword
      count = count + 1
   Loop
End Sub
Private Function GetRandomNumber(max As Integer)
   Dim n As Long
   
   Randomize (Timer)
   Do Until n > 0 And n <= max
      n = max * Rnd
   Loop
   
   GetRandomNumber = n
End Function
```


----------



## coderitr (Oct 12, 2003)

Here's a screen shot


----------



## TheLord (Jan 29, 2005)

rollin, i like ur idea but i hate to use it as a macro, cuz my secuirty is set to high and that's according to the policy.. if i get it as an executable it would be great ...

coderitr , I LOVE IT !!!!! thanks very much, i really appreciate your hard work on that .. just a little addition to it, i'm unable to select multipul strings to do copy&paste..
what shall i do ?

thanks again, i owe u.


----------



## coderitr (Oct 12, 2003)

You can't copy/paste froma list box. I can change it to put the password in a text biox so you'll be able to copy/paste but:

(1) you still won't be able to select more than one
(2) an array of 100 text boxes will make the memory resources required by this program unjustifiably large

Let me know.


----------



## TheLord (Jan 29, 2005)

how about exporting the output to a text file or excel sheet ?? possible ?


----------



## coderitr (Oct 12, 2003)

Here's version 2.0. 

My approach with the original was flawed. Only one random number is needed -- to select an ascii value between 33 and 126 -- the domain of printable characters excluding the extended ASCII characters.

Added a validation routine to ensure that each password contains at least one alphabetic character (upper or lower case), numeric and symbol. As with the previous version, the first character must be an alphabetic.

Added an "Export" menu option to the File menu which saves the list into a text file called PassGen.txt in the current directory (the directory from which the program was launched.)


----------



## TheLord (Jan 29, 2005)

coderitr, THANKS .... i owe u big time .. this is really beautiful ..


----------

