Python/PHP with ZK fingerprint attendance machines

biometric-attendance-machine-156954

If you are developing for Linux environment and If you have a task related to pulling data from a zk fingerprint attendance machine / biometric device the hair pulling phase may start 1 hour – 3 hours of hopeless search.

Downloading windows SDK and reverse engineering them isn’t the solution. wireshark isn’t the solution and connecting the the shared .mdb file isn’t also a solution the right solution is to connect to the machine using UDP port 4370.

0- Backup your attendance machine data.(You may use zktimes for this step.)

1- clone this repo:

For Python: git@github.com:dnaextrim/python_zklib.git

For PHP: https://github.com/dnaextrim/php_zklib

2- Login to the attendance machine as admin

and set the communication key (aka communication password to 0 or empty).

3- Set the IP address to some IP (say 192.168.1.201) this is the default one.

4-Connect the attendance machine to the network (ethernet most commonly)

5-Change IP:

zk = zklib.ZKLib(“192.168.1.201″, 4370)

6- Comment this (dangerous line that clears admin):

print Pesan Clear Admin:, zk.clearAdmin()

Now, try to run the script with the machine connected to your local network.

./zktest.py

I’ve just saved your life.

Check the file capability it should be very easy for any python programmer from here on.

Note: you may find very strange messages like “Pesan Koneksi” or use my safe English translated fork.

Enjoy!

odoo on docker

KuDr42X_ITXghJhSInDZekNEF0jLt3NeVxtRye3tqco

If you are on any linux distro and you want to play with odoo on docker and if you have docker installed you are 2 command away.

docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres
docker run -p 127.0.0.1:8069:8069 --name odoo --link db:db -t odoo

First command will pull and run the docker image postgres under the name “db”

The second command will pull and run the docker image odoo under the name odoo and will launch it to listen to port 8069 and forward it to you (the host) as the same port (8069) and finally will link it to the already runny “db” instance.

If you mac or windows the you will use boot2docker

docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres
docker run -p 0.0.0.0.1:8069:8069 --name odoo --link db:db -t odoo

Then do port forwarding from machine > settings > network

forward the boot2docker vm port 8069 to your local 8069
Inline image 1

Inline image 2

Now restart the power off the machine and start boot2docker again.
When you are done do the following command:
docker start db odoo

Bonus:

docker run -v /path/to/addons:/mnt/extra-addons -p 127.0.0.1:8069:8069 --name odoo --link db:db -t odoo

If you are linux and you want to mount your local addons folder to the docker image.

Reference: https://registry.hub.docker.com/_/odoo/

Enjoy !

10 years of CAT

I can’t believe It’s 10 years of CATReloaded. Huge achievement that worth stopping and studying how a tech community started that small @ nowhere succeed that much ?

Anyway. I’ll be speaker in scope 14 On April 18th 2015 isA
My session will be “How to Fail Fast” shocking name however tech geeks will know what I’m talking about hopefully young engineers of CAT will enjoy it.

AlSayed Gamal Scope 14

If you can be in Mansoura around that date [ April 18-20th 2015 ] I hope to see you there.

Here’s the Facebook event: https://www.facebook.com/events/1038977622783459/

Presentations

I’ve been posting my presentations on slideshare for a while and lately I found out that I didn’t post presentations for long time so take a look at them and tell me what do you think ?

 

If you think my presentations are kool ? Suggest me a topic to do a presentation about.

Thanks

Turning 27

Disclaimer: This post acts as a backup restore for my old blog.

It’s 2015 and It’s been 26 and few months since I was born.
Here’s how I summarize my life:

Before prep school [1-9] years old

  1. Some happy childhood memories and memories from KG with my elder brother
  2. Few teachers [My English teachers, Islamic Religion teacher , Music teacher]
  3. Very few friends.
  4. My mom.
  5. Death of my mom.الله يرحمها
  6. My Malaysian friends.[1- 9] years old.
  7. AlNasr Mosque and memorizing Quraan with Sheikh Shabaan.

[10-14] years old.

  1. My Prep. school الأميرية بنين
  2.  Bad friendship – أصدقاء السوء
  3. أجدع أصدقاء- Real Friendship
  4. Mr. Nader el Atafi – نادر العطافي – Maths teacher.
  5. Mr Ayman. – My English teacher / neighbor.
  6. Being real teenager grew a mustache and weird voice.
  7. Selling Jasminum on street.
  8. Getting to know my cousins more specially Mohammed Fayez and going w/ family to beach.
  9. My dad getting married and my younger brother crying.
  10. Playing soccer and fencing

[15-18] years old.

  1. العسكرية Mansoura Military school.
  2. El Droos [Private tuition].
  3. Friends (again).
  4. Last year challenge.
  5. My elder brother didn’t manage Faculty of engineering
  6. When my father hugged after knowing my score.

[18-23] years old.

  1. CAT.
  2. Complete freedom.
  3. One hell long and bad  one-sided love story.(This is what I thought back then.)
  4. My first Start-up with Ahmed Sameh.[Hosting]
  5. My First Failure.
  6. My Second Failure.
  7. My dad kicked me out of home.
  8. My first work and paid work.
  9. Being very famous and giving courses and lectures.
  10. Working from Cairo and living alone.
  11. Graduation project and Graduation.
  12. My second Start-up[Tafra]

[24-~27/now] years old.

  1. mash [mashsolvents]
  2. Abdulhamid is becoming a super web fronted developer.
  3. winning start-up weekend mansoura
  4. Knowing Reem
  5. One hell of love story with Reem.
  6. Marrying Reem
  7. Going to Turkey with Reem
  8. Working @ Vision
  9. Going to France with Eslam Farid and the great Muayyad AlSadi.

Notes: Years between 20-26 passed like 5 minutes however I’ve done enormous amount of activities in these years!