Skip to content

Instantly share code, notes, and snippets.

@kleo
Last active August 24, 2023 16:27
Show Gist options
  • Save kleo/8c85c084e9c5ae86b3367716a463e793 to your computer and use it in GitHub Desktop.
Save kleo/8c85c084e9c5ae86b3367716a463e793 to your computer and use it in GitHub Desktop.
Format usb flash drive and mount as sdcard for the WiFi Pineapple Nano
#!/bin/bash
#2018 - Zylla - ([email protected])
#Format usb flash drive as sdcard for the WiFi Pineapple Nano
#Source https://forums.hak5.org/topic/39096-mana-attack-for-the-pineapple/?do=findComment&comment=303054
#You can also manually partition your usb flash drive on your computer
[[ -f /tmp/usb_format.progress ]] && {
exit 0
}
touch /tmp/usb_format.progress
umount /sd
swapoff /dev/sdb2
sleep 2
cat /pineapple/modules/Advanced/formatSD/fdisk_options | fdisk /dev/sdb
sleep 2
umount /sd
mkfs.ext4 /dev/sdb1
sleep 2
mkfs.ext4 /dev/sdb2
mkswap /dev/sdb2
mount /dev/sdb1 /sd
swapon /dev/sdb2
rm /tmp/usb_format.progress
config global
option anon_swap '0'
option anon_mount '0'
option auto_swap '1'
option auto_mount '1'
option delay_root '5'
option check_fs '0'
config mount
option target '/sd'
option device '/dev/sdb1'
option fstype 'auto'
option options 'rw,sync'
option enabled '1'
config swap
option device '/dev/sdb2'
option enabled '1'
@bruvv
Copy link

bruvv commented Feb 1, 2021

option device '/dev/sdb1'

This will most likely fail if another pineapple will not use sdb as device. Use: /dev/sdcard/sd1 and sd2 for swap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment