]> gitweb.michael.orlitzky.com - hath.git/blob - hath.cabal
Rewrite command-line parsing to use cmdargs.
[hath.git] / hath.cabal
1 name: hath
2 version: 0.0.6
3 cabal-version: >= 1.8
4 author: Michael Orlitzky
5 maintainer: Michael Orlitzky <michael@orlitzky.com>
6 category: Utils
7 license: GPL-3
8 license-file: doc/LICENSE
9 build-type: Simple
10 extra-source-files:
11 doc/man1/hath.1
12 synopsis:
13 Hath manipulates network blocks in CIDR notation.
14 description:
15 Hath is a Haskell program for working with network blocks in CIDR
16 notation. When dealing with blocks of network addresses, there are a
17 few things that one usually wants to do with them:
18 .
19 * Create a regular expression matching the CIDR block(s). This is
20 because grep will throw up if you feed it CIDR.
21 .
22 * Combine small blocks into larger ones. For example, if you have two
23 consecutive \/24s, they might combine into a larger \/23.
24 .
25 * View the result of block combination in a useful way.
26 .
27 * List them.
28 .
29 * Find their associated PTR records.
30 .
31 Hath has several modes to perform these functions:
32 .
33 [@Regexed@]
34 This computes a (Perl-compatible) regular expression matching
35 the input CIDR blocks. It's the default mode of operation.
36 .
37 [@Reduced@]
38 This combines small blocks into larger ones where possible, and
39 eliminates redundant blocks. The output should be equivalent to
40 the input, though.
41 .
42 [@Duped@]
43 Shows only the blocks that would be removed by reduce; that is, it
44 shows the ones that would get combined into larger blocks or are
45 simply redundant.
46 .
47 [@Diffed@]
48 Shows what would change if you used reduce. Uses diff-like
49 notation.
50 .
51 [@Listed@]
52 List the IP addresses contained within the given CIDRs.
53 .
54 [@Reversed@]
55 Perform reverse DNS (PTR) lookups on the IP addresses contained
56 within the given CIDRs.
57 .
58 /Examples/:
59 .
60 Combine two \/24s into a \/23:
61 .
62 @
63 $ hath reduced <<< \"10.0.0.0\/24 10.0.1.0\/24\"
64 10.0.0.0/23
65 @
66 .
67 Create a perl-compatible regex to be fed to grep:
68 .
69 @
70 $ grep -P `hath regexed -i cidrs.txt` mail.log
71 @
72 .
73 List the addresses in 192.168.0.240\/29:
74 .
75 @
76 $ hath listed <<< \"192.168.0.240\/29\"
77 192.168.0.240
78 192.168.0.241
79 192.168.0.242
80 192.168.0.243
81 192.168.0.244
82 192.168.0.245
83 192.168.0.246
84 192.168.0.247
85 @
86 .
87 Perform PTR lookups on all of 198.41.0.4\/30:
88 .
89 @
90 hath reversed <<< \"198.41.0.4\/30\"
91 198.41.0.4: a.root-servers.net.
92 198.41.0.5:
93 198.41.0.6: rs.internic.net.
94 198.41.0.7:
95 @
96 .
97 The DNS lookups are usually the bottleneck for this mode, but we can
98 perform them in parallel. Simply pass the number of threads to the
99 GHC runtime on the command line; for example, the following will
100 perform 25 lookups in parallel:
101 .
102 @
103 hath reversed +RTS -N25 <<< \"198.41.0.4\/24\"
104 198.41.0.4: a.root-servers.net.
105 198.41.0.5:
106 198.41.0.6: rs.internic.net.
107 ...
108 @
109
110 executable hath
111
112 main-is:
113 Main.hs
114
115 hs-source-dirs:
116 src/
117
118 other-modules:
119 Bit
120 Cidr
121 CommandLine
122 DNS
123 ExitCodes
124 IPv4Address
125 Maskable
126 Maskbits
127 Octet
128
129 build-depends:
130 base >= 4.6 && < 4.7,
131 bytestring == 0.10.*,
132 cmdargs == 0.10.*,
133 dns == 1.*,
134 HUnit == 1.2.*,
135 QuickCheck == 2.6.*,
136 MissingH == 1.2.*,
137 parallel-io == 0.3.*,
138 split == 0.2.*,
139 test-framework == 0.8.*,
140 test-framework-hunit == 0.3.*,
141 test-framework-quickcheck2 == 0.3.*
142
143 ghc-options:
144 -Wall
145 -fwarn-hi-shadowing
146 -fwarn-missing-signatures
147 -fwarn-name-shadowing
148 -fwarn-orphans
149 -fwarn-type-defaults
150 -fwarn-tabs
151 -fwarn-incomplete-record-updates
152 -fwarn-monomorphism-restriction
153 -fwarn-unused-do-bind
154 -rtsopts
155 -threaded
156 -optc-O3
157 -optc-march=native
158 -O2
159
160 ghc-prof-options:
161 -prof
162 -auto-all
163 -caf-all
164
165
166 test-suite testsuite
167 type: exitcode-stdio-1.0
168 hs-source-dirs: src test
169 main-is: TestSuite.hs
170
171 build-depends:
172 base >= 4.6 && < 4.7,
173 bytestring == 0.10.*,
174 cmdargs == 0.10.*,
175 dns == 1.*,
176 HUnit == 1.2.*,
177 QuickCheck == 2.6.*,
178 MissingH == 1.2.*,
179 parallel-io == 0.3.*,
180 split == 0.2.*,
181 test-framework == 0.8.*,
182 test-framework-hunit == 0.3.*,
183 test-framework-quickcheck2 == 0.3.*
184
185 -- It's not entirely clear to me why I have to reproduce all of this.
186 ghc-options:
187 -Wall
188 -fwarn-hi-shadowing
189 -fwarn-missing-signatures
190 -fwarn-name-shadowing
191 -fwarn-orphans
192 -fwarn-type-defaults
193 -fwarn-tabs
194 -fwarn-incomplete-record-updates
195 -fwarn-monomorphism-restriction
196 -fwarn-unused-do-bind
197 -rtsopts
198 -threaded
199 -optc-O3
200 -optc-march=native
201 -O2
202
203
204 -- These won't work without shelltestrunner installed in your
205 -- $PATH. Maybe there is some way to tell Cabal that.
206 test-suite shelltests
207 type: exitcode-stdio-1.0
208 hs-source-dirs: test
209 main-is: ShellTests.hs
210
211 build-depends:
212 base >= 4.6 && < 4.7,
213 bytestring == 0.10.*,
214 cmdargs == 0.10.*,
215 dns == 1.*,
216 HUnit == 1.2.*,
217 QuickCheck == 2.6.*,
218 MissingH == 1.2.*,
219 parallel-io == 0.3.*,
220 process == 1.1.*,
221 split == 0.2.*,
222 test-framework == 0.8.*,
223 test-framework-hunit == 0.3.*,
224 test-framework-quickcheck2 == 0.3.*
225
226 -- It's not entirely clear to me why I have to reproduce all of this.
227 ghc-options:
228 -Wall
229 -fwarn-hi-shadowing
230 -fwarn-missing-signatures
231 -fwarn-name-shadowing
232 -fwarn-orphans
233 -fwarn-type-defaults
234 -fwarn-tabs
235 -fwarn-incomplete-record-updates
236 -fwarn-monomorphism-restriction
237 -fwarn-unused-do-bind
238 -rtsopts
239 -threaded
240 -optc-O3
241 -optc-march=native
242 -O2
243
244
245 test-suite shelltests-net
246 type: exitcode-stdio-1.0
247 hs-source-dirs: test
248 main-is: ShellTestsNet.hs
249
250 build-depends:
251 base >= 4.6 && < 4.7,
252 bytestring == 0.10.*,
253 cmdargs == 0.10.*,
254 dns == 1.*,
255 HUnit == 1.2.*,
256 QuickCheck == 2.6.*,
257 MissingH == 1.2.*,
258 parallel-io == 0.3.*,
259 process == 1.1.*,
260 split == 0.2.*,
261 test-framework == 0.8.*,
262 test-framework-hunit == 0.3.*,
263 test-framework-quickcheck2 == 0.3.*
264
265 -- It's not entirely clear to me why I have to reproduce all of this.
266 ghc-options:
267 -Wall
268 -fwarn-hi-shadowing
269 -fwarn-missing-signatures
270 -fwarn-name-shadowing
271 -fwarn-orphans
272 -fwarn-type-defaults
273 -fwarn-tabs
274 -fwarn-incomplete-record-updates
275 -fwarn-monomorphism-restriction
276 -fwarn-unused-do-bind
277 -rtsopts
278 -threaded
279 -optc-O3
280 -optc-march=native
281 -O2
282
283
284 source-repository head
285 type: git
286 location: http://michael.orlitzky.com/git/hath.git
287 branch: master