Wednesday, July 6, 2011

update script for back track 5

// This is a update script for Backtrack 5.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define TIME 500000

int check_internet()
{
 if(system("perl -e 'print qq|GET / HTTP/1.0\n\n|;' | nc www.google.com 80 > /dev/null")!= 0 || system("ping -qc1 www.google.com > /dev/null") != 0 || system("ping -qc1 www.l.google.com > /dev/null") != 0) {
  system("clear");
         printf(" [>] Checking for internet connectivity please wait!\n");
         usleep(TIME);
  printf(" [>] No Internet connectivity found, exiting. \n");
  exit(1);
 }
 
 else {
  system("clear");
  printf(" [>] Checking for internet connectivity please wait!\n");
         usleep(TIME);
  printf(" [>] Internet is working!\n");
  printf("\n");
 }
}

void backtrack_update()
{
 printf(" [>] Updating and cleaning Backtrack, please wait.\n");
 usleep(TIME);
 printf("\n");
 if(system("apt-get update && apt-get -y dist-upgrade && apt-get autoremove -y && apt-get -y autoclean") == 0) {
  printf("\n");
  printf(" [>] Backtrack updated and cleaned successfully!\n");
  usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Backtrack.\n");
  usleep(TIME);
 }
}

void exploit_db()
{
        printf(" [>] Updating Exploit-db, please wait.\n");
        usleep(TIME);
        printf("\n");
        if(system("cd /pentest/exploits/exploitdb/platforms/ && svn up") == 0) {
         printf("\n");
         printf(" [>] Exploit-db updated successfully!\n");
  usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Exploit-db.\n");
  usleep(TIME);
 }
}


void set()
{
        printf(" [>] Updating SET, please wait.\n");
        usleep(TIME);
        printf("\n");
        if(system("cd /pentest/exploits/set/ && svn up") == 0) {
   printf("\n");
   printf(" [>] SET updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update SET.\n");
  usleep(TIME);
 }
}

void warvox()
{
 printf(" [>] Updating Warvox, please wait.\n");
 usleep(TIME);
 printf("\n");
 if(system("cd /pentest/telephony/warvox/ && svn up") == 0) {
   printf("\n");
   printf(" [>] Warvox updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Warvox\n");
  usleep(TIME);
 }
}

void aircrack()
{
 printf(" [>] Updating Aircrack-NG and Airodump, please wait.\n");
 usleep(TIME);
 printf("\n");
 if(system("cd /pentest/wireless/aircrack-ng/ && svn up") == 0) {
   system("cd /pentest/wireless/aircrack-ng/scripts/ && chmod a+x airodump-ng-oui-update && ./airodump-ng-oui-update");
   printf("\n");
   printf(" [>] Aircrack-NG and Airodump updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Aircrack-ng.\n");
  usleep(TIME);
 }
}

void giskismet()
{
 printf(" [>] Updating Giskismet, please wait.\n");
 usleep(TIME);
 printf("\n");
 if(system("cd /pentest/wireless/giskismet/ && svn up") == 0) {
   printf("\n");
   printf(" [>] Giskismet updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Giskismet.\n");
  usleep(TIME);
 }
}

void msf()
{
 printf(" [>] Updating Metasploit, please wait.\n");
 usleep(TIME);
 printf("\n");
 if(system("cd /pentest/exploits/framework3/ && svn up") == 0) {
   printf("\n");
   printf(" [>] Metasploit updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Metasploit.\n");
  usleep(TIME);
 }
}

void nessus()
{
 printf(" [>] Updating Nessus plugins, please wait.\n");
 usleep(TIME);
 printf("\n");
 if(system("cd /opt/nessus/sbin/ && ./nessus-update-plugins") == 0) {
   printf("\n");
   printf(" [>] Nessus plugins updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Nessus.\n");
  usleep(TIME);
 }
}

void w3af()
{
        printf(" [>] Updating W3AF, please wait.\n");
        usleep(TIME);
        printf("\n");
        if(system("cd /pentest/web/w3af/ && svn up") == 0) {
   printf("\n");
   printf(" [>] W3AF updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update W3AF.\n");
  usleep(TIME);
 }
}
void nikto()
{
        printf(" [>] Updating Nikto, please wait.\n");
        usleep(TIME);
        printf("\n");
        if(system("cd /pentest/web/nikto/ && ./nikto.pl -update") == 0) {
   printf("\n");
   printf(" [>] Nikto updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Nikto.\n");
  usleep(TIME);
 }
}

