Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script asking to replace file. #15

Open
jmertin opened this issue Dec 29, 2021 · 2 comments
Open

Script asking to replace file. #15

jmertin opened this issue Dec 29, 2021 · 2 comments

Comments

@jmertin
Copy link

jmertin commented Dec 29, 2021

During a run, getting:

[root@lvnprod029619 cloud-agent]# cat log4j_findings.stderr
replace /tmp/log4j_for_extract/importlib/__init__.pyc? [y]es, [n]o, [A]ll, [N]one, [r]ename:

comes from archive have the same file twice. it however stops the entire scan.
Currently, circumvented on my system by using this diff:

diff --git a/log4j_findings.sh b/log4j_findings.sh
index 02fe7cb..791ce38 100644
--- a/log4j_findings.sh
+++ b/log4j_findings.sh
@@ -29,9 +29,9 @@ handle_war_ear_zip()
 {
        war_file=$1
        if jar1=`unzip -l $war_file | awk '{print $NF}'| grep -i ".jar" 2> /dev/null `;then
-               rm -rf /tmp/log4j_for_extract/
+               rm -rf /tmp/log4j_for_extract
                mkdir /tmp/log4j_for_extract;
-               unzip -d /tmp/log4j_for_extract/ $war_file > /dev/null
+               unzip -do /tmp/log4j_for_extract/ $war_file > /dev/null
        fi;
        jars=`find /tmp/log4j_for_extract -type f -regextype posix-egrep -iregex ".+\.(jar)$"  2> /dev/null`; 
        for i in $jars; do

Dunno if it is the right way to do it though... but the unzip version I have running on my system works with that. Colleague of mine does not need it.

@skandothlab
Copy link

@prerana-ambre ; You can use unzip -Bd on line# 34, this switch will rename the duplicate file and not overwrite the same file.

@KToddE
Copy link

KToddE commented Jan 6, 2022

NOTE: not sure if the problem I am encountering is this issue or one of the others noted that causes the same prompt.

This problem occurred very early in the scan on two CentOS servers (script downloaded 1/4). The latest version (downloaded 10 minutes ago) seems to have partially corrected this problem; the most recent scan ran appreciably longer but again encountered this problem.

Both are this CentOS 7 Kernel with the latest updates: Linux 3.10.0-1160.49.1.el7.x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants