2018-01-19 15:42:43 +00:00
|
|
|
# Ticketfrei social bot
|
2017-06-17 12:57:43 +00:00
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
Version: 1.0
|
|
|
|
|
2018-01-19 15:42:43 +00:00
|
|
|
Ticketfrei is a mastodon/twitter/mail bot to dodge ticket controllers
|
|
|
|
in public transport systems.
|
2017-06-17 12:57:43 +00:00
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
The functionality is simple: it retweets every tweet where it is
|
|
|
|
mentioned.
|
2017-06-17 12:57:43 +00:00
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
This leads to a community which evolves around it; if you see ticket
|
|
|
|
controllers, you tweet their location and mention the bot. The bot
|
|
|
|
then retweets your tweet and others can read the info and think twice
|
|
|
|
if they want to buy a ticket. If enough people, a critical mass,
|
|
|
|
participate for the bot to become reliable, you have positive
|
|
|
|
self-reinforcing dynamics.
|
2017-06-17 12:57:43 +00:00
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
In the promotion folder, you will find some promotion material you
|
|
|
|
can use to build up such a community in your city. It is in german
|
|
|
|
though =/
|
2017-06-17 12:57:43 +00:00
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
Website: https://wiki.links-tech.org/IT/Ticketfrei
|
2017-06-17 12:57:43 +00:00
|
|
|
|
2017-12-30 00:11:28 +00:00
|
|
|
## Install
|
2017-06-17 12:57:43 +00:00
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
Setting up a ticketfrei bot for your city is quite easy. Here are the
|
|
|
|
few steps:
|
|
|
|
|
|
|
|
First you need to install python3 and virtualenv with your favourite
|
|
|
|
package manager.
|
2017-11-28 14:11:09 +00:00
|
|
|
|
|
|
|
Create and activate virtualenv:
|
2017-07-11 19:51:37 +00:00
|
|
|
|
2017-06-17 12:57:43 +00:00
|
|
|
```shell
|
2018-01-07 23:09:25 +00:00
|
|
|
sudo apt install python3 virtualenv uwsgi uwsgi-plugin-python nginx
|
2017-12-30 00:21:57 +00:00
|
|
|
virtualenv -p python3 .
|
|
|
|
. bin/activate
|
2017-06-17 12:57:43 +00:00
|
|
|
```
|
2017-11-28 14:11:09 +00:00
|
|
|
|
|
|
|
Install the dependencies:
|
2017-06-17 12:57:43 +00:00
|
|
|
```shell
|
2018-01-08 21:56:05 +00:00
|
|
|
pip install tweepy pytoml requests Mastodon.py bottle pyjwt
|
2017-06-17 12:57:43 +00:00
|
|
|
```
|
2017-11-28 14:11:09 +00:00
|
|
|
|
|
|
|
Configure the bot:
|
2017-06-17 22:35:34 +00:00
|
|
|
```shell
|
2017-12-30 09:32:20 +00:00
|
|
|
cp config.toml.example config.toml
|
|
|
|
vim config.toml
|
2017-06-17 22:35:34 +00:00
|
|
|
```
|
2018-01-19 15:00:36 +00:00
|
|
|
|
|
|
|
You can use a Twitter, a Mastodon, and Mail with the account. They
|
|
|
|
will communicate with each other; if someone warns others via Mail,
|
|
|
|
Twitter and Mastodon users will also see the message. And vice versa.
|
|
|
|
|
|
|
|
You have to configure all of the accounts via config.toml; it should
|
|
|
|
be fairly intuitive to enter the right values.
|
|
|
|
|
|
|
|
## Maintaining
|
|
|
|
|
|
|
|
There is one security hole: people could start mentioning the bot
|
|
|
|
with useless information, turning it into a spammer. That's why it
|
|
|
|
has to be maintained; if someone spams the bot, mute them and undo
|
|
|
|
the retweet. So it won't retweet their future tweets and the useless
|
|
|
|
retweet is deleted if someone tries to check if something was
|
|
|
|
retweeted in the last hour or something.
|
|
|
|
|
|
|
|
To this date, we have never heard of this happening though.
|
2017-06-17 22:35:34 +00:00
|
|
|
|
2017-10-17 13:27:24 +00:00
|
|
|
### blacklisting
|
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
You also need to edit the goodlist and the blacklist. They are in the
|
|
|
|
"goodlists" and "blacklists" folders. All text files in those
|
|
|
|
directories will be used, so you should delete our templates; but
|
|
|
|
feel free to use them as an orientation.
|
2017-06-17 23:44:22 +00:00
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
Just add the words to the goodlist, which you want to require. A
|
|
|
|
report is only spread, if it contains at least one of them. If you
|
2018-01-19 15:27:30 +00:00
|
|
|
want to RT everything, just add a ```*```.
|
2017-06-17 23:44:22 +00:00
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
There is also a blacklist, which you can use to automatically sort
|
|
|
|
out malicious tweets. Be careful though, our filter can't read the
|
|
|
|
intention with which a word was used. Maybe you wanted it there.
|
2017-06-17 12:57:43 +00:00
|
|
|
|
2017-10-17 13:27:24 +00:00
|
|
|
### screen
|
|
|
|
|
2018-01-19 15:00:36 +00:00
|
|
|
To keep the bots running when you are logged out of the shell, you
|
|
|
|
can use screen:
|
2017-07-23 13:47:23 +00:00
|
|
|
|
|
|
|
```shell
|
|
|
|
sudo apt-get install screen
|
2017-10-17 13:27:24 +00:00
|
|
|
echo "if [ -z "$STY" ]; then screen -RR; fi" >> ~/.bash_login
|
2017-07-23 13:47:23 +00:00
|
|
|
screen
|
2017-12-30 00:17:13 +00:00
|
|
|
python3 ticketfrei.py
|
2017-07-23 13:47:23 +00:00
|
|
|
```
|
|
|
|
|
2017-10-17 13:27:24 +00:00
|
|
|
To log out of the screen session, press "ctrl+a", and then "d".
|
|
|
|
|