void sqlmap()
{
        printf(" [>] Updating Sqlmap, please wait.\n");
        usleep(TIME);
        printf("\n");
        if(system("cd /pentest/database/sqlmap/ && svn up --trust-server-cert --non-interactive") == 0) {
   printf(" [>] Sqlmap updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update SQLmap.\n");
  usleep(TIME);
 }
}

void fasttrack()
{
        printf(" [>] Installing/Updating Fasttrack, please wait.\n");
        usleep(TIME);
        printf("\n");
 system("apt-get -y install fasttrack");
        if(system("cd /pentest/exploits/fasttrack/ && ./fast-track.py -c 1") == 0) {
   printf(" [>] Fasttrack  updated successfully!\n");
   usleep(TIME);
 }
 else {
  printf(" [>] Failed to update Fasttrack.\n");
  usleep(TIME);
 }

}

void pyrit()
{
 printf(" [>] Checking to see if pyrit is installed.\n");
 usleep(TIME);
 printf("\n");
 if(system("pyrit > /dev/null") == 0) {
     printf(" [>] Pyrit installed!\n");
     usleep(TIME);
 }
 else {
     printf(" [>] Installing Pyrit, please wait.\n");
     usleep(TIME);
     system("apt-get -y install libssl-dev scapy python-dev");
     system("svn checkout http://pyrit.googlecode.com/svn/trunk/ pyrit_svn");
     system("cd pyrit_svn/pyrit && python setup.py build && python setup.py install");
     system("rm -rf pyrit_svn");
     printf(" [>] Pyrit installed successfully!\n");
 }
}

void nmap()
{
 printf(" [>] Updating Nmap Fingerprints, please wait.\n");
 usleep(TIME);
 if(system("wget http://nmap.org/svn/nmap-os-db -O /usr/local/share/nmap/nmap-os-db") == 0) {
     printf(" [>] Nmap updated successfully!\n");
     printf("\n");
     usleep(TIME);
 }
 else {
     printf(" [>] Failed to update nmap!\n");
     usleep(TIME);
 }
}

void update() 
{
 printf(" [>] Updating the evil script.\n");
 usleep(TIME);
 printf("\n");
 system("rm -rf backtrack5_update.c");
 system("wget http://sickness.tor.hu/wp-content/uploads/2011/06/backtrack5_update.c");
 system("gcc -o backtrack5_update backtrack5_update.c");
 printf("\n");
 printf("Update successfully, now please run the script again!\n");
 exit(0);
}

void changelog()
{
 system("cd /tmp && wget http://sickness.tor.hu/wp-content/uploads/2011/06/changelog.txt -o /dev/null");
 system("less /tmp/changelog.txt");
 system("rm -rf /tmp/changelog.txt"); 
}

void tryharder()
{
 printf(" [] Wrong choice, exiting now ... \n");
 usleep(TIME);
 exit(EXIT_SUCCESS);
}

