Learning C in 2016

Hey everyone. This is the first post in my series of posts about my experience with learning C in 2016. Today, I'll start with "Why?". So, Let's do this.


Why?


I think some of you may be wondering, why should you learn C in 2016? I mean it's 2016 (21st century) and you should be learning some high level languages like python, ruby, haskell, rust, swift, java etc. and just doing stuff rather than sitting on gdb terminal, banging your head against the table for hours because you double freed a pointer in your code. So, why c? Well, even though C is old (44 years old), it's still found everywhere (Kernels, drivers, embedded systems, real-time systems, etc). And, there's reason for it. Some of it includes wide availability, thin layer of abstraction, smallness, efficiency, lightweight-to-nonexistent runtime support etc. 

C is quirky, flawed, and an enormous success. While accidents of history surely helped, it evidently satisfied a need for a system implementation language efficient enough to displace assembly language, yet sufficiently abstract and fluent to describe algorithms and interactions in a wide variety of environments. - Dennis M. Ritchie

It's also broken. Undefined Behaviors in C are almost impossible to evade.It is full of design choices that made sense in the 1970s but make zero sense now. Everything from its unrestricted, wild use of pointers to its severely broken NULL terminated strings are to blame for nearly all of the security defects that hit C. It's very difficult to write secure code in C. 

The C programming language’s only failing is giving you access to what is really there, and telling you the cold hard raw truth. C gives you the red pill. C pulls the curtain back to show you the wizard. C is truth. - Zed Shaw


And, Of course, with great power comes great responsibility. But, I digress, I think you should learn C if you can answer yes to any of these:
  1. Do you want to Contribute to *nix Kernel or write your own?
  2. Do you want to write system drivers or programs for embedded systems, real-time systems?
  3. Do you want to understand Operating Systems and other low-level stuff?
  4. Do you want to write performance critical programs?
  5. Do you want to learn defensive and robust programming?
  6. Do you want to be a better programmer? 

I hope this was helpful to you in any way and don't forget, In the next post I'll be talking about the tools and resources you may need and how to use them effectively. 
see you later! 


- 0xelectron

"It's 5.50 a.m.... Do you know where your stack pointer is ?"  



The C Programming Language

Hello everyone. It's been quite a long time since I last posted; which obviously means I wasn't able to keep my up with my daily log idea. Heck, I didn't even log for a single day. But let's not waste this post on my failure and hope I can post more often from now on. Today I want to review 'The C Programming Language' by Dennis M. Ritchie and Brian K. Kernighan. So, Let's dive in.

So, I wanted to learn/Revisit C (more on this in next post) and I was looking for the books available. I googled, looked in blogs, asked in forums and most of them seemed to be recommending 'The C Programming Language' by Brian W. Kernighan and Dennis M. Ritchie as the first book to go for. I thought Why would I want to learn a programming language from a book almost 28 years old (even-though co-written by it's creator)? I mean, it's 2016 and this book should be way outdated. I have to say, I was terribly wrong.

The book is really well written and engaging. The book takes an practical approach and you get your hands dirty in no time. The language features are divided into chapters, arranged in coherent manner. Every topic is explained clearly in a very concise manner The examples are short, useful and fun. And code, It's... it's beautiful, elegant, logical, short and well commented. I have programmed before and I never understood what it means to write good quality code until I read this book. It teaches you how to divide your program into small functions which does one task, but does it perfectly well. It teaches you how to think in a procedural way which I believe is quite important. Even though the book is bit outdated and there are new language features available, this book is a solid read and I highly recommend it to anyone who want to learn C. You will not just learn C, you will learn to write good code.
 

Tl;Dr The book is short, complete, engaging; examples are short, fun, useful; code is short, concise, elegant.
 
Note: This book assumes you have a prior programming experience. Although you can fairly catch up quickly.


- 0xelectron 

Hello World.

Hello everyone. I'll keep this short and sweet. I've been trying to break into infosec for quite a while now, and so far, I've failed. So, recently I jumped to conclusion that I really should log about my journey. And so, I've started this blog. My primary intent with this blog is to motivate myself to learn. The blog will chronicle my feeble attempt to become moderately competent in penetration testing. By sharing what I've learned, my hope is that you will walk away having learned something useful as well. If through the course of my posting I happen to come up with something useful and innovative, great! If you find that I'm reinventing the wheel, so be it. Again, the purpose is to guide me along to my ultimate goal of becoming a legitimate Penetration Tester.


- 0xelectron