Tuesday, May 31, 2016

Using OpenSSL

Let's create a private key:

$> openssl genrsa 128 > my.key

Note: This is only a 128 bit key. Use this only for demo/educational purposes!

You can get some information about the private key with the rsa command:

$> openssl rsa -inform PEM -text -noout < my.key

However, the private key is our secret and we need the public key to encrypt a message. Extract the public key with the -pubout switch:

$> openssl rsa -pubout -in my.key > my.pub

You can get some information about the public key with the rsa command:

$> openssl rsa -inform PEM -text -noout -pubin < my.pub 

Let's encrypt a message using our public key. OpenSSL's rsautl helps with that:

$> echo -n "Hi" | openssl rsautl -encrypt -inkey my.key > message

$> cat message | hexdump 
0000000 e1a8 947f e1b2 e514 c8d4 b3e4 0c46 36c9

Note: This only works for messages which are smaller than the modulus. Usually the message is encrypted with a symmetric key which is in turn encrypted with RSA.
As you can see, we encrypted our message "Hi" and the result is gibberish. Only the recipient can decrypt it using his private key.

The last step is to decrypt the message with our key:

$> cat message | openssl rsautl -decrypt -inkey my.key

GPG cheatsheet

Getting Started

Creating your secret key will start with:
gpg --gen-key
You should probably use the default settings, except it doesn't hurt to make the key size as large as allowed (4096 bits currently.) The larger the key size, the longer it will take to initially generate your key (and encryption/decryption will be slightly slower. That is a Good Thing, as anyone attempting to break your encryption will also need to spend more time too.)
to export a public key into file public.key:
gpg --export -a "User Name" > public.key
list your key : 

gpg --list-keys your@email.address
to export a public key into file public.key :
gpg --export -a "User Name" > public.key
to export a private key :
gpg --export-secret-key -a "User Name" > private.key
To encrypt data, use :
gpg -e -u "Sender User Name" -r "Receiver User Name" somefile
gpg -s -a -r "User Name" -e somefile # the output file ""somefile.asc""
gpg --encrypt somefile # the output file ""somefile.gpg""
To decrypt data, use :
gpg -d somefile.gpg

Monday, May 30, 2016

Simple use of Base64 Command

This tool is Simple to use, just type : 

echo "Hi All" | base64 

to decode the message just type : 

echo "SGkgQWxsCg==" | base64 -d

Saturday, May 14, 2016

strace for "dig" command

I'm not sure if it the same situation, but is not a usage of 'strace' easier?
You can see syscalls and you can search for sendmsg and recvmsg to see what data are sent through socket.

For example:
strace -e trace=sendmsg,recvmsg -f -s 1024 dig +short www.google.com
This will show you a full DNS request and answer. Reverse engineering was never easy before :)

Byobu : Japanese term for decorative

Byobu is a Japanese term for decorative, multi-panel screens that serve as folding room dividers. As an open source software project, Byobu is an elegant enhancement of the otherwise functional, plain, practical GNU Screen. Byobu includes an enhanced profile, configuration utilities, and system status notifications for the GNU screen window manager as well as the Tmux terminal multiplexer. Byobu is developed and released as free software under the GPLv3.

Install in Fedora 22 32bit :

dnf install byobu

the final result :

Key Bindings

Byobu is a configuration layer on top of GNU Screen. As such, all of GNU Screen's keybindings work in Byobu exactly as in Screen.
Moreover, Byobu provides a comprehensive, advanced set of commands bound to the F-keys on most keyboards.

Create a new window

Move to the previous window

Move to the next window

Refresh all status notifications

Detach from the session and logout

Detach from the session, but do not logout

Enter scrollback/search mode

Rename the current window

Launch the Byobu Configuration Menu

GNU Screen's Escape Key

Scroll back through this window's history

Scroll forward through this window's history

Split the screen horizontally

Split the screen vertically

Move focus to the next split

Move focus to the previous split

Collapse all splits

Reconnect any SSH/GPG sockets or agents

Toggle all of Byobu's keybindings on or off

Friday, May 13, 2016

Use the Chromebook Recovery Utility

If you need to recover your Chromebook, you can use the Chromebook Recovery Utility to create recovery media and get your Chromebook working like new again.

What you need to create recovery media

Before using the utility, make sure that you have:
  • A flash drive or other storage media that can hold at least 4GB and that you don't mind clearing.
  • An extra Chromebook, Windows, or Mac computer with administrative rights and Chrome browser installed.

Create recovery media

If your Chromebook isn't working properly, you can use an extra Chromebook or another Windows or Mac computer to create recovery media. Otherwise, you can follow these steps on your Chromebook if you want to create recovery media to use later.
If you're using a Linux computer, follow the instructions listed after Step 6.
  1. Install the Chromebook Recovery Utility app on your Chromebook or on your Windows or Mac computer.
  2. Open the app.
  1. Type in the model number of the Chromebook you want to recover to get the correct recovery image. You can find that number at the bottom of the error message on your Chromebook or on the recovery screen in the app.
  2. Click the Continue button.
  1. Insert your storage media in to an open USB or SD Card port on your Chromebook or on your Windows or Mac computer. The tool will automatically detect the media.
  2. Use the dropdown menu to select the appropriate storage media.
  3. Click Continue.
Important: All of the data on the recovery media will be deleted if you continue.
  1. Make sure the media you'd like to use for your recovery is listed.
  2. Click the Create now button.
The tool will then create the recovery image on your selected media. Don't remove the flash drive or SD card while this is happening. After you see the message saying that your recovery media is ready, you may remove it from your Chromebook or computer.
Restore your Chromebook using your newly-created media.
The Chromebook Recovery Utility partitions the USB or SD media into different sections, which means you can’t store data on it unless you wipe the drive clean.
You can use the Chromebook Recovery Utility to erase the recovery files and partitions so that you can use the USB or SD media for storage again:
  1. Open the Chromebook Recovery Utility app and click the settings icon More.
  2. Select Erase recovery media.
  3. From the dropdown menu, select the recovery media you'd like to erase.
  4. Click Continue.
  5. Make sure the media you used for recovery is listed. Remember, all of the data on the media will be erased.
  6. Click Erase now.
The tool will then erase the recovery image on your selected media. Don't remove the flash drive or SD card while this is happening.
After you see the message saying that your recovery media is prepared for formatting, you may remove it from your Chromebook and format it using a tool provided by your operating system.

Create recovery media using a Linux computer

  1. Click here to download the Recovery Tool: https://dl.google.com/dl/edgedl/chromeos/recovery/linux_recovery.sh
  2. Change the script permissions to allow execution with the following command: $ sudo chmod 755 linux_recovery.sh
  3. Run the script with root privileges with the following command: $ sudo bash linux_recovery.sh
  4. Follow the instructions on your screen.

Source : https://support.google.com/chromebook/answer/6002417

Tuesday, May 3, 2016

Free Public DNS Servers

Google Public DNS IPv4 Addresses:
Google Public DNS IPv6 Addresses:
Level 3 Public DNS Server Addresses:
OpenDNS IP Addresses:
Norton DNS IP Addresses:
Option A:
Option B:
Option C: