Reverese Engineering

Reverese Engineering: Understanding a C program [Part2]

Empty Main funciton
assembly code for empty main
integer assignment
assembly code for integer assignment
another variable
a char variable
  • initialize an integer variable with a value of 5.
  • Compare the value the stored value with 10.
  • if the value is not equal then jump to the else section.
  • else follow the if section.
assembly equivalent
  • <+8> : initiate a variable and store the value of 5.
  • <+15> : compare the value with 0xa (decimal equivalent is 10)
  • <+19> : jump if not equal to (jne); jump on line (main+38). (main is the entry point here so its value is +0)
  • <+21>-<+31> : print “welcome”
  • <+36> : jump to line +53
  • <+38>-<+48> : print “invalid value”
values passed to the print statements
  • 0x400673 → W
  • 0x400674 → e
  • 0x400675 → l
  • 0x400676 → c
  • 0x400677 → o
  • 0x400678 → m
  • 0x400679 → e
  • 0x40067a → new line char (\n)
  • take input using the scanf function
  • compare the value with 0xa
  • take a jump if not equal to
  • else follow the path




Connecting the dots and rest is magic.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Tailor Tech Goes Open Source: Our Current Projects

I Probably Hate Your Code Review Process

Getting started with Flutter Driver

Lining up Audio and Visual to Build Cutscenes in Unity

12 weeks at Univelcity

How Much Fast is Fast Tokenizer of Huggingface?

Semantic Search engine design for Q&A [Docker containerization, Elastic search, Flask]

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rishabh Umrao

Rishabh Umrao

Connecting the dots and rest is magic.

More from Medium

PicoCTF: Glitch Cat Challenge-WriteUp

What is the differences between static and dynamic libraries?

Working with QR Codes in Embedded Linux and ARM-powered devices using the C language

How long Does It Take To Learn C++ Programming