The initial version of the phishing site
authorArtem Motchanyi <a.motchanyi@samsung.com>
Tue, 5 Sep 2017 10:40:21 +0000 (13:40 +0300)
committerArtem Motchanyi <a.motchanyi@samsung.com>
Tue, 5 Sep 2017 10:57:58 +0000 (13:57 +0300)
13 files changed:
phishing-site/.gitignore [new file with mode: 0644]
phishing-site/app.js [new file with mode: 0644]
phishing-site/bin/www [new file with mode: 0755]
phishing-site/package.json [new file with mode: 0644]
phishing-site/public/game/game.wgt [new file with mode: 0644]
phishing-site/public/stylesheets/style.css [new file with mode: 0644]
phishing-site/public/stylesheets/style.css.map [new file with mode: 0644]
phishing-site/public/stylesheets/style.scss [new file with mode: 0644]
phishing-site/routes/index.js [new file with mode: 0644]
phishing-site/routes/play.js [new file with mode: 0644]
phishing-site/views/error.pug [new file with mode: 0644]
phishing-site/views/index.pug [new file with mode: 0644]
phishing-site/views/layout.pug [new file with mode: 0644]

diff --git a/phishing-site/.gitignore b/phishing-site/.gitignore
new file mode 100644 (file)
index 0000000..392150b
--- /dev/null
@@ -0,0 +1,30 @@
+# Logs
+logs
+*.log
+
+# Runtime data
+pids
+*.pid
+*.seed
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directory
+# https://docs.npmjs.com/cli/shrinkwrap#caveats
+node_modules
+
+# Debug log from npm
+npm-debug.log
diff --git a/phishing-site/app.js b/phishing-site/app.js
new file mode 100644 (file)
index 0000000..0a5d565
--- /dev/null
@@ -0,0 +1,52 @@
+var express = require('express');
+var path = require('path');
+var favicon = require('serve-favicon');
+var logger = require('morgan');
+var cookieParser = require('cookie-parser');
+var bodyParser = require('body-parser');
+var sassMiddleware = require('node-sass-middleware');
+
+var index = require('./routes/index');
+var play = require('./routes/play');
+
+var app = express();
+
+// view engine setup
+app.set('views', path.join(__dirname, 'views'));
+app.set('view engine', 'pug');
+
+// uncomment after placing your favicon in /public
+//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
+app.use(logger('dev'));
+app.use(bodyParser.json());
+app.use(bodyParser.urlencoded({ extended: false }));
+app.use(cookieParser());
+app.use(sassMiddleware({
+  src: path.join(__dirname, 'public'),
+  dest: path.join(__dirname, 'public'),
+  sourceMap: true
+}));
+app.use(express.static(path.join(__dirname, 'public')));
+
+app.use('/', index);
+app.use('/play', play);
+
+// catch 404 and forward to error handler
+app.use(function(req, res, next) {
+  var err = new Error('Not Found');
+  err.status = 404;
+  next(err);
+});
+
+// error handler
+app.use(function(err, req, res, next) {
+  // set locals, only providing error in development
+  res.locals.message = err.message;
+  res.locals.error = req.app.get('env') === 'development' ? err : {};
+
+  // render the error page
+  res.status(err.status || 500);
+  res.render('error');
+});
+
+module.exports = app;
diff --git a/phishing-site/bin/www b/phishing-site/bin/www
new file mode 100755 (executable)
index 0000000..ef54472
--- /dev/null
@@ -0,0 +1,90 @@
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var app = require('../app');
+var debug = require('debug')('phishing-site:server');
+var http = require('http');
+
+/**
+ * Get port from environment and store in Express.
+ */
+
+var port = normalizePort(process.env.PORT || '3000');
+app.set('port', port);
+
+/**
+ * Create HTTP server.
+ */
+
+var server = http.createServer(app);
+
+/**
+ * Listen on provided port, on all network interfaces.
+ */
+
+server.listen(port);
+server.on('error', onError);
+server.on('listening', onListening);
+
+/**
+ * Normalize a port into a number, string, or false.
+ */
+
+function normalizePort(val) {
+  var port = parseInt(val, 10);
+
+  if (isNaN(port)) {
+    // named pipe
+    return val;
+  }
+
+  if (port >= 0) {
+    // port number
+    return port;
+  }
+
+  return false;
+}
+
+/**
+ * Event listener for HTTP server "error" event.
+ */
+
+function onError(error) {
+  if (error.syscall !== 'listen') {
+    throw error;
+  }
+
+  var bind = typeof port === 'string'
+    ? 'Pipe ' + port
+    : 'Port ' + port;
+
+  // handle specific listen errors with friendly messages
+  switch (error.code) {
+    case 'EACCES':
+      console.error(bind + ' requires elevated privileges');
+      process.exit(1);
+      break;
+    case 'EADDRINUSE':
+      console.error(bind + ' is already in use');
+      process.exit(1);
+      break;
+    default:
+      throw error;
+  }
+}
+
+/**
+ * Event listener for HTTP server "listening" event.
+ */
+
+function onListening() {
+  var addr = server.address();
+  var bind = typeof addr === 'string'
+    ? 'pipe ' + addr
+    : 'port ' + addr.port;
+  debug('Listening on ' + bind);
+}
diff --git a/phishing-site/package.json b/phishing-site/package.json
new file mode 100644 (file)
index 0000000..7af1d1d
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "name": "phishing-site",
+  "version": "0.0.0",
+  "private": true,
+  "scripts": {
+    "start": "node ./bin/www"
+  },
+  "dependencies": {
+    "body-parser": "~1.17.1",
+    "cookie-parser": "~1.4.3",
+    "debug": "~2.6.3",
+    "express": "~4.15.2",
+    "morgan": "~1.8.1",
+    "node-sass-middleware": "0.9.8",
+    "pug": "~2.0.0-beta11",
+    "serve-favicon": "~2.4.2"
+  }
+}
diff --git a/phishing-site/public/game/game.wgt b/phishing-site/public/game/game.wgt
new file mode 100644 (file)
index 0000000..e3b0cd9
Binary files /dev/null and b/phishing-site/public/game/game.wgt differ
diff --git a/phishing-site/public/stylesheets/style.css b/phishing-site/public/stylesheets/style.css
new file mode 100644 (file)
index 0000000..a05bd0e
--- /dev/null
@@ -0,0 +1,17 @@
+body {
+  font: 24pt "Lucida Grande", Helvetica, Arial, sans-serif;
+  float: left;
+  width: 100%; }
+
+.index {
+  margin-left: auto;
+  margin-right: auto;
+  padding-top: 20%;
+  width: 50%; }
+  .index span,
+  .index a {
+    float: left;
+    text-align: center;
+    width: 100%; }
+
+/*# sourceMappingURL=style.css.map */
\ No newline at end of file
diff --git a/phishing-site/public/stylesheets/style.css.map b/phishing-site/public/stylesheets/style.css.map
new file mode 100644 (file)
index 0000000..fba3684
--- /dev/null
@@ -0,0 +1,9 @@
+{
+       "version": 3,
+       "file": "style.css",
+       "sources": [
+               "style.scss"
+       ],
+       "mappings": "AAAA,AAAA,IAAI,CAAC;EACH,IAAI,EAAE,kDAAmD;EACzD,KAAK,EAAE,IAAK;EACZ,KAAK,EAAE,IAAK,GACb;;AAED,AAAA,MAAM,CAAC;EACL,WAAW,EAAE,IAAK;EAClB,YAAY,EAAE,IAAK;EACnB,WAAW,EAAE,GAAI;EACjB,KAAK,EAAE,GAAI,GAOZ;EAXD,AAKE,MALI,CAKJ,IAAI;EALN,AAME,MANI,CAMJ,CAAC,CAAC;IACA,KAAK,EAAE,IAAK;IACZ,UAAU,EAAE,MAAO;IACnB,KAAK,EAAE,IAAK,GACb",
+       "names": []
+}
\ No newline at end of file
diff --git a/phishing-site/public/stylesheets/style.scss b/phishing-site/public/stylesheets/style.scss
new file mode 100644 (file)
index 0000000..296bc95
--- /dev/null
@@ -0,0 +1,18 @@
+body {
+  font: 24pt "Lucida Grande", Helvetica, Arial, sans-serif;
+  float: left;
+  width: 100%;
+}
+
+.index {
+  margin-left: auto;
+  margin-right: auto;
+  padding-top: 20%;
+  width: 50%;
+  span,
+  a {
+    float: left;
+    text-align: center;
+    width: 100%;
+  }
+}
diff --git a/phishing-site/routes/index.js b/phishing-site/routes/index.js
new file mode 100644 (file)
index 0000000..d9e6967
--- /dev/null
@@ -0,0 +1,9 @@
+var express = require('express');
+var router = express.Router();
+
+/* GET home page. */
+router.get('/', function(req, res, next) {
+  res.render('index', { title: 'The best game ever' });
+});
+
+module.exports = router;
diff --git a/phishing-site/routes/play.js b/phishing-site/routes/play.js
new file mode 100644 (file)
index 0000000..b09f339
--- /dev/null
@@ -0,0 +1,27 @@
+var express = require('express');
+var path = require('path');
+var router = express.Router();
+
+/* Download page. */
+router.get('/', function(req, res, next) {
+  var fileName = "game.wgt";
+
+  var options = {
+    root: path.join(__dirname, '../public/game'),
+    headers: {
+        'x-timestamp': Date.now(),
+        'x-sent': true,
+        'Content-disposition': 'attachment; filename=' + fileName
+    }
+  };
+
+  res.sendFile(fileName, options, function (err) {
+    if (err) {
+      next(err);
+    } else {
+      console.log('Sent:', fileName);
+    }
+  });
+});
+
+module.exports = router;
diff --git a/phishing-site/views/error.pug b/phishing-site/views/error.pug
new file mode 100644 (file)
index 0000000..51ec12c
--- /dev/null
@@ -0,0 +1,6 @@
+extends layout
+
+block content
+  h1= message
+  h2= error.status
+  pre #{error.stack}
diff --git a/phishing-site/views/index.pug b/phishing-site/views/index.pug
new file mode 100644 (file)
index 0000000..e031dba
--- /dev/null
@@ -0,0 +1,6 @@
+extends layout
+
+block content
+  div(class='index')
+    span= title
+    a(class='button' href='/play') Play now
diff --git a/phishing-site/views/layout.pug b/phishing-site/views/layout.pug
new file mode 100644 (file)
index 0000000..15af079
--- /dev/null
@@ -0,0 +1,7 @@
+doctype html
+html
+  head
+    title= title
+    link(rel='stylesheet', href='/stylesheets/style.css')
+  body
+    block content