!C99Shell v. 1.0 pre-release build #13!

Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a 

uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 

uid=99(nobody) gid=98(nobody) groups=98(nobody) 

Safe-mode: OFF (not secure)

/usr/src/linux-2.4.18-xfs-1.1/drivers/sound/   drwxr-xr-x
Free 318.37 GB of 458.09 GB (69.5%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     hex2hex.c (1.91 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
 * hex2hex reads stdin in Intel HEX format and produces an
 * (unsigned char) array which contains the bytes and writes it
 * to stdout using C syntax
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define ABANDON(why) { fprintf(stderr, "%s\n", why); exit(1); }
#define MAX_SIZE (256*1024)
unsigned char buf[MAX_SIZE];

int loadhex(FILE *inf, unsigned char *buf)
{
    int l=0, c, i;

    while ((c=getc(inf))!=EOF)
    {
        if (c == ':')    /* Sync with beginning of line */
        {
            int n, check;
            unsigned char sum;
            int addr;
            int linetype;

            if (fscanf(inf, "%02x", &n) != 1)
               ABANDON("File format error");
            sum = n;

            if (fscanf(inf, "%04x", &addr) != 1)
               ABANDON("File format error");
            sum += addr/256;
            sum += addr%256;

            if (fscanf(inf, "%02x", &linetype) != 1)
               ABANDON("File format error");
            sum += linetype;

            if (linetype != 0)
               continue;

            for (i=0;i<n;i++)
            {
                if (fscanf(inf, "%02x", &c) != 1)
                      ABANDON("File format error");
                if (addr >= MAX_SIZE)
                   ABANDON("File too large");
                buf[addr++] = c;
                if (addr > l)
                   l = addr;
                sum += c;
            }

            if (fscanf(inf, "%02x", &check) != 1)
               ABANDON("File format error");

            sum = ~sum + 1;
            if (check != sum)
               ABANDON("Line checksum error");
        }
    }

    return l;
}

int main( int argc, const char * argv [] )
{
    const char * varline;
    int i,l;
    int id=0;

    if(argv[1] && strcmp(argv[1], "-i")==0)
    {
        argv++;
        argc--;
        id=1;
    }
    if(argv[1]==NULL)
    {
        fprintf(stderr,"hex2hex: [-i] filename\n");
        exit(1);
    }
    varline = argv[1];
    l = loadhex(stdin, buf);

    printf("/*\n *\t Computer generated file. Do not edit.\n */\n");
        printf("static int %s_len = %d;\n", varline, l);
    printf("static unsigned char %s[] %s = {\n", varline, id?"__initdata":"");

    for (i=0;i<l;i++)
    {
        if (i) printf(",");
        if (i && !(i % 16)) printf("\n");
        printf("0x%02x", buf[i]);
    }

    printf("\n};\n\n");
    return 0;
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0181 ]--