Fixed issues, added push device.config -

- Fixed Issues with SCP not pushing the correct inputted Variables for FULL PATH's.
- Added Push device.config to Shark Jack.
- Various fixes to prevent wrong files being pushed to the Shark Jack.
pull/41/head
ar1k88 2021-01-22 19:19:23 -08:00 committed by GitHub
parent de14bb72f6
commit ae6569125b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 57 additions and 5 deletions

View File

@ -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
@ -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" "root@172.16.24.1:/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 root@172.16.24.1:/root/payload/payload.txt && echo -e "\n [+] Payload copied to Shark" || echo -e "\n [!] ERROR copying paylod to Shark"
scp -r "$PAYLOADPATH" "root@172.16.24.1:/root/payload/payload.txt" && echo -e "\n [+] Payload copied to Shark" || echo -e "\n [!] ERROR copying payload to Shark"
exitscript 0
}
@ -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\
@ -342,6 +393,7 @@ function main_menu() {
[gG]) get_loot;;
[rR]) reset_key;;
[sS]) setup_shark;;
[dD]) push_deviceconfig;;
[qQ]) exitscript 0;;
*) main_menu;;
esac