Skip to content

Commit 5d5a0a5

Browse files
committed
Fixed csv report formatting, v2.5.1
1 parent a07d887 commit 5d5a0a5

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
log4j2-scan is a single binary command-line tool for CVE-2021-44228 vulnerability scanning and mitigation patch. It also supports nested JAR file scanning and patch. It also detects CVE-2021-45046 (log4j 2.15.0), CVE-2021-45105 (log4j 2.16.0), CVE-2021-4104 (log4j 1.x), and CVE-2021-42550 (logback 0.9-1.2.7) vulnerabilities.
44

55
### Download
6-
* [log4j2-scan 2.5.0 (Windows x64, 7z)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.0/logpresso-log4j2-scan-2.5.0-win64.7z)
7-
* [log4j2-scan 2.5.0 (Windows x64, zip)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.0/logpresso-log4j2-scan-2.5.0-win64.zip)
6+
* [log4j2-scan 2.5.1 (Windows x64, 7z)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.1/logpresso-log4j2-scan-2.5.1-win64.7z)
7+
* [log4j2-scan 2.5.1 (Windows x64, zip)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.1/logpresso-log4j2-scan-2.5.1-win64.zip)
88
* If you get `VCRUNTIME140.dll not found` error, install [Visual C++ Redistributable](https://docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170).
99
* If native executable doesn't work, use the JAR instead. 32bit is not supported.
1010
* 7zip is available from www.7zip.org, and is open source and free.
11-
* [log4j2-scan 2.5.0 (Linux x64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.0/logpresso-log4j2-scan-2.5.0-linux.tar.gz)
12-
* [log4j2-scan 2.5.0 (Linux aarch64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.0/logpresso-log4j2-scan-2.5.0-linux-aarch64.tar.gz)
11+
* [log4j2-scan 2.5.1 (Linux x64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.1/logpresso-log4j2-scan-2.5.1-linux.tar.gz)
12+
* [log4j2-scan 2.5.1 (Linux aarch64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.1/logpresso-log4j2-scan-2.5.1-linux-aarch64.tar.gz)
1313
* If native executable doesn't work, use the JAR instead. 32bit is not supported.
14-
* [log4j2-scan 2.5.0 (Mac OS)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.0/logpresso-log4j2-scan-2.5.0-darwin.tar.gz)
15-
* [log4j2-scan 2.5.0 (Any OS, 20KB)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.0/logpresso-log4j2-scan-2.5.0.jar)
14+
* [log4j2-scan 2.5.1 (Mac OS)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.1/logpresso-log4j2-scan-2.5.1-darwin.tar.gz)
15+
* [log4j2-scan 2.5.1 (Any OS, 20KB)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.5.1/logpresso-log4j2-scan-2.5.1.jar)
1616

1717
### Build
1818
* [How to build Native Image](https://github.com/logpresso/CVE-2021-44228-Scanner/wiki/FAQ#how-to-build-native-image)
@@ -22,7 +22,7 @@ Just run log4j2-scan.exe or log4j2-scan with target directory path. The logpress
2222

2323
Usage
2424
```
25-
Logpresso CVE-2021-44228 Vulnerability Scanner 2.5.0 (2021-12-21)
25+
Logpresso CVE-2021-44228 Vulnerability Scanner 2.5.1 (2021-12-21)
2626
Usage: log4j2-scan [--scan-log4j1] [--fix] target_path1 target_path2
2727
2828
-f [config_file_path]
@@ -93,7 +93,7 @@ On Linux
9393
```
9494
On UNIX (AIX, Solaris, and so on)
9595
```
96-
java -jar logpresso-log4j2-scan-2.5.0.jar [--fix] target_path
96+
java -jar logpresso-log4j2-scan-2.5.1.jar [--fix] target_path
9797
```
9898

9999
If you add `--fix` option, this program will copy vulnerable original JAR file to .bak file, and create new JAR file without `org/apache/logging/log4j/core/lookup/JndiLookup.class` entry. All .bak files are archived into the single zip file which is named by `log4j2_scan_backup_yyyyMMdd_HHmmss.zip`, then deleted safely. In most environments, JNDI lookup feature will not be used. However, you must use this option at your own risk. You can easily restore original vulnerable JAR files using `--restore` option.

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>com.logpresso</groupId>
88
<artifactId>log4j2-scanner</artifactId>
9-
<version>2.5.0</version>
9+
<version>2.5.1</version>
1010
<packaging>jar</packaging>
1111
<name>Logpresso Log4j2 Scanner</name>
1212

src/main/java/com/logpresso/scanner/Log4j2Scanner.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import com.logpresso.scanner.utils.ZipUtils;
2424

2525
public class Log4j2Scanner {
26-
public static final String VERSION = "2.5.0";
26+
public static final String VERSION = "2.5.1";
2727
public static final String RELEASE_DATE = "2021-12-21";
2828
public static final String BANNER = "Logpresso CVE-2021-44228 Vulnerability Scanner " + VERSION + " (" + RELEASE_DATE + ")";
2929

src/main/java/com/logpresso/scanner/ReportEntry.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ public String getJsonLine(String hostname) {
8989
df.format(reportTime), hostname, escapedPath, escapedEntry, product, version, cve, status, fixed);
9090
}
9191

92-
public String getCsvLine() {
92+
public String getCsvLine(String hostname) {
9393
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
94-
return String.format("\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"%n", path.getAbsolutePath(), entry, product,
95-
version, cve, status, fixed ? "FIXED" : "", df.format(reportTime));
94+
return String.format("\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"%n", hostname, path.getAbsolutePath(),
95+
entry, product, version, cve, status, fixed ? "FIXED" : "", df.format(reportTime));
9696
}
9797
}

src/main/java/com/logpresso/scanner/ReportGenerator.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private static File generateReportFileName(Configuration config, Metrics metrics
118118

119119
private static void writeCsvReport(Configuration config, Map<File, List<ReportEntry>> fileReports, FileOutputStream csvStream)
120120
throws IOException, UnsupportedEncodingException {
121-
String header = String.format("Hostname,Path,Entry,Product,Version,CVE,Status,Fixed,Detected at%n");
121+
String header = String.format("\"Hostname\",\"Path\",\"Entry\",\"Product\",\"Version\",\"CVE\",\"Status\",\"Fixed\",\"Detected at\"%n");
122122
csvStream.write(header.getBytes("utf-8"));
123123

124124
String hostname = getHostname(config.isDebug());
@@ -127,8 +127,7 @@ private static void writeCsvReport(Configuration config, Map<File, List<ReportEn
127127

128128
for (File file : fileReports.keySet()) {
129129
for (ReportEntry entry : fileReports.get(file)) {
130-
String line = entry.getCsvLine();
131-
line = hostname + "," + line;
130+
String line = entry.getCsvLine(hostname);
132131
csvStream.write(line.getBytes("utf-8"));
133132
}
134133
}

0 commit comments

Comments
 (0)