Hi All,

Before i start asking for advice on this just a quick mention to comatose to say thank you for all your previous help. Cheers..

Also just to say i believe my problem i pm'd you about has been resolved.. (i need to be a little more carful, i sometime get a bit relaxed with my security)

HENCE this question...

OK, since my previous question i have been learning how to code using Windows Scripting Learning Guide (Stop laughing, we all had to start somewhere) and am becoming better with my abilities to code.. Not perfect but getting there..

So.. I have an idea that i would like to see if its possible to create a piece of code that will allow a user to input and password of there choice into a text box and in return it will retun a more secure version of the password.

For example:

Let say my password was "DINNER" i would like the program to start with a input box and ask "Please enter the password you wish to secure" then the user enters there password, for example DINNER. I would then like the code to come back wth a response to the password by somehow searching the words, numbers and symbols of a standard keyboard layout an retun something like "D¦NN34"

it doesnt have to be exactly that but it searches randomly for words or symbols that closly resemble the word input "D1NN3R" would also be acceptable or "|)!|V|V34"

Know believe me i dont for one minute think that this will be easy or remotley simple and i am not asking for this for any other reason except i am currently not up to this level of coding experience yet but in my line of work and due to the fact i my self got lazy and had to pay the price (thanks again for sorting that out coma) i feel this kind of a tool would be invaluable for me and my users in our organisation.

I would be most grateful for any words of advice/wisdom or for anyone who has created such a program to share there knowledge with me, or even better if someone already knows how to code such a program to write it for me/us here.

Thanks in advance and look forward to the responses...

Thanks eveyone

PHREAK aka "TE"

Recommended Answers

All 24 Replies

This isn't a complete code, however it is a good example for making it, I don't know any better way than one. If anyone have better way, please let me know.

Function passGen( password As String ) As String

		Dim words(26, 3) As String
		Dim strTemp As String
		Dim intRnd As Integer
		Dim result As String
		
		' /*  Assign Similar Values For 'A' */
		words(0, 0) = "@"
		words(0, 1) = "/\"
		words(0, 2) = "A"
		words(0, 3) = "A"
		
		' /*  Assign Similar Values For 'B' */
		words(1, 0) = "8"
		words(1, 1) = "|3"
		words(1, 2) = "B"
		words(1, 3) = "B"
		
		' /*  Assign Similar Values For 'C' */
		words(2, 0) = "["
		words(2, 1) = "("
		words(2, 2) = "<"
		words(2, 3) = "C"
		
		' /*  Assign Similar Values For 'D' */
		words(3, 0) = "|}"
		words(3, 1) = "|]"
		words(3, 2) = "|)"
		words(3, 3) = "D"
		
		' /*  What you need to do are assign all 
		' the similar of each letter of the alphabet 
		' like what i have example for you above */
		
		Randomize
		
		' /* start generate each character
		' into secure character. */
		
		For i = 1 To Len(password)
		
			' /* store the current character
			' that we try to convert */
			
			strTemp = Mid(password, i, 1)
			
			' // Random similar letter of alphabet
			intRnd = Int(Rnd * 3)
			
			' /* if it is a alphabet then
			' we will replace it with similar string */
			
			If UCase(strTemp) <> LCase(strTemp) Then
			
				' /* start replace similar word into string */
				result = result & words(Asc(UCase(strTemp)) - 65, intRnd)
			Else
				' /* if it isn't a alphabet
				result = result & strTemp
			End If
			
		Next i
		
		' /* return the result
		passGen = result
		
End Function

Well Visal, It Says "You Must Spread Around Some Reputation Before Giving More To inVisal", so, I'm giving you rep points by this post instead :)

hi,

Thanks for the advice there,

However by doing it this way would that not mean i would also have to include similar values for symbols and numbers aswell? because if someones password was "Dinner2" then it would need to recognise the number? Also what if they entered a password of "D¦nner" would that mean i need to add values for evey key character avaialble on a standard keyboard just incase they included it into there code?

If so is there a quick way of doin it? or a resource containing some of the similar variations for a standard keyboard layout that i could use as a guide or reference. (or just copy and paste) ;-)

Cheers again

Elise

Elise,

I'm A Soldier In The US Army, and we have army e-mail addresses. I rarely use it, but that isn't the point... my point is, that their is a standard restriction on how the password must be done for security reasons. That standard is that the password must contain 3 upper and 3 lower case characters, 2 "special characters" such as @#$%, and 4 numbers.

That said, I see No purpose, based on security reasons, for a need to change numbers, or special characters into anything else. If you really wanted to change the numbers into something else, then it would require the same concept that Visal coded above with the array. You'd have to increase the size of the array, to accept whatever numbers you want to catch, and change. Again though, my personal opinion is that special characters and numbers are pretty much secure enough to not need altering....

Another Thing To Consider, when using this script, is that most of the alterations that are made replace a single character with two characters. So, If A Password given by the user is "janetomandmatt", which is 14 characters, and M as translated to: /\/\, The password length, by just changing The First M, Is Now 18 characters long. If The Program that is requiring the password has a character cap of say 16 characters..... now what? Some programs will just truncate it.... (chop it off) so they could type the whole thing and it wouldn't matter, but some check the length, and if it's not right, it throws a fit. Anyway, let me know if I can help any more. :)

hi guys,

you right about the special characters not needing changing (silly me) otherwise it could change a secure password into a non secure.. (doh) as long as it recognises they are not to be changed and leaves them exactly in tact where they are.

well thats ok then il just need to create the a to z of variations of the letters which is great...

Im slightly confised as to what to do next though? do i need to do anything to the code to get it to randomaize etc or is this done in the code provided.

Again sorry for the inadiquecy but i i am trying... :-)

at the monent im currently (vb for dummys book) learning how to take info from the regestry etc so as much as i wish i could take this code and run with it unfortunelty i still pull up a black as to what to do next. i can add all the similar characters in for the rest of the alphabet and i know how to create a text box/input box but may require some help....

Cheers again guys..

Ok.

The for loop For i = 1 To Len(password), says basically "for all the letters in their password", so, if their password is Dinner, it's going to loop 6 times. Since the value of "i" will change every time it loops (starting at one, and ending with [in this example] 6), this line strTemp = Mid(password, i, 1), basically starts at the very left, and gets the first letter of the password, then the second, then the third (it changes, since it uses i, with each "iteration" of the loop) So, strTemp will actually be 1 character, and it will move through the person's password, character by character. Then it does a randomize, because you'll notice there are 3 or 4 possibilities for each letter to be altered to. That way D isn't always |), it can be |] also, so we grab a random number within our "letter range" of the array. Then basically we maintain a variable that we just add our information to the end of. So the variable result just keeps getting more letters added to it as we figure them out. This function (with the exception of the missing letters, E-Z) is fully functional, and once you add the missing letters will work as it is :)

Because i want it to include caps and lower case letters aswell will i need to put them (as in caps and lowewe case version of the letters) in to the variations part of the script as uppercase and a lower case letter for it to choose from? or just add the letter and if it picks it check it against alphabet to see if it IS a "A to Z" letter and if so randomly make it upper or lower case? or im i off my head????? ;-)


im working on the a to z bit now....... sill al ittle confused but ill do as much as i can now and get you updated... thanks aagain guys..

Cheers

:-)

additional...

ive completed the "A to Z" part of the script so now we have

Function passGen( password As String ) As String
                
                Dim words(26, 3) As String
		Dim strTemp As String
		Dim intRnd As Integer
		Dim result As String
		
' /*  Assign Similar Values For 'A' */
		words(0, 0) = "@"
		words(0, 1) = "/\"
		words(0, 2) = "^"
		words(0, 3) = "4"
		          to
' /*  Assign Similar Values For 'Z' */
		words(25, 0) = "Z"
		words(25, 1) = "z"
		words(25, 2) = "2"
		words(25, 3) = "2"
		
		' /*  What you need to do are assign all 
		' the similar of each letter of the alphabet */
		
		Randomize
		
		' /* start generate each character
		' into secure character. */
		
		For i = 1 To Len(password)
		
			' /* store the current character
			' that we try to convert */
			
			strTemp = Mid(password, i, 1)
			
			' // Random similar letter of alphabet
			intRnd = Int(Rnd * 3)
			
			' /* if it is a alphabet then
			' we will replace it with similar string */
			
			If UCase(strTemp) <> LCase(strTemp) Then
			
				' /* start replace similar word into string */
				result = result & words(Asc(UCase(strTemp)) - 65, intRnd)
			Else
				' /* if it isn't a alphabet
				result = result & strTemp
			End If
			
		Next i
		
		' /* return the result
		passGen = result
		
End Function

ok so i'm up to there... what do i need to do now to get the script to run? Once its kind of running i think ill be able to ammend it from there on in.. i just dont think i am savvy enough with VB to get it up and running from this point on my own?

Cheers again

Well, it's a function, and can be used in VB or VBS. A Quick Breakdown, is that a function returns a value, so it would be something like this:

whatever.vbs:

Dim Secure as string

UnSecure = inputbox("Enter Your Password")
Secure = passGen(UnSecure)
msgbox "Your Secure Password is: " & Secure

WScript.Quit

Function passGen( password As String ) As String
                
                Dim words(26, 3) As String
		Dim strTemp As String
		Dim intRnd As Integer
		Dim result As String
		
                ' /*  Assign Similar Values For 'A' */
		words(0, 0) = "@"
		words(0, 1) = "/\"
		words(0, 2) = "^"
		words(0, 3) = "4"
		
                ' /*  Assign Similar Values For 'Z' */
		words(25, 0) = "Z"
		words(25, 1) = "z"
		words(25, 2) = "2"
		words(25, 3) = "2"
		
		' /*  What you need to do are assign all 
		' the similar of each letter of the alphabet */
		
		Randomize
		
		' /* start generate each character
		' into secure character. */
		
		For i = 1 To Len(password)
		
			' /* store the current character
			' that we try to convert */
			
			strTemp = Mid(password, i, 1)
			
			' // Random similar letter of alphabet
			intRnd = Int(Rnd * 3)
			
			' /* if it is a alphabet then
			' we will replace it with similar string */
			
			If UCase(strTemp) <> LCase(strTemp) Then
			
				' /* start replace similar word into string */
				result = result & words(Asc(UCase(strTemp)) - 65, intRnd)
			Else
				' /* if it isn't a alphabet
				result = result & strTemp
			End If
			
		Next i
		
		' /* return the result
		passGen = result
		
End Function

Don't forget to modify the actual function (because it's not modified here) to contain A - Z characters (above just has A and Z)

Not sure about this but doesnt the Randomize command need to be

Randomize Timer otherwise the same random numbers will be generated?

I've just built an APP in VB6, That has 4 Buttons and 2 listboxes. The buttons are for quitting, clearing the listboxes, and then 1 for randomize without timer, and 1 for randomize with timer. listbox1 contains the result of a randomize without timer, and a for loop from 0 to 20 (21 items), that adds the result of the random seed to listbox1. listbox2 contains the result of a randomize WITH timer, and a for loop from 0 to 20 that adds the result of the random seed gathered with timer added to randomize, to listbox2. I haven't yet gotten a duplicate result.

Randomize will generate different random number everytime ;)

here this is syntax for Randomize

Randomize (Optional Seed)

if you are omitted the seed, the system timer is used for the seed instead :)

Ok, im getting there? do i need to move the first dim down near the rest or shall i move the rest up? from what i was reading i should keep all the declarations of variables together? (or iam i yet again way off target) :-)

also it thows back an error on the first line of i try to run it? even with all the A to Z letters included?

about my previous question, do i need to add the upper and lower case versions of the letters into each letter section of the script for example...

' /* Assign Similar Values For 'B' */
words(1, 0) = "8"
words(1, 1) = "|3"
words(1, 2) = "|}"
words(1, 3) = "B"
words(1, 4) = "b"

or just

' /* Assign Similar Values For 'B' */
words(1, 0) = "8"
words(1, 1) = "|3"
words(1, 2) = "|}"
words(1, 3) = "B"

without the lower case version can i get to the script to recognise the letter it picked was a letter that is either "A, B, Z etc" then to reandomly decide weather it wants to make it upper or lower case?

AS for the ramdomise time anyone else have any ideas on that?

Thanks again for the input everyone, its great seeing something be built upon by everyone to get it to work..

i really appreciate all the input...


randomize question answered......you posted as i asked.... ;)

cheers :)

You can do it that way, but you'll need to change intRnd = Int(Rnd * 3) to 4, and that should work (adding it to the array). So, if you just add the upper and lower case versions to the array, and change the rnd seed between 4 instead of 3, it should work. Just fine for randomly selecting upper and lowercase, or special characters. As for the DIM, you don't even really need it in VBScript, just make your file look like my last post (the one that I responded to your "how to use it" question.)

Ok,

i think i am missing something here...

i get an error when i try and run this code as it is. (with the a to z completed)

the first line throws back an error on line 1 "Dim Secure as string" there must be something wrong with that?

then line 9 "Function passGen( password As String ) As String" there must be something wrong with that.

then this has an error "Dim strTemp As String"

am i way off target here or am i supposed to changed the parts where it says as string, coz these seem to be the bits that fail every time?

another question is "Dim words(26, 3) As String" has 26 as there are 26 letters but they are numbered from 0 to 25 so i presume it still includes all 26 of them and it counts a 0 as a actual number.? if so then why is the 3 a 3? should that not be a 4? and will i have to up the number when i add another letter variable and so on.... also if it says 4 will all the letters have to have the same amount of variables (4) or can they have different amounts of UPTO 4? or will it fail it it comes across a letter with only 3 for example.

Cheers again

If you are running this in VBScript, Instead of actual VB, then you have to remove the as strings. In VBScript, everything that is a data type (every variable, function, sub, return value) is a "variant" data type, and it can not be changed. In regular VB, you can dim X, and X is now a "variant" data type, it's the same as dim x as variant. VBScript only uses variants, it has no knowledge of things such as strings, integers, doubles, etc. If you were to put the exact same code in a VB 6 Program, it would work fine.

