xxxxxxxxxx
157
//Anti-Surveillance Tool for inclusive event organizing on social media
//Designed to be a modular tool for obfuscating event details from social media posts to prevent those who want to suppress the events from happening and the social media platform data scraping while still being able to use social media platforms to spread the information with a specific guest list or other centralization of attendees information. I envision this as a tool for helping organize underground parties and protests, but it really only exists as a thought exercise, as this in it's current form is not too difficult of a nut to crack
//fadeOutTimer logic from this timer script from Xin Xin https://editor.p5js.org/xinxin/sketches/T3XP02g7X
let counter = 0;
let puzzleNum = 3;
let maxDistance = 500;
let buttonVar;
let submitButton;
let oldTime;
let newTime;
let selfDestruct = false;
let hint = 'When the fading light of the sun lights up the evening sky with the full spectrum of light';
let passPhrase = 'sunset';
let userPhraseGuess = '';
let latitude = '40.713598';
let longitude = '-73.972165';
let eventTime = '22.10.20 18:00';
let eventDetails = 'B.Y.O.B.';
function setup() {
createCanvas(600,600);
buttonVar = 0;
}
function draw() {
background(255);
if (counter === 0) {
drawButtonPuzzle();
} else if (counter === 1) {
drawPassPhrasePuzzle();
} else if (counter === 2) {
revealMessage();
} else {
counter = 0;
}
}
function drawButtonPuzzle() {
//puzzle code goes here, including calling other functions needed to draw it
//after puzzle is complete, set counter to 1. This will trigger the next phase.
//keyPressed();
rectMode(CENTER);
ellipseMode(CENTER);
for (let x = 0; x < 30; x++) {
for (let y = 0; y < 30; y++) {
if (x % 2 == 0 && y % 2 == 0 || x % 2 == 1 && y % 2 == 1) {
fill(235);
} else {
fill(255);
}
rect(x * 50,y * 50,width / 12,height / 12);
rect(x * 50,y * 50,width / 15,height / 15);
rect(x * 50,y * 50,width / 20,height / 20);
}
}
push();
strokeWeight(2);
fill(255);
blendMode(DIFFERENCE);
circle(mouseX,mouseY,60);
pop();
if(!buttonVar) {
button = createButton(' ');
button.size(30.5,30.5);
button.position(285,85);
buttonVar = 1;
button.mousePressed(updateCounter);
}
}
function drawPassPhrasePuzzle() {
//puzzle code goes here, including calling other functions needed to draw it
//after puzzle is complete, set counter to 2. This will trigger the next phase.
textAlign(CENTER);
blendMode(BLEND);
fill(0);
text(hint,300,300);
if(buttonVar) {
input = createInput();
input.position(200,310);
submitButton = createButton('Submit');
submitButton.size(70,25);
submitButton.position(350,309);
buttonVar = 0;
submitButton.mousePressed(checkAnswer);
}
}
function revealMessage() {
//draws hidden Message
text(latitude,300,275);
text(longitude,300,295);
text(eventTime,300,315);
text(eventDetails,300,335);
fadeOutTimer();
}
function updateCounter() {
if (counter < puzzleNum) {
counter++;
} else {
counter = 0;
}
//console.log('counter is at: ' + counter);
if (counter === 1) {
button.hide();
} else {
input.hide();
submitButton.hide();
}
}
function checkAnswer() {
userPhraseGuess = input.value();
if (userPhraseGuess === passPhrase){
updateCounter();
} else {
input.value('');
}
}
function fadeOutTimer() {
if (selfDestruct){
newTime = millis() - oldTime;
rect(300,-300,newTime/20,newTime/20);
rect(900,300,newTime/20,newTime/20);
rect(300,900,newTime/20,newTime/20);
rect(-300,300,newTime/20,newTime/20);
if (newTime > 24500) {
push();
fill(255);
text('Goodbye :)',300,300);
pop();
}
if (newTime > 26000) {
clear();
}
} else {
oldTime = millis();
}
selfDestruct = true;
}