-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from tclahr/v1.6.0
V1.6.0
- Loading branch information
Showing
14 changed files
with
258 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.5.1 | ||
1.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Copyright (C) 2020 IBM Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the “License”); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an “AS IS” BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# files collector | ||
|
||
if $COLLECTOR_SYSTEM || $COLLECTOR_LOGS || $COLLECTOR_SUSPICIOUS_FILES || $COLLECTOR_USER; then | ||
|
||
logging I ">> Searching and collecting files\n" | ||
|
||
# exclude paths | ||
run_command "cat \"$CWD/conf/exclude.conf\" | grep -v \"^#\" | grep -v \"^$\" | grep \"^/\" | sed 's:^/:'\"$MOUNT_POINT\"'/:; s://*:/:g; s:/$::g'" "$COLLECTOR_OUTPUT_DIR/.exclude.tmp" | ||
# exclude names | ||
run_command "cat \"$CWD/conf/exclude.conf\" | grep -v \"^#\" | grep -v \"^$\" | grep -v \"^/\"" "$COLLECTOR_OUTPUT_DIR/.exclude.tmp" | ||
run_command "cat \"$CWD/conf/exclude.conf\" | grep -v \"^#\" | grep -v \"^$\" | grep -v \"^/\"" "$COLLECTOR_OUTPUT_DIR/.exclude_names.tmp" | ||
# exclude mounted network file systems | ||
$EXCLUDE_MOUNTED_REMOTE_FILE_SYSTEMS && run_command "get_mount_points_to_exclude" "$COLLECTOR_OUTPUT_DIR/.exclude.tmp" | ||
if [ -s "$COLLECTOR_OUTPUT_DIR/.exclude.tmp" ]; then | ||
logging D "File Systems excluded from collection:\n" | ||
cat "$COLLECTOR_OUTPUT_DIR/.exclude.tmp" >>"$UAC_LOG_FILE" | ||
fi | ||
|
||
if $COLLECTOR_SYSTEM || $COLLECTOR_LOGS || $COLLECTOR_SUSPICIOUS_FILES; then | ||
|
||
$COLLECTOR_SYSTEM && run_command "cat \"$CWD/conf/system_files.conf\"" >>"$COLLECTOR_OUTPUT_DIR/.merged.tmp" | ||
$COLLECTOR_LOGS && run_command "cat \"$CWD/conf/logs.conf\"" >>"$COLLECTOR_OUTPUT_DIR/.merged.tmp" | ||
$COLLECTOR_SUSPICIOUS_FILES && run_command "cat \"$CWD/conf/suspicious_files.conf\"" >>"$COLLECTOR_OUTPUT_DIR/.merged.tmp" | ||
|
||
# first we need to search for directories which names were added to conf files | ||
run_command "ufind \"$MOUNT_POINT\" \"$LOGS_MAX_DEPTH\" \"$COLLECTOR_OUTPUT_DIR/.exclude.tmp\" \"$COLLECTOR_OUTPUT_DIR/.merged.tmp\" \"d\" \"\" " "$COLLECTOR_OUTPUT_DIR/.directories.tmp" | ||
# merge the paths added to conf/logs.conf with the ones found above | ||
run_command "cat \"$COLLECTOR_OUTPUT_DIR/.merged.tmp\" | grep -v \"^#\" | grep -v \"^$\" | grep \"^/\" | sed 's:^/:'\"$MOUNT_POINT\"'/:; s://*:/:g; s:/$::g'" "$COLLECTOR_OUTPUT_DIR/.directories.tmp" | ||
# sort and uniq | ||
run_command "cat \"$COLLECTOR_OUTPUT_DIR/.directories.tmp\" | sort | uniq" "$COLLECTOR_OUTPUT_DIR/.directories_sort_uniq.tmp" | ||
# search paths | ||
run_command "cat \"$COLLECTOR_OUTPUT_DIR/.directories_sort_uniq.tmp\" | while read line; do ufind \"\$line\" \"$LOGS_MAX_DEPTH\" \"$COLLECTOR_OUTPUT_DIR/.exclude_names.tmp\" \"\" \"f\" \"$LOGS_MAX_FILE_SIZE\" \"$DATE_RANGE_T1\" \"$DATE_RANGE_T2\"; done " "$COLLECTOR_OUTPUT_DIR/.files.tmp" | ||
# search for file names | ||
run_command "ufind \"$MOUNT_POINT\" \"$LOGS_MAX_DEPTH\" \"$COLLECTOR_OUTPUT_DIR/.exclude.tmp\" \"$COLLECTOR_OUTPUT_DIR/.merged.tmp\" \"f\" \"$LOGS_MAX_FILE_SIZE\" \"$DATE_RANGE_T1\" \"$DATE_RANGE_T2\"" "$COLLECTOR_OUTPUT_DIR/.files.tmp" | ||
|
||
# remove temporary files | ||
run_command "rm -f \"$COLLECTOR_OUTPUT_DIR/.merged.tmp\"" "/dev/null" | ||
run_command "rm -f \"$COLLECTOR_OUTPUT_DIR/.directories.tmp\"" "/dev/null" | ||
run_command "rm -f \"$COLLECTOR_OUTPUT_DIR/.directories_sort_uniq.tmp\"" "/dev/null" | ||
|
||
fi | ||
|
||
if $COLLECTOR_USER; then | ||
|
||
USER_HOME_LIST=`get_user_home_list` | ||
|
||
if [ -n "$USER_HOME_LIST" ]; then | ||
|
||
echo "$USER_HOME_LIST" | while read USER_HOME_DIR || [ -n "$USER_HOME_DIR" ]; do | ||
USER_HOME_DIR=`sanitize_path "$MOUNT_POINT/$USER_HOME_DIR"` | ||
logging D "Collecting user files from $USER_HOME_DIR\n" | ||
|
||
# if home dir is / (like in some systems where root home dir is /) | ||
# uac will limit the search by setting the -maxdepth to 2 | ||
FIND_MAXDEPTH_PARAMETER="$USER_FILES_MAX_DEPTH" | ||
if [ "$USER_HOME_DIR" = "/" ]; then | ||
FIND_MAXDEPTH_PARAMETER="2" | ||
fi | ||
|
||
# exclude paths | ||
run_command "cat \"$CWD/conf/exclude.conf\" | grep -v \"^#\" | grep -v \"^$\" | grep \"^/\" | sed 's:^/:'\"$USER_HOME_DIR\"'/:; s://*:/:g; s:/$::g'" "$COLLECTOR_OUTPUT_DIR/.exclude.tmp" | ||
|
||
# first we need to search for directories which names were added to conf/user_files.conf | ||
run_command "ufind \"$USER_HOME_DIR\" \"$FIND_MAXDEPTH_PARAMETER\" \"$COLLECTOR_OUTPUT_DIR/.exclude.tmp\" \"$CWD/conf/user_files.conf\" \"d\" \"\" " "$COLLECTOR_OUTPUT_DIR/.directories.tmp" | ||
# merge the paths added to conf/user_files.conf with the ones found above | ||
run_command "cat \"$CWD/conf/user_files.conf\" | grep -v \"^#\" | grep -v \"^$\" | grep \"^/\" | sed 's:^/:'\"$USER_HOME_DIR\"'/:; s://*:/:g; s:/$::g'" "$COLLECTOR_OUTPUT_DIR/.directories.tmp" | ||
# sort and uniq | ||
run_command "cat \"$COLLECTOR_OUTPUT_DIR/.directories.tmp\" | sort | uniq" "$COLLECTOR_OUTPUT_DIR/.directories_sort_uniq.tmp" | ||
# search paths | ||
run_command "cat \"$COLLECTOR_OUTPUT_DIR/.directories_sort_uniq.tmp\" | while read line; do ufind \"\$line\" \"$FIND_MAXDEPTH_PARAMETER\" \"$COLLECTOR_OUTPUT_DIR/.exclude.tmp\" \"\" \"f\" \"$USER_FILES_MAX_FILE_SIZE\" \"$DATE_RANGE_T1\" \"$DATE_RANGE_T2\"; done " "$COLLECTOR_OUTPUT_DIR/.files.tmp" | ||
# search for file names | ||
run_command "ufind \"$USER_HOME_DIR\" \"$FIND_MAXDEPTH_PARAMETER\" \"$COLLECTOR_OUTPUT_DIR/.exclude.tmp\" \"$CWD/conf/user_files.conf\" \"f\" \"$USER_FILES_MAX_FILE_SIZE\" \"$DATE_RANGE_T1\" \"$DATE_RANGE_T2\"" "$COLLECTOR_OUTPUT_DIR/.files.tmp" | ||
|
||
# remove temporary files | ||
run_command "rm -f \"$COLLECTOR_OUTPUT_DIR/.directories.tmp\"" "/dev/null" | ||
run_command "rm -f \"$COLLECTOR_OUTPUT_DIR/.directories_sort_uniq.tmp\"" "/dev/null" | ||
|
||
done | ||
|
||
fi | ||
fi | ||
|
||
# remove UAC working directory from the collection, sort and uniq | ||
run_command "cat \"$COLLECTOR_OUTPUT_DIR/.files.tmp\" | grep -v \"$CWD\" | sort | uniq" "$COLLECTOR_OUTPUT_DIR/files.txt" | ||
|
||
if ${TAR_TOOL_AVAILABLE} && ${GZIP_TOOL_AVAILABLE}; then | ||
# archive and compress data | ||
run_command "archive_compress_data \"$COLLECTOR_OUTPUT_DIR/files.txt\" \"$COLLECTOR_OUTPUT_DIR/files.tar.gz\" true" | ||
elif ${TAR_TOOL_AVAILABLE}; then | ||
# archive data | ||
run_command "archive_data \"$COLLECTOR_OUTPUT_DIR/files.txt\" \"$COLLECTOR_OUTPUT_DIR/files.tar\" true" | ||
else | ||
# just copy data | ||
run_command "copy_data \"$COLLECTOR_OUTPUT_DIR/files.txt\" \"$COLLECTOR_OUTPUT_DIR\"" | ||
fi | ||
|
||
# remove temporary files | ||
run_command "rm -f \"$COLLECTOR_OUTPUT_DIR/.exclude.tmp\"" "/dev/null" | ||
run_command "rm -f \"$COLLECTOR_OUTPUT_DIR/.exclude_names.tmp\"" "/dev/null" | ||
run_command "rm -f \"$COLLECTOR_OUTPUT_DIR/.files.tmp\"" "/dev/null" | ||
|
||
fi |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.