1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,112 +0,0 @@ |
1 |
-diff -Naur ngrep.old/ngrep.8 ngrep.patched/ngrep.8 |
|
2 |
-+++ ngrep.patched/ngrep.8 Fri Aug 30 17:33:28 2002 |
|
3 |
-@@ -48,6 +48,10 @@ |
|
4 |
- .IP -h |
|
5 |
- Display help/usage information. |
|
6 |
- |
|
7 |
-+.IP -L |
|
8 |
-+Display captured packets in line-by-line manner. Good for post-processing |
|
9 |
-+of textual protocols. |
|
10 |
-+ |
|
11 |
- .IP -X |
|
12 |
- Treat the match expression as a hexadecimal string. See the |
|
13 |
- explanation of \fImatch expression\fP below. |
|
14 |
-diff -Naur ngrep.old/ngrep.c ngrep.patched/ngrep.c |
|
15 |
-+++ ngrep.patched/ngrep.c Fri Aug 30 17:33:28 2002 |
|
16 |
-@@ -54,6 +54,8 @@ |
|
17 |
- #include <signal.h> |
|
18 |
- #include <sys/ioctl.h> |
|
19 |
- |
|
20 |
-+#include <locale.h> |
|
21 |
-+ |
|
22 |
- #ifdef USE_PCRE |
|
23 |
- #include "pcre-3.4/pcre.h" |
|
24 |
- #else |
|
25 |
-@@ -62,6 +64,9 @@ |
|
26 |
- |
|
27 |
- #include "ngrep.h" |
|
28 |
- |
|
29 |
-+#define dump(_a,_b) ( show_eol ? \ |
|
30 |
-+ dump_line_by_line((_a),(_b)) : _dump((_a),(_b)) ) |
|
31 |
-+ |
|
32 |
- |
|
33 |
- static char rcsver[] = "$Revision$"; |
|
34 |
- |
|
35 |
-@@ -72,6 +77,8 @@ |
|
36 |
- int matches = 0, max_matches = 0; |
|
37 |
- int live_read = 1, want_delay = 0; |
|
38 |
- |
|
39 |
-+int show_eol=0; |
|
40 |
-+ |
|
41 |
- char pc_err[PCAP_ERRBUF_SIZE]; |
|
42 |
- #ifdef USE_PCRE |
|
43 |
- int err_offset; |
|
44 |
-@@ -117,8 +124,13 @@ |
|
45 |
- signal(SIGPIPE, clean_exit); |
|
46 |
- signal(SIGWINCH, update_windowsize); |
|
47 |
- |
|
48 |
-- while ((c = getopt(argc, argv, "hXViwqpevxlDtTs:n:d:A:I:O:")) != EOF) { |
|
49 |
-+ setlocale(LC_ALL, ""); |
|
50 |
-+ |
|
51 |
-+ while ((c = getopt(argc, argv, "LhXViwqpevxlDtTs:n:d:A:I:O:")) != EOF) { |
|
52 |
- switch (c) { |
|
53 |
-+ case 'L': |
|
54 |
-+ show_eol=1; |
|
55 |
-+ break; |
|
56 |
- case 'I': |
|
57 |
- read_file = optarg; |
|
58 |
- break; |
|
59 |
-@@ -649,8 +661,28 @@ |
|
60 |
- return 1; |
|
61 |
- } |
|
62 |
- |
|
63 |
-+void dump_line_by_line( char *data, int len ) |
|
64 |
-+{ |
|
65 |
-+ unsigned width; |
|
66 |
-+ char *c; |
|
67 |
-+ |
|
68 |
-+ c=data; |
|
69 |
-+ |
|
70 |
-+ while( c< data + len) { |
|
71 |
-+ if (*c=='\n') { |
|
72 |
-+ puts(""); |
|
73 |
-+ } else { |
|
74 |
-+ putchar(isprint(*c)?*c:'.'); |
|
75 |
-+ } |
|
76 |
-+ c++; |
|
77 |
-+ |
|
78 |
-+ } |
|
79 |
-+ puts(""); |
|
80 |
-+ |
|
81 |
-+} |
|
82 |
-+ |
|
83 |
- |
|
84 |
--void dump(char *data, int len) { |
|
85 |
-+void _dump(char *data, int len) { |
|
86 |
- if (len > 0) { |
|
87 |
- unsigned width = show_hex?16:(ws_col-5); |
|
88 |
- char *str = data; |
|
89 |
-@@ -811,7 +843,7 @@ |
|
90 |
- |
|
91 |
- |
|
92 |
- void usage(int e) { |
|
93 |
-- printf("usage: ngrep <-hXViwqpevxlDtT> <-IO pcap_dump> <-n num> <-d dev> <-A num>\n" |
|
94 |
-+ printf("usage: ngrep <-hLXViwqpevxlDtT> <-IO pcap_dump> <-n num> <-d dev> <-A num>\n" |
|
95 |
- " <-s snaplen> <match expression> <bpf filter>\n"); |
|
96 |
- exit(e); |
|
97 |
- } |
|
98 |
-diff -Naur ngrep.old/ngrep.h ngrep.patched/ngrep.h |
|
99 |
-+++ ngrep.patched/ngrep.h Fri Aug 30 17:33:29 2002 |
|
100 |
-@@ -29,7 +29,8 @@ |
|
101 |
- |
|
102 |
- char *get_filter(char **); |
|
103 |
- void process(u_char *, struct pcap_pkthdr*, u_char *); |
|
104 |
--void dump(char *, int); |
|
105 |
-+void _dump(char *, int); |
|
106 |
-+void dump_line_by_line(char *, int); |
|
107 |
- void clean_exit(int); |
|
108 |
- void usage(int); |
|
109 |
- void version(void); |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,112 @@ |
1 |
+diff -Naur ngrep.old/ngrep.8 ngrep.patched/ngrep.8 |
|
2 |
+--- ngrep.old/ngrep.8 Mon Dec 31 23:07:02 2001 |
|
3 |
+@@ -48,6 +48,10 @@ |
|
4 |
+ .IP -h |
|
5 |
+ Display help/usage information. |
|
6 |
+ |
|
7 |
++.IP -L |
|
8 |
++Display captured packets in line-by-line manner. Good for post-processing |
|
9 |
++of textual protocols. |
|
10 |
++ |
|
11 |
+ .IP -X |
|
12 |
+ Treat the match expression as a hexadecimal string. See the |
|
13 |
+ explanation of \fImatch expression\fP below. |
|
14 |
+diff -Naur ngrep.old/ngrep.c ngrep.patched/ngrep.c |
|
15 |
+--- ngrep.old/ngrep.c Mon Dec 31 23:11:00 2001 |
|
16 |
+@@ -54,6 +54,8 @@ |
|
17 |
+ #include <signal.h> |
|
18 |
+ #include <sys/ioctl.h> |
|
19 |
+ |
|
20 |
++#include <locale.h> |
|
21 |
++ |
|
22 |
+ #ifdef USE_PCRE |
|
23 |
+ #include "pcre-3.4/pcre.h" |
|
24 |
+ #else |
|
25 |
+@@ -62,6 +64,9 @@ |
|
26 |
+ |
|
27 |
+ #include "ngrep.h" |
|
28 |
+ |
|
29 |
++#define dump(_a,_b) ( show_eol ? \ |
|
30 |
++ dump_line_by_line((_a),(_b)) : _dump((_a),(_b)) ) |
|
31 |
++ |
|
32 |
+ |
|
33 |
+ static char rcsver[] = "$Revision$"; |
|
34 |
+ |
|
35 |
+@@ -72,6 +77,8 @@ |
|
36 |
+ int matches = 0, max_matches = 0; |
|
37 |
+ int live_read = 1, want_delay = 0; |
|
38 |
+ |
|
39 |
++int show_eol=0; |
|
40 |
++ |
|
41 |
+ char pc_err[PCAP_ERRBUF_SIZE]; |
|
42 |
+ #ifdef USE_PCRE |
|
43 |
+ int err_offset; |
|
44 |
+@@ -117,8 +124,13 @@ |
|
45 |
+ signal(SIGPIPE, clean_exit); |
|
46 |
+ signal(SIGWINCH, update_windowsize); |
|
47 |
+ |
|
48 |
+- while ((c = getopt(argc, argv, "hXViwqpevxlDtTs:n:d:A:I:O:")) != EOF) { |
|
49 |
++ setlocale(LC_ALL, ""); |
|
50 |
++ |
|
51 |
++ while ((c = getopt(argc, argv, "LhXViwqpevxlDtTs:n:d:A:I:O:")) != EOF) { |
|
52 |
+ switch (c) { |
|
53 |
++ case 'L': |
|
54 |
++ show_eol=1; |
|
55 |
++ break; |
|
56 |
+ case 'I': |
|
57 |
+ read_file = optarg; |
|
58 |
+ break; |
|
59 |
+@@ -649,8 +661,28 @@ |
|
60 |
+ return 1; |
|
61 |
+ } |
|
62 |
+ |
|
63 |
++void dump_line_by_line( char *data, int len ) |
|
64 |
++{ |
|
65 |
++ unsigned width; |
|
66 |
++ char *c; |
|
67 |
++ |
|
68 |
++ c=data; |
|
69 |
++ |
|
70 |
++ while( c< data + len) { |
|
71 |
++ if (*c=='\n') { |
|
72 |
++ puts(""); |
|
73 |
++ } else { |
|
74 |
++ putchar(isprint(*c)?*c:'.'); |
|
75 |
++ } |
|
76 |
++ c++; |
|
77 |
++ |
|
78 |
++ } |
|
79 |
++ puts(""); |
|
80 |
++ |
|
81 |
++} |
|
82 |
++ |
|
83 |
+ |
|
84 |
+-void dump(char *data, int len) { |
|
85 |
++void _dump(char *data, int len) { |
|
86 |
+ if (len > 0) { |
|
87 |
+ unsigned width = show_hex?16:(ws_col-5); |
|
88 |
+ char *str = data; |
|
89 |
+@@ -811,7 +843,7 @@ |
|
90 |
+ |
|
91 |
+ |
|
92 |
+ void usage(int e) { |
|
93 |
+- printf("usage: ngrep <-hXViwqpevxlDtT> <-IO pcap_dump> <-n num> <-d dev> <-A num>\n" |
|
94 |
++ printf("usage: ngrep <-hLXViwqpevxlDtT> <-IO pcap_dump> <-n num> <-d dev> <-A num>\n" |
|
95 |
+ " <-s snaplen> <match expression> <bpf filter>\n"); |
|
96 |
+ exit(e); |
|
97 |
+ } |
|
98 |
+diff -Naur ngrep.old/ngrep.h ngrep.patched/ngrep.h |
|
99 |
+--- ngrep.old/ngrep.h Mon Dec 31 23:02:00 2001 |
|
100 |
+@@ -29,7 +29,8 @@ |
|
101 |
+ |
|
102 |
+ char *get_filter(char **); |
|
103 |
+ void process(u_char *, struct pcap_pkthdr*, u_char *); |
|
104 |
+-void dump(char *, int); |
|
105 |
++void _dump(char *, int); |
|
106 |
++void dump_line_by_line(char *, int); |
|
107 |
+ void clean_exit(int); |
|
108 |
+ void usage(int); |
|
109 |
+ void version(void); |