Sunday, December 17, 2017

Hex Calendar

Some time ago, I've written a simple tool to generate calendar image for a year. But the calendar in not usual format, but in hex format, i.e. with days, month and year in hexadecimal format.

Repository with sources in Python is available on github:

Here is the result image of hex calendar for 2018 year (0x7e2 in hex) with SPbPython logo:

Wednesday, November 1, 2017

SchoolCTF 2017

SchoolCTF game will be held on November 5, 2017. Don't forget to register for this event. Despite the name of this CTF, not only student teams can participate. The rating is counted separately for school and non-school teams.
The complexity of the tasks is targeted at beginners. Therefore, if your team wants to practice, but does not have much experience – welcome.

Tuesday, July 11, 2017

PEP20 - The Zen of Python decorators

The Zen of Python principles as Python decorators:
def func():
    """Idiomatic function"""
Each decorator could act as code analyser.

Thursday, May 25, 2017

SNMP walk in pure Python

Some time ago I've added one more protocol to my github repo. This time SNMP.
I created tool similar to snmpwalk in pure Python. The most difficult part was to implement an ASN.1 parser. Current version supports only SNMP versions 1 and 2.

Friday, March 17, 2017

VolgaCTF 2017 Teaser - Octaves & Notes writeup

Eve intercepted this midi-file. She only knows that notes must be in 1st and 2nd octaves. Can you help her?

Stegano & Crypto. Hmmm...

Let's open this midi file in audio editor:

I've noticed that only ABCDE and F notes are present (no G note). Thus, it is possible to understood the relationship with hex.

If write out the full melody in octave-note format, we will have the next result:
2D, 1A, 2D, 1B, 2C, 1A, 2D, 1F, ...

Then I've noticed that 0x2d in ASCII is "-" (dash), 0x2c is "," or some sort of delimiter. And the other 4 notes (all in first octave) are non-printable in ASCII.
Often non-printable characters are replaced with a dot in the output.
So using the next Python script, I've got a flag encoded in Morse code:

import string

notes = [0x2D, 0x1A, 0x2D, 0x1B, 0x2C, 0x1A, 0x2D, 0x1F, 0x1E, 0x2C, 0x1B, 0x2D, 0x2C, 0x1F, 0x1E, 0x1A, 0x2C, 0x1B, 0x1F, 0x1E, 0x2C, 0x1B, 0x1A, 0x2C, 0x2D, 0x1B, 0x2D, 0x1A, 0x2C, 0x2D, 0x2D, 0x2C, 0x2D, 0x2D, 0x2D, 0x2C, 0x1B, 0x2D, 0x1B, 0x2C, 0x1A, 0x1B, 0x1F, 0x2C, 0x1E, 0x2C, 0x2D, 0x2D, 0x2D, 0x2C, 0x2D, 0x1B, 0x2C, 0x1F, 0x2C, 0x1A, 0x2D, 0x1B, 0x1A, 0x2C, 0x2D, 0x2D, 0x2D, 0x2C, 0x1A, 0x1F, 0x1E, 0x2D, 0x2C, 0x1E]
out = ''
for n in notes:
    out += chr(n) if chr(n) in string.printable else '.'

print(out.replace(',', ' '))

-.-. .-.. .- ... ... .. -.-. -- --- .-. ... . --- -. . .-.. --- ...- .

And the flag is:


PS: WTF! Where is hint about non-standard flag format? :(

Thursday, December 22, 2016

Computer Networks book

Finally finished a book "Computer Networks" by Andrew S. Tanenbaum and Davis Wetherall.
It is really good academic introduction for everyone interested in and works with computer networks.
A good explanation of how the networks works on each level is given. All popular protocols, network security, encryption and compression algorithms are reviewed. This book helps to organize knowledge about all these issues.
Moreover at the end of this book (and in the text of each chapter) a good list of further reading is included.
Highly recommend to look at this book.

Sunday, December 4, 2016

Insidious CodeType, or from segfault to a working code

Today I've made a 30-minutes blitz talk at ITGM with Andrey Zakharevich about a real problem with Segmentation Fault in CPython when special function has been generated.

ITGM #9 - Insidious CodeType, or from segfault to a working code (In Russian)