I'm not going to go into great detail about Arrays, or multi-dimensional arrays, but you are probably correct, it should most likely be declared from 0 to 25. Also, the number 3 is used, (again starting at 0), because there are 4 different options for the program to choose from to make it a B. I can be 8, |3, |}, and B, count 'em, there's 4 (0 through 3). If you add another one, then the array would have to be 4 (5 items). This line here:

intRnd = Int(Rnd * 3)

Says, give me a random whole number between 0 and 3, so yes, if you choose to change 1 of them to contain 5 different options for the program to choose from, then you will need to modify them all, including the line of code above, along with: Dim words(26, 3), to whatever the number needs to be. Imagine if you only had a couple of them with 4, and a some with 3, and the random function int(rnd * 4) chooses 4. What about the ones with 3? Besides, you can't have a multi-dimensional array with different numbers.... you can't declare the array as some having 3 and some having 4..... but even if you could, you see how that would cause problems?

The Best solution, is that if you want to use 5 items (0 to 4), for the ones that only have 3 options, duplicate one of the options. But B in there as a filler for B, or use |3.... it's ok to have the same values...

Cheers C~

My heads a bit all over the place, Busy day today...

Ok, i removed the strings from the text im pretty sure that there are some other lanauge issues, now it throws back and error in line 202 of "Expected end of statement" that line is the "next i" line?

not sure but i was thinking should this be a if command in vbs then it would go to the next if?

i also ammended all the as strings parts and changed the word count from 26 down to 25 as it runs from 0 to 25 (i think thats right). here is the script without all the a to z's

Dim Secure

UnSecure = inputbox("Enter Your Password")
Secure = passGen(UnSecure)
msgbox "Your Secure Password is: " & Secure

WScript.Quit

Function passGen( password )
                
                Dim words([B]25[/B],3)
		Dim strTemp
		Dim intRnd
		Dim result
                ' /*  What you need to do are assign all 
		' the similar of each letter of the alphabet */
                
                ' /*  Assign Similar Values For 'A' */
		words(0, 0) = "@"
		words(0, 1) = "/\"
		words(0, 2) = "^"
		words(0, 3) = "4"
                words(0, 4) = "a"
		words(0, 5) = "A"
		Randomize
		
		' /* start generate each character
		' into secure character. */
		
		For i = 1 To Len(password)
		
			' /* store the current character
			' that we try to convert */
			
			strTemp = Mid(password, i, 1)
			
			' // Random similar letter of alphabet
			intRnd = Int(Rnd * [B]5[/B])
			
			' /* if it is a alphabet then
			' we will replace it with similar string */
			
			If UCase(strTemp) <> LCase(strTemp) Then
			
				' /* start replace similar word into string */
				result = result & words(Asc(UCase(strTemp)) - 65, intRnd)
			Else
				' /* if it isn't a alphabet
				result = result & strTemp
			End If
			
		Next i
		
		' /* return the result
		passGen = result
		
End Function

Cheers again...

Good, Good, Now, what's wrong with this?

Dim words(25,[B]3[/B])
.
.
.
words(0, 0) = "@"
words(0, 1) = "/\"
words(0, 2) = "^"
words(0, 3) = "4"
[B]words(0, 4) = "a"
words(0, 5) = "A"[/B]

Also, A Lot of people who are used to programming in VB, get a little mixed up when they are using VBScript. Just like you can't use "as string" in a VBScript, you also can't give an identifier for a for loop's next. So, just remove the i after next... and it will run the loop correctly...

There She goes....

Cheers again,

removed the i from the next command and corrected the numbers and it works correctly..

Genious.

Thanks again C~

;)...

and uh, there is 10 character limit on posts!

10 character limit on posts?

Ok i either need some sleep :cheesy: or i am thick as pig s**t. :sad: coz i dont understand what you mean? :rolleyes:

Thanks again though

Well, I was winking at you (;)) and it would not let me post it, because in order to post, you have to have at least 10 characters.....

LMAO....

it makes perfect sense now. How did i not understand that?
Right i tell you what... I'm going to have an early night tonight and try and keep off the computer.. I'll watch a movie or something instead.

Sometimes its better to just walk away and forget everything, I've been mis-understanding the simplest of things latley. Been really busy here at work, think i just need a day or to wind down.

I think i need:
Bath, good dinner, Early night, no pc...

HA. :rolleyes: like that's gonna happen.

Home, Internet, 3am, pass out, wake up late for work, put same clothes (including pants) that i was wearing today.... :cheesy: :lol:

Seriously though Thanks again...

oh but one last question! As you have helped resolve every other question I thought i would see if anyone knew how to create a full blown operating system in VBS that supports plug and play, networking and and is really user friendly with a xp style gui?.....

Build that ya b*******s ;) :lol: :cheesy:

Cheers again guys, much appreciated.... ;)

Phreek

Don't tempt me ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.