mirror of https://github.com/dirtbags/fluffy.git
Merge commit 'd690f8d591806d13c0c0c96ad338dff942191d94'
Conflicts: Makefile
This commit is contained in:
commit
d6acb1666b
24
pcat.c
24
pcat.c
|
@ -34,11 +34,29 @@ ip4_addr(char *addr_s, uint32_t addr)
|
||||||
snprintf(addr_s, 16, "%u.%u.%u.%u", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (addr >> 0) & 0xff);
|
snprintf(addr_s, 16, "%u.%u.%u.%u", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (addr >> 0) & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_nybble(uint8_t nybble)
|
||||||
|
{
|
||||||
|
if (nybble < 10) {
|
||||||
|
putchar(nybble + '0');
|
||||||
|
} else {
|
||||||
|
putchar(nybble - 10 + 'a');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* About 3x faster than printf("%02x", octet); */
|
||||||
|
void
|
||||||
|
printx(uint8_t octet)
|
||||||
|
{
|
||||||
|
print_nybble(octet >> 4);
|
||||||
|
print_nybble(octet & 0xf);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_payload(struct stream *s)
|
print_payload(struct stream *s)
|
||||||
{
|
{
|
||||||
while (s->len) {
|
while (s->len) {
|
||||||
printf("%02x", read_uint8(s));
|
printx(read_uint8(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,13 +195,13 @@ void
|
||||||
pcat(FILE * f)
|
pcat(FILE * f)
|
||||||
{
|
{
|
||||||
struct pcap_file p;
|
struct pcap_file p;
|
||||||
|
struct pcap_pkthdr hdr;
|
||||||
|
char frame[MAXFRAME];
|
||||||
|
|
||||||
if (-1 == pcap_open_in(&p, f))
|
if (-1 == pcap_open_in(&p, f))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct pcap_pkthdr hdr;
|
|
||||||
char frame[MAXFRAME];
|
|
||||||
|
|
||||||
if (-1 == pcap_read_pkthdr(&p, &hdr)) {
|
if (-1 == pcap_read_pkthdr(&p, &hdr)) {
|
||||||
break;
|
break;
|
||||||
|
|
2
pmerge.c
2
pmerge.c
|
@ -102,7 +102,7 @@ main(int argc, char *argv[])
|
||||||
* Make sure it'll fit
|
* Make sure it'll fit
|
||||||
*/
|
*/
|
||||||
if (cur->next.caplen > sizeof(frame)) {
|
if (cur->next.caplen > sizeof(frame)) {
|
||||||
fprintf(stderr, "error: huge frame (size %u)\n", (unsigned int) len);
|
fprintf(stderr, "error: huge frame (size %u)\n", (unsigned int) cur->next.caplen);
|
||||||
return EX_SOFTWARE;
|
return EX_SOFTWARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue