Jump to content

Launching Tcp Dump On Pineapple Boot


Recommended Posts

I am trying to launch tcpdump on boot by editing the rc.local script through the Pineapple web interface. I am doing this because I want to be able to simply plug the Pineapple in and have it start collecting packets. My rc.local script is as follows:

wifi

hostapd_cli -p /var/run/hostapd-phy0 karma_disable

#Don't touch anything above this line

CAPTURE_DIRECTORY="/usb/"

CAPTURE_DIRECTORY_DISK_USAGE=$(du -s $CAPTURE_DIRECTORY | awk '{print $1}')

TCPDUMP_FILE_PREFIX=${CAPTURE_DIRECTORY}${CAPTURE_DIRECTORY_DISK_USAGE}$(echo ".pcap")

airmon-ng stop mon0.wlan0

airmon-ng start wlan0

tcpdump -i mon0 -n -C 10 -w $TCPDUMP_FILE_PREFIX

#Add your commands above this

exit 0

This is not working. In the logs I see this:

00:01:01 Pineapple user.info sysinit: /etc/rc.local: line 10: tcpdump: not found

I take it this means tcpdump is not yet available at the time the boot script runs (I have run tcpdump from ssh OK). Can anyone suggest a way around this, or some other way I can achieve effectively the same outcome of capturing packets in monitor mode on boot?

Link to comment
Share on other sites

I ran into this same problem with tcpdump...the way I got around it is to bind my tcpdump script to the wps button press. This may not be ideal for you, but works for my situation (where I am nearby my pineapple whenever I boot it - I don't have it stashed out of sight anywhere). Perhaps Seb can chime in with info on rc.local and any available alternatives?

telot

Link to comment
Share on other sites

Add your stuff in a .sh file and chmod +x it plus a sleep 20 and put the file somewhere not on the usb.

So as you said earlier :

#!/bin/sh

sleep 20 # makes it work

CAPTURE_DIRECTORY="/usb/"

CAPTURE_DIRECTORY_DISK_USAGE=$(du -s $CAPTURE_DIRECTORY | awk '{print $1}')

TCPDUMP_FILE_PREFIX=${CAPTURE_DIRECTORY}${CAPTURE_DIRECTORY_DISK_USAGE}$(echo ".pcap")

airmon-ng stop mon0.wlan0

airmon-ng start wlan0

tcpdump -i mon0 -n -C 10 -w $TCPDUMP_FILE_PREFIX

# save it to tcpdump.sh

And then run it in rc.local as:

/whatever/tcpdump.sh &

Can you tell me why did you stop mon0.wlan0 at start-up ?????

Link to comment
Share on other sites

Yeah..I don't get that either...that kills karma you know...

telot

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...