Jump to content

How do we operate pineapple from terminal connection/shell


overwraith

Recommended Posts

How do we learn how to operate the pineapple from putty/command line? I only recently learned that there was a "macchanger" program already installed on the pineapple. How can I see all the executable programs already installed on the pineapple? I would also like to learn about shell scripts and stuff. Also, how does the linux filesystem work? I see all those folders, and they are nothing like windows. PS. we need more videos!

Let me add that I already know how to connect via putty, etc, just need help learning the linux commands available to us.

Edited by overwraith
Link to comment
Share on other sites

How do we learn how to operate the pineapple from putty/command line? I only recently learned that there was a "macchanger" program already installed on the pineapple. How can I see all the executable programs already installed on the pineapple? I would also like to learn about shell scripts and stuff. Also, how does the linux filesystem work? I see all those folders, and they are nothing like windows. PS. we need more videos!

Let me add that I already know how to connect via putty, etc, just need help learning the linux commands available to us.

When you say you'd like to learn about shell scripts, what do you mean? Do you want to learn how to write them? Basically, shell scripts are used to automate a specific process. Here's a script I wrote that creates a fake access point with airbase-ng. It asks a series of configuration questions, and then it creates the fake access point based on your preferences. I created the script as an example for some friends, and included my notes in the comments. It may help you understand bash scripting a little better.

 
#!/bin/bash
#FakeAP - a utility for creating fake access points
#Authored by Chris Haralson

clear

echo

echo "  |¯¯¯¯¯¯¯|‚ /¯¯¯/|¯¯¯¯||¯¯¯¯| |¯¯¯¯||¯¯¯¯¯¯¯|  /¯¯¯/|¯¯¯¯||¯¯¯¯|\¯¯¯\’ "
echo "  |   \___| /  '/_|    ||    |/    /'|   ¯¯|¯  /  '/_|    ||    | |  '| "
echo "  |   ¯¯| '|     _    '||    |\    \'|  '¯¯¯'||     _    '||    |/   / "
echo "  |__|¯¯' ‚|____| ’|___||____| |____||_______||____| ’|___||____|¯¯¯’ "
echo "/======================================================================\ "
echo "||          FakeAP - a script for creating fake access points         || "
echo "||                       Version 1.0 By hack|this                     || "
echo "\======================================================================/ "

echo

echo "Checking to see if FakeAP is already installed..."
sleep 1
echo

#check to see if the user has already installed FakeAP- if not, ask user to install 
if [ ! -e '/usr/bin/fakeap' ];then
	echo -n "FakeAP is not installed. Do you want to install it? "
	read install
	echo
	#if install was answered with yes or y, install FakeAP
	if [[ $install = yes || $install = y ]] ; then
		cp -v $0 /usr/bin/fakeap #copy FakeAP to /usr/bin/fakeap
		chmod +x /usr/bin/fakeap #modify FakeAP permissions so user can launch it in terminal
		rm $0 #delete first copy of FakeAP
		echo
		echo "FakeAP was successfully installed. Launching it now!"
		sleep 3
		fakeap #restart FakeAP after installation process is complete
		exit 1
	else
		echo "Okay, let me know if you change your mind."
	fi
else
	echo "FakeAP is installed."
	sleep 1
fi
#end of installation process

echo

#ask user to attach a wireless network adapter and press enter when finished
echo -n "Attach your network adapter and press <enter> to continue. "
read
echo
echo -n "Checking for interfaces... "
sleep 2
echo "Done!"
sleep 1

#use airmon-ng to get the names of detected wireless interfaces
interface=$(airmon-ng | awk 'match($0, /wlan0/) {print substr($0, RSTART, RLENGTH)}')
echo

#print the names of detected wireless interfaces for user 
airmon-ng | awk 'match($0, /wlan[0-9]/) {print "Wireless Interface: " substr($0, RSTART, RLENGTH)}' 
echo

#ask user to enter the name of their wireless interface - default is wlan0
echo -n "Enter the name of your wireless interface or press <enter> to use $interface: "
read interface
echo

#use default wireless interface wlan0 if nothing is entered
if [ "$interface" = "" ]; then
    interface=$(airmon-ng | awk 'match($0, /wlan0/) {print substr($0, RSTART, RLENGTH)}')
    echo -e "$interface selected as default.\n"
    sleep 1
fi

#let user decide if monitor mode should be used
echo -n "Would you like to enable monitor mode? " 
read monitormode

#if monitormode is answered with yes or y, create a monitor interface
if [[ "$monitormode" = yes || "$monitormode" = y ]]; then
  echo
  echo "Creating a monitor interface on $interface..."
    airmon-ng >/dev/null start $interface #start airmon-ng and hide its output
    echo
    
    #use airmon-ng to get the names of detected monitor interfaces
    moninterface=$(airmon-ng | awk 'match($0, /mon0/) {print substr($0, RSTART, RLENGTH)}')
    #Print the names of detected monitor interfaces for user 
    airmon-ng | awk 'match($0, /mon[0-9]/) {print "Monitor Interface: " substr($0, RSTART, RLENGTH)}'
    echo
    
    #ask user to enter the name of their monitor interface - default is mon0
    echo -n "Enter the name of your monitor interface or press <enter> to use $moninterface: " 
    read moninterface
    echo
    
	#use default monitor interface mon0 if nothing is entered
	if [ "$moninterface" = "" ]; then
	  moninterface=$(airmon-ng | awk 'match($0, /mon0/) {print substr($0, RSTART, RLENGTH)}')
	  echo -e "$moninterface selected as default.\n"
	  
	fi
	sleep 1
	
    #if monitormode was answered with yes or y, ask user to change monitor interface MAC
    #if monitormode was not answered with yes or y, this will be skipped 
    echo -n "Would you like to set a random MAC address for your monitor interface? "
    read monmac
      #if monmac was answered with yes or y, change MAC address
      if [[ "$monmac" = yes || "$monmac" = y ]]; then
	echo
	echo "Setting random MAC address..."
	sleep 2
	echo
	ifconfig $moninterface down
	macchanger -r $moninterface
	echo
	echo "MAC address successfully changed!"
	sleep 1
	  #if monmac was not answered with yes or y, do not change MAC address
	  else
	    if [[ "$monmac" < yes || "$monmac" > y ]]; then
	    echo
	    echo "Skipping MAC address configuration process..."
	    sleep 1

  	    fi
	    
      fi
fi

#if monitormode was not answered with yes or y, ask user to change wireless interface MAC
#if monitor mode was answered with yes or y, this will be skipped.
if [[ "$monitormode" > yes || "$monitormode" < y ]]; then
  echo
  echo "Skipping monitor mode configuration process..."
  sleep 1
  echo
  echo -n "Would you like to set a random MAC address for your wireless interface? "
   read ifacemac
      #if ifacemac was answered with yes or y, change MAC address
      if [[ "$ifacemac" = yes || "$ifacemac" = y ]]; then
	echo
	echo "Setting random MAC address..."
	sleep 2
	echo
	ifconfig $interface down
	macchanger -r $interface
	echo
	echo "MAC address successfully changed!"
	sleep 1
	  #if ifacemac was not answered with yes or y, do not change MAC address
	  else
	    if [[ "$ifacemac" > yes || "$ifacemac" < y ]]; then
	    echo
	    echo "Skipping MAC address configuration process..."
	    sleep 1
	    
	    fi
      
      fi

fi

#begin collecting user input for fake access point configuration
echo
echo -n "Now it's time to setup the fake access point. Press <enter> when you're ready. "
read

#ask user to specify an ESSID - default is Free WiFi
echo
echo -n "Enter a name for your fake access point or press <enter> to use Free WiFi: "
read essid
	if [ "$essid" = "" ]; then
	  essid="Free WiFi"
	  echo
	  echo "Free WiFi selected as default."
	fi
echo

#ask user to enter a MAC address - default is 00:11:22:33:44:55
echo -n "Enter a MAC address for your fake access point or press <enter> to use 00:11:22:33:44:55: "
read bssid
	if [ "$bssid" = "" ]; then
	  bssid="00:11:22:33:44:55"
	  echo
	  echo "00:11:22:33:44:55 selected as default."
	fi

echo

#ask user which channel to broadcast on - default is channel 11
echo -n "Enter the channel to broadcast on or press <enter> to use channel 11: "
read channel
	if [ "$channel" = "" ]; then
	  channel="11"
	  echo
	  echo "Channel 11 selected as default."
	fi
echo

#let user decide if verbose mode should be used
echo -n "Do you want to use verbose mode? "
read verbose
	if [[ "$verbose" = yes || "$verbose" = y ]]; then
	  verbose="-v"
	  echo
	  echo "Data junky style..."
	else
	  verbose=""
	  echo
	  echo "Keeping it silent..."
	fi  
echo

