new password generator

This commit is contained in:
Martin Donnelly 2015-08-19 11:20:23 +01:00
parent b08983e7f7
commit 88686cdc5d
6 changed files with 712 additions and 377 deletions

109
app/libs/password.js Normal file
View File

@ -0,0 +1,109 @@
Array.prototype.random = function () {
return this[Math.floor((Math.random()*this.length))];
};
var alpha = ['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','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'];
var whitespace = ['.','~','#','!','$','+','-','+'];
var numbers = ['0','1','2','3','4','5','6','7','8','9'];
var left = ["Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Michigan",
"Minnesota",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Palau",
"Pennsylvania",
"Puerto Rico",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virgin Islands",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming",
"Glasgow",
"Inverness",
"Edinburgh",
"Dumbarton",
"Balloch",
"Renton",
"Helensburgh",
"Cardross",
"Dundee",
"Aberdeen",
"Paisley",
"Hamilton",
"Greenock",
"Falkirk",
"Irvine",
"Clydebank",
"Renfrew",
"Barrhead",
"Erskine",
"London",
"Hammersmith",
"Islington"
];
var right = ['Aganju', 'Cygni', 'Akeron', 'Antares', 'Aragoth', 'Arduinne', 'Ardus', 'Aquitaine', 'Carpenter', 'Beta Hydri', 'Cooper', 'Dahin', 'Capella', 'Endriago', 'Gallina', 'Fenris', 'Freya', 'Glenn', 'Grissom', 'Tau Ceti', 'Jotunheim', 'Kailaasa', 'Lagarto', 'Muspelheim', 'Nifleheim', 'Odin Rex', 'Primus', 'Vega', 'Ragnarok', 'Shepard', 'Slayton', 'Tarsis', 'Mercury', 'Venus', 'Mars', 'Earth', 'Terra', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Europa', 'Ganymede', 'Callisto', 'Titan', 'Juno', 'Eridanus', 'Cassiopeia', 'Scorpius', 'Crux', 'Cancer', 'Taurus', 'Lyra', 'Andromeda', 'Virgo', 'Aquarius', 'Cygnus', 'Corvus', 'Taurus', 'Draco', 'Perseus', 'Pegasus', 'Gemini', 'Columbia', 'Bootes', 'Orion', 'Deneb'];
var numberCluster = function() {
return numbers.random() + numbers.random() + numbers.random();
};
var randomAmount = function(i) {
var str='';
for (var t=0;t<i;t++) {
str = str + alpha.random();
}
return str;
};
var str = left.random() + ' ' + right.random() + ' ' + numberCluster() + ' ' + numberCluster() ;
str = str.split(' ').join(whitespace.random());
console.log(str);
str = randomAmount(10);
console.log(str);

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<title>Slack</title>
<!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> -->
@ -24,7 +25,24 @@
padding: 0;
}
body, ul, ol, dl, h1, h2, h3, h4, h5, h6, td, th, caption, pre, p, blockquote, input, textarea {
body,
ul,
ol,
dl,
h1,
h2,
h3,
h4,
h5,
h6,
td,
th,
caption,
pre,
p,
blockquote,
input,
textarea {
font: .9em 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
color: #333;
}
@ -39,14 +57,20 @@
color: #666;
}
h1, h2, h3, h4, h5, h6 {
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Helvetica Neue', Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
color: #FFF;
margin: 0;
padding: 9px 0;
}
h1 a, h1 a:visited {
h1 a,
h1 a:visited {
color: #EEE;
}
@ -128,7 +152,8 @@
padding-left: 10px;
}
a:hover, .red {
a:hover,
.red {
color: #C00;
}
@ -138,7 +163,8 @@
background-color: #ffffff;
}
#btc, #fx {
#btc,
#fx {
font-size: 75%;
}
@ -154,47 +180,142 @@
color: #000000;
}
s0 {border: solid 1px rgb(0,128,0);}
s1 {border: solid 1px rgb(4,124,0);}
s2 {border: solid 1px rgb(8,120,0);}
s3 {border: solid 1px rgb(16,116,0);}
s4 {border: solid 1px rgb(20,112,0);}
s5 {border: solid 1px rgb(24,108,0);}
s6 {border: solid 1px rgb(28,104,0);}
s7 {border: solid 1px rgb(32,100,0);}
s8 {border: solid 1px rgb(36,96,0);}
s9 {border: solid 1px rgb(40,92,0);}
s10 {border: solid 1px rgb(44,88,0);}
s11 {border: solid 1px rgb(48,84,0);}
s12 {border: solid 1px rgb(52,80,0);}
s13 {border: solid 1px rgb(56,76,0);}
s14 {border: solid 1px rgb(60,72,0);}
s15 {border: solid 1px rgb(64,68,0);}
s16 {border: solid 1px rgb(68,64,0);}
s17 {border: solid 1px rgb(72,60,0);}
s18 {border: solid 1px rgb(76,56,0);}
s19 {border: solid 1px rgb(80,52,0);}
s20 {border: solid 1px rgb(84,48,0);}
s21 {border: solid 1px rgb(88,44,0);}
s22 {border: solid 1px rgb(92,40,0);}
s23 {border: solid 1px rgb(96,36,0);}
s24 {border: solid 1px rgb(100,32,0);}
s25 {border: solid 1px rgb(104,28,0);}
s26 {border: solid 1px rgb(108,26,0);}
s27 {border: solid 1px rgb(112,22,0);}
s28 {border: solid 1px rgb(116,18,0);}
s29 {border: solid 1px rgb(120,12,0);}
s30 {border: solid 1px rgb(124,8,0);}
s31 {border: solid 1px rgb(128,4,0);}
s32 {border: solid 1px rgb(128,0,0);}
s0 {
border: solid 1px rgb(0, 128, 0);
}
s1 {
border: solid 1px rgb(4, 124, 0);
}
s2 {
border: solid 1px rgb(8, 120, 0);
}
s3 {
border: solid 1px rgb(16, 116, 0);
}
s4 {
border: solid 1px rgb(20, 112, 0);
}
s5 {
border: solid 1px rgb(24, 108, 0);
}
s6 {
border: solid 1px rgb(28, 104, 0);
}
s7 {
border: solid 1px rgb(32, 100, 0);
}
s8 {
border: solid 1px rgb(36, 96, 0);
}
s9 {
border: solid 1px rgb(40, 92, 0);
}
s10 {
border: solid 1px rgb(44, 88, 0);
}
s11 {
border: solid 1px rgb(48, 84, 0);
}
s12 {
border: solid 1px rgb(52, 80, 0);
}
s13 {
border: solid 1px rgb(56, 76, 0);
}
s14 {
border: solid 1px rgb(60, 72, 0);
}
s15 {
border: solid 1px rgb(64, 68, 0);
}
s16 {
border: solid 1px rgb(68, 64, 0);
}
s17 {
border: solid 1px rgb(72, 60, 0);
}
s18 {
border: solid 1px rgb(76, 56, 0);
}
s19 {
border: solid 1px rgb(80, 52, 0);
}
s20 {
border: solid 1px rgb(84, 48, 0);
}
s21 {
border: solid 1px rgb(88, 44, 0);
}
s22 {
border: solid 1px rgb(92, 40, 0);
}
s23 {
border: solid 1px rgb(96, 36, 0);
}
s24 {
border: solid 1px rgb(100, 32, 0);
}
s25 {
border: solid 1px rgb(104, 28, 0);
}
s26 {
border: solid 1px rgb(108, 26, 0);
}
s27 {
border: solid 1px rgb(112, 22, 0);
}
s28 {
border: solid 1px rgb(116, 18, 0);
}
s29 {
border: solid 1px rgb(120, 12, 0);
}
s30 {
border: solid 1px rgb(124, 8, 0);
}
s31 {
border: solid 1px rgb(128, 4, 0);
}
s32 {
border: solid 1px rgb(128, 0, 0);
}
</style>
</head>
<body>
<div class="container">
<div class="container">
<h1 class="title">Slack - I have plenty of talent and vision I just don't give a damn</h1>
<div>
@ -254,8 +375,8 @@
<li><a href="https://howsecureismypassword.net/">Password Checker</a></li>
<li><a href="https://archive.today">Archive Today</a></li>
<li><a href="http://staticmapmaker.com/google/">Static Map Generator</a></li>
<li><a href="https://httpbin.org/">AJAX Endpoints</a></li>
<li><a href="https://tools.bartlweb.net/webssh/">WebSSH</a></li>
<li><a href="https://httpbin.org/">AJAX Endpoints</a></li>
<li><a href="https://tools.bartlweb.net/webssh/">WebSSH</a></li>
</ul>
</td>
<td>
@ -274,9 +395,8 @@
<li><a href="http://bitminter.com/">Bitminter</a></li>
<li><a href="http://preev.com/">BTC Exchange Rate</a></li>
<li><a href="http://www.silvrtree.co.uk/watch.html">CFT Watcher</a>
<span style="cursor: pointer;"
onclick="popitoutSmall('http://www.silvrtree.co.uk/watch.html');"><img
src="gfx/popout.png"></span>
<span style="cursor: pointer;" onclick="popitoutSmall('http://www.silvrtree.co.uk/watch.html');"><img
src="gfx/popout.png" width='10' height="10"></span>
</li>
</ul>
</td>
@ -289,7 +409,9 @@
<tr>
<td>
<!-- Package Tracking -->
<ul><li><a href="http://m.ups.com/">UPS</a></li></ul>
<ul>
<li><a href="http://m.ups.com/">UPS</a></li>
</ul>
</td>
<td>
<!-- Weather Reports -->
@ -333,9 +455,9 @@
<li>
<a href="http://www.bordersweather.co.uk/wxlightning.php">Borders Lightning</a>
</li>
<li><a href='http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=map&lang=en'>Best Live Lightning</a></li>
<li><a href='http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=map&lang=en'>Best Live Lightning</a></li>
<li><a href="http://www.madpaddler.net/wxais.php">Ships</a></li>
<li><a href='http://www.raintoday.co.uk/'>Rain Today</a></li>
<li><a href='http://www.raintoday.co.uk/'>Rain Today</a></li>
</ul>
</td>
<td>
@ -415,21 +537,17 @@
news</a>
</li>
<li>
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/DBE/WES/To?ar=true">DBE->WES</a>
/
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/DBE/WES/To?ar=true">DBE->WES</a> /
<a href="http://www.traintime.uk/index.php?view=desktop&from=DBE&to=WES">Advanced</a>
</li>
<li>
<a href="http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true">WES->DBE</a>
<span style="cursor: pointer;"
onclick="popitout('http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true#skip-content-hold');"><img
src="gfx/popout.png"></span>
/
<span style="cursor: pointer;" onclick="popitout('http://ojp.nationalrail.co.uk/service/ldbboard/dep/WES/DBE/To?ar=true#skip-content-hold');"><img
src="gfx/popout.png" width='10' height="10"></span> /
<a href="http://www.traintime.uk/index.php?view=desktop&from=WES&to=DBE">Advanced</a>
</li>
<li>
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=DBE">DBE Board</a>
/
<a href="http://www.livedepartureboards.co.uk/ldb/summary.aspx?T=DBE">DBE Board</a> /
<a href="http://www.stationboard.uk/index.php?view=desktop&station1=DBE&direction=departures">Advanced</a>
</li>
<li>
@ -537,8 +655,9 @@
</td>
</tr>
</table>
</div>
<div id="container"></div>
</div>
<div id="container"></div>
</body>
<script src="app.js"></script>
</html>

