Kyle Geske
V-World Avatars
I first encountered the Pendulum 20 years ago. It contained code, really big words, and European history that I knew nothing about.
1 10 REM anagrams
2 20 INPUT L$(1),L$(2),L$(3),L$(4)
3 30 PRINT
4 40 FOR I1=1 TO 4
5 50 FOR I2=1 TO 4
6 60 IF I2=I1 THEN 130
7 70 FOR I3=1 TO 4
8 80 IF I3=I1 THEN 120
9 90 IF I3=I2 THEN 120
10 100 LET I4=10-(I1+I2+I3)
11 110 LPRINT L$(I1);L$(I2);L$(I3);L$(I4)
12 120 NEXT I3
13 130 NEXT I2
14 140 NEXT I1
15 150 END
It took me 18 years to finish this book.
Abulafia is the name of a computer in the book Foucault’s pendulum.
Named after Abraham Abulafia, religious philosopher of the 1200s and the founder of the school of “Prophetic Kabbalah”.
The characters use Abulafia to invent their own conspiracy theory by writing a program that makes connections between random bits of text they provide.
The Templars have something to do with everything
Minnie Mouse is Mickey Mouse’s fiancee
What follows is not true
Abotlafia is my version of this fictional computer.
Abotlafia makes the connections the inspire The Plan.
Abotlafia makes random connection between tweet-sized sentences from the book Foucault’s pendulum.
Abotlafia has over 480 followers…
… and a Klout score of 44.
Pull out your mobile devices and tweet a few of these phrases:
Inconceivable!
beetlejuice beetlejuice beetlejuice
Mirror mirror on the wall who’s the [fill in the blank] of them all.
These phrases summon bots written using the Ruby library Chatterbot.
Written by Colin Mitchell.
On Twitter: @mitchc2
First thing you’ll need to do is create an account for your bot on Twitter. That’s the easy part.
1 gem install chatterbot
Chatterbot comes with a script named chatterbot-register
which:
The code in this talk will be in the Ruby language. If you don’t know Ruby just pretend it’s pseudo-code. ;)
1 require 'chatterbot/dsl'
2
3 loop do
4
5 tweet rand(1000000..99000000).to_s
6
7 sleep 300
8
9 end
The Twitter bot equivalent of a Numbers Station.
I built the @bsidesreminder bot to ensure that I wouldn’t procrastinate writing this talk. Every day at 11am this bot would tell me how many days it was until BSides Winnipeg 2013.
1 require 'date'
2
3 BSIDES_WINNIPEG_2013_DATE = Date.parse('November 16 2013')
4 days_until_bsides = (BSIDES_WINNIPEG_2013_DATE - Date.today).to_i
5
6 exit if days_until_bsides < 0
7
8 require 'chatterbot/dsl'
9
10 tweet_text = "@stungeye You are presenting @BSidesWpg "
11
12 if days_until_bsides.zero?
13 tweet_text += "today!"
14 elsif days_until_bsides == 1
15 tweet_text += "tomorrow."
16 else
17 tweet_text += "in #{days_until_bsides} days."
18 end
19
20 tweet tweet_text
1 require 'chatterbot/dsl'
2
3 replies do |tweet|
4
5 user = tweet_user(tweet)
6
7 echo = tweet.text.gsub(/@echoes_bot/, user)
8
9 reply echo, tweet
10
11 end
Try sending a tweet to @echoes_bot. This bot will echo back to you anything you send to it.
1 require 'chatterbot/dsl'
2 require 'google-search'
3 require 'cgi'
4
5 NO_RESULTS_FOUND = 'Ever so sorry; I found no websites that reference: '
6
7 replies do |user_tweet|
8 user_who_tweeted = tweet_user(user_tweet)
9
10 google_query = user_tweet.text.gsub(/[#\@]\w+\b/,'').strip
11
12 feeling_lucky = Google::Search::Web.new(:query => google_query).first
13
14 response_tweet = user_who_tweeted + " "
15
16 if feeling_lucky.nil?
17 response_tweet += NO_RESULTS_FOUND + google_query
18 else
19 response_tweet += CGI.unescapeHTML(feeling_lucky.title)
20 end
21
22 response_tweet += " " + feeling_lucky.uri unless feeling_lucky.nil?
23
24 reply response_tweet, user_tweet
25 end
@redlibrarian: And if you’re fresh out of library school and need to learn *the job* as well…
@rhyemelibrarian: See, for example, under L.
Send @rhymelibrarian a tweet and it will reply with a sentences that rhymes with yours.
@redlibrarian: @stungeye Dude is @rhymelibrarian yours? If not, I’m blocking it.
@rhymelibrarian: If you can’t figure it out yourself, tough shit.
1 DB = Sequel.connect("mysql2://#{DB_USER}:#{DB_PASSWORD}@localhost/stungeye")
2 wordnik = WordnikParty.new(WORDNIK_KEY)
3
4 replies do |user_tweet|
5
6 user_name = tweet_user(user_tweet)
7 tweet_text = user_tweet.text.gsub(/[#\@]\w+\b/,'').gsub(/\W+$/,'')
8 last_word = tweet_text.split(' ').last.downcase
9
10 unless last_word.include?('http')
11 rhymes = wordnik.rhymes_with(last_word, 100)
12 possible_sentences = find_sentences(rhymes, user_name)
13
14 unless possible_sentences.size.zero?
15 selected_sentence = possible_sentences.sample
16 DB[:rhymesentences]
17 .where(:id => selected_sentence[:id])
18 .update(:tweeted => true)
19
20 reply "#{user_name} #{selected_sentence[:words]}", user_tweet
21 end
22 end
23 end
The rhymesentences
table contains sentences from The Communist Manifesto, The Wealth of Nations, and Alice in Wonderland.
The find_sentences
method is interacts with this database table to find sentences that end in the possible rhymes found by the Wordnik API.
Why do I do this? Why create Twitter bots?
As humans I believe we are contractually obligated to inspire each other.
“What are wonder sparks, you may ask? Well that’s the best part… The answer is: anything. Anything that will stimulate the sense of wonder of your fellow man.
Paint pictures on the sides of garbage cans, plant trees in strange urban locations, leave poems on the tables in the lunch room, or ponder strange philosophical concepts with the other people in the checkout line at the grocery store.”
– Me, in 2003.
Since then I’ve added “Write weird-ass Twitter bots” to this list.
@abotlafia: Besides, we had the logic of facts on our side.
@xorrbit: [email protected] BSides: We have the logic of facts on our side. #newslogan
@abotlafia: @xorrbit There’s no difference between you and me.
For 10 minutes last night I hijacked Abulafia’s tweets and had him do search for and retweet pictures of cats reading. He was averaging about 10 to 20 literary cat retweets a minute.
@roseandsigil: [email protected], my go-to for Eco bibliomancy, has turned into a machine for retweeting pictures of cats reading.
@abotlafia: To this Abraham Abulafia dedicated his life, while your Saint Thomas was toiling to find god with his five paths.
…nobody knows your a bot either.
One might say this user failed the Reverse Turing Test. But it’s all too easy to mistake a bot for a human… we want to believe!
an�thro�po�mor�phize
to attribute human form or personality to
to attribute human form or personality to things not human
Are you sure that all your followers on Twitter are human? How about everyone you follow?
Academic Research: Detecting Automation of Twitter Accounts: Are You a Human, Bot, or Cyborg?
The Ruby source for my BSides bots is available on GitHub:
github.com/stungeye/Bsides-Bots
An early version of Abotlafia:
The ChatterBot Library I used:
github.com/muffinista/chatterbot/
My bots mentioned in this talk: