My Journal

All things Mathematical
14 Nov 2018

GNIB Bot

/
Posted By
/
Comments0

As a teacher of international students I am aware of the need among my students to visit GNIB (Garda National Immigration Bureau) office to get their visa and GNIB card. When I lived in Dublin I would pass Burgh Quay every morning and would be stunned by the queues. Here is a picture of a typical queue from the Irish Times Newspaper:

So I was pleased to learn about a year or so ago that GNIB are moving to a system of online booking. Wonderful, no need to queue – just book a date and time online.

However, I discovered from my students some serious flaws in this system. It would seem their booking system is forever booked out. My students try for days and days and weeks and weeks to book a visit but fail every time. No free slots exist.

Now, I also learnt that there are people online offering to book a time for you. It would seem there are bots that book up all free slots moments they become free thus if you are to get an appointment you must either

  • be very lucky in your timing or
  • pay on the black market for someone to book for you.

Why do GNIB allow this problem to exist? I investigated their booking form and it seems there are huge flaws in the system that allow bots to book up free slots. It would seem that:

  • The captcha doesn’t really work
  • There is no automatically blocking of IP addresses associated with bot-like behaviour
  • There is no need to sign-up and make an account with a valid email address to proceed with a booking
  • The fields in the form are not validated (like email or passport number)

It would be very simple to fix this problem and I’m not sure why GNIB don’t fix it. For example they could:

  • Fix the captcha
  • Block abusive bots or at least limit the number of queries per IP address (no one can submit a form once per second so block these requests and the IP address for 1 hour)
  • Require users to confirm their email address
  • Or even to make an account

I was curious to see if I could make a python bot that checks if there are free slots (so I could then have a python script text me when slots open up). The function GNIB() returns True if a slot exists and False otherwise. It was surprisingly quick to code this up, here is my GNIB() function:

PS: And there wouldn’t be too much more work to have a script making the booking. This is a very odd broken system in place that doesn’t need to be this way.

CODE

import requests

import json

def GNIB():

url=’https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/(getAppsNear)?readform’

with requests.Session() as Session:

response = Session.get(url, verify=False)

html = response.text

j = json.loads(html)

if str(j[’empty’]) == “TRUE”:

return False

else:

return True

Leave a Reply

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