]> git.saurik.com Git - apple/configd.git/blob - get-network-info
configd-963.50.8.tar.gz
[apple/configd.git] / get-network-info
1 #!/bin/sh
2
3 #
4 # Copyright © 2015-2017 Apple Inc.
5 #
6 # get-network-info
7 #
8 # Collect network information.
9 #
10
11 PATH=/bin:/usr/bin:/sbin:/usr/sbin
12
13 # __SETUP_ROUTINES_BEGIN__
14
15 process_opts () {
16
17 for i in $ARGS
18 do
19 case "$i" in
20 -c)
21 COLLECT_CONFIGURATION_FILES="Y"
22 shift
23 ;;
24 -n)
25 COLLECT_NDF_INFO="Y"
26 shift
27 ;;
28 -P)
29 COLLECT_PCAP="N"
30 shift
31 ;;
32 -s)
33 COLLECT_SENSITIVE_INFO="Y"
34 shift
35 ;;
36 --)
37 shift
38 ;;
39 *)
40 REQUESTED_OUTDIR="${i}"
41 shift
42 ;;
43 esac
44 done
45
46 }
47
48 set_root () {
49
50 PRIV=""
51 if [ ${EUID} -ne 0 ]; then
52 PRIV="sudo"
53 fi
54
55 }
56
57 #
58 # Setup
59 #
60 setup () {
61
62 set_root
63 umask 077
64 cd "${REQUESTED_OUTDIR}"
65
66 }
67
68 # __SETUP_ROUTINES_END__
69
70
71 # __COMMAND_ROUTINES_BEGIN__
72
73 # note: the daemons dump to syslog so you need to wait a bit before
74 # capturing the logs.
75 collect_state_dump_sensitive () {
76
77 ${PRIV} /usr/bin/killall -INFO mDNSResponder 2>/dev/null
78
79 sleep 1 &
80
81 }
82
83 #
84 # network interface configuration
85 #
86 run_ifconfig () {
87
88 if [ ! -x /sbin/ifconfig ]; then
89 return
90 fi
91
92 /sbin/ifconfig -a -L -b -m -r -v -v > ifconfig.txt 2>&1
93 if [ $? -ne 0 ]; then
94 /sbin/ifconfig -a > ifconfig.txt 2>&1
95 fi
96
97 }
98
99 #
100 # network route configuration and statistics
101 #
102 run_netstat () {
103
104 if [ ! -x /usr/sbin/netstat ]; then
105 return
106 fi
107
108 echo "#" > netstat.txt
109 echo "# netstat -n -r -a -l" >> netstat.txt
110 echo "#" >> netstat.txt
111 /usr/sbin/netstat -n -r -a -l >> netstat.txt 2>&1
112
113 echo "#" >> netstat.txt
114 echo "# netstat -A -a -l -n -v" >> netstat.txt
115 echo "#" >> netstat.txt
116 /usr/sbin/netstat -A -a -l -n -v >> netstat.txt 2>&1
117
118 echo "#" >> netstat.txt
119 echo "# netstat -s" >> netstat.txt
120 echo "#" >> netstat.txt
121 /usr/sbin/netstat -s >> netstat.txt 2>&1
122
123 echo "#" >> netstat.txt
124 echo "# netstat -rs" >> netstat.txt
125 echo "#" >> netstat.txt
126 /usr/sbin/netstat -rs >> netstat.txt 2>&1
127
128 echo "#" >> netstat.txt
129 echo "# netstat -mmm" >> netstat.txt
130 echo "#" >> netstat.txt
131 /usr/sbin/netstat -mmm >> netstat.txt 2>&1
132
133 echo "#" >> netstat.txt
134 echo "# netstat -i -n -d" >> netstat.txt
135 echo "#" >> netstat.txt
136 /usr/sbin/netstat -i -n -d >> netstat.txt 2>&1
137
138 echo "#" >> netstat.txt
139 echo "# netstat -i -x R" >> netstat.txt
140 echo "#" >> netstat.txt
141 /usr/sbin/netstat -i -x R >> netstat.txt 2>&1
142
143 echo "#" >> netstat.txt
144 echo "# netstat -a -n -p mptcp" >> netstat.txt
145 echo "#" >> netstat.txt
146 /usr/sbin/netstat -anp mptcp >> netstat.txt 2>&1
147
148 echo "#" >> netstat.txt
149 echo "# netstat -s -p mptcp" >> netstat.txt
150 echo "#" >> netstat.txt
151 /usr/sbin/netstat -s -p mptcp >> netstat.txt 2>&1
152
153 echo "#" >> netstat.txt
154 echo "# netstat -g -n -s" >> netstat.txt
155 echo "#" >> netstat.txt
156 /usr/sbin/netstat -g -n -s >> netstat.txt 2>&1
157
158 if [ -x /sbin/ifconfig ]; then
159 for if in ${IF_LIST}
160 do
161 IF_INFO=`/sbin/ifconfig -v ${if}`
162 `echo $IF_INFO | grep -q TXSTART`
163 if [ $? -eq 0 ]; then
164 echo "#" >> netstat.txt
165 echo "# netstat -qq -I ${if}" >> netstat.txt
166 echo "#" >> netstat.txt
167 /usr/sbin/netstat -qq -I ${if} >> netstat.txt 2>&1
168 fi
169 `echo $IF_INFO | grep -q RXPOLL`
170 if [ $? -eq 0 ]; then
171 echo "#" >> netstat.txt
172 echo "# netstat -Q -I ${if}" >> netstat.txt
173 echo "#" >> netstat.txt
174 /usr/sbin/netstat -Q -I ${if} >> netstat.txt 2>&1
175 fi
176 done
177 fi
178
179 }
180
181 #
182 # ndp
183 #
184 run_ndp () {
185
186 if [ ! -x /usr/sbin/ndp ]; then
187 return
188 fi
189
190 echo "#" > ndp-info.txt
191 echo "# ndp -n -a" >> ndp-info.txt
192 echo "#" >> ndp-info.txt
193 /usr/sbin/ndp -n -a >> ndp-info.txt 2>&1
194
195 echo "#" >> ndp-info.txt
196 echo "# ndp -n -p" >> ndp-info.txt
197 echo "#" >> ndp-info.txt
198 /usr/sbin/ndp -n -p >> ndp-info.txt 2>&1
199
200 echo "#" >> ndp-info.txt
201 echo "# ndp -n -r" >> ndp-info.txt
202 echo "#" >> ndp-info.txt
203 /usr/sbin/ndp -n -r >> ndp-info.txt 2>&1
204
205 if [ -x /sbin/ifconfig ]; then
206 for if in ${IF_LIST}
207 do
208 echo "#" >> ndp-info.txt
209 echo "# ndp -i ${if}" >> ndp-info.txt
210 echo "#" >> ndp-info.txt
211 /usr/sbin/ndp -i ${if} >> ndp-info.txt 2>&1
212 done
213 fi
214
215 }
216
217 #
218 # arp
219 #
220 run_arp () {
221
222 if [ ! -x /usr/sbin/arp ]; then
223 return
224 fi
225
226 echo "#" > arp-info.txt
227 echo "# arp -n -a" >> arp-info.txt
228 echo "#" >> arp-info.txt
229 /usr/sbin/arp -n -a >> arp-info.txt 2>&1
230
231 }
232
233 #
234 # DHCP configuration
235 #
236 run_ipconfig () {
237
238 if [ ! -x /usr/sbin/ipconfig ]; then
239 return
240 fi
241
242 for if in ${IF_LIST}
243 do
244 case ${if} in
245 lo* )
246 ;;
247 *)
248 echo "#" >> ipconfig-info.txt
249 echo "# INTERFACE ${if}" >> ipconfig-info.txt
250 echo "#" >> ipconfig-info.txt
251
252 echo "DHCPv4 information:" >> ipconfig-info.txt
253
254 IPCONFIG_INFO=`/usr/sbin/ipconfig getpacket ${if}`
255 if [ "${IPCONFIG_INFO}" != "" ]; then
256 echo "${IPCONFIG_INFO}" >> ipconfig-info.txt
257 else
258 echo "not available" >> ipconfig-info.txt
259 fi
260
261 echo"" >> ipconfig-info.txt
262
263 echo "DHCPv6 information:" >> ipconfig-info.txt
264
265 IPCONFIG_INFO=`/usr/sbin/ipconfig getv6packet ${if}`
266 if [ "${IPCONFIG_INFO}" != "" ]; then
267 echo "${IPCONFIG_INFO}" >> ipconfig-info.txt
268 else
269 echo "not available" >> ipconfig-info.txt
270 fi
271
272 echo"" >> ipconfig-info.txt
273 ;;
274 esac
275 done
276
277 }
278
279 #
280 # IPsec configuration
281 #
282 run_setkey () {
283
284 if [ ! -x /usr/sbin/setkey -o ! -x /usr/bin/perl ]; then
285 return
286 fi
287
288 echo "#" > ipsec.txt
289 echo "# setkey -D" >> ipsec.txt
290 echo "#" >> ipsec.txt
291 ${PRIV} /usr/sbin/setkey -D \
292 | /usr/bin/perl -l -n -e '
293 if (/^(\s+[AE]:\s+\S+\s+)"?(.*)"?\s*$/) {
294 printf "%s[redacted]%s\n", $1, $3;
295 } else {
296 printf "%s\n", $_;
297 }
298 ' >> ipsec.txt
299
300 echo "" >> ipsec.txt
301 echo "#" >> ipsec.txt
302 echo "# setkey -Pp -D" >> ipsec.txt
303 echo "#" >> ipsec.txt
304 ${PRIV} /usr/sbin/setkey -Pp -D >> ipsec.txt
305
306 for CF in /var/run/racoon/*.conf
307 do
308 if [ ! -r "${CF}" ]; then
309 continue
310 fi
311
312 echo "" >> ipsec.txt
313 echo "#" >> ipsec.txt
314 echo "# ${CF}" >> ipsec.txt
315 echo "#" >> ipsec.txt
316 ${PRIV} cat ${CF} \
317 | /usr/bin/perl -l -n -e '
318 if (/^(\s+shared_secret\s+use\s+)"?([^\s;"]+)"?(.*)/) {
319 printf "%s[redacted]%s\n", $1, $3;
320 } else {
321 printf "%s\n", $_;
322 }
323 ' >> ipsec.txt
324 done
325
326 }
327
328 #
329 # skywalk configuration and statistics
330 #
331 run_skywalk () {
332
333 if [ ! -x /usr/sbin/skywalkctl ]; then
334 return
335 fi
336
337 echo "#" > skywalk.txt
338 echo "# skywalkctl show" >> skywalk.txt
339 echo "#" >> skywalk.txt
340 /usr/sbin/skywalkctl show >> skywalk.txt 2>&1
341
342 echo "#" >> skywalk.txt
343 echo "# skywalkctl flow -n" >> skywalk.txt
344 echo "#" >> skywalk.txt
345 /usr/sbin/skywalkctl flow -n >> skywalk.txt 2>&1
346
347 echo "#" >> skywalk.txt
348 echo "# skywalkctl flow-route -n" >> skywalk.txt
349 echo "#" >> skywalk.txt
350 /usr/sbin/skywalkctl flow-route -n >> skywalk.txt 2>&1
351
352 echo "#" >> skywalk.txt
353 echo "# skywalkctl flow-switch" >> skywalk.txt
354 echo "#" >> skywalk.txt
355 /usr/sbin/skywalkctl flow-switch >> skywalk.txt 2>&1
356
357 echo "#" >> skywalk.txt
358 echo "# skywalkctl flow-owner" >> skywalk.txt
359 echo "#" >> skywalk.txt
360 /usr/sbin/skywalkctl flow-owner >> skywalk.txt 2>&1
361
362 echo "#" >> skywalk.txt
363 echo "# skywalkctl flow-adv" >> skywalk.txt
364 echo "#" >> skywalk.txt
365 /usr/sbin/skywalkctl flow-adv >> skywalk.txt 2>&1
366
367 echo "#" >> skywalk.txt
368 echo "# skywalkctl netstat -s" >> skywalk.txt
369 echo "#" >> skywalk.txt
370 /usr/sbin/skywalkctl netstat -s >> skywalk.txt 2>&1
371
372 echo "#" >> skywalk.txt
373 echo "# skywalkctl netstat -s --global" >> skywalk.txt
374 echo "#" >> skywalk.txt
375 /usr/sbin/skywalkctl netstat -s --global >> skywalk.txt 2>&1
376
377 echo "#" >> skywalk.txt
378 echo "# skywalkctl interface" >> skywalk.txt
379 echo "#" >> skywalk.txt
380 /usr/sbin/skywalkctl interface >> skywalk.txt 2>&1
381
382 echo "#" >> skywalk.txt
383 echo "# skywalkctl channel" >> skywalk.txt
384 echo "#" >> skywalk.txt
385 /usr/sbin/skywalkctl channel >> skywalk.txt 2>&1
386
387 echo "#" >> skywalk.txt
388 echo "# skywalkctl provider -D" >> skywalk.txt
389 echo "#" >> skywalk.txt
390 /usr/sbin/skywalkctl provider -D >> skywalk.txt 2>&1
391
392 echo "#" >> skywalk.txt
393 echo "# skywalkctl netns -a" >> skywalk.txt
394 echo "#" >> skywalk.txt
395 /usr/sbin/skywalkctl netns -a >> skywalk.txt 2>&1
396
397 echo "#" >> skywalk.txt
398 echo "# skywalkctl memory" >> skywalk.txt
399 echo "#" >> skywalk.txt
400 /usr/sbin/skywalkctl memory >> skywalk.txt 2>&1
401
402 }
403
404 #
405 # skywalk configuration and statistics
406 #
407 run_nettop () {
408
409 if [ ! -x /usr/bin/nettop ]; then
410 return
411 fi
412
413 echo "#" > nettop.txt
414 echo "# nettop -U -l 1" >> nettop.txt
415 echo "#" >> nettop.txt
416 /usr/bin/nettop -U -l 1 >> nettop.txt 2>&1
417
418 }
419
420 #
421 # Network preferences
422 #
423 collect_configuration_files () {
424
425 for f in \
426 /Library/Preferences/com.apple.networkextension.plist \
427 /Library/Preferences/com.apple.networkextension.control.plist \
428 /Library/Preferences/com.apple.networkextension.necp.plist \
429 /Library/Preferences/com.apple.networkextension.cache.plist \
430 /Library/Preferences/SystemConfiguration/com.apple.nat.plist \
431 /Library/Preferences/SystemConfiguration/com.apple.RemoteAccessServers.plist \
432 /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist \
433 /Library/Preferences/com.apple.mDNSResponder.plist \
434 /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist \
435 /Library/Preferences/SystemConfiguration/preferences.plist \
436
437 do
438 if [ -e "${f}" ]; then
439 b="`basename ${f}`"
440 cat "${f}" > "${b}" 2>&1
441 fi
442 done
443
444 if [ -e /etc/resolv.conf ]; then
445 cat /etc/resolv.conf > etc-resolv-conf.txt 2>&1
446 fi
447 if [ -e /var/run/resolv.conf ]; then
448 cat /var/run/resolv.conf > var-run-resolv-conf.txt 2>&1
449 fi
450 if [ -e /etc/resolver ]; then
451 tar -c -H /etc/resolver > etc-resolver.tar 2>/dev/null
452 fi
453 }
454
455 #
456 # VPN
457 #
458 collect_vpn_logs () {
459
460 for f in \
461 /var/log/vpnd.log \
462 /var/log/racoon.log \
463
464 do
465 if [ -e "${f}" ]; then
466 b="`basename ${f}`"
467 ${PRIV} cat "${f}" > "${b}".txt 2>&1
468 fi
469 done
470 }
471
472 #
473 # Policy
474 #
475 run_neutil () {
476
477 if [ ! -x /usr/local/bin/neutil ]; then
478 return
479 fi
480
481 (
482 echo "#" > necp.txt
483 echo "# neutil policy dump" >> necp.txt
484 echo "#" >> necp.txt
485 /usr/local/bin/neutil policy dump >> necp.txt 2>&1
486
487 echo "#" > network-agents.txt
488 echo "# neutil agent dump" >> network-agents.txt
489 echo "#" >> network-agents.txt
490 /usr/local/bin/neutil agent dump >> network-agents.txt 2>&1
491
492 # Generates a default-level log message containing the current file handles that UserEventAgent has
493 /usr/local/bin/neutil session log-file-handles
494 sleep 1 &
495 ) &
496 }
497
498 #
499 # Path
500 #
501 run_network_test () {
502
503 if [ ! -x /usr/local/bin/network_test ]; then
504 return
505 fi
506
507 /usr/local/bin/network_test path_watcher > nw_path.txt 2>&1
508
509 }
510
511 #
512 # Network, DNS, Proxy, Reachability, Cache information
513 #
514 run_scutil () {
515
516 if [ ! -x /usr/sbin/scutil ]; then
517 return
518 fi
519
520 echo "#" > network-information.txt
521 echo "# scutil -d -v --nwi" >> network-information.txt
522 echo "#" >> network-information.txt
523 /usr/sbin/scutil -d -v --nwi >> network-information.txt 2>&1
524 for if in ${IF_LIST}
525 do
526 echo "" >> network-information.txt
527 echo "#" >> network-information.txt
528 echo "# scutil --nwi ${if}" >> network-information.txt
529 echo "#" >> network-information.txt
530 scutil --nwi ${if} >> network-information.txt 2>&1
531 done
532
533 echo "#" > dns-configuration.txt
534 echo "# scutil -d -v --dns" >> dns-configuration.txt
535 echo "#" >> dns-configuration.txt
536 /usr/sbin/scutil -d -v --dns >> dns-configuration.txt 2>&1
537
538 echo "#" > proxy-configuration.txt
539 echo "# scutil -d -v --proxy" >> proxy-configuration.txt
540 echo "#" >> proxy-configuration.txt
541 /usr/sbin/scutil -d -v --proxy >> proxy-configuration.txt 2>&1
542
543 echo "#" > reachability-info.txt
544 echo '# scutil -d -v -r www.apple.com' >> reachability-info.txt
545 echo "#" >> reachability-info.txt
546 /usr/sbin/scutil -d -v -r www.apple.com >> reachability-info.txt 2>&1
547
548 echo "#" >> reachability-info.txt
549 echo '# scutil -d -v -r 0.0.0.0' >> reachability-info.txt
550 echo "#" >> reachability-info.txt
551 /usr/sbin/scutil -d -v -r 0.0.0.0 >> reachability-info.txt 2>&1
552
553 echo "#" >> reachability-info.txt
554 echo '# scutil -d -v -r 169.254.0.0' >> reachability-info.txt
555 echo "#" >> reachability-info.txt
556 /usr/sbin/scutil -d -v -r 169.254.0.0 >> reachability-info.txt 2>&1
557
558 echo "#" > nc-info.txt
559 echo '# scutil --nc list' >> nc-info.txt
560 echo "#" >> nc-info.txt
561 /usr/sbin/scutil --nc list >> nc-info.txt 2>&1
562
563 /usr/sbin/scutil -p --snapshot SCDynamicStore.plist 2>&1
564
565 }
566
567 #
568 # route
569 #
570 run_route () {
571
572 if [ ! -x /sbin/route ]; then
573 return
574 fi
575
576 echo "#" > route-info.txt
577 echo '# route -n -v get www.apple.com' >> route-info.txt
578 echo "#" >> route-info.txt
579 /sbin/route -n -v get www.apple.com >> route-info.txt 2>&1
580
581 echo "#" >> route-info.txt
582 echo '# route -n -v get 0.0.0.0' >> route-info.txt
583 echo "#" >> route-info.txt
584 /sbin/route -n -v get 0.0.0.0 >> route-info.txt 2>&1
585
586 }
587
588 #
589 # dig
590 #
591 run_dig () {
592
593 if [ ! -x /usr/bin/dig -o ! -f /etc/resolv.conf ]; then
594 return
595 fi
596
597 echo "#" > dig-info.txt
598 echo '# dig -t any -c any www.apple.com' >> dig-info.txt
599 echo "#" >> dig-info.txt
600 /usr/bin/dig +time=2 -t any -c any www.apple.com >> dig-info.txt 2>/dev/null
601
602 }
603
604 #
605 # hostname
606 #
607 run_hostname () {
608
609 if [ ! -x /bin/hostname ]; then
610 return
611 fi
612
613 /bin/hostname > hostname.txt 2>&1
614
615 }
616
617 #
618 # lsof
619 #
620 run_lsof () {
621
622 if [ ! -x /usr/sbin/lsof ]; then
623 return
624 fi
625
626 ${PRIV} /usr/sbin/lsof -i -n -O -P -T q > lsof.txt 2>&1 &
627 LSOF_PID=$!
628 # start a watchdog for lsof
629 (
630 WAIT_TIME=5
631 while [ $WAIT_TIME -gt 0 ]
632 do
633 ${PRIV} kill -0 ${LSOF_PID} 2>/dev/null
634 if [ $? -eq 0 ]; then
635 # lsof is [still] gathering data...
636 sleep 1
637 WAIT_TIME=$((WAIT_TIME - 1))
638 continue
639 fi
640
641 # lsof completed gathering data
642 break
643 done
644
645 if [ $WAIT_TIME -eq 0 ]; then
646 # lsof timed out
647 ${PRIV} kill ${LSOF_PID} 2>/dev/null
648 fi
649 ) &
650
651 }
652
653 start_pcap() {
654 #
655 # collect a packet capture if netdiagnose is available
656 #
657 if [ -x /usr/local/bin/netdiagnose ]; then
658 trap stop_pcap SIGINT
659 /usr/local/bin/netdiagnose -p "${REQUESTED_OUTDIR}" start sysdiagpcap 2>&1 1>/dev/null
660 PCAP_STARTED=1
661 fi
662 }
663
664 stop_pcap () {
665 if [ ${PCAP_STARTED} -ne 0 ]; then
666 trap '' SIGINT
667 /usr/local/bin/netdiagnose stop sysdiagpcap 2>&1 1>/dev/null
668 fi
669 }
670
671 collect_ndf_info () {
672 run_lsof
673 }
674
675 collect_sensitive_info () {
676
677 if [ "${COLLECT_PCAP}" == "Y" ]; then
678 start_pcap
679 fi
680
681 collect_state_dump_sensitive
682 run_ndp
683 run_arp
684 run_neutil
685 run_nettop
686 run_network_test
687 }
688
689 collect_info () {
690
691 if [ "${COLLECT_NDF_INFO}" == "Y" ]; then
692 collect_ndf_info
693 fi
694
695 if [ "${COLLECT_SENSITIVE_INFO}" == "Y" ]; then
696 collect_sensitive_info
697 fi
698
699 run_scutil
700 run_dig
701 run_ifconfig
702 run_netstat
703 run_ipconfig
704 run_setkey
705 run_skywalk
706 collect_vpn_logs
707 run_route
708 run_hostname
709
710 if [ "${COLLECT_CONFIGURATION_FILES}" == "Y" ]; then
711 collect_configuration_files
712 fi
713
714 stop_pcap
715 }
716
717 # __COMMAND_ROUTINES_END__
718
719 # __HELPER_ROUTINES_BEGIN__
720
721 usage () {
722
723 echo "Usage: get-network-info [-c] [-n] [-s] <info-directory>"
724 echo " -c collects system configuration files"
725 echo " -n collects NDF information (lsof)"
726 echo " -P do not collect a packet capture"
727 echo " -s collects sensitive information (ARP/NDP/mDNS cache)"
728 echo " <info-directory> path to directory where all the information will be collected"
729
730 }
731
732 is_outdir_valid () {
733
734 if [ "${REQUESTED_OUTDIR}" = "" ]; then
735 usage
736 exit 1
737 fi
738
739 if [ ! -d ${REQUESTED_OUTDIR} ]; then
740 echo "${REQUESTED_OUTDIR} does not exist"
741 exit 1
742 fi
743
744 if [ ! -w ${REQUESTED_OUTDIR} ]; then
745 echo "${REQUESTED_OUTDIR} is write-protected"
746 exit 1
747 fi
748 }
749
750 #
751 # Collect most used command output to be used later
752 #
753 optimize () {
754
755 if [ ! -x /sbin/ifconfig ]; then
756 return
757 fi
758
759 IF_LIST=`/sbin/ifconfig -l`
760
761 }
762
763 init_globals () {
764 REQUESTED_OUTDIR=""
765 COLLECT_SENSITIVE_INFO=""
766 COLLECT_CONFIGURATION_FILES=""
767 COLLECT_PCAP="Y"
768 PCAP_STARTED=0
769
770 }
771
772 # __HELPER_ROUTINES_END__
773
774 #
775 # __MAIN__
776 #
777 ARGS=`getopt cnPs $*`
778 if [ $? != 0 ]; then
779 usage
780 exit 1
781 fi
782
783 init_globals
784 process_opts
785 is_outdir_valid
786 setup
787 optimize
788 collect_info
789 wait
790
791 exit 0