-
Notifications
You must be signed in to change notification settings - Fork 26
/
Service Desk Password Generator (strong).html
182 lines (148 loc) · 6.34 KB
/
Service Desk Password Generator (strong).html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Random Password Generator</title>
<script type="text/javascript">
<!--
/*
Simple Password generator.
This application will generate strong random passwords in a limited form for
use primarily as a password reset tool used by service desk agents.
Written by Dominic White <[email protected]>
http://singe.za.net/
The code to generate the random passwords is copywrite Bryan Harrington.
The code to translate into the Nato phonetic alphabet is copywrite L. Bower
and is subject to the terms of the GPL.
*/
function doWork()
{
//Check for compatible browser version
if (parseInt(navigator.appVersion) <= 3) {
alert("Sorry this only works in 4.0 browsers");
return true;
}
//Generate password and phonetic spelling
var Password = GeneratePassword();
document.getElementById('passForm').passField.value = Password
document.getElementById('passForm').passPhonetic.value = makePhonetic();
//Select and focus the new password
document.getElementById('passForm').passField.focus();
document.getElementById('passForm').passField.select();
//In IE copy this to the clipboard
if (window.clipboardData) {
var clipboard = document.selection.createRange();
clipboard.execCommand("Copy");
alert('New password "'+document.getElementById('passForm').passField.value+'" copied to clipboard.');
} else {
alert('New password could not be copied to clipboard, please manually copy/paste it.');
}
return true;
}
function GeneratePassword()
{
//Set variables
var length = 6;
var sPassword = "";
var noSpecial = true;
//Generate password
var i = 0;
for (i = 0; i < length; i++) {
numI = getRandomNum();
if (noSpecial) {
while (checkSpecial(numI)) {
numI = getRandomNum();
}
}
sPassword = sPassword + String.fromCharCode(numI);
}
return sPassword;
}
function getRandomNum()
{
// between 0 - 1
var rndNum = Math.random()
// rndNum from 0 - 1000
rndNum = parseInt(rndNum * 1000);
// rndNum from 33 - 127
//rndNum = (rndNum % 94) + 33;
// rndNum from 97 - 122
rndNum = (rndNum % 75) + 48;
return rndNum;
}
function checkSpecial(num) {
if ((num >=58) && (num <=96)) { return true; }
return false;
}
function makePhonetic()
{
var text=document.getElementById('passForm').passField.value;
var phonArray=new Array;
//lowercase
phonArray["a"]="alpha";phonArray["b"]="bravo";phonArray["c"]="charlie";phonArray["d"]="delta";phonArray["e"]="echo";phonArray["f"]="foxtrot";phonArray["g"]="golf";phonArray["h"]="hotel";phonArray["i"]="india";phonArray["j"]="juliet";phonArray["k"]="kilo";phonArray["l"]="lima";phonArray["m"]="mike";phonArray["n"]="november";phonArray["o"]="oscar";phonArray["p"]="papa";phonArray["q"]="quebec";phonArray["r"]="romeo";phonArray["s"]="sierra";phonArray["t"]="tango";phonArray["u"]="uniform";phonArray["v"]="victor";phonArray["w"]="whiskey";phonArray["x"]="x-ray";phonArray["y"]="yankee";phonArray["z"]="zulu";
//uppercase
phonArray["A"]="ALPHA";phonArray["B"]="BRAVO";phonArray["C"]="CHARLIE";phonArray["D"]="DELTA";phonArray["E"]="ECHO";phonArray["F"]="FOXTROT";phonArray["G"]="GOLF";phonArray["H"]="HOTEL";phonArray["I"]="INDIA";phonArray["J"]="JULIET";phonArray["K"]="KILO";phonArray["L"]="LIMA";phonArray["M"]="MIKE";phonArray["N"]="NOVEMBER";phonArray["O"]="OSCAR";phonArray["P"]="PAPA";phonArray["Q"]="QUEBEC";phonArray["R"]="ROMEO";phonArray["S"]="SIERRA";phonArray["T"]="TANGO";phonArray["U"]="UNIFORM";phonArray["V"]="VICTOR";phonArray["W"]="WHISKEY";phonArray["X"]="X-RAY";phonArray["Y"]="YANKEE";phonArray["Z"]="ZULU";
//numbers
phonArray["0"]="zero";phonArray["1"]="one";phonArray["2"]="two";phonArray["3"]="three";phonArray["4"]="four";phonArray["5"]="five";phonArray["6"]="six";phonArray["7"]="seven";phonArray["8"]="eight";phonArray["9"]="niner";
//special characters
phonArray["."]="dot";phonArray["-"]="dash";
var trans="";
var regExp=/[\!@#$%^&*(),=";:\/]/;
var stringCheck=regExp.exec(text);
if(!stringCheck)
{
if(text.length > 0)
{
for(var i=0;i < text.length;i++)
{
var thisChar=text.charAt(i);
trans += phonArray[thisChar] + " ";
}
} else {
trans +="The text field was empty. Please try again.";
}
} else {
trans +="The text you entered contained illegal characters. Please try again.";
}
return trans;
}
-->
</script>
<style media="screen" type="text/css">
.constwidth { font-family: courier, system }
textarea {overflow:auto;}
</style>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" />
</head>
<body>
<div style="float:Right;"><a href="http://www.sensepost.com/" ttle="SensePost" ><img src="SensePost.gif" alt="SensePost Logo" border="0" /></a></div>
<h1><a href="http://www.sensepost.com/" title="SensePost" style="text-decoration:none;" >SensePost</a> Service Desk Password Generator</h1>
<form id="passForm" action="none" >
<table>
<tr><td>
<input style="width:3in;height:1in" type="button" value="Generate Password" onclick="doWork()" /><br />
</td><td rowspan="3">
<h2>Instructions</h2>
<ol>
<li>Click the <i>"Generate Password"</i> button.</li>
<li>The user's new password will appear in the <i>"Password"</i> box.</li>
<li>Paste the new password into the new password field of the tool
being used to change the user's password.</li>
<li>The <i>"Pronunciation"</i> box is what you should read to the user over
the phone.</li>
<li>Ensure the user is forced to change their password at next
logon, if applicable.</li>
</ol>
<b>NB. Do not reset the user's password to something simple, like
"password".</b>
</td></tr><tr><td>
<label>Password: </label><br />
<input class="constwidth" type="text" name="passField" value="" style="width:3in;" readonly="readonly" />
</td></tr><tr><td>
<label>Pronunciation: </label><br />
<textarea name="passPhonetic" style="width:3in;" rows="3" readonly="readonly"></textarea>
</td></tr>
</table>
</form>
</body>
</html>