0
app/password.html Normal file
View File

14
app/password.new.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<title>Password Generator</title>
<meta name="Author" content=""/>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
</head>
<body>
<script src='libs/password.js'></script>
</body>
</html>

92
lib/password.js Normal file
View File

@ -0,0 +1,92 @@
var http = require('http');
Array.prototype.random = function() {
return this[Math.floor((Math.random() * this.length))];
};
var alpha = ['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', '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'];
var whitespace = ['.', '~', '#', '!', '$', '+', '-', '+'];
var numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
var left = ["Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Michigan",
"Minnesota",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Palau",
"Pennsylvania",
"Puerto Rico",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virgin Islands",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming",
"Glasgow",
"Inverness",
"Edinburgh",
"Dumbarton",
"Balloch",
"Renton",
"Helensburgh",
"Cardross",
"Dundee",
"Aberdeen",
"Paisley",
"Hamilton",
"Greenock",
"Falkirk",
"Irvine",
"Clydebank",
"Renfrew",
"Barrhead",
"Erskine",
"London",
"Hammersmith",
"Islington",
"Silver","Black","Yellow","Purple"
];
var right = ['Aganju', 'Cygni', 'Akeron', 'Antares', 'Aragoth', 'Arduinne', 'Ardus', 'Aquitaine', 'Carpenter', 'Beta Hydri', 'Cooper', 'Dahin', 'Capella', 'Endriago', 'Gallina', 'Fenris', 'Freya', 'Glenn', 'Grissom', 'Tau Ceti', 'Jotunheim', 'Kailaasa', 'Lagarto', 'Muspelheim', 'Nifleheim', 'Odin Rex', 'Primus', 'Vega', 'Ragnarok', 'Shepard', 'Slayton', 'Tarsis', 'Mercury', 'Venus', 'Mars', 'Earth', 'Terra', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Europa', 'Ganymede', 'Callisto', 'Titan', 'Juno', 'Eridanus', 'Cassiopeia', 'Scorpius', 'Crux', 'Cancer', 'Taurus', 'Lyra', 'Andromeda', 'Virgo', 'Aquarius', 'Cygnus', 'Corvus', 'Taurus', 'Draco', 'Perseus', 'Pegasus', 'Gemini', 'Columbia', 'Bootes', 'Orion', 'Deneb'];
module.exports = {
}

View File

@ -1,4 +1,4 @@
var express = require('express'), path = require('path'), http = require('http'), fx = require('./lib/fx'), btc = require('./lib/btc'), train = require('./lib/train')
var express = require('express'), path = require('path'), http = require('http'), fx = require('./lib/fx'), btc = require('./lib/btc'), train = require('./lib/train'), password = require('./lib/password')
//train = require('lib/train')
/* ,submit = require('./routes/mongo/submit') */
;
@ -30,10 +30,11 @@ app.configure(function () {
app.use('/fx', fx.doFx);
app.use('/dbeglq', train.dbe_glq);
app.use('/glqdbe', train.glq_dbe);
app.use('/gettrains', train.getTrainTimes);
app.use('/generate', password.generate);
app.use('/lot', function (req, res) {
var pg = require('pg');