June 24, 2017, 03:29:14 AM
Welcome, Guest. Please login or register.

CMFP (Certified Metasploit Framework Professional) Course is out! http://www.top-hat-sec.com/cmfp.html

Author Topic: How to use the terminal as a calculator or a hex <-> decimal converter  (Read 636 times)

Offline Grey-Matter

  • Top Hat Member
  • Experienced
  • ********
  • Posts: 112
  • Internets: +57/-0
Hey everybody. This is really just a quick tip for anybody that doesn't already know how to do this.

For regular calculator functions, you can just place the equation inside "echo $(())"



For Hex to Decimal, since normal hex is base16, you can echo $((16#HEX))
To convert Decimal back to Hex, i don't know how to do it with the same bash echo function. bc is another one of MANY ways to convert things in the terminal. 
echo'ing obase=16 to bc will convert decimal to hex. and echo'ing ibase=16 will convert hex back to decimal



Apologies if this is poorly written. I personally just started doing this alot while going thru the RE miniseries so i can get that damn flag on the practice CTF  :D

Offline GalaxyNinja

  • Global Moderator
  • Elite
  • *****
  • Posts: 1713
  • Internets: +95/-0
  • My password is **********
Re: How to use the terminal as a calculator or a hex <-> decimal converter
« Reply #1 on: February 20, 2016, 06:16:01 AM »
I personally just started doing this alot while going thru the RE miniseries so i can get that damn flag on the practice CTF  :D

You should have been able to get that flag in the first video of the Mini RE Series.
Now later on with another challenge....  ;D

Offline Grey-Matter

  • Top Hat Member
  • Experienced
  • ********
  • Posts: 112
  • Internets: +57/-0
Re: How to use the terminal as a calculator or a hex <-> decimal converter
« Reply #2 on: February 20, 2016, 06:46:10 AM »
Yeah i realize that now lol. I guess i kept missing it and automatically assuming it was something in one of the last video's. It's all good tho cuz i ended up going thru the whole series and that was my motivation.  :)

As far as other challenges tho, i'm 100% stumped right now. All the one's i have blank right now might be staying like that for a while.

Offline GalaxyNinja

  • Global Moderator
  • Elite
  • *****
  • Posts: 1713
  • Internets: +95/-0
  • My password is **********
Re: How to use the terminal as a calculator or a hex <-> decimal converter
« Reply #3 on: February 20, 2016, 11:00:56 AM »
I had to thrown in a Few challenging ones or you guys would get bored!  ;D

Offline RedCor

  • Top Hat Member
  • Prospect
  • ********
  • Posts: 31
  • Internets: +5/-0
I love !!! ;D