Skip to main content

Posts

Showing posts with the label python

Dissecting traces with DTMF tones

I'm sure I belong to the large group of people who love to analyse network traces with tools like Wireshark. Being able to see the details of a packet or datagram down to the level of the bits is not only extremely useful, but also fascinating. Time ago I wrote a dissector for Wireshark, using the Lua interface, and that was fun (I see it's still available here ). The official recommendation  is to use Lua only for prototyping and testing, but when performances are not key and there isn't the intent to add the dissector to the official distribution, it's fast and effective. In order to parse network traces with audio and extract it into the payload first, and then decode it into a WAV file, C is a viable solution. I wrote about a program that does that here and since it attracted some attention and feedback I wrote an updated version later . More recently I wanted to identify programmatically the presence (and value) of DTMF tones - as RTP Events, RFC 2833 - in network ...

Kubernetes role-based authorisation for controller applications

There are many scenarios where an application running inside a Kubernetes environment may need to interact with its API. For example, an application running inside a Pod may need to retrieve real time information about the availability of other applications' endpoints. This may be a form of service discovery that integrates or extend the native Kubernetes internal service discovery. In most cases, DNS records are associated to a Service and provide the list of active Endpoints for that Service, with a proper TTL. There are situations though where those DNS records are not available, an application is not able to use them directly, or what's needed is more than the private IP addresses associated with the Endpoints. If interacting with the Kubernetes API from inside an application is needed, then there are two main areas to consider: Authentication and Authorisation. Every Pod has a Service Account associated to it, and applications running inside that Pod can use that Service A...

Testing SIP platforms and pjsip

There are various levels of testing, from unit to component, from integration to end-to-end, not to mention performance testing and fuzzing. When developing or maintaining Real Time Communications (RTC or VoIP) systems,  all these levels (with the exclusion maybe of unit testing) are made easier by applications explicitly designed for this, like sipp . sipp has a deep focus on performance testing, or using a simpler term, load testing. Some of its features allow to fine tune properties like call rate, call duration, simulate packet loss, ramp up traffic, etc. In practical terms though once you have the flexibility to generate SIP signalling to negotiate sessions and RTP streams, you can use sipp for functional testing too. sipp can act as an entity generating a call, or receiving a call, which makes it suitable to surround the system under test and simulate its interactions with the real world. What sipp does can be generalised: we want to be able to simulate the real world tha...

Script vs Program - A pragmatic view

First, it'd be useless to talk about the distinction between a "scripting language' and a 'programming language', because it's clear that the same language can be used in different contexts and environments, be interpreted in some cases or compiled in others. The only distinction worth discussing in my opinion is whether a portion of source code is a script or a program . A very easy conclusion can be found in "Building Skills in Python", S. F. Lott: The “scripting” distinction is an operational feature of POSIX-compliant operating systems. Files which begin with the ‘#!/path/to/interpreter’ will be used as scripts by the OS. They can be executed from the command-line because the interpreter is named in the first line of the file. Languages like Java, C and C++ do not have this feature; these files must be compiled before they can be executed. So what happens if you have, say, a couple of thousands lines of Perl code, distributed in ...

A Practical Approach to the RSA Algorithm

So you're curious about the RSA algorithm, you like Internet technologies and mathematics? This is a short article on how the RSA Algorithm works, with practical examples. Preface and Disclaimer Obviously the article itself and the code here presented are suitable for a learning activity only and in case you use them, you do it at your own responsibility. I based this on the 1977's article from Rivest, Shamir and Adleman , (from which initial letters the algorithm takes the name), and ran the code on a Mac with python 2.6.1. The code presented here is also not optimized. The reader is invited to suggest better implementations (in languages other than python as well). Mathematics concepts you need to know - What a 'prime number' is. (A integer number which can be divided evenly only by 1 and itself. e.g. 1, 2, 3, 5, 7, 11, ..., 47, ...) - What the 'modulus' (here referred as 'mod') operation is. ('A mod B' is the reminder of A divided...