Penetration Testing Tutorial (Basic)-2

Source: Internet
Author: User
Tags documentation file system prepare win32 strong password git clone kali linux gparted

Two. Kali Introduction 9
2.1 Kali Linux features 10
2.2 Download Kali Linux 11
2.2.1 Package the latest Kali ISO 11
2.2.2 Official Kali Linux Mirror Image 11
2.3 Making Custom Kali mirror image 12
2.3.1 Ready to start 12
2.3.2 Package kali ISO configuration (optional) 12
2.3.3 Package ISO 13
2.3.4 speed up 14 for future package ISO
2.4 Installing Kali Linux 14
2.4.1 Encryption installation Kali Linux 14
2.4.2 Installing Kali Linux 17 with Live USB
2.4.3 Kali and Windows dual boot 20
2.4.4 HDD Installation Kali Linux 21
2.4.5 installing Kali Linux 22 over a network
2.4.6 installing Kali Linux 23 via network PXE
2.4.7 Kali Linux FAQ 24
2.4.8 Kali virtual machine installation VMware Tools 25
2.4.9 Kali Linux Arm Documentation 26
2.4.10 recompile Kali Linux kernel 27

Two. Kali Introduction
Kali Linux is an advanced penetration testing and security audit Linux distribution.

Kali Linux for you?
As a developer of the release, some might think that we recommend that everyone use kalilinux. In fact, Kali is a release for professional penetration testing and security audits, so it is not recommended for those who are not familiar with Linux.
In addition, misuse of security tools in your network, especially without permission, can lead to irreversible losses and serious consequences.

2.1 Kali Linux Features
kali is a complete rebuild of backtrack Linux in full compliance with the Debian Development standard. New directory framework, review and package all tools, and build a git tree for VCs.
 More than 300 penetration testing tools: After reviewing each of the tools in backtrack, we removed a subset of the tools that were invalid or functionally repetitive.
 Free Forever: Kali Linux is always free. You never have to pay for Kali Linux.
 Open Source Git tree: We are a loyal supporter of open source software, and those who want to tweak or rebuild the package can browse our development tree to get all the source code.
 Follow the development of Fhs:kali according to the Linux directory structure standards, users can easily find command files, Help files, library files and so on.
 Support for a large number of wireless devices: We try to make Kali
The linux supports more wireless devices, works well on a wide variety of hardware, and is compatible with a large number of USB and other wireless devices.
 Integrated injected kernel: A wireless security assessment is often required as a penetration tester or development team. So our kernel contains the latest injection patches.
 Secure development environment: The Kali Linux development team is comprised of a group of trusted people who can only submit packages or manage sources when using multiple security protocols.
 The package and source have GPG signature: Each developer will sign the Kali package when compiling and submitting it, and the source will sign it.
Multi-lingual: Although penetration tools tend to be in English, we ensure that Kali has multiple language support, allowing users to find the tools they need to work in their native language.
 Fully customizable: We fully understand that not everyone agrees with our design decisions, so we let more innovative users customize Kali Linux (or even custom kernels) into the way they like it as easily as possible.
armel and ARMHF Support:
Since arm-based devices have become increasingly popular and inexpensive, we know we should do our best to do Kali arm support. So there is now a system of Armel and ARMHF architectures. Kalilinux has the full mainline release of the arm source, So the arm version of the tool will be updated with other versions at the same time. Kali can now run on ARM devices such as the following:
rk3306 mk/ss808
Raspberry Pi
ODROID u2/x2
mk802/mk802 II
Samsung Chromebook
2.2 Downloads Kali Linux
2.2.1 Package the latest Kali ISO
Kali Linux allows you to encapsulate the latest Kali ISO with a Debian live-build script. The simplest way to encapsulate an image is to do the following in a Kali Linux environment.
You will need to install both Live-build and Cdebootstrap packages first:

Apt-get Install git live-build cdebootstrap

Next, clone Kali cdimage git Source:

git clone git://git.kali.org/live-build-config.git

Now switch to the live directory under the cdimage.kali.org directory and then encapsulate the ISO.

CD live-build-config
lb clean--purge
lb config
lb build
live-build

The script can be fully customized Kali Linux images.

2.2.2 Official Kali Linux mirror image
ISO file
Kali Linux provides 32-bit and 64-bit bootable ISO.
Download Kali ISO
VMware Mirror Image
Kali provides a VMware virtual machine mirror image (32-bit image of the PAE kernel) that has VMware Tools installed.
Download the Kali VMware image file
ARM Mirror Image
Due to the architectural nature of arm, a single mirror cannot be used to run on all arm devices. We offer Kali Linux arm mirrors for the following devices:
rk3306 mk/ss808
Raspberry Pi
Odroid-u2/x2
mk802/mk802 II
Samsung Chromebook
2.3 Making a custom Kali mirror image
Packaged Custom Kali Live ISO
Create your own Kali iso– profile
Encapsulating the custom Kali ISO is simple, interesting and meaningful. You can use the Debian Live-build script to fully configure the Kali ISO. These scripts are fully automated for mirroring in a series of configuration files. Make it easy for anyone to create a live system image. These scripts are also used by the official Kali ISO.
Premise
Ideally, customize your kaliiso in a pre-assembled Kali environment. If this is not the case, make sure to use the latest version of the Live-build script (the 3.x branch script is available for Debian wheezy).
2.3.1 Ready to begin
First, we need to build a custom Kali ISO environment with the following commands:

Apt-get install git live-build cdebootstrap kali-archive-keyring
git clone git://git.kali.org/ Live-build-config.git
cd live-build-config
lb config

2.3.2 Package kali ISO configuration (optional)
The Config directory contains a variety of important customization options for customizing the ISO, which are available in the Debian live build 3.x
The page has a document description. However, if you do not have the patience, please pay special attention to the following configuration files:
config/package-lists/kali.list.chroot– contains a list of packages to be installed in the Kali ISO. You can specify that you want to remove the packages that you have installed. You can also switch your Kali ISO desktop environment (KDE,GNOME,XFCE , LXDE, etc.).
The Hooks/–hooks directory allows us to call scripts at different stages to encapsulate the custom Kali Live ISO.
For example, Kali is the boot menu that adds forensics mode:

$ cat config/hooks/forensic-menu.binary
#!/bin/sh
cat >>binary/isolinux/live.cfg <<end
Label live-forensic
Menu label ^live (forensic mode)
Linux/live/vmlinuz
initrd/live/initrd.img
Append boot=live noconfig username=root hostname=kali noswap noautomount

2.3.3 Package ISO
Before encapsulating the ISO, you can specify the desired schema, select AMD64 or i386. Also note that the "LB build" requires root permissions. If you do not specify a schema, live build encapsulates the ISO based on the schema you are using now.
If you want to encapsulate a 64-bit ISO in a 32-bit system, be sure to turn on multi-architecture support:

dpkg--add-architecture amd64
apt-get Update

Configure Live-build to encapsulate 64-bit or 32-bit ISO:

lb config--architecture amd64 # for ... or ...
LB config--architecture i386 # for + bit
lb build

The last command takes some time because it downloads all the required packages and then encapsulates the ISO.
2.3.4 for future package ISO speed
If you intend to customize the ISO frequently, you can cache the Kali package locally for future encapsulation. The simplest is to install apt-cacher-ng, and then configure HTTP_PROXY environment variables each time you package.

Apt-get Install Apt-cacher-ng
/etc/init.d/apt-cacher-ng start
export http_proxy=http://localhost:3142/
.... # Setup and configure your live build
lb build

2.4 Installing Kali Linux
2.4.1 Encryption Installation Kali Linux
Sometimes we want to encrypt our sensitive information in a full-fledged way. You can use the Kali installer to install it on a hard disk or on a USB drive's encrypted LVM logical volume. The installation process is very similar to "regular Kali Linux installation" In addition to encrypting the LVM logical Volumes section.
Encrypt install Kali Linux conditions
The process of installing kalilinux to your PC is simple. First you need compatible computer hardware. The minimum hardware requirements are as follows, and better hardware performance will be better. I386 mirrors use the PAE kernel by default, so you can run it on a machine larger than 4GB of memory. Download Kali Linux and then burn the DVD disk, or prepare a Kali Linux Live USB drive as the installation medium.
Installation conditions
Installing Kali Linux requires a minimum of 8G hard disk free space.
I386 and AMD64 architectures with a minimum of 512MB memory.
CD-DVD Optical drive/USB boot support
Ready to install
1. Download Kali Linux.
2. Burn Kali Linux to DVD disk or make Kali Linux image usb drive.
3. Confirm that your computer's BIOS is set to boot from CD/USB.

Kali Linux Installation steps

1. Start the installation and start from the installation media of your choice. You will see the Kali interface. Select the graphical interface or text-mode installation. Here we select the graphical interface to install.
2. Choose your preferred language and country. You will be prompted to configure the appropriate keymap for your keyboard.
3. The installer will copy the mirror to your hard drive, probe your network interface, and then prompt you to enter the hostname for your system. In this example, we enter "Kali" as the hostname.
4. Enter a strong password for the root account
5. Next set the time zone.
6. The installer detects the hard drive and provides 4 options. Encrypted LVM installation should select "Guided–use entire disk and set up ENCRYPTEDLVM (using full-volume LVM encrypted volumes)". As shown in the following figure.
7. Select the destination drive where the Kali is installed. In this example we select a USB flash drive as the target. We will use this USB drive to start the encrypted Kali.
8. Confirm your partition structure and continue with the installation.
9. You will then be asked to enter an encrypted password. You must remember this password and enter it each time you start Kali.
10. Configure the network Mirrors.kali use the central source publishing software. When necessary, you need to enter the appropriate proxy information. Note: If you select "No", you will not be able to install the software from the Kali source.
11. Install grub Next.
12. Finally, click Continue (Continue) to reboot the system and go to the newly installed Kali. If the target drive you are installing is a USB drive, confirm that the BIOS is set to boot from the USB flash drive. You will enter the encrypted password that you previously set on each boot.

2.4.2 Installing Kali Linux with Live USB
Booting from a USB stick and installing Kali is our favorite and the fastest (easy) way to run Kali. To do this, we first have to clone the Kali ISO to a USB flash drive. If you use the Kali Linux USB flash drive Frequently, read the full document before cloning.
Preparing the USB mirror image

Download Kali Linux.
-If you are using Windows, download Win32 Disk Imager.
-The *nix class system does not require additional software.
-A USB flash drive (at least 2GB capacity). Kali Linux Live USB Drive installation process

Cloning Kali on a computer with Windows
-Insert USB drive. Run Win32 disk Imager.
-Select the Kali Linux ISO file as the cloned file and verify that the USB drive you want to clone is correct.
-After cloning is complete, eject the USB flash drive from the Windows machine. Now you can start Kali Linux with a USB stick. Cloning Kali on a Linux-made computer

It's easy to make bootable Kali Linux USB drives in a Linux environment. After downloading the Kali ISO file, you can clone it to a USB stick using DD:
Warning. Cloning the Kali process on a USB stick is easy, but if you don't understand what you're doing with DD, it's easy to break the boot partition.
1. Insert the USB drive.
2. Confirm your USB drive device block name with DMESG.
3. Start cloning the Kali ISO file to the USB drive (with caution. ):

DD If=kali.iso Of=/dev/sdb bs=512k

That's it! You can now boot into the Kali Live/installer environment with a USB stick. Add persistence functionality to your USB drive

In some cases, it is useful to add persistence functionality to your Kali Linux mirrors (You can save and modify files when live starts). To start the persistent function for your Kali Linuxu disk, follow these steps. In this example, Let's assume our device block name is/DEV/SDB.
If you want to add the persistence feature, you need a USB flash drive that is larger than the one mentioned above.
1. Clone Kali Linux ISO to u disk and as explained above, use DD to "clone Kali on Linux computer".
2. Create and format additional partitions on the USB drive. In this case, we use the GParted

Gparted/dev/sdb

Now your partitioning scheme should look similar to the following diagram:

Start by formatting a new partition that you want to use for the persistence function. In this case, we use all the remaining free space. Make sure that the newly created partition volume name is persistence and then formatted as a EXT4 file system.

When this is done, use the following command to mount the USB drive partition for the persistence function:

Mkdir/mnt/usb
Mount/dev/sdb2/mnt/usb
echo "/union" >>/mnt/usb/persistence.conf
Umount/mnt/usb
Insert the USB drive to the computer you want to start. Be sure to set the BIOS to boot from the USB device. When the Kali Linux splash screen is displayed, select "Live
Boot (do not press ENTER), and then press the TAB key. This will allow you to edit the startup parameters and add "persistence" to the boot parameter line at the end of each time you want to mount your persistent store.

2.4.3 Kali and Windows dual boot
It's useful to put Kali and windows together. However, you have to be careful with the installation. First make sure you have backed up the important data on your computer. Because we want to modify your hard drive, you should back up your data to another medium. Once you have completed the backup, we recommend you read hard disk installation Kali Linux, To understand the basic installation process of Kali.
In this example, we'll put Kali Linux and the hard disk's only Windows7 system together. We started to re-partition the Windows partition to size, reducing the capacity of the Windows partition to install Kali Linux into the new empty partition.
Download Kali Linux to DVD disc, or prepare a Kali Linux Live USB flash drive
As the installation medium. If your computer does not have a DVD drive or USB port, refer to network installation Kali Linux.
Hardware requirements:
Windows has at least 8G of space left
Support CD-DVD/USB Boot
Ready to install
1. Download Kali Linux.
2. Burn Kali Linux DVD disk or make Kali Linux Live USB drive.
3. Make sure your PC BIOS is set to boot from CD/USB.
Dual system Installation Process
1. Start the installation and start from the installation media of your choice. You'll see Kali's boot interface. Choose Live, then you'll go to the Kali Linux desktop.
2. Log in with the username root, and password Toor. Next Run the GParted program. We will use gparted to reduce the size of the Windows partition to provide enough space to install Kali.
3. Select the Windows partition. Depending on your system situation, this example selects the larger second partition. In this example there are two partitions, the first partition is the system recovery partition, and in fact Windows is installed in/dev/sda2. Resizing the Windows partition reservation (minimum 8GB) Space for Kali Linux.
4. After repartitioning. Make sure to click on the "Apply all Operations" of the hard drive (all actions are applied). Exit GParted and restart.

Kali Linux Installation steps
1. After installation, reboot. You will see the boot menu for grub with Kali and Windows startup items.

2.4.4 HDD Installation Kali Linux
Kali Linux Installation conditions
Installing Kali Linux into your PC process is simple. First you need compatible computer hardware. Kali supports i386, AMD64, and arm (Armel and ARMHF) platforms. The minimum hardware requirements are as follows, better hardware performance will be better. i386 mirrors use the PAE kernel by default, so you can run it on a machine larger than 4GB of memory. Download Kali Linux and then burn a DVD disk, or prepare a Kali Linux Live USB drive as the installation medium. If your computer does not have a DVD drive or a USB port, Please refer to kalilinux network installation.
Installation conditions
Install Kali Linux with a minimum of 8G hard disk free space.
I386 and AMD64 architectures with a minimum of 512MB memory.
CD-DVD Optical drive/USB boot support
Ready to install
1. Download Kali Linux.
2. Burn Kali Linux to DVD disk or make Kali Linux image usb drive.
3. Confirm that your computer's BIOS is set to boot from CD/USB.
Kali Linux Installation steps
1. Start the installation and boot from the installation media of your choice. You will see the Kali interface. Select the GUI installation or the text-mode installation. Here we choose the graphical interface to install.
2. Choose your preferred language and country. You will be prompted to configure the appropriate keymap for your keyboard
3. The installer will copy the mirror to your hard drive, probe your network interface, and then prompt you to enter the hostname for your system. In this example, we enter "Kali" as the hostname.
4. Enter a strong password for the root account, or create an additional account if needed.
5. Next set the time zone.
6. The installer detects the hard drive and provides 4 options. In this example, we use the entire hard disk of the computer and do not set up LVM (logical Volume Manager). Advanced users can configure their own partition structure by using the "manual" partition.
7. You will then have the opportunity to check the hard drive configuration before making irreversible changes to the installer. After you click the Continue button, the installer will start working and the installation is nearing the end.
8. Configure the network Mirrors.kali use the central source publishing software. When necessary, you need to enter the appropriate proxy information.
Note: If you select "No", you will not be able to install the software from the Kali source.
9. Install grub Next.
10. Finally, click Continue to reboot the system and go to the newly installed Kali.

2.4.5 installing Kali Linux over a network
Install Kali Linux over the network with mini ISO
Install Kali Linux with mini ISO
With Kali Mini ISO You can easily "start from scratch" To install a minimized Linux.mini
ISO will download the required packages from our source, which means you need a fast network to use this installation method.
Installation conditions
Install Kali Linux with a minimum of 8G hard disk free space.
I386 and AMD64 architectures with a minimum of 512MB memory.
CD-DVD Optical drive/USB boot support
Ready to install
1. Download Kali mini ISO.
2. Burn Kali Linux to DVD disk or make Kali Linux image usb drive.
3. Confirm that your computer's BIOS is set to boot from CD/USB.
Kali Linux Installation steps
When you start with the mini ISO, a startup interface with a lot of options will appear, and in this article we will perform a simple basic installation
You will then be prompted with various settings, such as the language and keyboard layout, and then you want to set a host name for the system, where we use the default Kali.
Next choose the time zone, then the partition option will appear, for the sake of quick, this article we choose ' guided–use entiredisk ' this option, always follow the prompts until the creation of a new partition pattern.
To reduce network traffic, only a small subset of packages are selected by default. If you want to add another service or feature, you can make a selection in this interface
At this point, the installer will download and install the required packages on the system. This step takes time to relate to your speed. Finally, you are prompted to install grub to complete the installation process

2.4.6 installing Kali Linux via network PXE
Building a PXE server
Booting and installing Kali over the network (PXE) is useful for a notebook that does not have an optical drive or USB port, or even a pre-installed Kali for an enterprise deployment.
First, we will install DNSMASQ to provide the DHCP/TFTP service and then edit the dnsmasq.conf configuration file.

Apt-get Install DNSMASQ
nano/etc/dnsmasq.conf
    In the dnsmasq.conf file, enable DHCP,TFTP and PXE boot as shown below, modify dhcp-range according to your environment:
interface=eth0
dhcp-range= 192.168.8.100,192.168.8.254,12h
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/tftpboot/

After editing, we need to restart the DNSMASQ service to make it effective.

Service DNSMASQ Restart

Download install Kali PXE network boot mirror
Now we're going to create a folder to hold the Kali network boot image, and the image we want to download from the Kali software source.

Mkdir-p/tftpboot
cd/tftpboot
# for + bit systems:
wget http://repo.kali.org/kali/dists/kali/main/ Installer-amd64/current/images/netboot/netboot.tar.gz
# for + bit systems:
wget http://repo.kali.org/ kali/dists/kali/main/installer-i386/current/images/netboot/netboot.tar.gz
tar zxpf netboot.tar.gz
RM Netboot.tar.gz

Set up the machine to install Kali boot from the network
After all is configured, you can now start your PC. And then configure it to boot from the network. It obtains the IP address from the PXE server and then starts Kali.

2.4.7 Kali Linux FAQs
Virtual Box's Kali Linux VMS
If you would like to install Kali Linux in the VirtualBox, please refer to the following guidelines in order to successfully install the feature enhancement tool.
It is recommended that you use the latest version of VirtualBox, as it improves the user experience, including improved compatibility, enhanced stability of the software core and client-side enhancements.
Kali Linux Virtual machine installation Enhancement tool in virtual box
In order to integrate the mouse and screen as well as share the directory with your host, you should install the VirtualBox enhanced features tool.
After starting the Kali Linux virtual machine, open a terminal and execute the following command to install the Linux kernel header file.

