Browse Category: Raspberry Pi

Create a Reddit Novelty Bot that Replies to User Comments using Python

I’ve been learning to program using Python recently and started making simple bots that can be used on Reddit. I created a Chat Bot that will reply questions asked on /r/AskReddit recently and wanted to make something a little more lighter and meme worthy. I created a bot that searches for people that say ‘Sad.’ at the end of a sentence and replies with ‘this is sad, alexa play despacito’. its basically two memes in one. A lot of people now add ‘Sad.’ to the end of their comments and I reply with the ‘alexa play despacito’ meme. It’s a very simple bot that shows you how to search all users comments and you can change the parameters however you see fit. If you think of other idea’s for simple reply’s please let me know in the comments below.

I programmed the Reddit Bot in Python and use Reddit’s API Wrapper (PRAW) that lets me easily search for Reddit comments and post reply’s. I use my Raspberry Pi to run my bot since my Raspberry Pi is always on and connected to the internet. Using the Raspberry Pi allows my bot to be running 24/7 which is nice to watch it respond to people all the time. you can view my bot in action by searching for the Reddit username /u/very_slowly

Objective

To create a Reddit Bot that automatically replies to comments that end in ‘Sad.’

Material

You will need the following:

Instructions

I will go over the functions and steps I used to create my Reddit bot below and try to explain what I am going to get the Bot the work. At the bottom I will combine everything together. You should be able to simply copy and paste the final code into Python, add your bot’s API credentials and it will start replying to comment

Continue Reading

Create a Reddit Bot that automatically replies to Questions on AskReddit using Python

I recently published an article on creating a basic Reddit Chatbot you would be able to ask it questions and it would search Reddit for the answer and reply with an answer. This is an upgraded version of the previous Reddit bot I created except this one will actually post replies on Reddit and other users will assume it is a real person replying to their questions. I used Reddit s PRAW library that uses the Reddit API and makes it very easy to search for submissions and grabbing comments and posting reply’s on Reddit. You will need to install the PRAW library in Python to use this script.

The way the script works is it monitors /r/AskReddit for new submissions and grabs the title of the new submission. After it grabs the title it will search Reddit using the title and try to see if the question was asked before. If it was asked before it will look at the comments to that question, grab a random comment and reply to the new submission with the grabbed comment. Its actully very ingenious and has a very high confidence rating when replying to submissions.

I use my Raspberry Pi to run my bot since my Raspberry Pi is always on and connected to the internet. Using the Raspberry Pi allows my bot to be running 24/7 which is nice to watch it respond to people all the time.

Objective

To create a Reddit Bot that automatically replies to Questions on the AskReddit subreddit using Python

Material

You will need the following:

Instructions

I will go over the functions and steps I used to create my Reddit bot below and try to explain what I am going to get the Bot the work. At the bottom I will combine everything together. You should be able to simply copy and paste the final code into Python, add your bot’s API credentials and it will start replying to comments.

Continue Reading

How to Set the Time and TimeZone on the Raspberry Pi

I recently installed a fresh install of Raspbian on my Raspberry Pi 3 and when I was setting up my server I noticed that the time was not set correctly. I never have had this issue using Raspbian since it would automatically update the time and grab the current time from the internet. It was frustrating because the project I was working on needed the current current time as well as the timezone.

We will be setting the correct time with the Raspi-Config tool. The Raspi-Config tool is a tool that comes packaged with Raspbian which allows you to configure many options on your Raspberry Pi like overclocking, enabling/disabling Bluetooth as well as setting the correct timezone and grabbing the correct time from the internet.

Objective

To set the correct time on the Raspberry Pi and grab the correct time and timezone from the internet

Material

You will need the following:

Instructions

You can either open up a new terminal window if you are running a GUI version of Raspbian or you can SSH into your Raspberry Pi if you are running it headless. I was running Raspbian Stretch when I wrote this tutorial.

Open a new terminal window or connect to your Raspberry Pi over SSH and run the following command to get the current time on your Raspberry Pi:

Run the following command to open up Raspi-Config tools. This will allow us to make changes to our Raspberry Pi configuration:

<media>

Now navigate to 4. Localization Options and hit enter

Selecting Localization Options using Raspi-Config

Now select I2 Change Time Zone. You can now set your Time Zone which will automatically update the time as well if you are connected to the internet.

