I wrote a python script to pick winners, this is what I came up with.

Posted by

So, the other day I wanted to see about how to ‘give back’ to the infosec/DFIR community on Twitter and I tried to find an easy way to just do a quick giveaway. I’m not trying to grow followers because I do giveaways and want people to retweet my stuff. Quite the opposite. I want to do a little here and there to help people educate themselves and grow personally. I want to maybe do that with Humble Bundles that pertain to cyber security, forensics, information security, STEM, and what not. I do NOT want to be doing these every month or all the time, just when I can.

So, I set out to find ANY website that could help me just get the replies to a specific tweet (mine) and then pick a winner from these replies. What I found was a whole bunch of bloated campaign managers and other related nonsense that I had no interest in using at all. Most of them chose their winners because they RT whatever I did and that was just not what I am looking for.

And then I had a “well duh” moment and realized I wrote a couple Twitter bots that I could probably cobble a quick python3 script and just do it myself. So I did.

I wrote a very ugly looking script (#still_learning) but I got the job done! I plan on making this a lot more neat-and-tidy, maybe even putting it on heroku/my site here so that people could use it for their own needs as well. We’ll see, that’s a bigger project than I have time for right now though.

Anyways, here’s the results of my ‘test’ tweet:

What user made the original tweet @mr_hobbits
We need the tweet ID. Looks like this:
the number is the Tweet id
Tweet id:1322741874503819264
Grabbing replies from 1322741874503819264
about to grab replies…
Got replies from twitter…
Picking a winner…
The winner is: JSomerstone
Winning reply: @Mr_Hobbits @cybersec_feeds What books exactly are we talking about here?

So, congrats to JSomerstone for winning this mini-giveaway!

I’m considering posting my code online as soon as it gets a bit more tidy and smooth for everyone to enjoy.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.