Apt-get update && apt-get install-y linux-headers-$ (uname-r)

After installation, from the VirtualBox menu, install Guest
Additions "Select ' Devices ' to mount the client-enhanced ISO to the virtual machine's CD drive." When prompted to run the CD automatically, click the Cancel button.
In the terminal window, copy the Vboxlinuxadditions.run file from the virtual machine CD-ROM to the local directory, confirm that you have the executable permission, and then run the file to start the installation.

cp/media/cd-rom/vboxlinuxadditions.run/root/
chmod 755/root/vboxlinuxadditions.run
cd/root
. Vboxlinuxadditions.run

The Feature enhancement tool is installed and restarts the Kali Linux virtual machine. The mouse and screen are integrated, and you can share the directory with the host.

Create a shared directory for a host
Exercises.

2.4.8 Kali virtual machine installation VMware Tools
We recommend that you create a Kali yourself
Linux VMware VMS, instead of using our pre-supplied VMware mirrors, do the following to successfully install Vmwaretools on a Kali virtual machine. You can choose to install Open-vm-tools, or bring your own VMware tools.
Installing Open-vm-tools
This is probably the easiest way to implement the "VMware Tools" feature in a Kali virtual machine.
Apt-get Install Open-vm-tools
Installing VMware Tools in Kali
If Open-vm-tools is not available, or if you are more inclined to use VMware Tools, start installing some of the packages required by the VMware Tools Installer:

Apt-get Install gcc make linux-headers-$ (uname-r)
ln-s/usr/src/linux-headers-$ (uname-)/include/generated/uapi/ linux/version.h/usr/src/linux-headers-$ (uname-r)/include/linux/

Next, Mount the ISO for VMware tools by clicking Install VMware Tools in the menu. After the virtual machine's optical drive is connected to the VMware Toolsiso, we mount the drive and then copy the VMware Tools installer to the/tmp/directory.

Mkdir/mnt/vmware
mount/dev/cdrom/mnt/vmware/
cp-rf/mnt/vmware/vmwaretools*/tmp/
Finally, go to the/tmp/directory, unzip and then start the installation:
cd/tmp/
tar zxpf vmwaretools-*.tar.gz
cd vmware-tools-distrib/
./vmware-tools-install.pl

With the above command, VMware Tools is installed.

Mouse movement is slow in VMware
If you're in a kalilinux VMware virtual machine, your mouse moves slowly or is slow to respond. Try installing Xserver-xorg-input-vmmouse This package in the Kali virtual machine.

Apt-get Install Xserver-xorg-input-vmmouse
reboot

VMWare Tools cannot compile
This is an unfortunate fact that often afflicts us, such as Kalilinux using a new kernel that VMware has not yet supported. Sometimes, you may need to look for "compatible VMware Tools Patches" in the VMware community.
Known Issues
Cut off from March 2, 2013. Vmwaretools has been compiled in the 3.7 kernel, except that the shared folder module does not work properly. There are patches to solve this problem

Kali Linux Electronic Forensics model
BackTrack Linux introduced the "Forensic Boot" boot option, BackTrack 5, and now Kali Linux still has this option. Due to the widespread spread of backtracklinux, "forensic Boot" It is also proven to be very popular. Many people have kalilinux in order to use it conveniently when they need evidence. It integrates popular open source forensics tools, and Kali is a very handy tool when you need to do open source forensics work.
Extending content
2.4.9 Kali Linux Arm Documentation
Installing Kali ARM on the mk/ss808
Install Kali in Samsung Chromebook
Installing Kali ARM at Odroid U2

2.4.10 recompile the Kali Linux kernel
Sometimes you may want to add the necessary drivers, patches, Kali features that are not available in the Linux kernel. The following tutorials describe how to quickly modify and compile the Kalilinux kernel as you need it. Note that the default Kali Linux kernel has already played a large number of wireless injection patches.
Dependencies required to install the compilation
Start installing all the dependencies required to compile the kernel.

Apt-get Install kernel-package Ncurses-dev fakeroot bzip2

Download Kali Linux kernel source code
Download and unzip the kernel source code for Kali Linux.

Apt-get Install Linux-source
cd/usr/src/
tar jxpf linux-source-3.7.tar.bz2
CD linux-source-3.7/

Configuring the Kernel
Copy the Kali default kernel profile and modify it to suit your needs. This step you need to apply a variety of drivers, patches, etc... In this example, we recompile a 64-bit kernel.

cp/boot/config-3.7-trunk-amd64. config make
menuconfig

Compiling the kernel
Compile the kernel you have modified. It takes time and hardware configuration.

concurrency_level=$ (Cat/proc/cpuinfo|grep processor|wc-l)
make-kpkg clean
fakeroot make-kpkg kernel_image

Installing the kernel
After the kernel compiles successfully. Continue to install the new kernel, and then restart. Note that the kernel version number may be different. In this example, the current kernel version is 3.7.2 and you need to
Modifications that should be made.

Dpkg-i. /linux-image-3.7.2_3.7.2-10.00.custom_amd64.deb
update-initramfs-c-k 3.7.2
update-grub2
reboot

After rebooting, your new kernel should be running. If something goes wrong and your kernel doesn't start, you can still fix the problem by starting the official Kali Linux kernel.

Compiling packages from source code
Sometimes, we need to recompile a Kali package from the source code. Fortunately, it is easy to download the source code package with APT, make the necessary changes and then recompile with the Debian tool. In this example, in order to add an extra mifare key hard-coded to the MIFARE format tool, We will recompile libfreefare this package.
Download the source of the package

# Get The source package
Apt-get source libfreefare
CD libfreefare-0.3.4~svn1469/

Modifying the source code of a package
Modify the source code file in the package as needed, in this example, we will modify mifare-classic-format.c as an example.

Nano examples/mifare-classic-format.c

Check the dependencies required for compilation
Check the dependencies required to compile the package. They need to be installed before the package is compiled.

Dpkg-checkbuilddeps

The result of the output is similar to what you have installed. If Dpkg-checkbuilddeps does not have any output, you can continue compiling without a lack of dependencies.

Dpkg-checkbuilddeps:unmet Build dependencies:dh-autoreconf Libnfc-dev

Dependencies required to install the compilation
Install the dependencies required for compiling the above dpkg-checkbuilddeps output:

Apt-get Install dh-autoreconf Libnfc-dev

Compiling a modified Package
After all installation dependencies are installed, it is easy to call Dpkg-buildpackage to compile.

Dpkg-buildpackage

Install a newly compiled package
If all goes well, you can install the newly compiled package.

Dpkg-i. /libfreefare*.deb

Arm Cross-compilation
This document explains how to configure the arm cross-compilation environment on Kali Linux as a starting point for many of our documentation on "Custom arm mirroring".
Configuration of the development machine
It usually takes a lot of hard disk space to build the kernel. Make sure your development machine has at least 50G of free hard disk space and enough memory for the CPU to be low.
Installation dependencies
Install the dependencies required for ARM cross-compilation first.

Apt-get Install Git-core GnuPG Flex Bison gperf libesd0-dev build-essential
Zip curl Libncurses5-dev Zlib1g-dev Libncu Rses5-dev Gcc-multilib G++-multilib

If you are a 64-bit Kali Linux system, add the i386 architecture to your development environment with the following command.

Dpkg--add-architecture i386
apt-get update
apt-get install Ia32-libs

Download Linaro tool Chain
Download the Linaro Cross compiler from our git source.

CD ~
mkdir-p arm-stuff/kernel/toolchains
cd arm-stuff/kernel/toolchains
git clone git://github.com/ Offensive-security/arm-eabi-linaro-4.6.2.git

Setting environment variables
To be able to use the Linaro cross compiler, you need to set the following environment variables in your session.

Export Arch=arm
Export cross_compile=~/arm-stuff/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-

Now that your arm cross-compilation environment is complete, you can compile your own arm kernel.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.