Skip to content

Commit

Permalink
""
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Lightfoot committed Apr 26, 2004
1 parent 680bf0d commit 16f589c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
3 changes: 2 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Changelog for driftnet
$Id: CHANGES,v 1.18 2003/10/16 11:56:37 chris Exp $
$Id: CHANGES,v 1.19 2004/04/26 14:42:36 chris Exp $

Driftnet now uses GTK2, rather than GTK1.

Added support for reading packets from a pcap dump file (thanks to Rob Timko
and Joshua Wright for this); and for extracting URLs from HTTP requests (not
Expand Down
4 changes: 3 additions & 1 deletion CREDITS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Credits and contributors for driftnet
$Id: CREDITS,v 1.8 2003/08/25 12:23:43 chris Exp $
$Id: CREDITS,v 1.9 2004/04/26 14:42:36 chris Exp $

Thanks to the authors of EtherPEG, for a cool idea, and to Eric Richardson,
whose website brought it to my attention.
Expand All @@ -19,3 +19,5 @@ Joshua Wright for some 802.11 fixes.
Rob Timko and Joshua Wright for getting Driftnet working on wireless networks
and reading decrypted data from Kismet.

Bastien Nocera for updating driftnet to use GTK2.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright (c) 2001 Chris Lightfoot. All rights reserved.
# Email: chris@ex-parrot.com; WWW: http://www.ex-parrot.com/~chris/
#
# $Id: Makefile,v 1.40 2004/04/08 23:06:28 chris Exp $
# $Id: Makefile,v 1.41 2004/04/26 14:42:36 chris Exp $
#

#
Expand Down Expand Up @@ -34,8 +34,8 @@ LDLIBS += -lpcap -lpthread #-lefence

# Optional C compiler and linker flags. Typical driftnet builds have support
# for displaying captured images in an X window, and need the following flags:
CFLAGS += `gtk-config --cflags`
LDLIBS += -ljpeg -lungif -lpng `gtk-config --libs`
CFLAGS += `pkg-config --cflags gtk+-2.0`
LDLIBS += -ljpeg -lungif -lpng `pkg-config --libs gtk+-2.0`

# Alternatively, you can build a version of driftnet which can only be used
# in `adjunct' mode as the back end for some other image-processing program. To
Expand Down
26 changes: 12 additions & 14 deletions display.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#ifndef NO_DISPLAY_WINDOW

static const char rcsid[] = "$Id: display.c,v 1.18 2003/08/25 12:23:43 chris Exp $";
static const char rcsid[] = "$Id: display.c,v 1.19 2004/04/26 14:42:36 chris Exp $";

#include <sys/types.h>

Expand Down Expand Up @@ -108,7 +108,7 @@ void update_window() {
GdkGC *gc;
gc = gdk_gc_new(drawable);
gdk_draw_rgb_32_image(drawable, gc, 0, 0, width, height, GDK_RGB_DITHER_NORMAL, (guchar*)backing_image->flat, sizeof(pel) * width);
gdk_gc_destroy(gc);
g_object_unref(gc);
}
}

Expand Down Expand Up @@ -176,7 +176,7 @@ struct imgrect *find_image_rectangle(const int x, const int y) {
* React to an expose event, perhaps changing the backing image size. */
void expose_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
if (darea) drawable = darea->window;
gdk_window_get_size(drawable, &width, &height);
gdk_drawable_get_size(GDK_DRAWABLE(drawable), &width, &height);
if (!backing_image || backing_image->width != width || backing_image->height != height)
make_backing_image();

Expand All @@ -187,7 +187,7 @@ void expose_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
* React to a configure event, perhaps changing the backing image size. */
void configure_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
if (darea) drawable = darea->window;
gdk_window_get_size(drawable, &width, &height);
gdk_drawable_get_size(GDK_DRAWABLE(drawable), &width, &height);
if (!backing_image || backing_image->width != width || backing_image->height != height)
make_backing_image();

Expand Down Expand Up @@ -394,28 +394,26 @@ int dodisplay(int argc, char *argv[]) {

/* do some init thing */
gtk_init(&argc, &argv);
gdk_rgb_init();

gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
gtk_widget_set_default_visual(gdk_rgb_get_visual());
gtk_widget_push_colormap(gdk_rgb_get_colormap());

/* Make our own window. */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(window, 0, 0);
gtk_widget_set_size_request(window, 100, 100);

darea = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(window), darea);
gtk_widget_set_events(darea, GDK_EXPOSURE_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK);

gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(delete_event), NULL);
gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(destroy), NULL);
g_signal_connect(G_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(delete_event), NULL);
g_signal_connect(G_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(destroy), NULL);

gtk_signal_connect(GTK_OBJECT(darea), "expose-event", GTK_SIGNAL_FUNC(expose_event), NULL);
gtk_signal_connect(GTK_OBJECT(darea), "configure_event", GTK_SIGNAL_FUNC(expose_event), NULL);
g_signal_connect(G_OBJECT(darea), "expose-event", GTK_SIGNAL_FUNC(expose_event), NULL);
g_signal_connect(G_OBJECT(darea), "configure_event", GTK_SIGNAL_FUNC(expose_event), NULL);

/* mouse button press/release for saving images */
gtk_signal_connect(GTK_OBJECT(darea), "button_press_event", GTK_SIGNAL_FUNC(button_press_event), NULL);
gtk_signal_connect(GTK_OBJECT(darea), "button_press_event", GTK_SIGNAL_FUNC(button_release_event), NULL);
g_signal_connect(G_OBJECT(darea), "button_press_event", GTK_SIGNAL_FUNC(button_press_event), NULL);
g_signal_connect(G_OBJECT(darea), "button_press_event", GTK_SIGNAL_FUNC(button_release_event), NULL);

gtk_widget_show_all(window);

Expand Down
5 changes: 3 additions & 2 deletions driftnet.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.\" Copyright (c) 2002 Chris Lightfoot. All rights reserved.
.\" Email: chris@ex-parrot.com; WWW: http://www.ex-parrot.com/~chris/
.\"
.\" $Id: driftnet.1.in,v 1.6 2003/06/13 15:51:44 chris Exp $
.\" $Id: driftnet.1.in,v 1.7 2004/04/26 14:42:36 chris Exp $
.\"

.SH NAME
Expand Down Expand Up @@ -36,6 +36,7 @@ Print a summary of usage.
.TP
\fB-v\fP
Print additional details of packets captured to the terminal.
.TP
\fB-b\fP
Beep when a new image is displayed.
.TP
Expand Down Expand Up @@ -103,7 +104,7 @@ Chris Lightfoot <chris@ex-parrot.com>
.SH VERSION
\fBDriftnet\fP, version @@@VERSION@@@.
.br
$Id: driftnet.1.in,v 1.6 2003/06/13 15:51:44 chris Exp $
$Id: driftnet.1.in,v 1.7 2004/04/26 14:42:36 chris Exp $

.SH COPYING
This program is free software; you can redistribute it and/or modify
Expand Down

0 comments on commit 16f589c

Please sign in to comment.