______________________________________________________________/\/\/\__/\/\________________________ ______________________/\/\______/\/\____/\/\/\______________/\/\__________________________________ ______________________/\/\__/\__/\/\__/\/\/\/\/\__/\/\/\/\__/\/\/\____/\/\________________________ ______________________/\/\/\/\/\/\/\__/\/\__________________/\/\______/\/\________________________ ________________________/\/\__/\/\______/\/\/\/\____________/\/\______/\/\/\______________________ __________________________________________________________________________________________________ about admin howto meetings projects __________________________________________________________________________________________________ __________________________________________________________________________________________________ |
||
All Your Ads Are Belong To UsSynopsisAppropriate web ad space and replace with art space. ![]() DescriptionThe tools of web censorship plus open wireless networks in public space provide interesting opportunities for voyeuristic socializing and collective aesthetic agency. I've employed an HTTP proxy, a database, and special firewall rules on my local wireless router to create a graffiti-net-- a network where users are able to edit, replace or censor any image or set of images they encounter and make those changes visible to all other users on the network. I began by connecting an HTTP proxy (Squid) to my network with some special firewall rules to route all port 80 traffic from the network to the proxy. Then I connected the proxy to a database (MYSQL) via a perl script. The script runs in the proxy and checks each HTTP request as it comes in, looking for images. New images are added to the database. Old images have their statistics updated. Flagged images have their URLs re-written. Re-written images are pulled from a correlated table of modified images uploaded by users. Now, the network's users control the web's vast image space. Any image can be picked off and replaced or an entire server can be flagged to have all images coming from it replaced. Advertising and other corporate negative space can be over-written with art space. To see the images gathered so far or to flag and manipulate images live on the network go to the All Your Ads Are Belong To Us interface. LinksTODO
TODONE
Firewall instructions/usr/sbin/iptables -t nat -A PREROUTING -i br0 -s 192.168.1.0/24 -d 192.168.1.0/24 -p tcp --dport 80 -j ACCEPT /usr/sbin/iptables -t nat -A PREROUTING -i br0 -s ! 209.40.196.72 -p tcp --dport 80 -j DNAT --to 209.40.196.72:3128 /usr/sbin/iptables -t nat -A POSTROUTING -o br0 -s 192.168.1.0/24 -p tcp -d 209.40.196.72 -j SNAT --to 192.168.1.1 /usr/sbin/iptables -t filter -I FORWARD -s 192.168.1.0/24 -d 209.40.196.72 -i br0 -o br0 -p tcp --dport 3128 -j ACCEPT Perl script ~ mustache.pl
#!/usr/bin/perl -w
use strict;
use DBI;
use POSIX;
$| = 1;
# FOR EACH REQUESTED URL
while (<>) {
chomp $_;
if($_ =~ /(.*\.(jpg|jpeg|gif))/i) {
my $url = $1;
my $type = $2;
$url =~ /^(http:\/\/)?([^\/]+)/i; # PICK OFF THE HOSTNAME FROM THE URL
my $host = $2;
# BREAK THE HOSTNAME INTO C NAME AND A NAME RECORDS
my $aname;
my $cname;
if($host =~ /(\d{1,3}\.){3}.\d{1,3}/x) {
$aname = $host;
}
else {
$host =~ /\.*(([A-Za-z0-9\-]*)\.(...))$/;
$aname = $1;
$cname = $`;
}
# CONNECT TO DB
my $db = DBI->connect( "DBI:mysql:wefi:localhost", "user", "pass" );
# CHECK IF THE IMAGE ALREADY EXISTS IN THE SYSTEM
my @row = $db->selectrow_array( "SELECT * FROM `images` WHERE
url = '$url'" );
# IF IT DOESN'T...
if(@row == 0) {
# ADD IMAGE
$db->do( "INSERT INTO `images`(url, date_added, count)
VALUES('$url', now(), 1)" );
my $image_id = $db->last_insert_id(undef,undef,"images","id");
my $img = "$host-$image_id.$type";
# ADD ANAME
$db->do( "INSERT IGNORE INTO `aname`(aname) VALUES('$aname')
ON DUPLICATE KEY UPDATE last_date = now()" );
my @row = $db->selectrow_array( "SELECT id FROM `aname`
WHERE aname = '$aname';" );
my $a_id = $row[0];
if($cname) {
# ADD CNAME
$db->do( "INSERT IGNORE INTO `cname`(cname) VALUES('$cname')
ON DUPLICATE KEY UPDATE last_date = now(),
id = LAST_INSERT_ID(id)" );
#my $c_id = $db->last_insert_id(undef,undef,"cname","id");
my @row = $db->selectrow_array( "SELECT id FROM `cname`
WHERE cname = '$cname';" );
my $c_id = $row[0];
# RELATE ANAME TO CNAME
$db->do( "INSERT IGNORE INTO `aname-cname`(c_id,a_id)
VALUES('$c_id', '$a_id');" );
}
# RELATE HOST TO IMAGE
$db->do( "INSERT IGNORE INTO `host-image`(a_id,image_id)
VALUES('$a_id', '$image_id');" );
# PRINT THE IMAGE
print "$_\n";
}
# IF IT DOES & ITS AN AD...
elsif($row[4] == 1) {
# UPDATE THE COUNT
$db->do( "UPDATE `images` SET count = count+1 WHERE id = $row[0]" );
my $width = $row[2];
my $height = $row[3];
my @row = $db->selectrow_array(
"SELECT
t2.id AS id,
t2.type AS type
FROM
`images` as t1,
`images-modified` as t2,
`images-images-modified` as t3
WHERE
t1.id = t3.image_id
AND
t2.id = t3.image_modified_id
AND
t1.id = $row[0]
ORDER BY rand()
LIMIT 1" );
if(@row == 0) {
# PRINT HOLDER IMAGE
print "http://we-fi.org/allyouradsarebelongtous/
allyouradsarebelongtous.php?w=$width&h=$height\n";
}
else {
# PRINT THE IMAGE
print "http://we-fi.org/allyouradsarebelongtous/
processing/data/modified/$row[0].$row[1]\n";
}
}
# IF IT DOES & ITS JUST A REGUALR IMAGE UPDATE THE COUNT &
# PRINT THE IMAGE, UNMOLESTED
else {
# UPDATE THE COUNT
$db->do( "UPDATE `images` SET count = count+1 WHERE id = $row[0]" );
print "$_\n";
}
# DISCONNECT FROM DB
$db->disconnect;
}
else {
print "$_\n";
}
}
|
||
__________________________________________________________________________________________________ __________________________________________________________________________________________________ __________________________________________________________________________________________________ __________________________________________________________________________________________________ __________________________________________________________________________________________________ __________________________________________________________________________________________________ Page last modified on January 09, 2009, at 01:26 AM
Site designed by wwwizardry |
||