diff -Naur wireshark-0.99.5/gtk/follow_dlg.c 
wireshark-0.99.5-pkts2python/gtk/follow_dlg.c
--- wireshark-0.99.5/gtk/follow_dlg.c   2007-02-01 17:55:20.000000000 -0500
+++ wireshark-0.99.5-pkts2python/gtk/follow_dlg.c       2007-06-14 
16:06:28.000000000 -0400
@@ -87,6 +87,7 @@
        SHOW_EBCDIC,
        SHOW_HEXDUMP,
        SHOW_CARRAY,
+       SHOW_PYTHONSTR,
        SHOW_RAW
 } show_type_t;
 
@@ -99,6 +100,7 @@
        GtkWidget       *ebcdic_bt;
        GtkWidget       *hexdump_bt;
        GtkWidget       *carray_bt;
+       GtkWidget       *pythonstr_bt;
        GtkWidget       *raw_bt;
        GtkWidget       *follow_save_as_w;
 #if GTK_MAJOR_VERSION >= 2
@@ -470,6 +472,19 @@
                        follow_info);
        follow_info->carray_bt = radio_bt;
 
+       /* Python string radio button */
+       radio_bt = gtk_radio_button_new_with_label(gtk_radio_button_group
+                                            (GTK_RADIO_BUTTON(radio_bt)),
+                                            "Python String");
+       gtk_tooltips_set_tip (tooltips, radio_bt, "Stream data output in 
\"Python String\" format", NULL);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_bt), FALSE);
+       gtk_box_pack_start(GTK_BOX(hbox), radio_bt, FALSE, FALSE, 0);
+       SIGNAL_CONNECT(radio_bt, "toggled", follow_charset_toggle_cb,
+                      follow_info);
+       follow_info->pythonstr_bt = radio_bt;
+       
+
+
        /* Raw radio button */
        radio_bt = gtk_radio_button_new_with_label(gtk_radio_button_group
                                            (GTK_RADIO_BUTTON(radio_bt)),
@@ -596,6 +611,8 @@
                        follow_info->show_type = SHOW_HEXDUMP;
                else if (w == follow_info->carray_bt)
                        follow_info->show_type = SHOW_CARRAY;
+               else if (w == follow_info->pythonstr_bt)
+                       follow_info->show_type = SHOW_PYTHONSTR;
                else if (w == follow_info->ascii_bt)
                        follow_info->show_type = SHOW_ASCII;
                else if (w == follow_info->raw_bt)
@@ -650,6 +667,9 @@
     size_t              nchars;
     static const gchar hexchars[16] = "0123456789abcdef";
 
+    int issrvfirstline = 1;
+    int iscltfirstline = 1;
+
     iplen = (follow_info->is_ipv6) ? 16 : 4;
 
     data_out_file = eth_fopen(follow_info->data_out_filename, "rb");
@@ -804,7 +824,71 @@
                            goto print_error;
                    }
                    break;
+
+                   case SHOW_PYTHONSTR:
+
+                       current_pos = 0;
+                       issrvfirstline = 1;
+                       iscltfirstline = 1;
+
+                       while (current_pos < nchars) {
+                           gchar hexbuf[256];
+                           int i, cur;
+
+                           cur = 0;
+
+                           if (is_server && issrvfirstline)
+                               g_snprintf(hexbuf, sizeof(hexbuf),
+                                         "peer_1_%d  = ", server_packet_count);
+                           if (is_server && !issrvfirstline)
+                               g_snprintf(hexbuf, sizeof(hexbuf),
+                                         "peer_1_%d += ", server_packet_count);
+
+                           if (!is_server && iscltfirstline)
+                               g_snprintf(hexbuf, sizeof(hexbuf),
+                                         "peer_0_%d = ", client_packet_count);
+                           if (!is_server && !iscltfirstline)
+                               g_snprintf(hexbuf, sizeof(hexbuf),
+                                         "peer_0_%d += ", client_packet_count);
+
+                            cur = strlen(hexbuf);
+                           hexbuf[cur++] = '"';
+
+                           for (i = 0; i < 8 && current_pos + i < nchars; i++) 
{
+                               hexbuf[cur++] = '\\';
+                               hexbuf[cur++] = 'x';
+                               hexbuf[cur++] = 
+                                     hexchars[(buffer[current_pos + i] & 0xf0) 
>> 4];
+                               hexbuf[cur++] = 
+                                     hexchars[buffer[current_pos + i] & 0x0f];
+                            }
+
+                            current_pos += i;
+                            (*global_pos) += i;
+
+                            hexbuf[cur++] = '"';
+                            hexbuf[cur++] = '\n';
+                            hexbuf[cur] = 0;
+                            
+                            if (!(*print_line) (hexbuf, strlen(hexbuf), 
is_server, arg))
+                                goto print_error;
+
+                            if (is_server)
+                                issrvfirstline = 0;
+                            else
+                                iscltfirstline = 0;
+
+                    } 
+
+                    if (is_server)
+                        server_packet_count++;
+                    else 
+                        client_packet_count++;
+
+                   break; 
+                       
                }
+
            }
        }
     }
diff -Naur wireshark-0.99.5/gtk/ssl-dlg.c 
wireshark-0.99.5-pkts2python/gtk/ssl-dlg.c
--- wireshark-0.99.5/gtk/ssl-dlg.c      2007-02-01 17:55:13.000000000 -0500
+++ wireshark-0.99.5-pkts2python/gtk/ssl-dlg.c  2007-06-14 16:06:30.000000000 
-0400
@@ -75,6 +75,7 @@
        SHOW_ASCII,
        SHOW_HEXDUMP,
        SHOW_CARRAY,
+       SHOW_PYTHONSTR,
        SHOW_RAW
 } show_type_t;
 
@@ -86,6 +87,7 @@
        GtkWidget       *ebcdic_bt;
        GtkWidget       *hexdump_bt;
        GtkWidget       *carray_bt;
+       GtkWidget       *pythonstr_bt;
        GtkWidget       *raw_bt;
        GtkWidget       *follow_save_as_w;
 #if GTK_MAJOR_VERSION >= 2
@@ -453,6 +455,19 @@
                    follow_info);
     follow_info->carray_bt = radio_bt;
 
+    /* Python string radio button */
+    radio_bt = gtk_radio_button_new_with_label(gtk_radio_button_group
+                                         (GTK_RADIO_BUTTON(radio_bt)),
+                                        "Python String");
+    gtk_tooltips_set_tip (tooltips, radio_bt, 
+                         "Stream data output in \"Python String\" format", 
NULL);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_bt), FALSE);
+    gtk_box_pack_start(GTK_BOX(hbox), radio_bt, FALSE, FALSE, 0);
+    SIGNAL_CONNECT(radio_bt, "toggled", follow_charset_toggle_cb,
+                  follow_info);
+    follow_info->pythonstr_bt = radio_bt;
+    
+
     /* Raw radio button */
     radio_bt = gtk_radio_button_new_with_label(gtk_radio_button_group
                                         (GTK_RADIO_BUTTON(radio_bt)),
@@ -576,6 +591,8 @@
                        follow_info->show_type = SHOW_HEXDUMP;
                else if (w == follow_info->carray_bt)
                        follow_info->show_type = SHOW_CARRAY;
+               else if (w == follow_info->pythonstr_bt)
+                       follow_info->show_type = SHOW_PYTHONSTR;
                else if (w == follow_info->ascii_bt)
                        follow_info->show_type = SHOW_ASCII;
                else if (w == follow_info->raw_bt)
@@ -625,6 +642,9 @@
     static const gchar hexchars[16] = "0123456789abcdef";
     GList* cur;
 
+    int issrvfirstline = 1;
+    int iscltfirstline = 1;
+
     iplen = (follow_info->is_ipv6) ? 16 : 4;
     
     for (cur = follow_info->ssl_decrypted_data; cur; cur = g_list_next(cur)) {
@@ -754,6 +774,68 @@
                         goto print_error;
                 }
                 break;
+
+               case SHOW_PYTHONSTR:
+
+                   current_pos = 0;
+                   issrvfirstline = 1;
+                   iscltfirstline = 1;
+
+                   while (current_pos < nchars) {
+                       gchar hexbuf[256];
+                       int i, cur;
+
+                       cur = 0;
+
+                       if (rec->is_server && issrvfirstline)
+                           g_snprintf(hexbuf, sizeof(hexbuf),
+                                     "peer_1_%d  = ", server_packet_count);
+                       if (rec->is_server && !issrvfirstline)
+                           g_snprintf(hexbuf, sizeof(hexbuf),
+                                     "peer_1_%d += ", server_packet_count);
+
+                       if (!rec->is_server && iscltfirstline)
+                           g_snprintf(hexbuf, sizeof(hexbuf),
+                                     "peer_0_%d  = ", client_packet_count);
+                       if (!rec->is_server && !iscltfirstline)
+                           g_snprintf(hexbuf, sizeof(hexbuf),
+                                     "peer_0_%d += ", client_packet_count);
+
+                       cur = strlen(hexbuf);
+                       hexbuf[cur++] = '"';
+
+                       for (i = 0; i < 8 && current_pos + i < nchars; i++) {
+                           hexbuf[cur++] = '\\';
+                           hexbuf[cur++] = 'x';
+                           hexbuf[cur++] = 
+                                 hexchars[(buffer[current_pos + i] & 0xf0) >> 
4];
+                           hexbuf[cur++] = 
+                                 hexchars[buffer[current_pos + i] & 0x0f];
+                       }
+
+                       current_pos += i;
+                       (*global_pos) += i;
+
+                       hexbuf[cur++] = '"';
+                       hexbuf[cur++] = '\n';
+                       hexbuf[cur] = 0;
+
+                       if (!(*print_line) (hexbuf, strlen(hexbuf), 
rec->is_server, arg))
+                           goto print_error;
+
+                       if (rec->is_server)
+                           issrvfirstline = 0;
+                       else
+                           iscltfirstline = 0;
+               }
+
+               if (rec->is_server)
+                   server_packet_count++;
+               else
+                   client_packet_count++;
+
+               break;
+
             }
         }
     }
_______________________________________________
Wireshark-dev mailing list
[email protected]
http://www.wireshark.org/mailman/listinfo/wireshark-dev

Reply via email to