@@ -211,26 +211,23 @@ func (c *Client) ProcessOutput() {
211
211
panic (err )
212
212
}
213
213
214
- lineNum := 0
215
214
scan := bufio .NewScanner (f )
216
215
217
216
for scan .Scan () {
218
217
line := scan .Text ()
219
- if strings .Contains (line , "NXDOMAIN " ) {
220
- lineNum = 0
218
+ if strings .Contains (strings . ToLower ( line ) , "nxdomain " ) {
219
+ continue
221
220
}
222
221
223
- if lineNum > 0 && lineNum <= AnswerLineNum {
224
- if strings .Contains (line , "NOERROR" ) {
225
- domain := ProcessRecord (line )
226
- _ , err = w .WriteString (domain + "\n " )
222
+ if ! strings .Contains (strings .ToLower (line ), "noerror" ) {
223
+ continue
224
+ }
227
225
228
- if err != nil {
229
- panic ( err )
230
- }
231
- }
226
+ domain := ProcessRecord ( line )
227
+ _ , err = w . WriteString ( domain + " \n " )
228
+ if err != nil {
229
+ panic ( err )
232
230
}
233
- lineNum ++
234
231
}
235
232
236
233
_ = w .Flush ()
@@ -270,15 +267,17 @@ func (c *Client) Run() {
270
267
c .RunMassDNS ()
271
268
c .ProcessOutput ()
272
269
//
273
- xz := exec .Command ("/usr/bin/xz" , "/tmp/results.txt" )
274
- err := xz .Start ()
275
- if err != nil {
276
- log .Fatal (err .Error ())
277
- }
278
- err = xz .Wait ()
279
- if err != nil {
280
- log .Fatal (err .Error ())
281
- }
270
+ xz := exec .Command ("/usr/bin/xz" , "/tmp/results.txt" )
271
+ err := xz .Start ()
272
+ if err != nil {
273
+ log .Error (err .Error ())
274
+ continue
275
+ }
276
+ err = xz .Wait ()
277
+ if err != nil {
278
+ log .Error (err .Error ())
279
+ continue
280
+ }
282
281
283
282
err = c .Upload ("https://api.domainsproject.org/api/vo/upload" , "/tmp/results.txt.xz" )
284
283
if err != nil {
@@ -288,7 +287,7 @@ func (c *Client) Run() {
288
287
// clean up
289
288
os .Remove ("/tmp/input.txt" )
290
289
os .Remove ("/tmp/output.txt" )
291
- os .Remove ("/tmp/results.txt" )
290
+ os .Remove ("/tmp/results.txt.xz " )
292
291
}
293
292
}
294
293
0 commit comments