GridMan – intro

Zrzut ekranu 2016-08-04 o 13.14.13

As everything in my dev life GridMan started because of a need. And yes i did some research on the topic but all projects that i found were not exactly what i was looking for, so i decided to write my own Distributed Computing Library.

So here it begins.
Somewhere around 2014 after diving into the pen testing (again:) i found that working with the WPA and WEP and MD5 cracker on a single host is just a pain in the ass and i waiting weeks or months for some password to popup is just a waste of time. So at that time i was playing around with MD5 hashes and i knew john the ripper could do the job but it was not acceptable to let a 24 core cpu running at home with all his fans operating, cables lying around, power consumption and kids wandering around. I opened my garage and found couple of Raspberry PI’s laying around. Then it started. It was clear decision to start developing with raspberries, why?

Because of costs, power consumtion and lack of noise they generate. If GridMan will work on Raspberries it is obvious it will work on a dedicate Blades/… after recompiling, so the goal was set.

Zrzut ekranu 2016-08-04 o 13.40.28

What i needed at that time is pretty what i am using the GridMan today for.
All i wanted is a network connected group of computers working together on projects that are made of tasks of binaries with payloads. Payload in the sense of passing argv’s to the binary so that each node can start binary with some arguments.

Infrastructure and hardware – I needed to ensure that the whole h/w part is easy – as mentioned, i didn’t want to have cables lying around for weeks, routers and lots of space taken so i had to figure out how to approach it so that the Grid was small and fully customizable and what’s more important – cool looking – so that i could place it somewhere at home and look at it when it’s crunching.

Zrzut ekranu 2016-08-04 o 13.46.56

WiFi – packets flying to/from GridMan are very small, i strip the binaries (tasks) and payloads are just arguments passed so mainly uint_16’s or some chars. WiFi is enough to get this connected and it obviously safes a lot of space around (no cables mess).

Stacking – i used some bolts and screws to stack the boards on top of each other, couple of minutes of work and its done. Even looks good.

Power – a single power unit would be perfect, therefore i use a DLINK 7 port active USB hub to power up 5 PI’s.

Power cycling – sometimes grid goes off, i used a Belkin WEMO switch to poweron / poweroff the grid from my phone.

Zrzut ekranu 2016-08-04 o 13.52.36

So the hardware part was easy, stack the PI’s however you want, let them connect to your network and play. And btw.. new PI’s have a big advantage over old ones ( 4 cores, Wifi built in ).

The software
Yes, the best part.

GridMan consists of a Dedicated Server binary ( GridMaster ), a Worker (GridNode) and a command line tool for playing around with the projects, tasks, grid itself. In addition to that, there are couple of Grid Tasks that i’ve made that can be kicked off on the grid for crunching. Some of these are : MD5 cruncher, WPA, WEP, Raytraycer, NN learner and something new that i’m working on is Distributed Fuzzer.

GridMaster (Server) – this guy is responsible for work management mainly. You upload a Project (that is just a container of tasks with a name) and tasks you want to run on Nodes.

Zrzut ekranu 2016-08-04 o 14.04.36
Server keeps track of all the tasks and distributes them to idling nodes.
What he really does is finds out the Idling nodes within the grid and sends them the Binary  + Payload, then flags the node as active and keeps getting heartbeats with load average from crunching node. When node finishes, it sends back the new payload (return of the binary) to the server, then the task is set to Complete (or failed) and next task is given to a node / next node meantime.

GridNode (worker) – these guys are like bees. They connect to the GridMaster and wait for tasks to be received. If a task is received, worker saves the binary and payload in the /tmp/. Then it chmods the binary and spawns a child that runs it.
There are two possible options at this moment:

1) the binary exec fails – then a failure is returned to server, you can later on decide what to do (restart for example),

2) the binary starts and keeps working

Zrzut ekranu 2016-08-04 o 14.21.09

After completion, a success code together with payload is returned to server and worker starts waiting for another task.

CommandLine – handy tool for a grid manager 😉
Zrzut ekranu 2016-08-04 o 14.12.04
This command line utility is to drive the whole grid. You can do all project management down to a task operations with a single command. It’s nothing more than exposed api from GridMan lib to control the whole system.

Zrzut ekranu 2016-08-04 o 14.18.09

Above, example showing 2 workers 1 project with 6 tasks. You can also see which node is working on which task.

Zrzut ekranu 2016-08-04 o 14.18.55

Above, example showing 2 tasks running from MD5_TEST project

GridMan IOS – yeah, the pocket GridMan administrator.
Not everybody likes consoles so i made a fine looking easy to use grid manager. Play with the grid from all over the world 😉 A single gif is worth more than thousands of words.

EntityAI

So that’s mainly it for an intro, i will go in to details with next updates on GridMan.

There are couple of GridMan Vids you can watch :YouTube
And a (Polish) article: osworld article

Advertisements