#let user decide if all probe requests should be responded to
echo -n "Would you like your fake access point to answer all probe requests? "
read probe
	if [[ "$probe" = yes || "$probe" = y ]]; then
	  probe="-P"
	  echo
	  echo "Living on the edge..."
	else
	  probe=""
	  echo
	  echo "Playing it safe..."
	fi
echo

#let user choose what type of encryption to use
echo "Choose an encryption for your fake access point. "
echo "1) WEP"
echo "2) WPA"
echo "3) WPA2"
echo "4) None"
echo
echo -n "Selection: "
read encryption

	if [ "$encryption" = 1 ]; then #if user inputs 1, use WEP encryption
	  encryption="-W 1"
	  echo
	  echo "You chose WEP encryption..."
	  
	  else
	    if [ "$encryption" = 2 ]; then #if user inputs 2, use WPA encryption
	      encryption="-z 2"
	      echo
	      echo "You chose WPA encryption..."
	    
	    else  
	      if [ "$encryption" = 3 ]; then #if user inputs 3, use WPA2 encryption
		encryption="-Z 4"
		echo
		echo "You chose WPA encryption..."
		
	      else
		if [ "$encryption" = 4 ]; then #if user inputs 4, use OPEN encryption
		  encryption=""
		  echo
		  echo "No encryption will be used..."
		  
	else 
	  encryption=""	#if user inputs anything other than 1-4, use OPEN encryption as default
	  echo
	  echo "Invalid selection. No encryption set as default." 
		fi
	      fi
	    fi
	fi  

echo

echo -n "Please wait while your fake access point is configured... "
sleep 2

echo "Configuration complete!"
sleep 1
echo

echo -n "Press <enter> when you're ready to start your fake access point. "
read
echo

#if monitormode was answered with yes or y, start the fake AP on monitor interface
#if monitormode was not answered with yes or y, this will be skipped
if [[ "$monitormode" = yes || "$monitormode" = y ]]; then
  echo -n "Starting fake access point on $moninterface... "
    sleep 2
    echo "Finished!"
    echo
    sleep 1
    #start airbase-ng and create fake access point with user input
    #EXAMPLE: airbase-ng -c 6 -e Free WiFi -a 00:11:22:33:44:55 -v -P -z 2 mon0
    airbase-ng -c $channel -e "$essid" -a $bssid $verbose $probe $encryption $moninterface
    echo
    
#if monitormode was not answered with yes or y, start the fake AP on wireless interface
#if monitormode was answered with yes or y, this will be skipped
else 
  if [[ "$monitormode" > yes || "$monitormode" < y ]]; then
    echo -n "Starting fake access point on $interface... "
      sleep 2
      echo "Finished!"
      echo
      sleep 1
      #start airbase-ng and create fake access point with user input
      #EXAMPLE: airbase-ng -c 6 -e Free WiFi -a 00:11:22:33:44:55 -v -P -z 2 wlan0
      airbase-ng -c $channel -e "$essid" -a $bssid $verbose $probe $encryption $interface
      echo

  fi
  
fi


done

As far as using the command line, what do you want to learn to do? Navigate the file system, start/ stop infusions, etc.?

Link to comment
Share on other sites

chriswhat: When you say you'd like to learn about shell scripts, what do you mean? Do you want to learn how to write them?

I would ultimately like to be able to control everything on the pineapple via command line, there are a lot of commands built in though, and I don't know where to find the ones that are installed. Man pages will also be a problem, considering the pineapple doesn't have any, but that should be solvable just by using a Linux VM.

Foxtrot: If you like, I'll make a nice wiki page for use over ssh later

A wiki over the scripting and command line concepts would be nice, but I already know how to connect via putty if that's what you are asking. I need help purely with what commands are available via bash.

Edited by overwraith
Link to comment
Share on other sites

I too am still learning Linux and I got to say that the way I have learned the command line is by messing around with Linux on a virtual machine. I would recommend Debian since you have to install it use the command line instead of a graphical user interface. I had no experience what so ever in Linux so I would just look it up on how to do it when I got stuck. I have also learn with a Raspberry Pi.

Anyways I will be getting my Pineapple in a few days so will be following this thread and I'm willing to help out.

Edited by eXsoR65
Link to comment
Share on other sites

Slackware, in my opinion was a great starting point for me to learn linux. I accidently wondered into a Linux Users Group meeting at my local coffee shop when i was in middle school. from that point forward it has been linux. I tend to go between the flavors for one reason or another.

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...