char menu_exploit()
{
        char ex_choice[4];
        int ex_var;

        printf("        +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
        printf("        |B||a||c||k||t||r||a||c||k| |5| |u||p||d||a||t||e|\n");
        printf("        +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
 printf("   Section: EXPLOIT TOOLS\n");
 printf("\n");
        printf(" [>] 1. Metasploit Framework.\n");
        printf(" [>] 2. Exploit-db.\n");
        printf(" [>] 3. SET - Social Engineering Toolkit.\n");
 printf(" [>] 4. Update all.\n");
        printf(" [>] 5. Back.\n");
        printf("\n");
        printf(" [>] Enter your choice: ");

        fgets(ex_choice,sizeof(ex_choice),stdin);
 ex_var = atoi(ex_choice);

 switch(ex_var) {
   case 1: msf(); menu_exploit();
   case 2: exploit_db(); menu_exploit();
   case 3: set();  menu_exploit();
   case 4: msf(); exploit_db(); set(); menu_exploit();
   case 5: main();
   default: tryharder(); break;
 }
}

char menu_wireless()
{
        char w_choice[4];
        int w_var;

        printf("        +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
        printf("        |B||a||c||k||t||r||a||c||k| |5| |u||p||d||a||t||e|\n");
        printf("        +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
        printf("                        Section: WIRELESS & TELEPHONY\n");
        printf("\n");
        printf(" [>] 1. Aircrack-ng and Airdrop.\n");
        printf(" [>] 2. WarVox.\n");
        printf(" [>] 3. Giskismet.\n");
        printf(" [>] 4. Update all.\n");
        printf(" [>] 5. Back.\n");
        printf("\n");
        printf(" [>] Enter your choice: ");
 
 fgets(w_choice,sizeof(w_choice),stdin);
 w_var = atoi(w_choice);
 
 switch(w_var) {
   case 1: aircrack(); menu_wireless();
   case 2: warvox();  menu_wireless();
   case 3: giskismet();  menu_wireless();
   case 4: aircrack(); warvox(); giskismet();  menu_wireless();
   case 5: main();
   default: tryharder(); break;
 }

}


char menu_web_db()
{
        char wd_choice[4];
        int wd_var;

        printf("        +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
        printf("        |B||a||c||k||t||r||a||c||k| |5| |u||p||d||a||t||e|\n");
        printf("        +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
        printf("                        Section: WEB & DATABASE\n");
        printf("\n");
        printf(" [>] 1. W3AF.\n");
        printf(" [>] 2. Nikto.\n");
        printf(" [>] 3. Sqlmap.\n");
        printf(" [>] 4. Update all.\n");
        printf(" [>] 5. Back.\n");
        printf("\n");
        printf(" [>] Enter your choice: ");

        fgets(wd_choice,sizeof(wd_choice),stdin);
        wd_var = atoi(wd_choice);
 
 switch(wd_var) {
   case 1: w3af(); menu_web_db();
   case 2: nikto(); menu_web_db();
   case 3: sqlmap(); menu_web_db();
   case 4: w3af(); nikto(); sqlmap(); menu_web_db();
   case 5: main();
   default: tryharder(); break;
 }
 

}

char menu_other()
{
 char o_choice[4];
 int c_var;

 printf("        +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
        printf("        |B||a||c||k||t||r||a||c||k| |5| |u||p||d||a||t||e|\n");
        printf("        +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
        printf("                        Section: OTHER\n");
 printf(" [>] 1. Nessus.\n");
 printf(" [>] 2. Fasttrack.\n");
 printf(" [>] 3. Pyrit.\n");
 printf(" [>] 4. Nmap.\n");
 printf(" [>] 5. Update all.\n");
 printf(" [>] 6. Back.\n");
 printf("\n");
        printf(" [>] Enter your choice: ");

 fgets(o_choice,sizeof(o_choice),stdin);
 c_var = atoi(o_choice);
 
 switch(c_var) {
   case 1: nessus(); menu_other();
   case 2: fasttrack(); menu_other();
   case 3: pyrit(); menu_other();
   case 4: nmap(); menu_other();
   case 5: nessus(); fasttrack(); pyrit(); nmap(); menu_other();
   case 6: main();
   default: tryharder(); break;
   
 }
}
  
 

main()
{
 char choice[4];
 int choice_var;
 check_internet();

 printf(" +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
  printf(" |B||a||c||k||t||r||a||c||k| |5| |u||p||d||a||t||e|\n");
  printf(" +-++-++-++-++-++-++-++-++-+ +-+ +-++-++-++-++-++-+\n");
 printf("                        Section: MAIN\n");
 printf(" [>] 1. Update and clean Backtrack.\n");
 printf(" [>] 2. Exploit tools.\n");
 printf(" [>] 3. Wireless & Telephony.\n");
 printf(" [>] 4. Web & Database.\n");
 printf(" [>] 5. Others.\n");
 printf(" [>] 6. Update all.\n");
 printf(" [>] 7. Update script.\n");
 printf(" [>] 8. Changelog.\n");
  printf(" [>] 9. Exit.\n");
 printf("\n");
 printf(" [>] Enter your choice: ");

 fgets(choice,sizeof(choice),stdin);
 choice_var = atoi(choice);

 switch(choice_var) {
   case 1: backtrack_update(); main();
   case 2: menu_exploit(); main();
   case 3: menu_wireless(); main();
   case 4: menu_web_db();  main();
   case 5: menu_other(); main();
   case 6: backtrack_update(); exploit_db(); set(); warvox(); aircrack(); giskismet(); msf(); nessus(); w3af(); nikto(); sqlmap(); fasttrack(); pyrit(); nmap(); main();
   case 7: update();
   case 8: changelog(); main();
   case 9: exit(1);
   default: tryharder(); break;
 }
 
 return 0;
}

No comments:

Post a Comment