Showing posts from 2016

Calculating hash(md5, sha1...) of a hex string in Python

To calculate hash of hex string in python:
In [1]: import hashlib
In [2]: import binascii

In [3]: hex_string = '3082010a0282010100c3dfee03290fb01e3a4887c5ce0630dcdd8495bfb568b1f61cb8fa8294545b74f06facd215933c53babdd4d066dcb2a713740b9a018c8e0d5fbe1c2a7c793d317c69590c6a34cb1758fd1ff00f36d757c97371d08e9e9efcad1bf6fc8a0c03972296870ad825fa81000fee7aa79c2bcfab0e92d67d3d429d9a25cd6087e3139b17ce1809a6bf83d5ef40ff8e4532412adc15c63eff4eadd264860cb61b381e4f0e8a9e19cf7e39fefdfe9904b1aafe54f12289b930e341dd12b5a41eca1ae9d3556e6c7860a162652a31e256a7fa5720b4cbeb32fa65b67eb0610c6857dfe775d71de5aeb041d7ea0a7c5f335d678280b30dd014e16b37290c4c56d20df737850203010001'
In [4]: hashlib.md5(binascii.unhexlify(hex_string)).hexdigest() Out[4]: '0c6f3dd3d5d896e0f3f49dfae0437ba1'
In [6]: hashlib.sha1(binascii.unhexlify(hex_string)).hexdigest() Out[6]: 'fc6d7e7925e18c5bed6314ea112a230948cfde75'
In [7]: hashlib.sha256(binascii.unhexlify(hex_string)).hexdigest() Out[7]: '73a1b42ca158112e233cd42b03…

How to extract signing certificates from macOS binary files

Code signing is a macOS security technology that you use to certify that an app was created by you. Once an app is signed, the system can detect any change to the app—whether the change is introduced accidentally or by malicious code. As Apple Developer site says ( click here for more details on code signing) :

code signing allows the operating system to: Ensure that a piece of code has not been altered since it was signed. The system can detect even the smallest change, whether it was intentional (by a malicious attacker, for example) or accidental (as when a file gets corrupted). When a code signature is intact, the system can be sure the code is as the signer intended. Identify code as coming from a specific source (a developer or signer). The code signature includes cryptographic information that unambiguously points to a particular author. Determine whether code is trustworthy for a specific purpose. Among other things, a developer can use a code signature to state that an updated ve…

How to fix "This copy of the Install OS X Mavericks application can't be verified. It may have been corrupted or tampered with during downloading." message and install Mavericks or older operating system versions of OS X on VmWare Fusion application

It is very annoying to see  the message "This copy of the Install OS X Mavericks application can't be verified. It may have been corrupted or tampered with during downloading."  when you try to install old releases of Apple OS X operating systems such as Mountain Lion, Mavericks, Yosemite etc. If you are trying to install OS X Mavericks as virtual machine in VMWare fusion or in physical system, then follow below steps to successfully install the operating system.
In VMWARE Fusion.
Create a OSX Mavericks VM by attaching OSX Mavericks Installer to the virtual machine.Do not Poweron the virtual machine. If powered on automatically after 1st step above then poweroff the VM.Open Virtual Machine Settings, Goto Advanced Section.Un check "Synchronize Time" setting.Start the Virtual Machine to install the OSX Mavericks.In the OSX Installer app , Launch the system date to old date as date 102613152013 (Oct/26/2013 13:15).Quit the Terminal application.Conti…

Genrating MD5 for all files in the system

The following command will generate MD5 for all the files in the system.

sudo find ./ -type f -print0 | xargs -0 md5  >>  /tmp/checksums.md5

What is (7.0.0) kext is doing on OS X systems ?

When you run kextstat command to see the list of kernel extensions loaded in the system, you might come across kext named (7.0.0) being loaded all the time. You might me wondering what is the role of this kernel extension.  prevents OS X from being used on non approved Intel hardware – as OS X is licensed only for use of approved Apple Intel hardware. This kext is used to control software piracy of OSX on non Apple supported hardwares. Hence its role is to detect and fail the OSX installation on non apple certified hardwares. 

How to disable default certificate verification in Python 2.7.9 and above permanently on Mac?

Python from 2.7.9 and above now verifies the SSL certificate prior establishing the connection to server. This might cause problem in few servers which do not support certificate validation yet. In these circumstances the HTTPS connection requests fails due to new changes in python. For more information on the new changes please read more at : This link describes the ways to establish ssl connection without certificate verification. In my case i was not using the httplib modules API directly hence i had to find out a crude approach to disable the SSL certificate  verification. I would not recommend the below change unless it is really required to do it as you might be opening a set of vulnerabilities as specified in this article.  However the below sample code tells you how disable SSL certificate  verification completely on your system. 
1. Open Terminal 2. Open with sudo privileges the following file [ Note: You may be required to disable …

How to disable USB ports on Mac OS X Mavericks, Yosemite or El Capitan ?

We might wonder how to disable the USB ports on Mac to prevent data copy to external USB mass storage devices. The USB kext on os x is loaded at the time of start of the system, this can be loaded / unloaded using kextload or kextunload command. To disable USB port on Mac , follow below steps:
On Macs running Mountain Lion, Mavericks  and Yosemite:
Unmount any connected USB devices to the system by running below command                  $diskutil unmount /Volumes/USBDISK.Now unload the USB related kernel extensions in the following order using kextunload command.sudo kextunload -b
sudo kextunload -b
sudo kextunload -b

       This will unload the USB kext and disable the USB ports for storage devices on Mountain Lion, Mavericks  and Yosemite.
On Mac running El Capitan:
Unmount any connected USB devices to the system by running below command                  $diskutil unmount /Volumes/USBDI…

How to format an external hard disk or USB disk whose size is > 32GB as FAT32 ?

Formatting an external disk or usb disk of size more than 32 GB is a problem ? Then use the this tool available at below link. with this tool you can format the disk of size 2TB. A GUI BASED TOOL - OR A COMMAND LINE BASED TOOL -

How to create local RHEL DVD repository for package installations ?

This blog tells you how to create a local repository from a RHEL installer DVD iso image.
Firstly please note that  RHEL is not a free software.  To get access to the fully up-to-date repositories (RHN) a  paid subscription is required.Without this subscription it will not be possible to get security updates and the newest versions of packages. An alternative for using RHEL would be CentOSor Scientific Linux. Both are free and almost identical to RHEL. The below steps should only be used for testing, studying or evaluation purposes. The steps below are based on RHEL server 6.4 but the basics are the same for other versions.
Pre Conditions prior performing the following setup steps. - RHEL installed system, - ~4-8 GB free space on disk.

All the below steps are to be executed with root privileges.
1. A directory needs to be created which will contain the repository with following command: $ mkdir /mnt/rhel_repo
2. Mount the DVD disk or iso image with following command. $ mount /dev/dvd /media   …

How to decrypt the Filevault encrypted volume using Recovery HD ?

There might be a time where you want decrypt the FileVault encrypted mac, but you are facing issues in logging into Mac to perform decryption using system preferences. In such cases the following steps will help you in decrypting the disk using Recovery HD. Reboot the Mac, Go to recovery HD partition of the system. (To start your computer from Recovery, restart your Mac and hold down the Command and R keys at startup.)Open Terminal application from Utilities -> Application. First will need to identify the Logical Volume UUID of the encrypted drive using the diskutil corestorage list command: diskutil corestorage list

      4.  Once you have the UUID of the logical volume as shown in above picture, you can then either             unlock or decrypt the encrypted volume using the following commands.
      a) Using the password of an authorised account or the recovery key ( Provided by the                                FileVault at the time of enabling it) on the command line            …

How and where can i reverse lookup the MD5 or SHA1 hashes or generate these hashes ?

If you are looking for tool which reverse looks up a database to find out what text created your hash value or you want to check which generates those md5 or sha-1 etc hashes, then there is online website available here which does the job pretty neatly for you.

How PhET interactive simulations tool helps in building the knowledge of basic science in students

PhET Interactive Simulations, a project at the University of Colorado Boulder, is a non-profit[1]open educational resource (OER) project founded in 2002 by Nobel Laureate Carl Wieman. PhET began with Wieman’s vision to improve the way science is taught and learned. Their stated mission is "To advance science and math literacy and education worldwide through free interactive simulations."
PhET provides fun, free, interactive, research-based science and mathematics simulations. These tests include student interviews and observation of simulation use in classrooms. The simulations are written in Java, Flash or HTML5, and can be run online or downloaded to your computer. All simulations are open source 
Following video explains what is PhET. The PhET simulation software is available for Windows, Linux and Mac platforms. The PhET simulators for the appropriate platforms can be downloaded from here.