Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issues, added push device.config - #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 57 additions & 5 deletions sharkjack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function locate_shark(){
function ssh_connect(){
printf "\n\tLogging into Shark Jack...\n\n"
printf "\n\t[!] Ensure Shark Jack is in Arming Mode (middle switch position) or connection will be refused...\n\n\n"
ssh [email protected] || return 1
ssh [email protected] || return 1
}

function connect() {
Expand All @@ -121,6 +121,45 @@ function cleanup() {
printf "\n%s\n" "[!] Cleaning up..."
}

function check_suffixdevice(){
if [[ -f $DEVICECONFIGPATH ]]; then
if [[ $DEVICECONFIGPATH != "*/device.config" ]]; then
printf "\n%s\n" "[!] Directory or File was not a valid device.config file."
printf "\n%s\n" "[!] Returning to Main Menu."
main_menu;
fi
fi
if [[ -d $DEVICECONFIGPATH ]]; then
printf "\n%s\n" "[!] Defaulting to device.config since input was a directory."
DEVICECONFIGPATH=$(echo -e "$DEVICECONFIGPATH/device.config")
fi
}

function check_suffixpayload(){
if [[ -f $PAYLOADPATH ]]; then
if [[ $PAYLOADPATH != "*/payload.txt" || $PAYLOADPATH != "*/payload.sh" ]]; then
printf "\n%s\n" "[!] Defaulting to payload.txt since input was a not a normal payload file."
PAYLOADPATH=$(echo -e "$PAYLOADPATH/payload.txt")
fi
fi
if [[ -d $PAYLOADPATH ]]; then
printf "\n%s\n" "[!] Defaulting to payload.txt since input was a directory."
PAYLOADPATH=$(echo -e "$PAYLOADPATH/payload.txt")
fi
}

function get_deviceconfig_path(){
read -p "FULL PATH to the downloaded device.config file (q to return to menu): " DEVICECONFIGPATH
if [[ $DEVICECONFIGPATH == "q" ]]; then
cleart
printf "\n%s\n" "[!] Returning to main menu..."
sleep 2
main_menu
else
[[ ! -e $DEVICECONFIGPATH ]] && printf "\n%s\n" "[!] $DEVICECONFIGPATH does not exist" && sleep 2 && main_menu
fi
}

function get_payload_path(){
read -p "FULL PATH to payload (q to return to menu): " PAYLOADPATH
if [[ $PAYLOADPATH == "q" ]]; then
Expand All @@ -133,14 +172,25 @@ function get_payload_path(){
fi
}

function push_deviceconfig(){
echo -e "\n [+] Push device.config to Shark Jack"
echo -e "\n----------------------------------------"
get_deviceconfig_path
locate_shark
check_suffixdevice
echo -e "\n [+] Pushing device.config to device..."
scp -r "$DEVICECONFIGPATH" "[email protected]:/etc/device.config" && echo -e "\n [+] Device.config copied to Shark" || echo -e "\n [!] ERROR copying device.config to Shark"
exitscript 0
}

function push_payload(){
echo -e "\n [+] Push Payload to Shark Jack"
echo -e "\n----------------------------------------"
get_payload_path
locate_shark
check_suffixpayload
echo -e "\n [+] Pushing payload to device..."
EXPANDEDPATH=$(echo $PAYLOADPATH |cd)
scp -r $EXPANDEDPATH [email protected]:/root/payload/payload.txt && echo -e "\n [+] Payload copied to Shark" || echo -e "\n [!] ERROR copying paylod to Shark"
scp -r "$PAYLOADPATH" "[email protected]:/root/payload/payload.txt" && echo -e "\n [+] Payload copied to Shark" || echo -e "\n [!] ERROR copying payload to Shark"
exitscript 0
}

Expand Down Expand Up @@ -329,6 +379,7 @@ function main_menu() {
[$(tput bold)C$(tput sgr0)]onnect - get a shell on your Shark Jack\n\
[$(tput bold)U$(tput sgr0)]pgrade firmware\n\
[$(tput bold)P$(tput sgr0)]ush payload to Shark Jack\n\
Push [$(tput bold)D$(tput sgr0)]evice.config to Shark Jack\n\
[$(tput bold)G$(tput sgr0)]et loot saved on Shark Jack\n\n\
[$(tput bold)R$(tput sgr0)]eset known_hosts keys for the Shark Jack on this system\n\
[$(tput bold)S$(tput sgr0)]etup ssh keys for easy access\n\
Expand All @@ -337,11 +388,12 @@ function main_menu() {
read -r -sn1 key
case "$key" in
[cC]) connect;;
[uU]) upgrade_process_menu;;
[pP]) push_payload;;
[uU]) upgrade_process_menu;;
[pP]) push_payload;;
[gG]) get_loot;;
[rR]) reset_key;;
[sS]) setup_shark;;
[dD]) push_deviceconfig;;
[qQ]) exitscript 0;;
*) main_menu;;
esac
Expand Down