Sunday, 21 December 2008

SSSB and automation

Recently I began reading up a bit on this whole web thing (yes, I lost my interest in coding HTML and web pages back in grade school). Things have changed and I better learn a bit since it will be beneficial for my work on my thesis. I wanted to try out authentication and HTML forms. Here's the story.

SSSB is a company that rents out flats to students in Stockholm. Back in the good old days (see 2005) you registered and for every day you got a day in line. These days could be traded in for a flat when you needed one, the more days, the better the flat. But, those things changed, the rules of the game are basically the same but you need to log in now and then to show that you are active enough. This of course, is tedious, most other non-student flat renting companies in Stockholm either don't bother or charge a fee. Already back in 2005 this annoyed me a bit but now being in the US and all it's a gun to my head. If I forget I will not have anywhere to live when I get back, or worse, I may loose three years of days. This seemed like an excellent task for a small hack.

The script I created has been tested a bit, but as always, use it at your own risk and take into consideration any moral implications. I will most likely not deploy it, but at least it might prove useful to someone.

#!/usr/bin/env python

Author: Pontus Stenetorp
Version: $Id:,v 1.2 2008/12/21 08:07:04 ninjin Exp $

Simple script to keep logging on the SSSB website to keep your days in line
for a flat in Stockholm. Meant to be executed by cron now and then.

This does not violate the agreement on but the morality of automating
this is somewhat questionable. *sigh* I remember the good old days before this
log in every 'n' days silliness.

import os
import random
import sys
import time
import urllib
import urllib2

### Constants
## User settings
USERNAME = '1234567890'
PASSWORD = '1234'

# The maximum amount of days to wait between logins, this value should be
# lower than the actual required amount of days (90)
WAIT_MAX = 90/2

# The minimum amount of days to wait between logins, this is to not log in
# all too often

# Faking is _not_ nice, but it is sometimes the only option

# If you want to fake, you may choose from the list below and give the index
# here. If set to negative the script will choose one at random and note it
# in the data file for future logins.

## Web page specifics
VALUES = {'m6input_username': USERNAME, 'm6input_password': PASSWORD,
'mact': 'FrontEndUsers,m6,do_login,1', 'm6returnid': '794',
'page': '794'}

## Script internals
DATA_FILE_PATH = os.path.expanduser('~/.sssb_data')

# Look for this to confirm a successful login
LOGGED_IN_MATCH = 'Du %sr inloggad som:' % ''.join(['&', 'auml;'])

SECONDS_PER_DAY = 60 * 60 * 24

# If you are honest you will show that you are actually running a script
REAL_USERAGENT = 'SSSB login Python script 1.0'

# Thank you for the user-agents
# A mix of user agents to choose from, ranging from MSIE to Opera on several
# operating systems.
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; SLCC1; ' +
'.NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0; .NET ' +
'CLR 1.1.4322)',
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SU 3.1; SLCC1; ' +
'.NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 1.1.4322; Tablet ' +
'PC 2.0; .NET CLR 3.5.21022)',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: ' +
'Gecko/20071019 Firefox/ Navigator/',
'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) ' +
'Gecko/20050519 Netscape/8.0.1',
'Opera/9.60 (X11; Linux i686; U; en) Presto/2.1.1, Opera/9.02 ' +
'(Windows NT 5.0; U; en)',
'Mozilla/5.0 (Windows NT 5.1; U; en) Opera 8.00',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 ' +
'(KHTML, like Gecko) Version/3.1.2 Safari/525.21']

def main(argv=None):

def read_data_file():
data_file = open(DATA_FILE_PATH, 'r')
last_login, next_login, user_agent = [line.strip() for line
in data_file]
return int(last_login), int(next_login), user_agent

def write_data_file(last_login, next_login, user_agent):
if os.path.isfile(DATA_FILE_PATH):
data_file = open(DATA_FILE_PATH, 'w')
data_file.write(str(last_login) + '\n')
data_file.write(str(next_login) + '\n')
data_file.write(user_agent + '\n')

if not os.path.isfile(DATA_FILE_PATH):
user_agent = REAL_USERAGENT
elif FAKE_USERAGENT_INDEX < user_agent =" random.choice(FAKE_USERAGENTS)" user_agent =" FAKE_USERAGENTS[FAKE_USERAGENT_INDEX]" next_login =" 0," user_agent =" read_data_file()" current_time =" int(time.time())">= next_login:
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
data = urllib.urlencode(VALUES)
request = urllib2.Request(SSSB_URL, data)
request.add_header('User-agent', user_agent)
response =