Setting the Time Zone on the Raspberry Pi

 

 

 

 

How to Hack a Router with RouterSploit on the Raspberry Pi

A majority of people do no update their routers or other IOT (Internet of Things) devices on their network, this is where RouterSploit comes in. RouterSploit will search a device for multiple known exploits and vulnerability and if any are given will give you access to these devices. RouterSploit will also check these device credentials and attempt to find if the device is using the default username and password. Updating your device firmware and changing passwords are the easiest and best way to protect your system from hackers, yet many people do not do these steps. also many older IOT devices like IP Cameras or printers might not even be supported anymore and these devices may have vulnerabilities that will never be patched and can compromise your whole network.

RouterSploit is a python script which will scan devices for multiple exploits and vulnerabilities and mainly focuses on embedded devices like IP cameras, routers and printers. You just need to set the target IP address and run the script and RouterSploit will do the rest. You can only check devices that are on your network, meaning you need to be connected to the same network as the device you are trying to hack. You can scan many routers, printers, IP cameras and any other devices that are on your network.

Using the Raspberry Pi to run RouterSploit makes it easy to check networks on the go. You can bring your Raspberry Pi over your friends house and connect into their network and check their network for any vulnerabilities. The Raspberry Pi is so cheap and easy to work with which makes it a great pen-testing tool to have. I will show you how to install RouterSploit on the Raspberry Pi and how to use the basic features of RouterSploit.

Objective

To install RouterSploit on the Raspberry Pi

Material

You will need the following:

Instructions

We’ll be installing the latest version of RouterSploit, which at the time of writing this article was 3.3. I will assume you are connecting to your Raspberry Pi over SSH. If you are working directly on the Raspberry Pi simply open up a terminal window and run the commands from there. I tested this using a Raspberry Pi 3 running Stretch but this should work for older versions as well. I also had the GUI running on my Raspberry Pi which may include some packages pre-installed. For example the lite version of Stretch will not have ‘git‘ installed and you will have to install ‘git‘ before running the ‘git‘ command. Continue Reading

How to Create a Simple Python Chatbot on the Raspberry Pi

I have recently been working on a new project that required scraping data from other websites and have been slowly learning python. I usually work with PHP but I knew python will work faster and better. I also have always wanted to create a simple chatbot that I can input text into and it would reply with something meaningful. Creating a chatbot with a huge database of words and actually understanding what is being said is not an easy task and is something that is way over my head. I was browsing Reddit and found out that you can get results in JSON format is you append ‘.json‘ to the end of the URL. This got me thinking, what if I search Reddit with a question or comment and pick a random search result and reply with one of the top comments. This would fill my urge in creating a chatbot and it would also be a good starting point if I ever wanted to go deeper into creating a database and store answers for the chatbot to get a personality of its own.

I figured the Raspberry Pi would be an easy starting point since I have a bunch of them laying around and it is already setup with a Python environment. You can easily replicate this in any Python environment but I tested out my chatbot on the Raspberry Pi.

Objective

To create a chatbot in Python on the Raspberry Pi that searches Reddit and replies using a Reddit comment

Material

You will need the following:

Instructions

Create a new file on the Raspberry Pi and call it main.py Continue Reading

How to install Doom on the Raspberry Pi 3

Doom is a classic DOS game and has been ported to many operating systems and now you can play it on your Raspberry Pi in just a few minutes. You can even setup a joystick or controller to play Doom and relive your childhood memories. You can also download a ton of WAD’s (“Wheres all the Data”) for Doom. WAD’s are like old school mods and include new levels, weapons and really just transform your Doom playing experience. There are many WAD’s out there right now which make the game completely different.

We’ll be using the Chocolate Doom port today to install and play Doom. Chocolate Doom try’s to mimic the original experience of Doom as much as possible. Chocolate Doom’s main features are its accurate reproduction of the game as it was played in the 1990s. We’ll be downloading the source for Chocolate Doom and building and compiling the code on the Raspberry Pi, so this may be a new experience for some people but I promise it is very easy to do.

Objective

To install and play Doom on the Raspberry Pi 3

Material

You will need the following:

Instructions

We’ll be installing the latest version of Chocolate Doom, which as of this tutorial is 3.0.0. You can check to see if there are new version’s by clicking here. You would just need to modify the ‘wget‘ commands and directory commands below to match the version and file names that you downloaded. Continue Reading