Skip to content

Instantly share code, notes, and snippets.

@elvey
Forked from LincDavis/script.command
Created August 12, 2016 07:31
Show Gist options
  • Save elvey/299d659de9390db79c6260a8d98a0d04 to your computer and use it in GitHub Desktop.
Save elvey/299d659de9390db79c6260a8d98a0d04 to your computer and use it in GitHub Desktop.
Diagnostic script
# This script copyrighted (C) 2014-2016 by Linc Davis. All rights reserved.
exec /usr/bin/caffeinate -i /bin/bash
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/libexec;clear;cd;p=(1629 10 51 25600 8 10 25 9215 102400 1000 25 1536 500 40 500 300 85 25 20480 262144 20 2000 524288 604800 5 1024 25 5000 );S1=(3360141552 2033013220 174611125 188739418 2052836284 1075906481 3825718575 2300025090 1148937583 251475945 682956541 927568548 820662417 4241232455 1991908505 3842510280 3977296738 308326518 734968811 2881593577 3505613185 2011804606 2744472450 2096931782 2744923784 1633899514 3906210243 2889776626 2760600606 2995622555 2897718090 4139467666 1700120144 1051611322 1648728658 3324257250 611182208 669172048 3840699747 47378461 1563668620 1913010178 21614981 3317727426 2804616813 3023133321 2454547884 3875065669 1414269023 2986938149 143180065 35978667 3750893214 4057397868 3217312339 4094747275 510902573 3402409903 1854863555 3303202798 3980761837 3615694239 3315417941 658259764 3919897779 3099425515 3963940199 2306272388 2666586405 3421663691 3618000133 4294043818 3684872501 2190268618 2011084572 111903873 1771548258 3412733082 3764591419 3536604875 1626810686 726997059 3089972979 965789760 1958045828 3601961299 3939321264 3390509433 24440299 1111943634 1502939913 903507633 2755255132 1013713749 3639955287 2653384246 3427341633 133031465 1402503255 2460335390 4010722210 3330289254 607533800 3603030264 375162695 953534657 3694511832 3390880884 3550734337 3284111723 4260352026 1679316479 2193208314 1235694912 1932720162 409973292 1981779047 1805964115 3792832809 3727397485 3318920532 1310215028 1921181810 109105900 3376821650 3318818604 859499809 605316200 1020536223 3232581519 2334349229 3067551913 3018700574 2041093625 2733568428 2496133483 4094528007 4160453711 3082177689 2503580807 2323930572 2930526215 1164775004 3637272653 777649792 1353210385 3836345965 2746485114 1601103986 2981603713 521823316 1561159557 2673555063 4033778457 746170378 2643404996 1149243300 995083354 1226672687 667378382 4075192329 3670276510 3299216348 1841055884 1090485649 1605549829 1084088435 2473644975 952526793 656959714 3245077171 3841016027 2912631181 2083559019 3625461743 3021245439 2363960837 4044216846 437388889 1623908994 1009358836 3828686270 942988028 3778080291 879166715 1147404123 2490917226 3071778363 4048689778 2910635962 2613535613 2480451690 3191974903 72090863 1320861637 279338563 4000659386 2530979426 1401247618 3085096083 3154333685 2403725682 908491363 1133891987 3664989557 154149346 3824050961 1047645429 2982761435 3957991969 2216136891 3822954955 3889851778 279962554 2239586183 2932934162 1847442617 34515999 3642087926 692420124 4058791145 3808851459 1571458668 1089636345 2385449540 2199169857 81546269 2606994792 1247174099 4055043500 1799611813 373980237 1729475163 243488571 2048819260 3099290484 1650054758 3579750759 818650142 3522950681 895363712 191606943 4191044848 1291963638 4016216329 309312656 3361115350 3511182577 2678676874 466132960 1510440764 103947945 993525156 2357654692 3872124609 1510257042 1667743738 3423649941 2286523815 2803700861 581561683 2746466359 3034899150 638239040 3435471484 2059092204 1082780527 1399319867 3524949524 1602298225 757530713 1771807727 2031034526 2146074145 1936967685 3795794146 2714102141 1527865465 3658106393 3525286124 3672779027 3057036944 830855136 4097629469 2923812917 1275574132 783155124 4264016201 2629234589 1730703540 3346339634 970976212 563662987 3575663622 2391839691 43590648 2698791206 812399490 2837236935 60232629 1294495927 2187358862 554121294 175350128 162057097 3619415585 2435252211 1879881542 222376568 2557256990 1427870910 1250418571 3302541514 192352240 3315736960 4181926529 2335868048 410105640 1002221603 218699348 2347181717 694425604 4102434062 37428618 2772845580 2597194616 2818525868 3563183488 3430552430 499617068 3273779524 1675014494 1660706593 480771255 3614264283 3893609370 98896710 2641293985 2735844738 1890084998 380615393 3850840404 4186869406 2298499089 3180363661 2611538906 4138006483 1116499364 832753319 255310038 2370683383 36195354 1829596129 1135082786 2083544424 1397255543 1390569062 1642482820 2400572721 2949765037 1708953511 94571169 218059987 3595733975 4294891786 1844733751 3170712884 3059014601 3484139038 1881294995 3500075558 3127607528 1187806771 2460954868 3464490505 4029921598 894565306 1919121011 1855642237 892418881 3499366086 4289653325 334581144 2682286546 701237231 2570364875 2099443919 1647964433 1536968318 58788461 2767303772 4016108568 2609326102 2258414072 1101479640 481885922 1212066722 1707241580 307213054 1752720279 1095494074 105738869 3466807010 724646769 3635771575 292052159 2442914445 2190055897 3881734947 3728923944 678313962 1281867281 4124236870 53825452 3134941737 4221292522 2183746256 1851932188 2124784392 2610664747 2802793776 421375160 3678937970 4216468613 1461490543 2134391578 4000930051 3212667125 3340218596 1589673643 1592850892 3788370612 330681270 2681289265 508171720 2296390983 3165327857 2602661277 1756522027 813996801 3173080548 3357201488 1572624117 3411359730 1185058867 2901309563 2004875112 2263381375 3233018571 556927970 4284229805 49922936 1965271970 3157155693 3626643960 528403615 2635146989 4259220271 3489871515 2929571840 2046350318 974055863 1374785742 537108324 2897716880 4288990193 481821500 2618031204 3910634755 2910240653 4084518825 4161022133 449733927 1928962746 4146097030 2967598643 3039233234 3664723109 1268920403 2082334690 3349991298 1955057613 3609918069 836203353 2076129053 );S2=(879294308 4071182229 461455494 3953060756 216630318 2254479735 364192525 2331732828 2427690278 3361796797 3887726299 930028549 2830975514 3627668074 1083382502 1274181950 394731943 3038793022 1855907737 3469280363 2758863019 1565429098 2707474481 3668832669 200870336 1848501757 464843899 2636415542 3694147963 1233118628 2456546649 2806998573 2778718105 2370036484 77112498 842973933 1995816654 3743051555 3691224471 1770634273 2824893286 3730953884 495358405 710721696 290641261 3867330796 1383871077 1501830148 1591517921 676087606 827728504 1445213025 2051385900 627108361 821485203 2810021953 891421492 3545718986 1726226152 2045352620 1862971771 2428299547 3343799110 796956247 4139687208 1503053263 3301885676 891055588 77374180 1866638499 95484570 3424434743 930719081 3423398678 3051698494 998894468 1071658030 1121431055 1698653368 695903914 3829477473 1443423563 4136085286 354022165 483910120 199883012 3374894509 3555256303 1051159591 1581764341 1602219417 2033408783 2573594465 2857725553 132335822 892310726 2176602139 2384203231 2466887275 3242354755 3825896858 3936987127 4145709178 1322107948 1506521430 1666586439 1707497389 2423513700 2586050363 50854030 643960326 1116988227 1894334785 1240520345 3234353297 523110921 2883943871 2451978492 3873345487 );S3=(KiB/s{,,,,,,,} relative{,} ms/s{,,,,} % total{,} MB /s{,,,} );S4=({{Net,I/O}\ {in,out},Energy\ impact,{G,C}PU\ usage}', '{lifetime,sampled} I/O\ latency CPU\ usage Open\ files Mach\ ports Memory File\ opens Forks{,', 'failed} System\ errors );S5=(50{,} 25{,} 1000{,,,} 15{,} 100{,} 150{,} 25 15 5120 25000 1000 5 1 0 100 );k=(-\\t NA '^_d|AES|atr|udit|mdmc|mrt|msa|dnse|ax|ensh|fami|FileS|fing|ft[pw]|gedC|kdu|etS|is\.|alk|ODSA|otp|htt|pace|pcas|ps-lp|rexe|rlo|rsh|smb|snm|teln|upd-[aw]|uuc|vix|webf' Enabled Name "`IFS=:;echo "${S3[*]}"`" "`IFS=:;echo "${S4[*]}"`" '^_d|llag|tostr|tsA|[ST]M[HL]' kMDItem 'com\.apple\.' CFBundleIdentifier {,/}Library/Preferences/ {Info\\,MobileMeAccounts,loginwindow,.GlobalPreferences}.plist Network\ {home,directory} FileVault spindump );T=({Soft,Hard}ware Memory Diagnostics Power FireWire Thunderbolt USB SPI Bluetooth SerialATA Extensions Applications Frameworks PrefPane NVMe Displays PCI UniversalAccess InstallHistory ConfigurationProfile AirPort Storage ManagedClient Fonts WWAN );f=('\n%s'{': ','\n\n'}'%s\n' '\t\tPart %d of 4 \e[32mdone\e[0m at: %4d sec\n' '%s'{' ','\n'{"${k[0]}"{,'%s\n'"${k[0]}"},}}'%s\n' '\n ...and %d more line(s)\n' '\nContents of %s\n '"${k[0]}"'mod date: %s\n '"${k[0]}"'size (B): %d\n '"${k[0]}"'checksum: %d\n%s\n' '%.1f GiB: %s\n' 'swap used %.1f\n' );c1=(system_profiler pmset\ -g nvram fdesetup find syslog df vm_stat sar ps crontab kextfind top pkgutil PlistBuddy\ -c echo cksum kextstat launchctl smcDiagnose sysctl\ -n defaults\ read stat lsbom mdfind\ -onlyin env pluginkit scutil 'dtrace -q -x aggsortrev -n' security sed\ -En awk 'dscl /Search -read' networksetup mdutil lsof test osascript\ -e netstat mdls fs_usage cat file powermetrics codesign serverinfo lpstat : diskutil mdimport );s=(' s/[0-9A-Za-z._]+@[0-9A-Za-z.]+\.[0-9A-Za-z]{2,4}/EMAIL/g;/faceb/s/(at\.)[^.]+/\1NAME/g;/Users\/Shared/!s/(\/Users\/)[^ /]+/\1USER/g;s/[-0-9A-Fa-f]{22,}/UUID/g;s/ [^ ]+(\.local)/ HOST\1/g;' ' s/^ +//;/de: [^N]|t:|s..n:|t..n: ([^E]|.+\()/p;' ' { sub(/^ +/,"");} /^[BM]/&&/[nr]:/;$1~/^P/&&$2~/N/&&$3!~/^I/ $1~/^Se/&&$3~/sy/&&$4!~/^[0-9CDFGHJKLMNPQRSTVWX]{11,12}$/ { $4="[invalid]";print;} /y:/&&$2<'${p[4]} ' s/:$//;2,6d;/[my].+:/d;s/^ {4}//;H;${ g;s/\n$//;/s: (E[^m]|[^EO])|x([^08]|02[^F]|8[^0])/p;} ' ' 1,2d;s/^ {4}//;s/:$//;/^ V/!H;${ g;s/\n\n$//;/F|\): .+[1-9]/p;};' ' ($1~/^Cy/&&$3>'${p[9]}')||($1~/^Cond/&&$2!~/^N/) ' ' /:$/{ N;/: .+: /d;s/ *://;b0'$'\n'' };/^ *(V.+ [0N]|Man).+ /{ s/ 0x.... +/ /;s/[()]//g;s/(.+: )(.+)/ (\2)/;H;};$b0'$'\n'' d;:0'$'\n'' x;s/\n\n//;/Apple[ ,]|Genesy|Intel|SMSC|VIA La/d;/^ *Port \(/d;s/\n.*//;/\)$/p;' ' s/^.*C/C/;H;${ g;/: N.+: N/!p;};' ' /= [^GO]/p ' ' { $1="";} 1 ' ' /f\.$/q;p ' ' BEGIN { FS="\f";if(int('`uname -r`')>13) d="^'"${k[9]}"'launch(d\.peruser\.[0-9]+|ctl\.(Aqua|Background|System))$";} { if($2~/[1-9]/) printf("'"${f[4]}"'",$1,"status: "$2);else if(!d||$1!~d) print $1;} ' ' $1>1 { $NF=$NF" x"$1;} /\*/ { if(!f) f="\n\t* Code injection";} {$1=""} 1;END { print f;} ' ' NR==2&&$4<='${p[7]}' { print $4;} ' ' BEGIN { FS=":";} $1~"wir"&&$2>'${p[22]}' { printf("wired %.1f\n",$2/2^18);} $1~/P.+ts/&&$2>'${p[19]}' { printf("paged %.1f\n",$2/2^18);} ' ' /YLD/s/=/ /p ' ' { q=$1;$1="";u=$NF;$NF="";gsub(/ +$/,"");print q"\f"$0"\f"u;} ' ' /^ {6}[^ ]/d;s/:$//;/([^ey]|[^n]e):/d;/e: Y/d;s/: Y.+//g;H;${ g;s/ \n (\n)/\1/g;s/\n +(M[^ ]+)[ -~]+/ (\1)/;s/\n$//;/( {8}[^ ].*){2,}/p;} ' 's:^:/:p;' ' !/, .+:/ { print;n++;} END { if(n<'{${p[12]},${p[13]}}') printf("^'"${k[9]}"'.+");} ' '|uniq' ' 1;END { print "/L.+/Scr.+/Templ.+\.app$";print "/L.+/Pri.+\.plugin$";if(NR<'{${p[14]},${p[21]}}') print "^/[Sp].+|'${k[9]}'";} ' ' /\.(framew|lproj)|\):/d;/plist:|:.+(Mach|scrip)/s/:.+//p;' '&&'${c1[15]}' Yes' '>&-||'${c1[15]}\ No ' /\.dylib$/p ' ' /Temp|emac/{next};/(etc|Preferences|Launch[AD].+|San.+)\// { sub(".","");print $0"$";} END { split("'"${S2[*]}"'",c);for(i in c) print "\t"c[i]"$";} ' ' /^\/(Ap|Dev|Inc|Prev|ServerD)/d;/((iTu|ok).+dle|\.(component|fs|mailbundle|mdimporter|osax|qlgenerator|saver|wdgt|(web)?plugin|xpc))$/p;' ' /'"${k[9]}"'Boot|mMig|tDev|WebCl/!p ' ' /#:|[-0-9A-F]{36}/!p ' ' /(\.app|\/SDKs)\//d;/\.(bundle|component|framework|fs|kext|mdimporter|osax|plugin|qlgenerator|saver|wdgt|xpc)$/p ' ' { print $3"\t"$1;} ' ' s/\'$'\t''.+//p ' ' s/1/On/p ' ' /Prox.+: [^0]/p ' ' $2>'${p[2]}' { $2=$2-1;print;} ' ' BEGIN { M1='${p[16]}';M2='${p[18]}';M3='${p[8]}';M4='${p[3]}';} !/^A/ { next;};/%/ { getline;if($5<M1) o["CPU"]="CPU: user "$2"%, system "$4"%";next;} $2~/^disk/&&$4>M2 { o[$2]=$2": "$3" ops/s, "$4" blocks/s";next;} $2~/^(en[0-9]|bridg)/ { if(o[$2]) { e=$3+$4+$5+$6;if(e) o[$2]=o[$2]"; errors "e"/s";next;};if($4>M3||$6>M4) o[$2]=$2": in "int($4/1024)", out "int($6/1024)" (KiB/s)";} END { for(i in o) print o[i];} ' ' /r\[0\] /&&$NF!~/^1(0|72\.(1[6-9]|2[0-9]|3[0-1])|92\.168)\./ { print $NF;exit;} ' ' !/^T/ { printf "(static)";exit;} ' '/apsd|BKAg|OpenD/!s/:.+//p' ' NR==1&&!/:/&&!/^D/;(/k:/&&$3!~/(255\.){3}0/)||(/v6:/&&$2!~/A/) ' ' BEGIN { FS=": ";} /^ {10}(O|S.{5}: N)/ { exit;} !/^ {14}[^ ]/ { next;} ($1~"Ne"&&$2!~/^In/)||($1~"T"&&$2<'${p[20]}')||($1~"Se"&&$2!~"2") { print;} $1~"Si" { if(a[2]) next;split($2,a," ");if(a[1]-a[4]<'${p[5]}') print;} ' ' BEGIN { FS="\f";} { sub(/_[0-9]+\.'${k[20]}'\.txt$/,"\.'${k[20]}'",$3);n=split($3,a,".");sub(/_2[01].+/,"",$3);print $2" "$3" "a[n]$1;} ' ' BEGIN { split("'"${S5[*]}"'",m);FS="\f";M=2^10;} $1<9 { $2=int(($2+M/2)/M);} $2<=m[$1] { next;} $1<15&&$3!="kernel_task" { if(!("'${c1[9]}' -c -ouid -p"$4"|sed 1d"|getline $4)) next;} $1<20&&$1!=15 { o[$1]=o[$1]"\n "$3" (UID "int($4)"): "$2;} $1==15 { o[$1]=o[$1]"\n "$3": "$2;} $1==20&&$5!~"^/dev" { o[$1]=o[$1]"\n "$3" (UID "$4") => "$5" (status "$6"): "$2;} $1==21&&$5 { "'${c1[9]}' -c -ocomm -p"$5"|sed 1d"|getline n;if(n) $5=n;o[$1]=o[$1]"\n "$5" => "$3" (UID "$4"): "$2;} $1~/2[23]/ { o[$1]=o[$1]"\n "$3" (UID "$4", error "$5"): "$2;} END { n=split("'"${k[5]}"'",u,":");split("'"${k[6]}"'",l,":");for(i=1;i<=n;i++) if(o[i]) print "\n"l[i]" ("u[i]")\n"o[i];} ' ' /^ {8}[^ ]/{print} ' ' BEGIN { L='${p[17]}';} !/^[[:space:]]*(#.*)?$/ { l++;if(l<=L) f=f"\n "$0;} END { F=FILENAME;if(!F||F~"~"||F~/\/(ntp|resolv)\.conf$/) exit;if(!f) f="\n ['${k[1]}']";"'${c1[16]}' "F|getline C;split(C, A);C=A[1];"'${c1[42]}' -b "F|getline T;if(T=="data"&&F~/\/\.DS_Store$/) exit;"'${c1[22]}' -f%Sm "F|getline D;"'${c1[22]}' -f%z "F|getline S;if(T~/^Apple b/) { f="";l=0;while("'"${c1[14]}"' Print "F|getline g) { l++;if(l<=L) f=f"\n "g;};};if(T!~/^(AS.+ (En.+ )?text(, with v.+)?$|(Bo|PO).+ sh.+ text ex|XM)/) F=F"\n '"${k[0]}"'"T;printf("'"${f[8]}"'",F,D,S,C,f);if(l>L) printf("'"${f[7]}"'",l-L);} ' ' s/^ ?n...://p;s/^ ?p...:/-'$'\t''/p;' ' s/0/Off/p ' ' s/^.{52}(.+[)]).+/\1/p ' ' /id: N|te: Y/ { i++;} END { print i;} ' ' BEGIN { split("'"${S1[*]}"'",W);} NF { b="";d="";sub(/:.*/,"");p="'${c1[44]}' -dvv \""$0"\" 2\>\&1";while(p|getline C[++i]) { split(C[i],t,"=");A[i]=t[1];B[i]=t[2];if(A[i]~/^Id/) b=B[i];if(A[i]~/^A/) { d=B[i];sub(/[^:]+: /,"",d);break;};};close(p);if($0~/\.(app|backend|driver|ds|dylib|filter|framework|prefPane|tool|xpc)$/&&d) { p="'${c1[15]}' \""d"\"|'${c1[16]}'";p|getline c;close(p);sub(/ .+/,"",c);for(i in W) if(c==W[i]) next;};if($0~/\.(app|ds)$/&&!d) next;if($0!~/\./) next;if($0!~/\.dylib$/&&!d) { p="'${c1[39]}' -name '${k[8]}${k[10]}' \""$0"\"";p|getline b;close(p);if(b~/ [(]|: co/) b="";sub(/^.+= (\")?/,"",b);sub(/\"/,"",b);if(!b) { p="'"${c1[14]}"' Print\\ :'${k[10]}' \""$0"\"/*/'${k[13]}'";p|getline b;close(p);if(b~/ .+:/) b="";};if(!b) b="'"${k[1]}"'";};if(b&&d) printf("'"${f[5]}"'",$0,b,d);else if(b&&!d) printf("'"${f[4]}"'",$0,b);else if(!b&&d) printf("'"${f[4]}"'",$0,d);else print;} ' ' / en/!s/\.//p ' ' NR>=13 { gsub(/[^0-9]/,"",$1);print;} ' ' $10~/\(L/&&$9!~"localhost" { sub(/.+:/,"",$9);print $1": "$9|"sort|uniq";} ' ' /^ +r/s/.+"(.+)".+/\1/p ' ' s/(.+\.wdgt)\/(Contents\/)?'${k[13]}'$/\1/p ' ' s/^.+\/(.+)\.wdgt$/\1/p ' ' /l: /{ /DVD/d;s/.+: //;b0'$'\n'' };/s: /{ / [VY]/d;s/^ */- /;H;};$b0'$'\n'' d;:0'$'\n'' x;/APPLE [^:]+$/!p;' ' /^find: /!p;' ' /^p/{ s/.//g;x;s/\nu/'$'\f''/;s/(\n)c/\1'$'\f''/;s/\n\n//;p;};H;' ' BEGIN { FS="= ";} /Path/ { print $2;} ' ' /^ *$/d;s/^ */ /;p;' ' s/^.+ |\(.+\)$//g;p;' ' 1;END { if(NR<'${p[15]}') printf("^/(S|usr/(X|li))");} ' ' /2/ { print "WARN";} /4/ { print "CRITICAL";} ' ' /EVHF|MACR|^s/d;s/^.+: //p;' ' $3~/^[1-9][0-9]{0,2}(\.[1-9][0-9]{0,2}){2}$/&&$5+$7 { i++;n=n"\n"$1": "$3;} END { if(i>1) print n;} ' s/{'\.|jnl: ','P.+:'}'//;s/ +([0-9]+)(.+)/\2'$'\t''\1/p' ' /es: ./{ s/^.+://;b0'$'\n'' };/^ +C.+ted: +[NY]/H;/:$/b0'$'\n'' d;:0'$'\n'' x;/: +N/d;s/://;s/\n.+//p;' ' 1d;/:$/b0'$'\n'' $b0'$'\n'' /(D|^ *Loc.+): /{ s/^.+: //;H;};/[my]: /H;d;:0'$'\n'' x;/[my]: [AM]|(^|\n)\/V/d;s/(^|\n) [ -~]+//g;s/(.+)\n(.+)/\2:\1/;s/\n//g;/[ -~]/p;' ' s/$/'$'\f''(0|-(4[34])?)$/p ' '|sort'{'|uniq'{,\ -c},\ -nr} ' BEGIN { FS=":";s="stat -f%z ";} $1!~" "&&$1~"lo" { s$1|getline S;close(s$1);sub(/^\/.+\//,"",$1);print $0" ("S" B)";} ' ' /^ {5}|[{}()]|'"${k[9]}"'|"[_0-9A-F]{35,}"/d;/ = [0<]|dUIM|iSyn|iToo|le(Ac|Hi|ID|Lo)|Mous|Nav[PS]|nOrd|NS(Aut|Pers|Tab)/d;/Scro|Spel|tiAl|uaCo|Units|untr|yRep|zeOn/d;s/;$//p ' ' NR<='${p[1]}' { print;next;} { print "...";exit;} ' /$'\f'/\!p ' 1;END { if(!NR) print "\f";} ' p ' s/:[^:]+$//;p ' '|wc -l' /{\\.{kext,xpc,'(appex|pluginkit)'}'\/(Contents\/)?'Info,'Launch[AD].+'}'\.plist$/p' ' s/([-+.?])/\\\1/g;p ' ' s/, /\'$'\n''/g;p ' ' BEGIN { FS="\f";} { printf("'"${f[9]}"'",$1/2^30,$2);} ' ' /= D/&&$1!~/'{${k[2]},${k[7]}}'/ { getline d;if(d~"t") print $1;} ' ' BEGIN { FS="\t";} NR>1&&$NF!~/0x|\.([0-9]{3,}|[-0-9A-F]{36})$/ { print $NF"\f"a[split($(NF-1),a," ")];} ' '|tail -n'{${p[6]},${p[10]}} ' s/.+bus /Bus: /;s/,.+[(]/ /;s/,.+//p;' ' { $NF=$NF" Errors: "$1;$1="";} 1 ' ' 1s/^/\'$'\n''/;/^ +(([MNPRSV]|De|Li|Tu).+|Bus): .|d: Y/d;s/:$//;$d;p;' ' BEGIN { RS=",";FS=":";} $1~/"name"/&&$2!~/__MSG.+[Ee]__/ { gsub(/["\\]/,"",$2);print $2;} ' ' BEGIN { FS=":";} $1=="HomeDirectory" { sub(/.+\>/,"",$2);if($2=="file") print "'${k[19]}' 1";if($2~/afp|nfs|smb/) print "'"${k[17]}"': " toupper($2);} $1~/^AppleMetaN/ { split($2,a,"/");if(a[2]!="Local") print "'"${k[18]}"': " a[2];} ' '/[^ .]/p' '{ print $1}' ' /^ +N.+: [1-9]/ { i++;} END { if(i) print "system: "i;} ' ' NF { print "'{admin,user}' "$NF;exit;} ' ' 1,/se.+s =/d;/[}]/,$d;p ' ' 3,4d;/^ +D|Of|Fu|0/d;s/^ |:$//g;$!H;${ x;/:/p;} ' ' BEGIN { FS=": ";} NR==1 { sub(":","");h="\n"$1"\n";} /:$/ { l=$1;next;} $1~"S"&&$2!~3 { getline;next;} /^ {6}I/ { L[++i]=l" "$2;} END { if(i) print h;for(j=0;j<'${p[24]}';j++) print L[i-j];} ' ' /./H;${ x;s/\n//;s/\n/, /g;/,/p;} ' ' { if(int($6)>'${p[25]}') printf("'"${f[10]}"'",$6/1024);} ' ' BEGIN { FS="\"";} $3~/ t/&&$2!~/'{${k[2]},${k[7]}}'/ { print $2;} ' ' $1~/^K/&&int($NF)>1'{3,4}' { print $NF;} ' ' s/1/No/p ' {,'1d;'}'/r%/,/^$/p' ' NR<='${p[26]}' { o=o"\n"$0;next;} { o="";exit;} END { print o|"sed 1d";} ' ' END { print $'{3,4}';} ' ' 1 END { exit "'${c1[4]}' /{var/db/r,S*/*/R}*/'${k[9]}'*.{BS,Bas,Es,J,OSXU,Rem,up}*.bom -mtime -'${p[23]}'s"|getline;} ' ' NR==1 { next;} !NF||$2==-2 { exit;} { print $(NF-'{3,2,8,7,0,1,14}')"\f"substr($0,1,32)"\f"$(NF-15);} ' ' $1~/^C/ { exit;} $3!=1500 { print "\n"$0;} ' '|grep -Elq "^ +Me.+E SD C"' ' 1s/(.+):/\'$'\n''\1/;/^ +So/d;$d;p;' /^t/p ' BEGIN { FS="\f";} /\.[0-9]+ W / { gsub(/^.+ | +$/,"");sub(" W ",FS);$1*=500;if($2) t[$2]+=$1;t["Total"]+=$1;} END { for(p in t) print int(t[p]+.5),FS,p;} ' ' /^...C/{ s/^.+\"([^"]+)\".+/\1/p;q;} ' ' /^[(]/{ s/^[(][0-9]+[)] //;s/$/:/;N;/: [)]$/d;s/\n.+ ([^ ]+).$/\1/;p;} ' ' /[{}]/d;H;${ g;/E[^\n]+[1-9]/p;} ' ' /\/(Composition|Content|Device|Input Method|Printer|SDK|Template|Version|XPCService)s\//d;/^\/(Library\/[DEI]|o)/d;/(ApplicationF|CoreD|InternetS|SystemV|WifiC|mDNSR).+\.b/d;/(MediaB|TW|Tcl|Tk|vecL|Apple(Pro|Sau)|CoreCh|FaceC|GPUC).*\.f/d;/libt[ck].*\.dy/d;/\.(app|bundle|dylib|framework|fs|kext|loginPlugin|prefPane|slotd|xpc)$/p ' ' BEGIN { FS="=";} !/=/ { if($0!~/: N/) print;exit;} NR==1 { sub(/\/Contents\/.+/,"",$2);p=$2;} $1~/^A/ { if($2!~/^(Apple Mac OS Application|Software) Signing)$|Apple Inc\. - XQuartz$/) { sub(/[^:]+: /,"",$2);print p": "$2;};exit;} ' ' BEGIN { FS="[()]";} { print $4;} ' ' /\//!d;/\/App.+\/(GarageBand|Xcode)\.app\//d;s/^ +.|.,?$//g;p ' );N4=${#s[@]};for i in {1..19};do s[N4+i-1]='11q;s/^/'$i$'\f''/;s/ *'$'\f'' */'$'\f''/g;p;';done;c2=(${k[9]}loginwindow\ LoginHook Print\ ${k[12]}${k[15]} "'tell app \"System Events\" to get properties of login items'" 'L*/Ca*/'${k[9]}'Saf*/E* -d 2 -name '${k[13]} '~ $TMPDIR.. \( -flags +sappnd,schg,'{,sunlnk\,}'uappnd,uchg -o ! -user $UID -o ! -perm -600 \)' '-nl -print' '-F \$Sender -k Level Nle 3 -k Facility Req "'${k[9]}'('{'bird|.*i?clou','lsu|sha'}')"' "-f'%N: %l' Desktop {/,}L*/Keyc*" therm sysload boot-args status " -F '\$Time \$Message' -k Sender kernel -k Message CRne '0xdc008012|(allow|call)ing|Goog|(mplet|nabl)ed|ry HD|safe b|uccee|xpm' -k Message Req 'bad |Can.t l|corru|dead|fail|GPU |hfs: Ru|hortag|inval|Limiti|v_c|not priv|NVDA[(]|overf|pa(gin|us)|Purg(ed|in)| err| [Rr]ein|Refus|s ful|Shutd|TCON|tDro|tim(ed? ?|ing )o|trig|ttl| unab|WARN|YS_R' " '-du -n DEV -n EDEV 1 10' 'acrx -o%cpu,comm,ruid' "' syscall::open*:entry {@a[execname,uid,copyinstr(arg0),errno]=count()} syscall::execve:return, syscall::posix_spawn:return {@b[execname,uid,ppid]=count()} syscall::fork:return, syscall::vfork:return, syscall::posix_spawn:return /arg0<0/ {@c[execname,uid,arg0]=count()} syscall:::return /errno!=0/ {@d[execname,uid,errno]=count()} tick-10sec { normalize(@a,10);normalize(@b,10);normalize(@c,10);normalize(@d,10);printa(\"20\f%@d\f%s\f%d\f%s\f%d\n\",@a);printa(\"21\f%@d\f%s\f%d\f%d\n\",@b);printa(\"22\f%@d\f%s\f%d\f%d\n\",@c);printa(\"23\f%@d\f%s\f%d\f%d\n\",@d);exit(0);} '" '-f -pfc /{var/db/r,S*/*/R}*/'${k[9]}'*.{BS,Bas,Es,J,OSXU,Rem,up}*.bom' '{/,}L*/Lo*/Diag* -type f -regex .\*[cght] ! -name .?\* ! -name \*ag \( -exec grep -lq "^Thread c" {} \; -exec printf \* \; -o -true \) -execdir stat -f'$'\f''%Sc'$'\f''%N -t%F {} \;' '/S*/*/Ca*/*p'{c,-s}\* '/ '${k[8]}'ContentTypeTree='${k[9]}{'bundle\|\|'${k[8]}'FSName=*.mailbundle\|\|'${k[8]}'Kind=Scripti*\|\|'${k[8]}'Kind=*Plug*',mach-o-dylib} 'Print\ :Label' "/p*/e*/{*.{conf,local,sh},auto_*,{cron,fs}tab,hosts,mach_i*/*,pam.d/*,pf*/*,rc*,ssh/*_config,su*} {/p*,/usr/local}/e*/periodic/*/* /L*/P*{,/*}/com.a*.{Bo,sec*.ap}*t {/S*/,/,}L*/Launch[AD]*/{.??,}*{,/*} /S*/*/Sa*/*.conf .launchd.conf" list '-F "" -k Sender hidd -k Level Nle 3' ${k[12]}${k[9]}alf\ globalstate --proxy -fdiskio\ -t2 vm.swapusage --dns -q\ --configured ${k[9]}spaces\ spans-displays dump-trust-settings\ {-s,-d,} '~ '${k[8]}'Kind\=Package' '-R -ce -l1 -n5 -o'{'prt -stats prt','mem -stats mem'}',command,uid' -kl -l -s\ / '--regexp --files '${k[9]}'pkg.*' '+c0 -i4TCP:0-1023' ${k[9]}dashboard\ layer-gadgets '"`ls -A /L*/A*/A*/P*/ALR*`"' '-app Safari '{{WebKitDNSPrefetching,UserStyleSheet}Enabled,CustomUserAgent} 'L*/{Con*/*/Data/L*/,}Pref* -type f -size 0c -name *.plist.???????' kern.memorystatus_vm_pressure_level '3>&1 >&- 2>&3' ' -F "\$Message" -k Sender kernel -k Message Req "'{'n cause: -','(: data und|O |gnment |jnl_io.+)err|disk.+(abo|: (med|res))','USBF:.+bus'}'" ' '/S*/*/Caches /[LU]* -flags +restricted' list --nwi -listnetworkserviceorder 'Print\ :'${k[10]} 'Print\ ':CFBundleDisplayName "${EUID#501}" {'$TMPDIR../C ','/{S*/,}'}'L*/{,Co*/*/*/L*/}{Cache,Log}s -type f -size +'${p[11]}'M -exec stat -f%z'$'\f''%N {} \;' 'Print /v*/d*/*/*l*d'{,'.*.'$UID}'/*' /Users/$USER 'L*/A*/'{'Fi*/P*/*/a','Chrom*/D*/E*/*/*/'}'*.json' '{/,}L*/{Con,Pref}* -type f ! -size 0 -name *.plist -exec plutil -s {} \;' ' -F "\$Time \$(Sender): \$Message" -k Sender Rne "launchd|nsurls" -k Level Nle 3 -k Facility R'{'ne "user|','eq "'}'console" -k Message CRne "[{}<>]|asser|commit - no t|deprec|done |ect pas|fmfd|Goog|ksho|ndum|obso|realp|rned f|/root|sandbox ex" ' getenv '/ "'${k[8]}'DateAdded>=\$time.now(-'${p[23]}')&&'${k[8]}${k[10]}'=*"' -m\ / '' ' -F "\$Time \$(RefProc): \$Message" -k Sender Req launchd -k Level Nle 3 -k Message Rne "asse|bug|File ex|hij|Ig|Jet|key is|lid t|Plea|ship" ' print{,-disabled}\ {system,{gui,user}/$UID} '-n1 --show-initial-usage --show-process-io --show-process-gpu --show-process-netstats --show-process-energy' '-L /{S*/,}L*/StartupItems -type f -exec file {} +' "L* /L*/Ca*/*.$UID $TMPDIR.. /v*/db -type f \( -name *ache -o -name *.Q*V2 -o -name *.C*base -o -name *.*db -o -name *.loc*e -o -name *.sqlite -o -name *.st*a \) -exec sh -c '"${c1[42]}" -b \"\$1\"|grep -qw SQLite' {} {} \; ! -exec sh -c 'sqlite3 \"\$1\" PRAGMA\ integrity_check &>-' {} {} \; -print" '/{A,L*/Fr}* -type d \( -name *.app -o -name *.f*k \) -prune' -vv '-dvv 2>&1' -o -g ${k[12]}${k[16]} '/l*/i*' -get{dnsservers,info,MTU} --nc\ {list,statistics} -i -m '-Fcu +c0 -l' '/v*/db/lsd/*t' ' -F "\$Message" -k Sender watchdogd -k Message Seq "unresp" ' '-L 2>&1' );N1=${#c2[@]};for ((j=0;j<${#T[@]};j++));do c2[N1+j]=SP${T[j]}DataType;done;N5=${#c2[@]};for i in 0 1;do for j in {0..11};do c2[N5+12*i+j]='Print\ ':Accounts:0:Services:$j:${k[3+i]}\ ${k[11]}${k[14]};done;done;l=({Restricted\ ,Lock,Pro}files Tunnel{,\ errors} {Safari,App,{Non-loading,Loaded}\ kernel,Firefox,Chrome}\ extensions boot\ args ${k[19]}\ 2 Account {Kernel,System,Console,launchd}\ log SMC Login\ hook 'I/O per process' 'High file counts' UID {System,Login,Agent,User}\ services\ {load,disabl}ed {Admin,Root}\ access Font\ issues Firewall Proxies DNS TCP/IP Wi-Fi 'Elapsed time (sec)' {Root,User}\ crontab {Global,User}' login items' Spotlight Memory\ pressure Listeners Widgets Parental\ Controls Prefetching Nets Volumes {Continuity,I/O,iCloud,HID,HCI}\ errors {User,System}\ caches/logs {XPC,Sandbox}\ cache Shutdown\ codes Heat Diagnostic\ reports Unreadable\ {plist,database}s Restrictive\ permissions Bundles{,' (new)'} Trust\ settings Activity 'Free space (MiB)' Stylesheet Library\ paths{,' ('{shell,launchd}\)} Data\ packages Modifications Print\ jobs 'Global prefs ('{user,system}\) lost+found Server Separate\ spaces 'VM (GiB)' Startup\ items SD\ card iCloud\ services Battery Signatures System\ load Agent\ string LS\ schemes Non-responders MD\ importers );N3=${#l[@]};for i in {0..10};do l[N3+i]=${T[5+i]};done;F() { local x="${s[$1]}";[[ "$x" =~ ^([\&\|\<\>]|$) ]]&&{ printf "$x";return;};:|${c1[30]} "$x" 2>&-;printf "%s \'%s\'" "|${c1[30+$?]}" "$x";};A0() { P=0;v[2]=1;id -G|grep -qw 80;v[1]=$?;((v[1]))||{ sudo -v;v[2]=$?;};v[3]=`date +%s`;date '+Start time: %T %D%n';printf '\n\t\e[1mTest started\e[0m\n\n'>&4;printf 'Revision: %s\n\n' ${p[0]};};A1() { local c="${c1[$1]} ${c2[$2]}";shift 2;c="$c ` while [[ "$1" ]];do F $1;shift;done`";((P2))&&{ c="sudo $c";P2=;};v=`eval "$c"`;[[ "$v" ]];};A2() { local c="${c1[$1]}";[[ "$c" =~ ^(awk|sed ) ]]&&c="$c '${s[$2]}'"||c="$c ${c2[$2]}";shift 2;local d=` while [[ "$1" ]];do F $1;shift;done`;((P2))&&{ c="sudo $c";P2=;};local a;v=` while read a;do eval "$c '$a' $d";done<<<"$v";`;[[ "$v" ]];};A3(){ v=$((`date +%s`-v[3]));};B1() { v=No;! ((v[1]))&&{ v=;P1=1;};};eval "`type -a B1|sed '1d;s/1/2/'`";B3(){ v[$1]="$v";};B4() { local I=$1;local J=$2;shift 2;local c="cat` while [[ "$1" ]];do F $1;shift;done`";v[J]=`eval "{ $c;}"<<<"${v[I]}"`;};B5(){ v="${v[$1]}"$'\n'"${v[$2]}";};B6() { v=` paste -d$'\e' <(printf "${v[$1]}") <(printf "${v[$2]}")|awk -F$'\e' ' {printf("'"${f[$3]}"'",$1,$2)} ' `;};B7(){ v=`egrep -v "${v[$1]}"<<<"$v"|sort`;};eval "`type -a B7|sed '1d;s/7/8/;s/-v //'`";B9(){ [[ "${v[$1]}" ]];};eval "`type -a B2|sed '1d;4d;6d;s/B2/B10/'`";C0() { [[ "$v" ]]&&sed -E "$s"<<<"$v";};C1() { [[ "$v" ]]&&printf "${f[$1]}" "${l[$2]}" "$v"|sed -E "$s";};C2() { v=`echo $v`;[[ "$v" != 0 ]]&&C1 0 $1;};C3() { B4 0 0 63&&C1 1 $1;};C4() { printf "${f[2]}" $((++P)) $((`date +%s`-v[3]))>&4;};C5() { sudo -k;awk 'NR>'${p[27]}'{print " [Output truncated]";exit};{printf("%4d %s\n",NR,$0)}'<<<"$o"|pbcopy;printf '\n\tThe test results are on the Clipboard.\n\n\t\e[1m\e[5m\e[31mPlease close this window.\e[8m\n\n\n\n\n\n\n\n\n\n';exit;};for i in 1 2;do eval D$((i-1))'() { A'$i' $@;C0;};';for j in 2 3;do eval D$((i+2*j-3))'() { local x=$1;shift;A'$i' $@;C'$j' $x;};';done;done;trap C5 2;o=$({ A0;D0 0 N1+1 2;D0 0 $N1 1;B4 0 14 114;B4 0 15 115;B1;C2 31;B1&&! B2&&C2 32;D2 22 15 63;D0 0 N1+2 3;D0 0 N1+16 17;D0 0 N1+3 4;D4 88 0 N1+4 5;D4 N3+5 0 N1+10 59;D4 N3+10 0 N1+15 59;D0 0 N1+17 99;D0 0 N1+25 132;for i in {0..3};do D4 N3+i 0 N1+5+i 6;done;D4 N3+4 0 N1+9 71;D2 86 0 N1+22 131 25;D4 62 1 10 7;D4 90 1 11 8;B2&&D4 18 19 53 67;D2 11 2 12 9;D4 12 3 13 10;D2 71 6 76 13;D2 45 20 52 66;A1 7 77 14;B3 28;A1 20 31 111;B6 0 28 6;B4 0 0 110;C2 84;D4 70 8 15 38;D0 9 16 76 16 N4+15 45;B2;D0 35 102 61 75 76 N4+16 45;B2&&D0 40 30 134 76 N4+14 45;B2&&D0 28 17 45;C4;B2&&{ A1 43 85 117;B3 24;for i in {0..6};do for j in 0 1;do B4 24 0 82+36*j 123+i 76 N4+2*i+j 45;C0;done;done;};D0 12 40 54 16 N4+18 45;D0 12 39 54 16 N4+17 45;D4 78 46 91 103 75 69;B2;D4 0 4 57 30 79;D4 74 25 77 15&&{ B4 0 8 103;B4 8 0;A2 18 74 81;B6 8 0 3;B4 0 0 80;C3 75;};B2&&D4 19 21 0;B2&&D4 40 10 42;D2 2 0 N1+20 46 84;D2 44 34 43 53;D2 59 22 20 26;B9 14&&D2 60 22 21 26;B9 15&&D2 92 22 103 26;D2 33 0 N1+24 51;D4 80 21 93 78;for i in {0..2};do A1 29 35+i 104+i;B3 25+i;done;B6 25 27 6;B6 0 26 6;B4 0 0 110;C2 69;D2 34 21 28 35;D4 35 27 29 36;A1 27 59;B4 0 18 120;B4 0 29 121;A1 33 60 136;B8 18;B9 0||{ D3 3 47 82 25;A1 27 98 135;};B4 0 19 83;D5 4 27 99 137;B9 19&&A1 27 32 39&&{ B3 20;B4 19 0;A2 33 95 40;B3 21;B6 20 21 3;};C2 36;D4 50 38 100 68;B4 19 0;B9 0&&D5 37 33 96 42;B9 29;j=$?;B4 29-11*j 0;B9 0&&D1 33 97 130;B2&&D4 46 35 45 55;D2 82 45 33 25;D4 38 0 N1+21 43;B2;D4 58 4 65 76 91;D4 81 42 94 77 79;D4 63 4 19 44 75 95 12;B1&&{ D4 53 5 55 75 69&&D4 51 48 58 31;D4 56 5 56 97 75 98&&D0 0 N1+7 99;D2 55 5 27 84;D4 61 5 54 75 70;D4 93 5 104 140 75 70;D4 14 5 14 96;D4 15 5 72 96;D4 17 5 78 96;};D4 16 5 73 96;A1 13 44 74 18;B3 4;B4 4 0 85;A2 14 61 89;B4 0 5 19 102;A1 17 41 50;B7 5;C3 8;B4 4 0 88;A2 14 24 89;C4;B4 0 6 19 102;B4 4 0 86;A2 14 61 89;B4 0 7 19 102;B5 6 7;B4 0 11 73 102;B9 14;j=$?;for i in 0 1 2;do ((i==2&&j==1))&&break;((! j))||((i))||B2&&A1 18 "79+i-(i+53)*j" 107-25*j 94 74||continue;B7 11;B4 0 0 11;C3 "23+i*(1+i+2*j)";D4 "24+i*(1+i+2*j)" 18-4*j 82+i-16*j "112+((3-i)*i-40*j)/2";done;B9 14||D4 85 4 86 24;D4 42 14 1 62;A1 23 18 28 89;B4 0 16 22 102;B2;A1 16 25 33;B7 16;B4 0 0 34;B10;D1 31 47;B2;D4 64 4 71 41 79;B2;D4 65 4 87 79;D4 13 32 68 101;D4 43 37 2 90 48;D4 41 10 42;D2 48 36 47 25;D0 0 N1+23 132;A1 4 3 60&&{ B3 9;A2 14 61;B4 0 10 21;B4 9 0;A2 14 62;B4 0 0 21;B6 0 10 4;C3 5;};D4 10 41 70 100;D4 9 41 69 100;D2 49 21 48 49;D2 72 21 49 35;D4 91 21 50;B4 4 22 57 102;A1 21 46 56 74;B7 22;B4 0 0 58;C3 47;for i in {0..11};do A1 14 N5+i 133&&{ A1 14 N5+i+12;B5 23 0;B3 23;};done;B4 23 0;C3 87;D4 54 5 7 75 76 69;D4 52 5 8 75 76 69;D4 57 4 64 76 91;B9 15;j=$?;D2 66 4 5-j 84;D2 1 4 51 84;D4 21 22 9 37;D4 79 21 92 78;D2 83 21 34 116;D0 0 N1+18 108;D4 76 24 38;B4 4 12 32 89 23 102;for i in {0..3};do A1 0 N1+11+i 72 74;B7 12;B4 0 0 52;C3 N3+6+i;done;A1 24 22 29;B7 12;B4 0 0 52;C3 67;A1 24 75 74;B4 1 1 122||B7 12;B4 0 0 119 52;C3 68;B4 4 13 27 89 65;A1 24 23;B7 13;B4 0 0 52;C3 73;A1 49 105 141;B7 12;C3 94;B4 4 0 87;A2 14 61 89 20;B4 0 17;A1 26 101 64;B7 17;C3 6;A1 4 88;C4;D5 77 44 89 79;B9 14&&{ B4 4 0 138;D5 89 44 90 139 79;};D4 7 11 6 52;D0 0 N1+19 109;A3;C2 39;C4;} 4>&2 2>/dev/null;);C5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment