-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathunix_collector.sh
2245 lines (2109 loc) · 100 KB
/
unix_collector.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Copyright (C) 2022 Jerzy 'Yuri' Kramarz (op7ic)
# --------------------------------------------------
# A live forensic collection script for UNIX-like systems.
# Author: Jerzy 'Yuri' Kramarz (op7ic)
# Inspired by:
# - Collective knowledge of Portcullis Security Team. Check out https://labs.portcullis.co.uk/
# - https://github.com/pentestmonkey/unix-privesc-check/blob/master/upc.sh
# - Ian Ventura-Whiting (Fizz)
# --------------------------------------------------
# This script is designed to work on multiple UNIX platforms
# and gather the information required for a quick forensic
# investigation of the device.
#
# Current UNIX platforms supported include:
# > Sun Solaris
# > Linux
# > IBM AIX
# > HPUX
# > MacOS
# > Debian
# > Ubuntu
# > CentOS
# > Red Hat
# > Android
# > VMware ESXi
# > FreeBSD
# > OpenBSD
# > NetScaler
# > Any IoT platform that is based on Linux/Unix
# > Probably others as well.
#
# Commandline Options
# ~~~~~~~~~~~~~~~~~~~
#
# --platform=<solaris | hpup | mac | aix | linux | android | generic>
# Specify a platform, instead of using the platform auto-
# detection code.
#
# --quiet
# No questions will be asked, unless specified
# ---------------------------
# Global Variables
# ---------------------------
VERSION="1.9"
HOSTNAME=`hostname`
PLATFORM="none"
SHORT_DATE=`date +%B" "%Y`
LONG_DATE=`date +%A" "%d" "%B" "%Y`
COLLECTION_DATE=`date +%d"-"%m"-"%Y`
WHOAMI="root"
QUIET="NO"
DISPLAYHELP="OFF"
OUTPUT_DIR="collector-${HOSTNAME}-${COLLECTION_DATE}"
TAR_FILE="collector-${HOSTNAME}-${COLLECTION_DATE}.tar"
RSYNC_MAX_FILESIZE=-500m
TAR_MAX_FILESIZE=-500M
HASH_MAX_FILESIZE=-500M
# ---------------------------
# Parse ARGS
# ---------------------------
for ARG in $*
do
case $ARG in
"--platform=solaris")
PLATFORM="solaris"
;;
"--platform=aix")
PLATFORM="aix"
;;
"--platform=mac")
PLATFORM="mac"
;;
"--platform=generic")
PLATFORM="generic"
;;
"--platform=linux")
PLATFORM="linux"
;;
"--platform=hpux")
PLATFORM="hpux"
;;
"--platform=android")
PLATFORM="android"
;;
"--quiet")
QUIET="YES"
;;
esac
done
# ---------------------------
# Detect Platform
# ---------------------------
if [ $PLATFORM = "none" ]
then
if [ -x /usr/bin/showrev ]
then
PLATFORM="solaris"
elif [ -x /usr/bin/lslpp ]
then
PLATFORM="aix"
elif [ -x /usr/sbin/sam -o -x /usr/bin/sam ]
then
PLATFORM="hpux"
elif [ -x /usr/bin/osacompile ]
then
PLATFORM="mac"
elif [ -x /system/bin/app_process -o -x /system/bin/getprop ]
then
PLATFORM="android"
elif [ -x /usr/bin/rpm -o -x /bin/rpm -o -x /usr/bin/dpkg -o -x /usr/bin/emerge ]
then
PLATFORM="linux"
fi
fi
# ---------------------------
# Console Colors
# ---------------------------
if [ $PLATFORM != "hpux" ]
then
esc="\033"
RESET="${esc}[0m" # DEFAULT
COL_WARNING="${esc}[31m" # RED
COL_SECTION="${esc}[32m" # BLUE
COL_ENTRY="${esc}[34m" # GREEN
COL_LOGO="${esc}[36m" # CYAN
else
RESET=""
COL_WARNING=""
COL_SECTION=""
COL_ENTRY=""
COL_LOGO=""
fi
# ---------------------------
# Banner
# ---------------------------
echo "${COL_ENTRY}"
echo " _ _ _ _ _____ __ ____ ___ _ _ _____ ____ _____ ___ ____ "
echo " | | | | \ | |_ _\ \/ / / ___/ _ \| | | | | ____/ ___|_ _/ _ \| _ \ "
echo " | | | | \| || | \ / | | | | | | | | | | _|| | | || | | | |_) | "
echo " | |_| | |\ || | / \ | |__| |_| | |___| |___| |__| |___ | || |_| | _ < "
echo " \___/|_| \_|___/_/\_\ \____\___/|_____|_____|_____\____| |_| \___/|_| \_\ "
echo ""
echo "${COL_ENTRY}A live forensic collection script for UNIX-like systems. Version: $VERSION by op7ic"
echo ""
echo "${RESET}"
# ---------------------------
# Platform detected
# ---------------------------
case $PLATFORM in
"solaris")
echo "${COL_SECTION}PLATFORM:${RESET} Sun Solaris"
;;
"linux")
echo "${COL_SECTION}PLATFORM:${RESET} GNU/Linux"
;;
"aix")
echo "${COL_SECTION}PLATFORM:${RESET} IBM AIX"
;;
"mac")
echo "${COL_SECTION}PLATFORM:${RESET} MacOS (Darwin)"
;;
"android")
echo "${COL_SECTION}PLATFORM:${RESET} Android"
;;
"hpux")
echo "${COL_SECTION}PLATFORM:${RESET} HPUX"
;;
*)
PLATFORM="generic"
echo "${COL_SECTION}PLATFORM:${RESET} Generic UNIX"
;;
esac
echo ""
# ---------------------------
# Check if directory exists
# ---------------------------
if [ -d $OUTPUT_DIR ]
then
DELETEDIR="YES"
if [ $QUIET = "NO" ]
then
echo "${COL_WARNING}The directory '$OUTPUT_DIR' already exists. Delete it?${RESET} [y] "
read USERDIRCONFIRM
if [ $USERDIRCONFIRM ]
then
if [ $USERDIRCONFIRM != "y" -a $USERDIRCONFIRM != "Y" ]
then
DELETEDIR="NO"
fi
fi
fi
if [ $DELETEDIR = "YES" ]
then
echo "Deleting existing output directory..."
echo ""
rm -fr $OUTPUT_DIR
else
echo "${COL_WARNING}Exiting...${RESET}"
exit 1
fi
fi
# ---------------------------
# check if TAR file exist
# ---------------------------
if [ -f $TAR_FILE ]
then
DELETETAR="YES"
if [ $QUIET = "NO" ]
then
echo "${COL_WARNING}The file '$TAR_FILE' already exists. Delete it?${RESET} [y] "
read USERTARCONFIRM
if [ $USERTARCONFIRM ]
then
if [ $USERTARCONFIRM != "y" -a $USERTARCONFIRM != "Y" ]
then
DELETETAR="NO"
fi
fi
fi
if [ $DELETETAR = "YES" ]
then
echo "Deleting existing tar file..."
echo ""
rm -f $TAR_FILE
else
echo "${COL_WARNING}Exiting...${RESET}"
exit 1
fi
fi
# Create output directory
mkdir $OUTPUT_DIR
# ------------------
# PART 2: THE BASICS
# ------------------
echo "${COL_SECTION}BASIC INFORMATION [0% ]:${RESET}"
echo " ${COL_ENTRY}>${RESET} UNIX Collector Version"
echo $VERSION 1> $OUTPUT_DIR/collector-version.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} UNIX Collector Date"
echo $LONG_DATE 1> $OUTPUT_DIR/collector-date.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} UNIX Collector User"
id 1> $OUTPUT_DIR/collector-user.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} UNIX Collector Platform"
echo $PLATFORM > $OUTPUT_DIR/collector-platform.txt
# ---------------------------
# PART 3: GENERAL INFORMATION
# ---------------------------
echo "${COL_SECTION}GENERAL INFORMATION [15% ]:${RESET}"
mkdir $OUTPUT_DIR/general
echo " ${COL_ENTRY}>${RESET} Hostname"
hostname 1> $OUTPUT_DIR/general/hostname.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Kernel"
uname -s 1> $OUTPUT_DIR/general/kernel.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Version"
uname -v 1> $OUTPUT_DIR/general/version.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Check for tainted kernel"
# Based on amazing work by Craig Rowland - https://twitter.com/CraigHRowland/status/1628883826738077696
cat /proc/sys/kernel/tainted 1> $OUTPUT_DIR/general/tainted_kernel.txt 2> /dev/null
for i in $(seq 18); do echo $(($i-1)) $(($(cat /proc/sys/kernel/tainted)>>($i-1)&1));done 1>> $OUTPUT_DIR/general/tainted_bitmap.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} SSH settings"
sshd -T 1> $OUTPUT_DIR/general/sshd-t.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} File timeline"
if [ $PLATFORM = "solaris" ]
then
echo "Inode,Hard Link Count,Full Path,Last Access,Last Modification,Last Status Change,File Creation,User,Group,File Permissions,File Size(bytes)" > $OUTPUT_DIR/general/timeline.csv
find / -xdev -print0 2>/dev/null | xargs -0 stat --printf="%i,%h,%n,%x,%y,%z,%w,%U,%G,%A,%s\n" 1>> $OUTPUT_DIR/general/timeline.csv 2>/dev/null
elif [ $PLATFORM = "linux" ]
then
echo "Inode,Hard Link Count,Full Path,Last Access,Last Modification,Last Status Change,File Creation,User,Group,File Permissions,File Size(bytes)" > $OUTPUT_DIR/general/timeline.csv
find / -xdev -print0 2>/dev/null | xargs -0 stat --printf="%i,%h,%n,%x,%y,%z,%w,%U,%G,%A,%s\n" 1>> $OUTPUT_DIR/general/timeline.csv 2>/dev/null
elif [ $PLATFORM = "android" ]
then
echo "Inode,Hard Link Count,Full Path,Last Access,Last Modification,Last Status Change,File Creation,User,Group,File Permissions,File Size(bytes)" > $OUTPUT_DIR/general/timeline.csv
find / -xdev -print0 2>/dev/null | xargs -0 stat --printf="%i,%h,%n,%x,%y,%z,%w,%U,%G,%A,%s\n" 1>> $OUTPUT_DIR/general/timeline.csv 2>/dev/null
elif [ $PLATFORM = "mac" ]
then
find / -xdev -print0 2>/dev/null | xargs -0 stat -L 1>> $OUTPUT_DIR/general/timeline.txt 2>/dev/null
elif [ $PLATFORM = "generic" ]
then
echo "Inode,Hard Link Count,Full Path,Last Access,Last Modification,Last Status Change,File Creation,User,Group,File Permissions,File Size(bytes)" > $OUTPUT_DIR/general/timeline.csv
find / -xdev -print0 2>/dev/null | xargs -0 stat --printf="%i,%h,%n,%x,%y,%z,%w,%U,%G,%A,%s\n" 1>> $OUTPUT_DIR/general/timeline.csv 2>/dev/null
elif [ $PLATFORM = "aix" ]
then
echo "device number,inode,file name,nlink,uid,gid,rdev,size,access time,modified time,inode change time,io size,block size" > timeline.csv
find / -xdev 2>/dev/null | perl -n -e '$_ =~ s/\x0a//g; $_ =~ s/\x0d//g;print $_ . "," . join(",", stat($_)) . "\n";' 1>> timeline.csv 2>/dev/null
fi
echo " ${COL_ENTRY}>${RESET} Release"
uname -r 1> $OUTPUT_DIR/general/release.txt 2> /dev/null
cp /etc/*release $OUTPUT_DIR/general/ 2> /dev/null
cp /etc/debian_version $OUTPUT_DIR/general/ 2> /dev/null
cp /etc/passwd $OUTPUT_DIR/general/ 2> /dev/null
cp /etc/group $OUTPUT_DIR/general/ 2> /dev/null
cp /etc/ssh/sshd_config $OUTPUT_DIR/general/ 2> /dev/null
cp /etc/ssh/ssh_config $OUTPUT_DIR/general/ 2> /dev/null
zdump /etc/localtime 1> $OUTPUT_DIR/general/timezone.txt 2> /dev/null
stat /lost+found 1> $OUTPUT_DIR/general/installation-time.txt 2> /dev/null
ls -lct /etc | tail -1 1> $OUTPUT_DIR/general/installation-time.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Kerberos ticket list"
klist 1> $OUTPUT_DIR/general/kerberos-ticket-list.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Mount points"
mount 1> $OUTPUT_DIR/general/mount.txt 2> /dev/null
if [ $PLATFORM = "android" ]
then
echo " ${COL_ENTRY}>${RESET} Android Features"
pm list features 1> $OUTPUT_DIR/general/pm_list_features.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Android Users"
pm list users 1> $OUTPUT_DIR/general/android_users.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Android Properties"
getprop 1> $OUTPUT_DIR/general/android_getprop.txt 2> /dev/null
getprop -T 1> $OUTPUT_DIR/general/android_getprop-T.txt 2> /dev/null
getprop -Z 1> $OUTPUT_DIR/general/android_getprop-Z.txt 2> /dev/null
lsof -l 1> $OUTPUT_DIR/general/android_lsof_l.txt 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} LSOF"
lsof -nPl 1> $OUTPUT_DIR/general/lsof_nPl.txt 2> /dev/null
if [ $PLATFORM = "aix" ]
then
echo " ${COL_ENTRY}>${RESET} Processor"
uname -p 1> $OUTPUT_DIR/general/processor.txt 2> /dev/null
oslevel -s 1> $OUTPUT_DIR/general/oslevel.txt 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} Full OS Info"
uname -a 1> $OUTPUT_DIR/general/uname-a.txt 2> /dev/null
if [ $PLATFORM = "solaris" ]
then
echo " ${COL_ENTRY}>${RESET} EEPROM"
eeprom 1> $OUTPUT_DIR/general/eeprom.txt 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} Stroage Info"
arcstat 1> $OUTPUT_DIR/general/storage_arcstat.txt 2> /dev/null
blkid 1> $OUTPUT_DIR/general/storage_blkid.txt 2> /dev/null
df 1> $OUTPUT_DIR/general/storage_df.txt 2> /dev/null
df -h 1> $OUTPUT_DIR/general/storage_df_h.txt 2> /dev/null
df -n 1> $OUTPUT_DIR/general/storage_df_n.txt 2> /dev/null
diskutil list 1> $OUTPUT_DIR/general/storage_diskutil.txt 2> /dev/null
fdisk -l 1> $OUTPUT_DIR/general/storage_fdisk.txt 2> /dev/null
findmnt --ascii 1> $OUTPUT_DIR/general/storage_findmnt.txt 2> /dev/null
geom disk list 1> $OUTPUT_DIR/general/storage_geom_disk_list.txt 2> /dev/null
geom -t 1> $OUTPUT_DIR/general/storage_geom_t.txt 2> /dev/null
gstat -b 1> $OUTPUT_DIR/general/storage_gstat_b.txt 2> /dev/null
iostat -d -l 1> $OUTPUT_DIR/general/storage_iostat_d_l.txt 2> /dev/null
iscsiadm -m node 1> $OUTPUT_DIR/general/storage_iscsiadm_node.txt 2> /dev/null
iscsiadm -s 1> $OUTPUT_DIR/general/storage_iscsiadm_s.txt 2> /dev/null
lparstat -i 1> $OUTPUT_DIR/general/storage_lparstat.txt 2> /dev/null
ls -l /dev/disk/by-* 1> $OUTPUT_DIR/general/storage_disks_dev.txt 2> /dev/null
ls -l /vmfs/devices/disks 1> $OUTPUT_DIR/general/storage_disks_vmfs.txt 2> /dev/null
lsblk 1> $OUTPUT_DIR/general/storage_lsblk.txt 2> /dev/null
lsblk -l 1> $OUTPUT_DIR/general/storage_lsblk_l.txt 2> /dev/null
lsblk -f 1> $OUTPUT_DIR/general/storage_lsblk_f.txt 2> /dev/null
lsfs 1> $OUTPUT_DIR/general/storage_lsfs.txt 2> /dev/null
lspv 1> $OUTPUT_DIR/general/storage_lspv.txt 2> /dev/null
lsvg 1> $OUTPUT_DIR/general/storage_lsvg.txt 2> /dev/null
lvdisplay 1> $OUTPUT_DIR/general/storage_lvdisplay.txt 2> /dev/null
lvs 1> $OUTPUT_DIR/general/storage_lvs.txt 2> /dev/null
cat /proc/mdstat 1> $OUTPUT_DIR/general/storage_mdstat.txt 2> /dev/null
mdadm --detail --scan --verbose 1> $OUTPUT_DIR/general/storage_mdadm.txt 2> /dev/null
mount 1> $OUTPUT_DIR/general/storage_mount.txt 2> /dev/null
pdisk -l 1> $OUTPUT_DIR/general/storage_pdisk.txt 2> /dev/null
pvdisplay 1> $OUTPUT_DIR/general/storage_pvdisplay.txt 2> /dev/null
pvesm status 1> $OUTPUT_DIR/general/storage_pvesm.txt 2> /dev/null
pvs 1> $OUTPUT_DIR/general/storage_pvs.txt 2> /dev/null
vgdisplay 1> $OUTPUT_DIR/general/storage_vgdisplay.txt 2> /dev/null
vgs 1> $OUTPUT_DIR/general/storage_vgs.txt 2> /dev/null
zfs list -o name,avail,used,usedsnap,usedds,usedrefreserv,usedchild,sharenfs,mountpoint 1> $OUTPUT_DIR/general/storage_zfs_list.txt 2> /dev/null
zpool history 1> $OUTPUT_DIR/general/storage_zpool_history.txt 2> /dev/null
zpool list -v 1> $OUTPUT_DIR/general/storage_zpool_list.txt 2> /dev/null
zpool status -v 1> $OUTPUT_DIR/general/storage_zpool_status.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Process list and information"
ps -efl 1> $OUTPUT_DIR/general/ps.txt 2> /dev/null
ps -auxww 1> $OUTPUT_DIR/general/ps-auxww.txt 2> /dev/null
ps -deaf 1> $OUTPUT_DIR/general/ps-deaf.txt 2> /dev/null
ps -aux 1> $OUTPUT_DIR/general/ps-aux.txt 2> /dev/null
pstree 1> $OUTPUT_DIR/general/pstree.txt 2> /dev/null
pstree -a 1> $OUTPUT_DIR/general/pstree_a.txt 2> /dev/null
pstree -p -n 1> $OUTPUT_DIR/general/pstree_p_n.txt 2> /dev/null
ps -eo args | grep "^/" | awk '{print $1}' | sort -u 1> $OUTPUT_DIR/general/running_executables.txt 2> /dev/null
ps -c | awk '{print $4}' | sort -u | grep "^/" 1> $OUTPUT_DIR/general/running_executables_esxi.txt 2> /dev/null
mkdir $OUTPUT_DIR/process_info/ 2> /dev/null
for pid in /proc/[0-9]*; do echo "PID: $(echo ${pid} | sed -e 's:/proc/::')" 2> /dev/null && ls -la /proc/$(echo ${pid} | sed -e 's:/proc/::')/fd; done 1> $OUTPUT_DIR/process_info/all_process_handles.txt 2> /dev/null
ls -l /proc/[0-9]*/cwd 1> $OUTPUT_DIR/process_info/process_working_directory.txt 2> /dev/null
ls -l /proc/[0-9]*/exe 2> /dev/null | grep -E "\(deleted\)" | awk -F"/proc/|/exe" '{print $2}' 1> $OUTPUT_DIR/process_info/deleted_processes_ids.txt 2> /dev/null
ls -l /proc/[0-9]*/exe 2> /dev/null | grep -E "\(deleted\)" 1> $OUTPUT_DIR/process_info/deleted_processes.txt 2> /dev/null
for pid in $(find /proc -maxdepth 1 -type d -name '[0-9]*'); do echo $(basename $pid); done 1> $OUTPUT_DIR/process_info/all_process_ids.txt 2> /dev/null
if [ $PLATFORM = "generic" ]
then
find /proc/[0-9]*/exe -type l -exec sha256sum {} \; >> $OUTPUT_DIR/process_info/sha256sum_running_processes_proc_exe 2> /dev/null
find /proc/[0-9]*/file -type l -exec sha256sum {} \; >> $OUTPUT_DIR/process_info/sha256sum_running_processes_proc_file 2> /dev/null
find /proc/[0-9]*/exe -type l -exec sha1sum {} \; >> $OUTPUT_DIR/process_info/sha1sum_running_processes_proc_exe 2> /dev/null
find /proc/[0-9]*/file -type l -exec sha1sum {} \; >> $OUTPUT_DIR/process_info/sha1sum_running_processes_proc_file 2> /dev/null
find /proc/[0-9]*/exe -type l -exec md5sum {} \; >> $OUTPUT_DIR/process_info/md5sum_running_processes_proc_exe 2> /dev/null
find /proc/[0-9]*/file -type l -exec md5sum {} \; >> $OUTPUT_DIR/process_info/md5sum_running_processes_proc_file 2> /dev/null
find /proc/[0-9]*/exe -type l -exec openssl dgst -sha256 {} \; >> $OUTPUT_DIR/process_info/openssl_sha256_running_processes_proc_exe 2> /dev/null
find /proc/[0-9]*/file -type l -exec openssl dgst -sha256 {} \; >> $OUTPUT_DIR/process_info/openssl_sha256_running_processes_proc_file 2> /dev/null
ps -axo args | grep "^/" | awk '{print $1}' | sort -u | xargs -I {} shasum -a 256 {} >> $OUTPUT_DIR/process_info/sha256sum_running_processes 2> /dev/null
ps -axo args | grep "^/" | awk '{print $1}' | sort -u | xargs -I {} shasum -a 1 {} >> $OUTPUT_DIR/process_info/sha256sum_running_processes 2> /dev/null
ps -axo comm | grep "^/" | sort -u | xargs -I {} md5 -q {} >> $OUTPUT_DIR/process_info/md5sum_running_processes 2> /dev/null
ps -axo args | grep ^/ | awk '{print $1}' | sort -u 1> $OUTPUT_DIR/process_info/process_running_paths.txt 2> /dev/null
fi
if [ $PLATFORM = "linux" ]
then
find /proc/[0-9]*/exe -type l -exec sha256sum {} \; >> $OUTPUT_DIR/process_info/sha256sum_running_processes 2> /dev/null
find /proc/[0-9]*/exe -type l -exec sha1sum {} \; >> $OUTPUT_DIR/process_info/sha1sum_running_processes 2> /dev/null
find /proc/[0-9]*/exe -type l -exec md5sum {} \; >> $OUTPUT_DIR/process_info/md5sum_running_processes 2> /dev/null
find /proc/[0-9]*/exe -type l -exec openssl dgst -sha256 {} \; >> $OUTPUT_DIR/process_info/openssl_sha256_running_processes 2> /dev/null
fi
if [ $PLATFORM = "aix" ]
then
find /proc/[0-9]*/object/a.out -type l -exec sha256sum {} \; >> $OUTPUT_DIR/process_info/sha256sum_running_processes 2> /dev/null
find /proc/[0-9]*/object/a.out -type l -exec sha1sum {} \; >> $OUTPUT_DIR/process_info/sha1sum_running_processes 2> /dev/null
find /proc/[0-9]*/object/a.out -type l -exec md5sum {} \; >> $OUTPUT_DIR/process_info/md5sum_running_processes 2> /dev/null
find /proc/[0-9]*/object/a.out -type l -exec openssl dgst -sha256 {} \; >> $OUTPUT_DIR/process_info/openssl_sha256_running_processes 2> /dev/null
fi
if [ $PLATFORM = "solaris" ]
then
find /proc/[0-9]*/path/a.out -type l -exec sha256sum {} \; >> $OUTPUT_DIR/process_info/sha256sum_running_processes 2> /dev/null
find /proc/[0-9]*/path/a.out -type l -exec sha1sum {} \; >> $OUTPUT_DIR/process_info/sha1sum_running_processes 2> /dev/null
find /proc/[0-9]*/path/a.out -type l -exec md5sum {} \; >> $OUTPUT_DIR/process_info/md5sum_running_processes 2> /dev/null
find /proc/[0-9]*/path/a.out -type l -exec openssl dgst -sha256 {} \; >> $OUTPUT_DIR/process_info/openssl_sha256_running_processes 2> /dev/null
fi
if [ $PLATFORM = "hpux" ]
then
find /proc/[0-9]*/exe -type l -exec sha256sum {} \; >> $OUTPUT_DIR/process_info/sha256sum_running_processes 2> /dev/null
find /proc/[0-9]*/exe -type l -exec sha1sum {} \; >> $OUTPUT_DIR/process_info/sha1sum_running_processes 2> /dev/null
find /proc/[0-9]*/exe -type l -exec md5sum {} \; >> $OUTPUT_DIR/process_info/md5sum_running_processes 2> /dev/null
find /proc/[0-9]*/exe -type l -exec openssl dgst -sha256 {} \; >> $OUTPUT_DIR/process_info/openssl_sha256_running_processes 2> /dev/null
fi
if [ $PLATFORM = "mac" ]
then
ps -axo comm | grep "^/" | sort -u | xargs -I {} shasum -a 256 {} >> $OUTPUT_DIR/process_info/sha256sum_running_processes 2> /dev/null
ps -axo comm | grep "^/" | sort -u | xargs -I {} shasum -a 1 {} >> $OUTPUT_DIR/process_info/sha1sum_running_processes 2> /dev/null
ps -axo comm | grep "^/" | sort -u | xargs -I {} md5 -q {} >> $OUTPUT_DIR/process_info/md5sum_running_processes 2> /dev/null
fi
if [ $PLATFORM = "solaris" ]
then
ptree 1> $OUTPUT_DIR/general/ptree.txt 2> /dev/null
fi
if [ $PLATFORM = "aix" ]
then
proctree -a 1> $OUTPUT_DIR/general/proctree_a.txt 2> /dev/null
pstat -a 1> $OUTPUT_DIR/general/pstat_a.txt 2> /dev/null
pstat -f 1> $OUTPUT_DIR/general/pstat_f.txt 2> /dev/null
pstat -A 1> $OUTPUT_DIR/general/pstat_A.txt 2> /dev/null
pstat -p 1> $OUTPUT_DIR/general/pstat_p.txt 2> /dev/null
fi
if [ $PLATFORM = "android" ]
then
ps -A 1> $OUTPUT_DIR/general/android_ps-all 2> /dev/null
ps -A -f -l 1> $OUTPUT_DIR/general/android_ps-all-F-l 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} Cron and other scheduler files"
if [ -f "/etc/crontab" ] && [ -r "/etc/crontab" ]; then
cp /etc/crontab $OUTPUT_DIR/general/etc-crontab.txt 2>/dev/null
fi
mkdir $OUTPUT_DIR/general/crontabs/ 2> /dev/null
if [ -d /var/cron/ ]
then
cp -R /var/cron/ $OUTPUT_DIR/general/crontabs/var_cron 2> /dev/null
fi
if [ -d /var/adm/cron/ ]
then
cp -R /var/adm/cron/ $OUTPUT_DIR/general/crontabs/var_adm_cron 2> /dev/null
fi
if [ -d /var/spool/at/ ]
then
cp -R /var/spool/at/ $OUTPUT_DIR/general/crontabs/var_spool_at 2> /dev/null
fi
if [ -d /var/spool/cron/ ]
then
cp -R /var/spool/cron/ $OUTPUT_DIR/general/crontabs/var_spool_cron 2> /dev/null
fi
if [ -d /data/crontab/ ]
then
cp -R /data/crontab/ $OUTPUT_DIR/general/crontabs/ 2> /dev/null
fi
if [ -d /dev/shm/ ]
then
cp -R /dev/shm/ $OUTPUT_DIR/general/dev_shm_folder/ 2> /dev/null
fi
if [ -d /run/shm ]
then
cp -R /run/shm/ $OUTPUT_DIR/general/run_shm_folder/ 2> /dev/null
fi
if [ $PLATFORM = "mac" ]
then
crontab -v 1> $OUTPUT_DIR/general/crontab-v.txt 2> /dev/null
crontab -l 1> $OUTPUT_DIR/general/crontab-l.txt 2> /dev/null
cp -R /var/at/ $OUTPUT_DIR/general/crontabs/var_at 2> /dev/null
cp -R /private/var/at/tabs/ $OUTPUT_DIR/general/crontabs/private_var_at_tabs 2> /dev/null
cp -R /Library/StartupItems/ $OUTPUT_DIR/general/crontabs/StartupItems 2> /dev/null
cp -R /System/Library/StartupItems/ $OUTPUT_DIR/general/crontabs/System_StartupItems 2> /dev/null
cp -R /Library/LaunchAgents/ $OUTPUT_DIR/general/crontabs/LaunchAgents 2> /dev/null
cp -R /System/Library/LaunchAgents/ $OUTPUT_DIR/general/crontabs/System_LaunchAgents 2> /dev/null
cp -R /usr/lib/cron/jobs/ $OUTPUT_DIR/general/crontabs/usr_lib_cron_jobs 2> /dev/null
cp -R /usr/lib/cron/tabs/ $OUTPUT_DIR/general/crontabs/usr_lib_cron_tabs 2> /dev/null
cp /etc/periodic.conf $OUTPUT_DIR/general/crontabs/ 2> /dev/null
cp /etc/periodic.conf.local $OUTPUT_DIR/general/crontabs/ 2> /dev/null
cp -R /etc/periodic/ $OUTPUT_DIR/general/crontabs/ 2> /dev/null
cp -R /etc/daily.local/ $OUTPUT_DIR/general/crontabs/ 2> /dev/null
cp -R /etc/weekly.local/ $OUTPUT_DIR/general/crontabs/ 2> /dev/null
cp -R /etc/monthly.local/ $OUTPUT_DIR/general/crontabs/ 2> /dev/null
cp -R /etc/periodic/daily/ $OUTPUT_DIR/general/crontabs/periodic_daily 2> /dev/null
cp -R /etc/periodic/weekly/ $OUTPUT_DIR/general/crontabs/periodic_weekly 2> /dev/null
cp -R /etc/periodic/monthly/ $OUTPUT_DIR/general/crontabs/periodic_monthly 2> /dev/null
cp -R /usr/local/etc/periodic/ $OUTPUT_DIR/general/crontabs/usr_local_etc_periodic 2> /dev/null
cp -R /etc/crontab $OUTPUT_DIR/general/crontabs/etc_crontab 2> /dev/null
cp -R /Library/LaunchDaemons/ $OUTPUT_DIR/general/crontabs/LaunchDaemons 2> /dev/null
cp -R /System/Library/LaunchDaemons/ $OUTPUT_DIR/general/crontabs/System_LaunchDaemons 2> /dev/null
fi
if [ $PLATFORM = "android" ]
then
crontab -l 1> $OUTPUT_DIR/general/android_crontab-l 2> /dev/null
fi
mkdir $OUTPUT_DIR/general/systemd/ 2> /dev/null
if [ -d /lib/systemd/system/ ]
then
cp -R /lib/systemd/system/ $OUTPUT_DIR/general/systemd/lib_systemd_system 2> /dev/null
fi
if [ -d /usr/lib/systemd/system/ ]
then
cp -R /usr/lib/systemd/system/ $OUTPUT_DIR/general/systemd/usr_lib_systemd_system 2> /dev/null
fi
if [ $PLATFORM = "aix" ]
then
crontab -v 1> $OUTPUT_DIR/general/crontab.txt 2> /dev/null
else
crontab -l 1> $OUTPUT_DIR/general/crontab.txt 2> /dev/null
fi
if [ -d /var/spool/cron/crontabs ]
then
mkdir $OUTPUT_DIR/general/crontabs 2> /dev/null
for name in `ls /var/spool/cron/crontabs/`
do
ls -lL /var/spool/cron/crontabs/$name 1>> $OUTPUT_DIR/general/crontabs/perms 2> /dev/null
cp /var/spool/cron/crontabs/$name $OUTPUT_DIR/general/crontabs/$name 2> /dev/null
cat /var/spool/cron/crontabs/$name 2> /dev/null | grep -v "^#" | while read null null null null null name null
do
ls -lL $name 1>> $OUTPUT_DIR/general/crontabs/perms 2> /dev/null
done
done
fi
if [ -d /etc/cron.d ]
then
mkdir $OUTPUT_DIR/general/cron.d 2> /dev/null
for name in `ls /etc/cron.d/`
do
if [ -f /etc/cron.d/$name ]
then
ls -lL /etc/cron.d/$name 1>> $OUTPUT_DIR/general/cron.d/perms 2> /dev/null
cp /etc/cron.d/$name $OUTPUT_DIR/general/cron.d/$name 2> /dev/null
if [ $PLATFORM = "linux" ]
then
cat /etc/cron.d/$name 2> /dev/null | grep -v "^#" | while read null null null null null user name null
do
echo "$user:" 1>> $OUTPUT_DIR/general/cron.d/perms 2> /dev/null
ls -lL /etc/cron.d/$name 1>> $OUTPUT_DIR/general/cron.d/perms 2> /dev/null
done
fi
fi
done
fi
if [ -d /etc/cron.hourly ]
then
mkdir $OUTPUT_DIR/general/cron.hourly 2> /dev/null
for name in `ls /etc/cron.hourly/`
do
if [ -f /etc/cron.hourly/$name ]
then
ls -lL /etc/cron.d/$name 1>> $OUTPUT_DIR/general/cron.d/perms 2> /dev/null
cp /etc/cron.hourly/$name $OUTPUT_DIR/general/cron.hourly/$name 2> /dev/null
fi
done
fi
if [ -d /etc/cron.daily ]
then
mkdir $OUTPUT_DIR/general/cron.daily 2> /dev/null
for name in `ls /etc/cron.daily/`
do
if [ -f /etc/cron.daily/$name ]
then
ls -lL /etc/cron.daily/$name 1>> $OUTPUT_DIR/general/cron.daily/perms 2> /dev/null
cp /etc/cron.daily/$name $OUTPUT_DIR/general/cron.daily/$name 2> /dev/null
fi
done
fi
if [ -d /etc/cron.weekly ]
then
mkdir $OUTPUT_DIR/general/cron.weekly 2> /dev/null
for name in `ls /etc/cron.weekly/`
do
if [ -f /etc/cron.weekly/$name ]
then
ls -lL /etc/cron.weekly/$name 1>> $OUTPUT_DIR/general/cron.weekly/perms 2> /dev/null
cp /etc/cron.weekly/$name $OUTPUT_DIR/general/cron.weekly/$name 2> /dev/null
fi
done
fi
if [ -d /etc/cron.monthly ]
then
mkdir $OUTPUT_DIR/general/cron.monthly 2> /dev/null
for name in `ls /etc/cron.monthly/`
do
if [ -f /etc/cron.monthly/$name ]
then
ls -lL /etc/cron.monthly/$name 1>> $OUTPUT_DIR/general/cron.monthly/perms 2> /dev/null
cp /etc/cron.monthly/$name $OUTPUT_DIR/general/cron.monthly/$name 2> /dev/null
fi
done
fi
echo " ${COL_ENTRY}>${RESET} Kernel Modules"
if [ $PLATFORM = "solaris" ]
then
modinfo 1> $OUTPUT_DIR/general/kernel-modules.txt 2> /dev/null
elif [ $PLATFORM = "linux" ]
then
lsmod 1> $OUTPUT_DIR/general/kernel-modules.txt 2> /dev/null
elif [ $PLATFORM = "android" ]
then
lsmod 1> $OUTPUT_DIR/general/kernel-modules.txt 2> /dev/null
elif [ $PLATFORM = "mac" ]
then
kmutil showloaded 1> $OUTPUT_DIR/general/kernel-modules.txt 2> /dev/null
elif [ $PLATFORM = "android" ]
then
ls -la /sys/module/ 1> $OUTPUT_DIR/general/kernel-modules.txt 2> /dev/null
ls -la /system/lib/modules/ 1> $OUTPUT_DIR/general/loadable-modules.txt 2> /dev/null
elif [ $PLATFORM = "aix" ]
then
genkex 1> $OUTPUT_DIR/general/kernel-modules.txt 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} At scheduler"
if [ $PLATFORM != "solaris" ]
then
atq 1> $OUTPUT_DIR/general/atq.txt 2> /dev/null
fi
if [ -d /var/spool/cron/atjobs ]
then
mkdir $OUTPUT_DIR/general/atjobs 2> /dev/null
for name in `ls /var/spool/cron/atjobs/`
do
cp /var/spool/cron/atjobs/$name $OUTPUT_DIR/general/atjobs/$name 2> /dev/null
done
fi
echo " ${COL_ENTRY}>${RESET} Kernel settings"
cat /etc/sysctl.conf 1> $OUTPUT_DIR/general/sysctl.conf 2> /dev/null
if [ $PLATFORM = "linux" ]
then
sysctl -a 1> $OUTPUT_DIR/general/sysctl-a.txt 2> /dev/null
fi
if [ $PLATFORM = "android" ]
then
sysctl -a 1> $OUTPUT_DIR/general/sysctl-a.txt 2> /dev/null
fi
if [ $PLATFORM = "mac" ]
then
sysctl -a 1> $OUTPUT_DIR/general/sysctl-a.txt 2> /dev/null
fi
if [ $PLATFORM = "solaris" ]
then
cat /etc/system 1> $OUTPUT_DIR/general/system 2> /dev/null
ndd /dev/ip \? | while read setting null
do
echo "$setting" 1>> $OUTPUT_DIR/general/ip 2> /dev/null
ndd /dev/ip $setting 1>> $OUTPUT_DIR/general/ip 2> /dev/null
done
fi
echo " ${COL_ENTRY}>${RESET} Environment"
env 1> $OUTPUT_DIR/general/env.txt 2> /dev/null
echo " ${COL_ENTRY}>${RESET} ulimit"
ulimit -a 1> $OUTPUT_DIR/general/ulimit-a.txt 2> /dev/null
if [ $PLATFORM = "solaris" ]
then
echo " ${COL_ENTRY}>${RESET} Zones"
zoneadm list -i -v 1> $OUTPUT_DIR/general/zoneadm_list.txt 2> /dev/null
fi
if [ $PLATFORM = "linux" ]
then
echo " ${COL_ENTRY}>${RESET} Auditd"
mkdir $OUTPUT_DIR/auditd
auditctl -l > $OUTPUT_DIR/auditd/auditctl-l.txt 2> /dev/null
auditctl -s > $OUTPUT_DIR/auditd/auditctl-s.txt 2> /dev/null
cp /etc/audit/audit.rules $OUTPUT_DIR/auditd/ 2> /dev/null
cp /etc/audit/auditd.conf $OUTPUT_DIR/auditd/ 2> /dev/null
ps aux | grep auditd > $OUTPUT_DIR/auditd/ps-grep-auditd.txt 2> /dev/null
mkdir $OUTPUT_DIR/selinux
sestatus -v > $OUTPUT_DIR/selinux/sestatus-v.txt 2> /dev/null
cp /etc/selinux/config $OUTPUT_DIR/selinux/ 2> /dev/null
cp /etc/sysconfig/selinux $OUTPUT_DIR/selinux/sysconfig-selinux 2> /dev/null
fi
if [ $PLATFORM = "mac" ]
then
cp /etc/security/audit_control $OUTPUT_DIR/auditd/ 2> /dev/null
cp /var/audit/ $OUTPUT_DIR/auditd/ 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} spool files"
mkdir $OUTPUT_DIR/general/spool/ 2> /dev/null
cp -R /var/spool $OUTPUT_DIR/general/spool/ 2> /dev/null
if [ $PLATFORM = "mac" ]
then
mkdir $OUTPUT_DIR/general/spool/private_var_spool/ 2> /dev/null
cp -R /private/var/spool/ $OUTPUT_DIR/general/spool/private_var_spool/ 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} Hardware information"
mkdir $OUTPUT_DIR/hardware/ 2> /dev/null
if [ $PLATFORM = "linux" ]
then
cat /proc/cpuinfo 1> $OUTPUT_DIR/hardware/cpuinfo.txt 2> /dev/null
dmesg 1> $OUTPUT_DIR/hardware/dmesg.txt 2> /dev/null
dmesg -a 1> $OUTPUT_DIR/hardware/dmesg_a.txt 2> /dev/null
dmesg -s 1> $OUTPUT_DIR/hardware/dmesg_s.txt 2> /dev/null
dmidecode 1> $OUTPUT_DIR/hardware/dmidecode.txt 2> /dev/null
hwinfo 1> $OUTPUT_DIR/hardware/hwinfo.txt 2> /dev/null
lscpu 1> $OUTPUT_DIR/hardware/lscpu.txt 2> /dev/null
lshw 1> $OUTPUT_DIR/hardware/lshw.txt 2> /dev/null
lspci 1> $OUTPUT_DIR/hardware/lspci.txt 2> /dev/null
lspci -vv 1> $OUTPUT_DIR/hardware/lspci_vv.txt 2> /dev/null
lspci -nn -k 1> $OUTPUT_DIR/hardware/lspci_nn_k.txt 2> /dev/null
lsscsi 1> $OUTPUT_DIR/hardware/lsscsi.txt 2> /dev/null
lshal 1> $OUTPUT_DIR/hardware/lshal.txt 2> /dev/null
lsusb 1> $OUTPUT_DIR/hardware/lsusb.txt 2> /dev/null
lsusb -vv 1> $OUTPUT_DIR/hardware/lsusb_vv.txt 2> /dev/null
lshw -businfo 1> $OUTPUT_DIR/hardware/lshw_businfo.txt 2> /dev/null
lspci -vvknnqq 1> $OUTPUT_DIR/hardware/lspci_vvknnqq.txt 2> /dev/null
fi
if [ $PLATFORM = "android" ]
then
dmesg 1> $OUTPUT_DIR/hardware/dmesg.txt 2> /dev/null
fi
if [ $PLATFORM = "mac" ]
then
dmesg 1> $OUTPUT_DIR/hardware/dmesg.txt 2> /dev/null
hostinfo 1> $OUTPUT_DIR/hardware/hostinfo.txt 2> /dev/null
ioreg -l 1> $OUTPUT_DIR/hardware/ioreg.txt 2> /dev/null
nvram -p 1> $OUTPUT_DIR/hardware/nvram_p.txt 2> /dev/null
systemstats 1> $OUTPUT_DIR/hardware/systemstats.txt 2> /dev/null
fi
if [ $PLATFORM = "solaris" ]
then
cfgadm -l 1> $OUTPUT_DIR/hardware/cfgadm.txt 2> /dev/null
dmesg 1> $OUTPUT_DIR/hardware/dmesg.txt 2> /dev/null
dmesg -a 1> $OUTPUT_DIR/hardware/dmesg_a.txt 2> /dev/null
dmesg -s 1> $OUTPUT_DIR/hardware/dmesg_s.txt 2> /dev/null
prtconf -v 1> $OUTPUT_DIR/hardware/prtconf.txt 2> /dev/null
psrinfo -v 1> $OUTPUT_DIR/hardware/psrinfo.txt 2> /dev/null
smbios 1> $OUTPUT_DIR/hardware/smbios.txt 2> /dev/null
fi
if [ $PLATFORM = "aix" ]
then
alog -o -t boot 1> $OUTPUT_DIR/hardware/alog_boot.txt 2> /dev/null
bootlist -o -m normal 1> $OUTPUT_DIR/hardware/bootlist.txt 2> /dev/null
lsdev -P 1> $OUTPUT_DIR/hardware/lsdev.txt 2> /dev/null
mpstat 1> $OUTPUT_DIR/hardware/mpstat.txt 2> /dev/null
prtconf -v 1> $OUTPUT_DIR/hardware/prtconf.txt 2> /dev/null
fi
if [ $PLATFORM = "hpux" ]
then
machinfo 1> $OUTPUT_DIR/hardware/machinfo.txt 2> /dev/null
lsdev 1> $OUTPUT_DIR/hardware/lsdev.txt 2> /dev/null
ioscan -kfnC disk 1> $OUTPUT_DIR/hardware/ioscan_disk.txt 2> /dev/null
isocan -kfnC tape 1> $OUTPUT_DIR/hardware/ioscan_tape.txt 2> /dev/null
ioscan -kfnC lan 1> $OUTPUT_DIR/hardware/ioscan_lan.txt 2> /dev/null
ioscan -kfnC fc 1> $OUTPUT_DIR/hardware/ioscan_fibre_channel.txt 2> /dev/null
ioscan -kfnC processor 1> $OUTPUT_DIR/hardware/ioscan_processor.txt 2> /dev/null
/opt/ignite/bin/print_manifest 1> $OUTPUT_DIR/hardware/print_manifest.txt 2> /dev/null
echo "selall;info;wait;infolog" | /usr/sbin/cstm 1> $OUTPUT_DIR/hardware/cstm_hardwareinfo.txt 2> /dev/null
echo "selclass qualifier memory;info;wait;infolog"|cstm 1> $OUTPUT_DIR/hardware/cstm_memoryinfo.txt 2> /dev/null
lssf 1> $OUTPUT_DIR/hardware/lssf.txt 2> /dev/null
fi
if [ $PLATFORM = "generic" ]
then
dmesg 1> $OUTPUT_DIR/hardware/dmesg.txt 2> /dev/null
dmesg -a 1> $OUTPUT_DIR/hardware/dmesg_a.txt 2> /dev/null
dmesg -s 1> $OUTPUT_DIR/hardware/dmesg_s.txt 2> /dev/null
hwinfo 1> $OUTPUT_DIR/hardware/hwinfo.txt 2> /dev/null
lscpu 1> $OUTPUT_DIR/hardware/lscpu.txt 2> /dev/null
lshw 1> $OUTPUT_DIR/hardware/lshw.txt 2> /dev/null
lspci 1> $OUTPUT_DIR/hardware/lspci.txt 2> /dev/null
lspci -vv 1> $OUTPUT_DIR/hardware/lspci_vv.txt 2> /dev/null
lspci -nn -k 1> $OUTPUT_DIR/hardware/lspci_nn_k.txt 2> /dev/null
lshal 1> $OUTPUT_DIR/hardware/lshal.txt 2> /dev/null
lsscsi 1> $OUTPUT_DIR/hardware/lsscsi.txt 2> /dev/null
lsusb 1> $OUTPUT_DIR/hardware/lsusb.txt 2> /dev/null
lsusb -vv 1> $OUTPUT_DIR/hardware/lsusb_vv.txt 2> /dev/null
pciconf -l 1> $OUTPUT_DIR/hardware/pciconf.txt 2> /dev/null
pciconf -l -v 1> $OUTPUT_DIR/hardware/pciconf_l_v.txt 2> /dev/null
pcidump -v 1> $OUTPUT_DIR/hardware/pcidump.txt 2> /dev/null
usbconfig show_ifdrv 1> $OUTPUT_DIR/hardware/usbconfig_show_ifdrv.txt 2> /dev/null
usbdevs -v 1> $OUTPUT_DIR/hardware/usbdevs_v.txt 2> /dev/null
lshw -businfo 1> $OUTPUT_DIR/hardware/lshw_businfo.txt 2> /dev/null
lspci -vvknnqq 1> $OUTPUT_DIR/hardware/lspci_vvknnqq.txt 2> /dev/null
fi
# ------------------------------------
# PART 4: INSTALLED SOFTWARE / PATCHES
# ------------------------------------
echo "${COL_SECTION}INSTALLED SOFTWARE AND PATCHES [25% ]:${RESET}"
mkdir $OUTPUT_DIR/software
echo " ${COL_ENTRY}>${RESET} Installed software (this could take a few mins)"
if [ $PLATFORM = "solaris" ]
then
pkginfo -l 1> $OUTPUT_DIR/software/software-pkginfo-l.txt 2> /dev/null
pkginfo -x 1> $OUTPUT_DIR/software/software-pkginfo-x.txt 2> /dev/null
showrev 1> $OUTPUT_DIR/software/software-showrev.txt 2> /dev/null
pkginfo -x 2> /dev/null | awk '{ if ( NR % 2 ) { prev = $1 } else { print prev" "$0 } }' > $OUTPUT_DIR/software/solaris-pkginfo.txt 2> /dev/null
showrev -a > $OUTPUT_DIR/software/showrev.txt 2> /dev/null
elif [ $PLATFORM = "aix" ]
then
lslpp -L all 1> $OUTPUT_DIR/software/software-lslpp.txt 2> /dev/null
lslpp -Lc 1> $OUTPUT_DIR/software/aix-patchlist.txt 2> /dev/null
pkginfo 1> $OUTPUT_DIR/software/software-pkginfo.txt 2> /dev/null
elif [ $PLATFORM = "android" ]
then
find / -iname "*.apk" 1> $OUTPUT_DIR/software/software-apps.txt 2> /dev/null
pm list packages 1> $OUTPUT_DIR/software/list_packages-pm.txt 2> /dev/null
cmd package list packages -f -u -i -U 1> $OUTPUT_DIR/software/android_list_packages-package.txt 2> /dev/null
dumpsys -l 1> $OUTPUT_DIR/software/android_services_list.txt 2> /dev/null
dumpsys 1> $OUTPUT_DIR/software/android_services_dumpsys.txt 2> /dev/null
pm list libraries 1> $OUTPUT_DIR/software/android_libraries.txt 2> /dev/null
pm list permissions -f -u 1> $OUTPUT_DIR/software/android_permissions.txt 2> /dev/null
pm list permission-groups -f 1> $OUTPUT_DIR/software/android_group_permissions.txt 2> /dev/null
pm list instrumentation 1> $OUTPUT_DIR/software/android_instrumentation.txt 2> /dev/null
pm list features 1> $OUTPUT_DIR/software/android_features.txt 2> /dev/null
pm get-install-location 1> $OUTPUT_DIR/software/android_install_location.txt 2> /dev/null
elif [ $PLATFORM = "mac" ]
then
find / -iname "*.app" 1> $OUTPUT_DIR/software/software-apps.txt 2> /dev/null
find / -iname "*.plist" 1> $OUTPUT_DIR/software/software-plist.txt 2> /dev/null
ls -la /Applications/ 1> $OUTPUT_DIR/software/software-Applications-folder.txt 2> /dev/null
mkdir $OUTPUT_DIR/software/System_Kernel_Extensions/ 2> /dev/null
cp -R /System/Library/Extensions/ $OUTPUT_DIR/software/System_Kernel_Extensions/ 2> /dev/null
mkdir $OUTPUT_DIR/software/Library_Kernel_Extensions/ 2> /dev/null
cp -R /Library/Extensions/ $OUTPUT_DIR/software/Library_Kernel_Extensions/ 2> /dev/null
elif [ $PLATFORM = "hpux" ]
then
swlist 1> $OUTPUT_DIR/software/software-swlist.txt 2> /dev/null
swlist -l fileset -a revision 1> $OUTPUT_DIR/software/hpux-patchlist.txt 2> /dev/null
else
cp /etc/redhat-release $OUTPUT_DIR/software/ 2> /dev/null
rpm -q -a 1> $OUTPUT_DIR/software/software-rpm.txt 2> /dev/null
rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}|%{EPOCH}\n' > $OUTPUT_DIR/software/rpm-patchlist.txt 2> /dev/null
dpkg --list 1> $OUTPUT_DIR/software/software-dpkg.txt 2> /dev/null
dpkg -l 1> $OUTPUT_DIR/software/dpkg-patchlist.txt 2> /dev/null
ls -1 /var/log/packages 1> $OUTPUT_DIR/software/slackware-patchlist.txt 2> /dev/null
grep -A 1 displayName /Library/Receipts/InstallHistory.plist 2>/dev/null| grep string | sed 's/<string>\(.*\)<\/string>.*/\1/g' | sed 's/^[ ]*//g'|tr -d -c 'a-zA-Z0-9\n _-'|sort|uniq > $OUTPUT_DIR/software/osx-patchlist.txt 2> /dev/null
ls -1 /Library/Receipts/boms /private/var/db/receipts 2>/dev/null | grep '\.bom$' > $OUTPUT_DIR/software/osx-bomlist.txt 2> /dev/null
emerge -pev world 1> $OUTPUT_DIR/software/software-emerge.txt 2> /dev/null
pkg_info > $OUTPUT_DIR/software/freebsd-patchlist.txt 2> /dev/null
chkconfig --list $OUTPUT_DIR/software/chkconfig--list.txt 2> /dev/null
pkg info > $OUTPUT_DIR/software/freebsd-patchlist_pkg_info.txt 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} Installed patches"
if [ $PLATFORM = "solaris" ]
then
showrev -p 1> $OUTPUT_DIR/software/patches-showrev-p.txt 2> /dev/null
patchadd -p 1> $OUTPUT_DIR/software/patches-patchadd-p.txt 2> /dev/null
elif [ $PLATFORM = "mac" ]
then
system_profiler SPInstallHistoryDataType 1> $OUTPUT_DIR/software/patches-SPInstallHistoryDataType.txt 2> /dev/null
softwareupdate --history --all 1> $OUTPUT_DIR/software/patches-history.txt 2> /dev/null
cp /Library/Receipts/InstallHistory.plist $OUTPUT_DIR/software/ 2> /dev/null
elif [ $PLATFORM = "aix" ]
then
instfix -a 1> $OUTPUT_DIR/software/patches-instfix.txt 2> /dev/null
fi
echo " ${COL_ENTRY}>${RESET} Compiler tools (NFS skip)"
find / -fstype nfs -prune -o \( -name 'gcc*' -o -name 'javac*' -o -name 'java*' -o -name 'perl*' -o -name 'tclsh*' -o -name 'python*' -o -name 'ruby*' \) -ls 1> $OUTPUT_DIR/software/compiler.txt 2> /dev/null
# ------------------------------------
# PART 5: LOG FILES, HOME DIR and PROC folders
# ------------------------------------
echo "${COL_SECTION}LOG, HOME and PROC FILE COLLECTION [50% ]:${RESET}"
mkdir $OUTPUT_DIR/logs 2> /dev/null
echo " ${COL_ENTRY}>${RESET} Copying logs"
if [ $PLATFORM = "solaris" ]
then
cp -R /var/adm/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/log/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/nslog/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/nsproflog/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/nssynclog/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/share/adm/lastlog $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/share/adm/wtmpx $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /system/volatile/utmpx $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/svc/log $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/webui/logs $OUTPUT_DIR/logs/ 2> /dev/null
elif [ $PLATFORM = "aix" ]
then
cp -R /var/adm/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/log/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/nslog/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/nsproflog/ $OUTPUT_DIR/logs/ 2> /dev/null
cp -R /var/nssynclog/ $OUTPUT_DIR/logs/ 2> /dev/null
fcstkrpt -a 1> $OUTPUT_DIR/general/fast-fail-log.txt 2> /dev/null
errpt -a 1> $OUTPUT_DIR/general/crash-log.txt 2> /dev/null
elif [ $PLATFORM = "android" ]
then
logcat -d 1> $OUTPUT_DIR/logs/logcat-d.txt 2> /dev/null
logcat -d *:D 1> $OUTPUT_DIR/logs/logcat-d-D.txt 2> /dev/null
logcat -d *:I 1> $OUTPUT_DIR/logs/logcat-d-I.txt 2> /dev/null
logcat -d *:W 1> $OUTPUT_DIR/logs/logcat-d-W.txt 2> /dev/null
logcat -d *:E 1> $OUTPUT_DIR/logs/logcat-d-E.txt 2> /dev/null
logcat -d *:F 1> $OUTPUT_DIR/logs/logcat-d-F.txt 2> /dev/null
elif [ $PLATFORM = "mac" ]
then
mkdir $OUTPUT_DIR/logs/private_var_log
cp -R /private/var/log $OUTPUT_DIR/logs/private_var_log/ 2> /dev/null