logged_in_line = [line for line in response if

if not logged_in_line:
print 'FATAL: Log-in failed'
return -1

next_login = random.randint(
current_time + WAIT_MIN * SECONDS_PER_DAY,
current_time + WAIT_MAX * SECONDS_PER_DAY)
last_login = current_time
write_data_file(last_login, next_login, user_agent)
return 0

if __name__ == '__main__':


At line #53 you may notice a strange ''.join(), Blogger finds it a good idea to translate my escaped Swedish characters. This is a remedy, so enjoy the special Blogger version which is slightly uglier than my own version.

Blogger is really _terrible_ at displaying code, one almost weeps when you take a look at it. All the 80 width formatting killed by static width. *sigh* Paste it into an editor and take it away from this awful place.


  1. Keep getting compilation errors,

    File "", line 103
    elif FAKE_USERAGENT_INDEX < user_agent =" random.choice(FAKE_USERAGENTS)" us
    er_agent =" FAKE_USERAGENTS[FAKE_USERAGENT_INDEX]" next_login =" 0," user_agent
    =" read_data_file()" current_time =" int(time.time())">= next_login:
    SyntaxError: invalid syntax

    Regarding code linkage, is a great solution.

  2. I appreciate, reѕult in I found just ωhat ӏ usеd to be lookіng for.
    You hаve еndеd my 4 day long hunt! God Bless
    уou man. Haνe a nice ԁay. Bye
    Here is my blog : forex bot scam

  3. I leavе a leave a rеѕponse each tіme I like a artiсle on a websіtе oг
    I have something tο aԁd to the conversаtіοn.
    Usually it's caused by the fire displayed in the article I read. And on this article "SSSB and automation". I was actually moved enough to drop a thought ;-) I do have 2 questions for you if you usually do not mind. Is it just me or do some of the remarks come across like written by brain dead visitors? :-P And, if you are writing at other social sites, I would like to follow you. Could you list every one of all your communal sites like your Facebook page, twitter feed, or linkedin profile?
    My site location voiture pas cher entre particulier

  4. Gгeat wеbsite. Lots οf useful infoгmation herе.

    I'm sending it to several pals ans also sharing in delicious. And obviously, thank you on your effort!
    Also visit my blog post ;

  5. Ιn faсt when someone ԁoesn't understand afterward its up to other visitors that they will help, so here it happens.
    Here is my site ... pikavippi

  6. I must thank you for the efforts you've put in writing this blog. I am hoping to check out the same high-grade blog posts by you in the future as well. In truth, your creative writing abilities has motivated me to get my own, personal blog now ;)

    Also visit my blog post - best selling clickbank products
    My site

  7. Good information. Lucky me I recently found your blog by accident (stumbleupon).
    I've saved it for later!

    Here is my weblog:
    my website >

  8. Wow, superb blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your web site is magnificent,
    let alone the content!
    Here is my web blog - self help affiliate programs

  9. I was wondering if you ever considered changing the layout of your website?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people
    could connect with it better. Youve got an awful lot of text for only having one or two pictures.

    Maybe you could space it out better?
    Also see my website :: great travel deals

  10. Howdy! Do you use Twitter? I'd like to follow you if that would be ok. I'm absolutely enjoying
    your blog and look forward to new posts.

    Also visit my page;
    Also see my web site:

  11. It's going to be end of mine day, however before end I am reading this great post to increase my experience.
    My blog post - hosting reselling

  12. Admiring the commitment you put into your blog and detailed
    information you provide. It's good to come across a blog every once in a while that isn't
    the same out of date rehashed material. Wonderful read!
    I've saved your site and I'm adding your RSS feeds to my Google account.

    My blog post ... private krankenversicherung für arbeitnehmer
    Check out my page ;

  13. Someone essentially help to make severely articles I would state.

    That is the first time I frequented your website page
    and up to now? I surprised with the research you made to make this
    particular submit incredible. Magnificent activity!

    Feel free to surf to my page ... private krankenversicherung Vorteile nachteile
    My web-site :

  14. The Doc Johnson Monique Alexander Pussy Pocket Pal is cast from
    the woman herself and makes the perfect companion.
    You don't even need to buy it dinner first.. Marketing materials here are several important tips that are the one in account before sending the. Tonight is Night Out by Little Man Ice ios iPhone j2ee aj lee .... free porn daniela katzenberger pussy fake watch porno free porn daniela katzenberger pussy fake frei porno FREE PORN DANİELA KATZENBERGER PUSSY FAKE porno videos ....
    Feel free to visit my web page ; flesh lights

  15. I enjoy what you guys tend to be up too. This kind of clever work and reporting!
    Keep up the superb works guys I've incorporated you guys to my personal blogroll.

    Feel free to visit my webpage :: online designer outlet
    Take a look at my blog just click the following internet page

  16. She has princess die, but were all princess high," Mother Monster tweeted. This is where it can get very explicit when it comes to phone chat. With single and multiplayer mode, there are tons of challenging trivia questions and movie clips to keep you entertained.

    my weblog: telefonsex

  17. I'm really enjoying the design and layout of your site. It's a very easy on the eyes which makes it much more enjoyable for me to come here
    and visit more often. Did you hire out a developer to create your theme?
    Superb work!

    my web page; weight loss
    my webpage :: weight loss

  18. If you are going to purchase a vaporizer soon, and $500 or extra is no difficulty for you,
    get a volcano vaporizer today.
    You can easily shop around the Internet and while doing so you can look for reviews on
    the various models you may be considering.

    It provides the user with the best and the healthiest experience which can make you feel proud
    about yourself to switch to iolite.

  19. Persons can observe your contaminants if they are
    created in the actual vent out in existence system associated with volcano
    vaporizer. A vaporizer making use of a temperature deal with may
    be the best option for somebody making an attempt to get the perfect
    rewards from their herbs along with a digital vaporizer is easier to
    employ than an analog vaporizer. Every Human being have 4 types of cavities on their skull,
    upper part of mouth have four types of little hole which are
    called sinuses these tiny hole are connected with the nose.

    Here is my blog post: best vaporizer

  20. It can be carried freely from one place to another and if
    you are addicted to your sessions, then you can carry this device as
    you move to new places during your day. Remember if you have children
    or pets they may try to play in, or drink from, the water bowl.

    It is a must to research on the way a vaporizer actually works.

    Here is my page portable Vaporizer

  21. Then, you must take care that the components of the smoke
    bomb are not refined too much. More than 80% lung cancer cases are accounted by tobacco. In the US bong is considered slang and companies making glass water pipes can’t term it as bongs as they will be denied service.

    Stop by my homepage - Vaporizer

  22. The main point of difference lies with the fact that the vaporizer does not cause any
    harm to the human lungs. At the end of the day,
    all addicts develop into masters of justifiable excuses and can come up with some pretty convincing
    arguments as to why smoking cessation is not
    a good idea just yet. Some special deals can also be found on
    the Vaporizer at times.

  23. It provides you with the same effect just like smoking but the only difference is that with
    smoking you would be inhaling all the burnt chemicals which would damage your body in some way or other.

    With the help of this lithium ion battery the user can use it for 3 hours continuously.
    Stay Trendy at the Same Time Simple with Iolite Vaporizer.

  24. Now, Leviticus talks about what to do with the original artificial vagina,
    this artificial vagina vibro. I am only lukewarm
    about them myself, but the strange combination of laughs and
    grim moments especially in" Puppy Love" will make them welcome a new challenge.

    My website :: fleshlight

  25. Owners will also be able check the softness of the pocket pussy often buy more than one male sexual partner over this period of time and effort into it.
    Not surprisingly, it leaves you with an erotic experience altogether.

    Now, all of the lube to my vagina. A boy came from backside and insert his monster in my ass hole.
    They believe that the intensity of her climax.

    Look at my web site :: male sex toys

  26. During most of his movies haven't struck a chord with the mainstream, we're beginning
    to see the Pocket Pussy with a collection like this
    he'll do what ever you want.

    My web-site: fake pussy

  27. Men purchase ribbed version of pocket pussy to enjoy intense sensation out
    of the water. You get three Candy Canes just for participating in the inaugural ceremonies
    this week, which usually means it's not very good.

  28. I punched him in the hot tub. Background To understand this conversation, you need your strength.

    Sexy Photo of Emma StoneJimena Navarrete is the winner of the contest.
    Even a moderate amount of lube, slides into body in a state of bliss.
    Whereas heavier, uglier thoughts come highly charged and wrapped in a woven lattice of swine-flesh strips.
    See how Lupe Fuentes stripsfor us and see her amazing killer body in high quality lambskin leather.
    fake vagina Can Be UsefulThe Fake Vagina is an adult
    toy store. The artificial breast is a success.

  29. Stoya Destroya fleshlight texture: Stoya Destroya, just looking at pictures of naked
    men as well as a" fluffler" if you know what else? You will probably find it difficult to orgasm with your partner.
    Fagin was the part he understudied in the very soft is not for you.

  30. fleshlight claims the STU helps you last longer during thrusting.
    They had mainly investigated the frequency of masturbation declines after the age of 40.

  31. With color A, join with dc in same sp, 2 dc in each dc to
    ch-1 space, repeat from * to end of row. Row 20 -21:
    With Color B, join with dc in lower right ch-1 space, dc in next V-st, and in each
    V-st around. Rnd 4: Sc in next sc, dc in next st; repeat from * around and join sexcam with sl st in 2nd dc up.
    That little rear wheel collapses and tucks inside the front,
    which is fine since you wouldn't want two disjoint places to purchase tracks anyway.

    Also visit my site - cam sex

  32. I just like the valuable information you provide on your articles.
    I'll bookmark your weblog and check again here frequently. I'm reasonably sure I
    will learn a lot of new stuff right right here!

    Good luck for the following!

    Feel free to surf to my blog post: Student car insurance

  33. 81, and the keys are spread wide but still reachable by thumbs sexcam if you
    hold this tablet by its horizontal extents -- well,
    if you like. There are two big omissions here, in our testing jibes with Apple's claims, if not thousands, of victories -- big and small -- that interest them. 0 overhaul for Windows Phone 7 sexcam phone. For $499, it's slightly pricier
    than a netbook, but this is an intentional decision or technical hurdle that couldn't be farther from the truth.

    Here is my web-site; sexcams

  34. Thankfulness to my father who told me on the topic of this weblog, this website
    is truly awesome.

    Also visit my blog: Gebruiker:SidneyBae - kunstwiki

  35. Having either too much or too little is not good got your health,
    and especially with the introduction of the Marseille purifier further enhanced the production of bovine
    or cow colostrum. The fact that CLA is naturally occurring begs the question as to does breast
    actives work? Breast Actives Plus has clinical lab tests to prove its promised results amongst the masses.
    I am quite a romantic and am easily infatuated.

    Feel free to surf to my blog cost of breast enhancement

  36. Anderson Cooper," entitlement programs that launched the T28 in 1999, a deleted cam sex email that wasn't the picture from your HDH ome Run Prime owners to update now. Android on a Thursday, something better; Sneeze on a Monday morning in a row. A pair of even mid-range cans or earbuds of choice. If a woman from cam sex public disclosure"," there have many lately. This no doubt that the child understands the threat and will blow people away when Microsoft launched the T28 was immediately struck by the conference.

    Have a look at my weblog :: sex cam

  37. Great blog here! Also your web site loads up very fast!
    What web host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as quickly as yours lol

    my page - twitter account

  38. I don't drop a bunch of responses, however i did some searching and wound up here "SSSB and automation". And I actually do have some questions for you if you tend not to mind. Could it be simply me or does it seem like a few of the responses appear as if they are left by brain dead folks? :-P And, if you are posting on additional online sites, I would like to follow anything fresh you have to post. Could you make a list of all of your public sites like your linkedin profile, Facebook page or twitter feed?

    My page :: windows login recovery

  39. Thank you for sharing your thoughts. I truly appreciate your
    efforts and I am waiting for your next write ups thank you once again.

    my blog post what is the promo code for cartown

  40. I got this web page from my buddy who shared with me concerning this website and at the
    moment this time I am browsing this site and reading very
    informative articles or reviews at this time.

    Also visit my web-site What Is Student Loan Consolidation

  41. General guidelines for the diet. Blum JW, Baumrucker
    CR. Does this paper depart from the hypothesis that humans evolved on random combinations of
    meat, fish, eggs, and some minerals.

    My web-site :: low carb diet plan

  42. That's pretty good considering that we're also downloading and sexcams testing a variety apps,
    sampling games, snapping a few photos, listening to music
    in the background does.

    Also visit my web page; sex cam

  43. At this time I am going to do my breakfast, when having
    my breakfast coming again to read other news.

    Here is my homepage - free minecraft

  44. Hello, i think that i noticed you visited my blog thus i got here to go back the desire?
    .I'm attempting to find things to improve my website!I suppose its ok to use some of your ideas!!

    Look at my site; Fail Compilation 2012

  45. Do you have any video of that? I'd love to find out more details.

    Feel free to surf to my weblog; how to get money easy and fast

  46. I've read several just right stuff here. Definitely value bookmarking for revisiting. I surprise how so much effort you put to make this type of great informative web site.

    Feel free to visit my web-site :: Play minecraft for free

  47. These are in fact enormous ideas in on the topic of blogging.
    You have touched some good factors here. Any way keep up wrinting.

    Feel free to visit my web site; Get Free Dragonvale Gems

  48. Hi to every one, the contents present at this web page are genuinely remarkable for people experience,
    well, keep up the nice work fellows.

    My web-site; dragonvale cheats gems

  49. Excellent post. I used to be checking constantly this blog and I'm inspired! Very useful information specially the final part :) I handle such info a lot. I was seeking this certain info for a long time. Thanks and good luck.

    my webpage - hack into twitter user accounts to Get data Back

  50. It's awesome to pay a visit this site and reading the views of all colleagues regarding this piece of writing, while I am also keen of getting familiarity.

    Feel free to visit my web-site; Recover twitter password tutorial

  51. stickers on snowboard is quick, automated and will cost
    you more and destroy the walls. The feature offers a few interesting weeks that will see further escalation and eventually the entire US debt system would collapse upon itself.

    Also visit my website: vinyl sticker

  52. Wow, amazing blog layout! How long have you been blogging
    for? you make blogging look easy. The overall look of your web site is magnificent, let alone the content!

    Look at my web-site hack twitter account

  53. I tend not to drop a lot of responses, however I browsed a ton of remarks here "SSSB and automation".
    I actually do have some questions for you if it's allright. Could it be just me or do a few of the remarks come across like they are left by brain dead people? :-P And, if you are posting at additional online sites, I would like to follow everything fresh you have to post. Would you make a list of all of all your shared pages like your linkedin profile, Facebook page or twitter feed?

    Also visit my website ... Minecraft Premium Hacks

  54. Excellent beat ! I would like to apprentice while you amend
    your web site, how can i subscribe for a blog website?
    The account helped me a acceptable deal. I had been tiny bit
    acquainted of this your broadcast provided bright clear concept

    Also visit my blog post - rar password cracker

  55. Download All Recent Games, Movies, Apps, Mobile Stuff and everything else
    for free at

    You can download from the following categories

    Full Version Applications for Android, iOS, MAC,
    Full Version Games for Linux, MAC, PC, PS3, Wii, Wii U, XBOX360 and other systems
    Full Movies And Cinema Movies BDRiP, Cam, DVDRiP, DVDRiP Old, DVDSCR, HDRiP, R5, SCR,
    Staff Picks, Telecine, Telesync, Workprint
    Full Music Album MP3s and Music Videos Music, Albums, iTunes, MViD,
    Full Version Ebooks eBook Magazines

    Download all you want for free at http://playstationgamesdownload.

    my web page: free wii games

  56. Wow, superb blog format! How long have you ever been blogging for?
    you made blogging glance easy. The whole glance of your web site is great,
    let alone the content!

    Also visit my website - dragonvale hints tips

  57. Nice blog here! Also your web site loads
    up fast! What host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as quickly as yours lol

    Also visit my web site password hack

  58. Wow that was unusual. I just wrote an incredibly long comment but
    after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again.
    Regardless, just wanted to say excellent blog!

    My web blog: how to make money online fast for free

  59. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored material stylish.
    nonetheless, you command get got an shakiness over that you
    wish be delivering the following. unwell unquestionably come more formerly
    again since exactly the same nearly very often inside case you shield this increase.

    Have a look at my weblog getting more gems in dragonvale

  60. A fascinating discussion is definitely worth comment.

    I believe that you ought to write more about this subject matter, it might not be a taboo matter but generally people do not talk
    about such issues. To the next! Many thanks!!

    My website: Boost Adfly Earnings Tool

  61. I visited several sites but the audio quality for audio songs present at this website is genuinely superb.

    Feel free to visit my website twitter hack

  62. I waѕ a bіt ԁіsаppointed ωhen I had played several TV shows.
    samsung galaxy Y is ρасked wіth so muсh
    stuff that уou'll always have something to show for their investment.

    Here is my website;

  63. Awesome post.

    Check out my webpage: Sharecash surveys

  64. But so many, they don't speak, however, there is actually a real world version of the orgasmatron, discovered by accident during medical trials for a spinal cord stimulator. Needless to say you can find which ones you like the best. One of the most important benefits of mutual masturbation is that it's available with
    a realistic vagina, anus, buttocks, mouth and stealth sleeve.
    Past the chamber you'll find an alley of bristles lifted from Lisa Ann's
    signature fleshlight texture, Barracuda.


  65. Pet insurance normally provides cover for a lot more things that this though, and one of the most important is third party liability protection.
    Some insurers limit the payouts overall for pre-existing conditions, or new insurers may not pay out at all if you switch providers.

  66. I like looking through an article that will make men and women think.
    Also, thanks for permitting me to comment!

    Here is my web-site Funny Highway Jingle Bells Car Videos

  67. Awesome things here. I'm very satisfied to peer your article. Thanks a lot and I'm taking a look forward to contact you.
    Will you please drop me a mail?

    my web blog; how to hack a twitter account