Skip to content

Commit

Permalink
Fix webswing and kali detection
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Bennetts <psiinon@gmail.com>
  • Loading branch information
psiinon committed Nov 23, 2021
1 parent ba55831 commit f4f02ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zap/src/main/java/org/parosproxy/paros/Constant.java
Expand Up @@ -297,8 +297,9 @@ public final class Constant {
public static final String FLATPAK_NAME = "flatpak";
private static final String SNAP_FILE = "meta/snap.yaml";
public static final String SNAP_NAME = "snapcraft";
private static final String WEBSWING_ENVVAR = "WEBSWING_VERSION";
private static final String HOME_ENVVAR = "HOME";
public static final String WEBSWING_NAME = "webswing";
public static final String KALI_NAME = "kali";

//
// Home dir for ZAP, i.e. where the config file is. Can be set on cmdline, otherwise will be set
Expand Down Expand Up @@ -1604,7 +1605,8 @@ public static boolean isInContainer() {
File snapFile = new File(SNAP_FILE);
if (isLinux() && containerFile.exists()) {
inContainer = true;
boolean inWebSwing = System.getenv(WEBSWING_ENVVAR) != null;
String home = System.getenv(HOME_ENVVAR);
boolean inWebSwing = home != null && home.contains(WEBSWING_NAME);
try {
containerName =
new String(
Expand All @@ -1624,6 +1626,8 @@ public static boolean isInContainer() {
} else if (snapFile.exists()) {
inContainer = true;
containerName = SNAP_NAME;
} else if (isKali()) {
containerName = KALI_NAME;
} else {
inContainer = false;
}
Expand Down

0 comments on commit f4f02ee

Please sign in to comment.