diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..8c72466
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,38 @@
+module.exports = function(grunt) {
+
+ grunt.initConfig({
+
+ jshint: {
+ options: {
+ curly: true,
+ eqeqeq: true,
+ eqnull: true,
+ browser: true,
+ undef: false,
+ sub: true,
+ globals: {
+ jQuery: true
+ },
+ },
+
+ files: {
+ src: ['headless/*.js', 'chrome extension/*.js', 'chrome extension/*/*.js']
+ },
+ },
+
+ jsonlint: {
+ sample: {
+ src: [ 'headless/json/*.json' ]
+ }
+ },
+
+ });
+
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-jsonlint');
+
+ grunt.registerTask('default', [
+ 'jsonlint',
+ 'jshint'
+ ]);
+};
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..03d88f3
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+Copyright 2013 Discountrobot
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b661662
--- /dev/null
+++ b/README.md
@@ -0,0 +1,64 @@
+## Headless
+`Headless` is a project demonstrating how easily the verification scheme of [`eovendo.com`](http://eovendo.com) can be foiled. The project both includes a bot based upon [`phantomjs`](http://phantomjs.org/) utilizing multi-threading, dispatched by python. And a [`chrome extension`](chrome extension) for a more visualized demonstration.
+
+#### Features
+1. Minimal bandwidth usage:
+ (currently using less than 600kb pr. account)
+2. Proxies: Taking advantage of the native proxy flag in [`phantomjs`](http://phantomjs.org/) the python dispatcher can take a list of proxy servers and will randomly assign a proxy to each Thread.
+3. currently undetectable, given the data-model sent between the client and the server (more on this in the [verification scheme](#verification-scheme) section .
+
+#### Limitations
+1. There are known memory leaks in [`phantomjs`](https://code.google.com/p/phantomjs/issues/detail?id=979), so if you're running the script on something small, say a raspberry pi, then remember to make a swap file to prevent hanging.
+
+### Verification Scheme
+The verification scheme for correctly watching a commercial on [`eovendo.com`](http://eovendo.com) is easily reverse engineered given the insight in the javaScript API, and the console output.
+
+1. javaScript API: [`adplay.js`](headless/docs/adplay.js)
+2. structure of a sample "GET" request: [`postback.json`](headless/docs/postback.json).
+
+#### Time validation
+Verification happens through validating the time and that it has changed correctly.
+We can describe this scheme with a formula.
+`R` = requestTime = the time of the request
+`S` = startTime = the time stamp given when starting the commercial
+`E` = endTIme = the time stamp given when finishing the commercial
+`mediaDuration` = the runtime of the commercial
+
+we describe the formula as `R < (S + mediaDuration) <= E` which can also be visualized as:
+
+
+
+
+
+#### Possible pesudo server code
+Below is a pseudo snippet of what could be the validating part of the server, written in javaScript syntax.
+
+```javascript
+if (
+ // timestamp
+ client.RequestTime === server.RequestTime &&
+ client.StartTime > client.RequestTime &&
+ client.EndTime >= client.SartTime + server.Campaign.MediaDuration &&
+
+ // values that needs to be set accordingly
+ client.AdStatus.value === 'Completed' &&
+ client.Campaign.IsViewed === true &&
+
+ // other values that needs to be set (correct by default)
+ client.id === server.id &&
+ client.UserId === server.UserId &&
+ client.Tag === server.Tag &&
+ client.RequestIpAddress === server.RequestIpAddress &&
+ client.Campaign.CampaignId === server.Campaign.CampaignId &&
+) {
+ return true;
+}
+```
+### Installation
+#### Chrome Extension
+read more here: [`chrome extension`](chrome extension)
+#### Phantomjs bot
+read more here: [`headless.js`](headless)
+
+### License
+[MIT](LICENSE)
diff --git a/chrome extension/README.md b/chrome extension/README.md
new file mode 100644
index 0000000..da4c55c
--- /dev/null
+++ b/chrome extension/README.md
@@ -0,0 +1,21 @@
+### Demonstration
+A video demonstration can be found on youtube
+
+
+### Features
+1. Generation of random Danish names, passwords and emails on the sign-up page.
+
+### Sign up parameters.
+To extend the generated data at the sign up page, edit the respective arrays in [`signup.js`](scripts/signup.js)
+
+### Settings
+There are currently 2 settings for the chrome extension
+
+1. temporarily activate/deactivate the extension
+2. Run automatically on load
+
+![settings picture](http://i.imgur.com/jm9uHBB.png)
+
+### Installation
+Install by adding the folder as an "unpacked extension" in the `chrome://extensions` tab
\ No newline at end of file
diff --git a/chrome extension/background.js b/chrome extension/background.js
new file mode 100644
index 0000000..679ce46
--- /dev/null
+++ b/chrome extension/background.js
@@ -0,0 +1,15 @@
+// add the page action, if we're on the right domain.
+chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
+ if (tab.url.indexOf('eovendo.com') !== -1) {
+ chrome.pageAction.show(tabId);
+ }
+});
+
+// return localStorage data upon request.
+chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
+ if (request.method === "getLocalStorage") {
+ sendResponse({data: localStorage[request.key]});
+ } else {
+ sendResponse({});
+ }
+});
\ No newline at end of file
diff --git a/chrome extension/icon-24.png b/chrome extension/icon-24.png
new file mode 100644
index 0000000..0103327
Binary files /dev/null and b/chrome extension/icon-24.png differ
diff --git a/chrome extension/manifest.json b/chrome extension/manifest.json
new file mode 100644
index 0000000..d7484c8
--- /dev/null
+++ b/chrome extension/manifest.json
@@ -0,0 +1,37 @@
+{
+ "name": "EovendoHeadless",
+ "version": "0.6",
+ "manifest_version": 2,
+ "icons": {
+ "48" : "icon-24.png",
+ "128" : "icon-24.png"
+ },
+ "page_action": {
+ "default_name": "EovendoHeadless",
+ "default_icon": "icon-24.png",
+ "default_popup": "popup.html"
+ },
+ "permissions" : [
+ "tabs"
+ ],
+ "background" : {
+ "scripts": ["background.js"]
+ },
+ "content_scripts": [
+ {
+ "matches": ["*://www.eovendo.com/Signup"],
+ "js": ["scripts/signup.js"],
+ "run_at": "document_idle"
+ },
+ {
+ "matches": ["*://www.eovendo.com/Home"],
+ "js": ["scripts/home.js"],
+ "run_at": "document_idle"
+ },
+ {
+ "matches": ["*://www.eovendo.com/UserData"],
+ "js": ["scripts/userData.js"],
+ "run_at": "document_idle"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/chrome extension/popup.html b/chrome extension/popup.html
new file mode 100644
index 0000000..e247cad
--- /dev/null
+++ b/chrome extension/popup.html
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chrome extension/popup.js b/chrome extension/popup.js
new file mode 100644
index 0000000..23e0907
--- /dev/null
+++ b/chrome extension/popup.js
@@ -0,0 +1,37 @@
+chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
+ if (request.method === "getLocalStorage") {
+ sendResponse({data: localStorage[request.key]});
+ }
+ else {
+ sendResponse({});
+ }
+});
+
+window.onload = function(){
+
+ var $evhActive = document.querySelector('#evhActive');
+ var $evhAutomatic = document.querySelector('#evhAutomatic');
+ var evh = JSON.parse(localStorage['evheadless'] || "{}");
+
+ if(evh.active) { $evhActive.click(); }
+ if(evh.automate) { $evhAutomatic.click(); }
+
+ $evhActive.addEventListener('change', function(){
+ evh.active = this.checked;
+ localStorage['evheadless'] = JSON.stringify(evh);
+
+ chrome.tabs.getSelected(null, function(tab) {
+ chrome.tabs.reload(tab.id);
+ });
+ });
+
+ $evhAutomatic.addEventListener('change', function(){
+ evh.automate = this.checked;
+ localStorage['evheadless'] = JSON.stringify(evh);
+
+ chrome.tabs.getSelected(null, function(tab) {
+ chrome.tabs.reload(tab.id);
+ });
+ });
+
+};
diff --git a/chrome extension/scripts/home.js b/chrome extension/scripts/home.js
new file mode 100644
index 0000000..9e02362
--- /dev/null
+++ b/chrome extension/scripts/home.js
@@ -0,0 +1,186 @@
+home = function() {
+
+ evhStop = false;
+
+ getMoney = function () {
+
+ $goPro.css({'opacity': '0.5'}).prop('onclick', null);
+
+ this.playCoinSound = function() {
+ var sound = document.createElement('audio');
+ sound.setAttribute("type", "audio/ogg");
+ sound.setAttribute("src","data:audio/mpeg;base64, SUQzAwAAAAAHdlRDT04AAAANAAAB//5PAHQAaABlAHIAR0VPQgAAACYAAAEAAAD//lMAZgBNAGEAcgBrAGUAcgBzAAAADAAAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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"initializing ...";
+
+ var totalAds = parseInt($('#spnTotalAds').text()),
+ adsLeft = totalAds - parseInt($('#spnWatchedAds').text()),
+ balance = parseFloat($('#lblBalance').text().replace(',','.'));
+
+ this.done = function() {
+ document.title = "Done! balance: " + balance + 'kr,-';
+ $overlay.fadeOut();
+ document.dispatchEvent(new Event('adPlayCompletedEvent'));
+ };
+
+ this.run = function() {
+
+ $.ajax({
+ type: "GET",
+ url: "/api/adblockapi",
+ dataType: "json"
+ }).done(function(abm){
+
+ // the returned data block will be null if no ads are left
+ // we'll end the script that is the case.
+ if (!abm) {
+
+ done();
+ return false;
+
+ }
+
+ // these are the values required for verification
+ abm.Campaign.isViewed = true;
+ abm.AdStatus.value = "Completed";
+ // abm.StartTime > abm.RequestTime
+ abm.StartTime = abm.Campaign.StartTime = (new Date()).toISOString();
+
+ var randomEndTime = Math.round(Math.random() * (10 - 2) + 2),
+ countDown = abm.Campaign.MediaDuration + randomEndTime,
+ titleTimer = setInterval(function(){
+
+ if (countDown <= 1) { clearInterval(titleTimer); }
+
+ var msg = 'Ad ' + (totalAds - adsLeft) + '/' + totalAds + ' has ' + countDown + "s left ..";
+ document.title = msg;
+ $info.text(msg);
+
+ countDown --;
+
+ }, 1000);
+
+ var timeout = setTimeout(function(){
+ // abm.EndTime >= abm.SartTime + abm.Campaign.MediaDuration
+ abm.EndTime = abm.Campaign.EndTime = (new Date()).toISOString();
+
+ // post the updated abm object.
+ $.ajax({
+ type: "POST",
+ url: "/api/adblockapi",
+ data: JSON.stringify(abm),
+ contentType: "application/json",
+ dataType: "json"
+ }).done(function(){
+ adsLeft --;
+ playCoinSound();
+ updateUserBalance();
+ checkAdStatus();
+ $('#lblBalance').text(balance);
+ run(); // recursive step
+ });
+
+ }, (countDown) * 1000);
+
+ var stopEvh = setInterval(function() {
+ if (evhStop) {
+
+ clearTimeout(timeout);
+ clearInterval(titleTimer);
+ done();
+
+ }
+ });
+
+ });
+ };
+
+ this.run();
+
+ };
+
+ $('#popupReferrerClose').click();
+
+
+ var $overlay = $('')
+ .css({
+ 'width': $(window).width(),
+ 'height': $(window).height(),
+ 'zIndex': 10000,
+ 'background': 'rgba(0,0,0,0.5)',
+ 'position': 'absolute',
+ 'top': 0,
+ 'transition': 'background-color 0.5s ease'
+ })
+ .appendTo('body');
+
+ var $handler = $('