User:Lidia.Pereira/PTSP/SCPL

From XPUB & Lens-Based wiki

CybersTalk

CybersTalk is a browser plug-in which pops up chat windows on your screen for every third-party website tracking you. It is a play on cyberstalker common behaviour. For now you can get it as a bookmarklet here: http://headroom.pzwart.wdka.hro.nl/~lpereira/bookmarklets.html

var body = document.getElementsByTagName("body")[0];
var links = document.getElementsByTagName("link");
var linkSrc = [];
var closingDiv = document.createElement("button");
var text=document.createTextNode("x")
closingDiv.appendChild(text)
closingDiv.id = "close";


for (var i = 0; i < links.length; i++) {
    var check = links[i].href.substring(7, links[i].href.length-1).split("/");
    var hoolahoop = "http://"+check[0]
    if (links[i].href.substring(0, 4) === "http") {
        if (hoolahoop != "http://"){
        linkSrc.push(hoolahoop);
        console.log(hoolahoop);}
            
        }
    }



uniqueArray = linkSrc.filter(function(elem, pos) {
    return linkSrc.indexOf(elem) == pos;
})

function janelas(){
    var iframe = document.createElement("iframe");
    body.insertBefore(iframe,body.firstChild);
    iframe.id = "trackerchat";
    iframe.src = "http://headroom.pzwart.wdka.hro.nl/~lpereira/cgi-bin/trackerscrape.cgi?url="+uniqueArray[0];
    document.getElementById('trackerchat').setAttribute("style","width: 190px; height: \
255px; bottom:0; right:15px; z-index: 555555;");
    document.getElementById('trackerchat').style.position = 'fixed';
    body.insertBefore(closingDiv, body.firstChild)
    document.getElementById('close').setAttribute("style","width:23px; height:23px;\
background-color:#0099FF;z-index:999999;right:20px; bottom:227px; border:none; color: #FFFFFF;\
 font-weight:bold; font-size:13px;")
    document.getElementById('close').style.position = 'fixed';
    document.getElementById('close').setAttribute("onclick","closeWin()");
    uniqueArray.splice(0,1)

}

if(linkSrc!=0){
    janelas();
}

function closeWin() {
    document.getElementById('close').setAttribute("style","display:  none")
    document.getElementById('trackerchat').setAttribute("style","display:  none")
    if (uniqueArray.length>0){
        janelas();
    }
}
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import cgi, urllib
import cgitb; cgitb.enable()
import urlparse, time, random
import urllib2

print "Content-Type: text/html"
print
print """
    <!DOCTYPE html>
    <html>
    <head>
    <style>
    body {
        width: 190px;
        height: 255px;
        overflow: hidden;
    }
    #footer {
width: 190px;
height: 255px;
background: white;
left:0;
top:0;
position:fixed;
}

h1{
    color: white;
    font-size:13px;
    font-family: sans-serif;
    text-indent: 1%;
}

#chatname {
    padding:2%;
    background-color:#0099FF;
}
#chat, #warning, #rpl {
    text-indent: 5%;
    margin-top:5%;
    font-family:sans-serif;
    font-size:11px;

}

#warning{
    color:red;
    font-weight:bold;
}

#rpl{
    text-decoration: line-through;
}

#reply{
    position:absolute;
    bottom:0;
    width:190px;
}
iframe{
    width: 177px;
    height: 255px;
}

#hiddenform {
    position:absolute;
    bottom:55px;
    width:190px;   
}


</style>
    </head> """

form = cgi.FieldStorage()
tracker = form.getvalue("url")
reply = form.getvalue("reply","").strip().lower()
track = form.getvalue("track","").strip().lower()
chc = form.getvalue("choice","")

if not reply and tracker != None:
    prs = urlparse.urlparse(tracker)
    trck = prs.netloc



possible = ["Hi, u free tonite?", "Feeling funky, babe?", "Want to have some fun?", "U lonely?"]
choice = random.choice(possible)

if reply:
    trck = track
    choice = chc

print"""<body>
    <div id='footer'>
    <div id='chatname'>
    <h1>"""+trck+"""</h1>
    </div>
    <p id='chat'> """+choice+""" </p>"""

if reply:
    print """<p id='rpl'>""" +reply+"""</p>"""
    print """<p id='warning'> This is a one-way conversation! </p>"""

print """<form id='reply'>
    <input type='text' name='reply' placeholder = 'Reply...' size='25' value='"""+reply+"""'/>
    <input type='hidden' name='track' size='25' value='"""+trck+"""'/>
    <input type='hidden' name='choice' size='25' value='"""+choice+"""'/>
    </form>"""


print""" </body>
    </html>"""