Commit c9bfae67 by Tobias

added "disable-noise-detection" to CLI

1 parent fe406b47
......@@ -36,6 +36,10 @@ public class StegosuitePresenter implements EmbeddingDoneListener, ExtractingDon
this.embedding = embeddingFor(image);
}
public void setPointFilter(int value) {
this.embedding.setPointFilter(value);
}
private Embedding embeddingFor(ImageFormat image) {
Embedding embedding = EmbeddingFactory.getEmbedding(image);
embedding.setPointFilter(1);
......
......@@ -15,7 +15,9 @@ import org.stegosuite.model.exception.SteganoExtractException;
import org.stegosuite.model.exception.SteganoImageException;
import org.stegosuite.ui.gui.ImageUtils;
public class Cli implements StegosuiteUI {
public class Cli
implements
StegosuiteUI {
private static final Logger LOG = LoggerFactory.getLogger(Cli.class);
private ImageFormat image;
......@@ -23,20 +25,22 @@ public class Cli implements StegosuiteUI {
public void embed(CommandLine cmd) {
String steganogramPath = cmd.getOptionValue("e");
if (!validImageFormat(steganogramPath)) return;
if (!validImageFormat(steganogramPath))
return;
pointFilter(cmd);
String message = cmd.getOptionValue("m");
String[] files = cmd.getOptionValues("f");
if (files != null) {
for (String string : files) {
presenter.addFileToPayload(string);
}
}
String key = cmd.getOptionValue("k");
embed(message, key);
}
......@@ -46,7 +50,10 @@ public class Cli implements StegosuiteUI {
public void extract(CommandLine cmd) {
String steganogramPath = cmd.getOptionValue("x");
if (!validImageFormat(steganogramPath)) return;
if (!validImageFormat(steganogramPath))
return;
pointFilter(cmd);
String key = cmd.getOptionValue("k");
extract(key);
}
......@@ -57,11 +64,21 @@ public class Cli implements StegosuiteUI {
public void capacity(CommandLine cmd) {
String steganogramPath = cmd.getOptionValue("c");
if (!validImageFormat(steganogramPath)) return;
if (!validImageFormat(steganogramPath))
return;
pointFilter(cmd);
int capacity = presenter.getEmbeddingCapacity();
LOG.info("Capacity: {}",ImageUtils.formatSize(capacity));
LOG.info("Capacity: {}", ImageUtils.formatSize(capacity));
}
private void pointFilter(CommandLine cmd) {
if (cmd.hasOption("disable-noise-detection")) {
presenter.setPointFilter(0);
} else {
presenter.setPointFilter(1);
}
}
private boolean validImageFormat(String steganogramPath) {
image = getImageFormat(steganogramPath);
if (image == null) {
......@@ -82,8 +99,7 @@ public class Cli implements StegosuiteUI {
}
private void showFormatNotSupportedError() {
LOG.error("Error: Currently only these file types are supported: {}",
supportedFormats());
LOG.error("Error: Currently only these file types are supported: {}", supportedFormats());
}
private String supportedFormats() {
......@@ -101,7 +117,8 @@ public class Cli implements StegosuiteUI {
}
@Override
public void extractingCompleted(String extractedMessage, List<String> filePaths, Visualizer visualizer, ImageData imageData) {
public void extractingCompleted(String extractedMessage, List<String> filePaths, Visualizer visualizer,
ImageData imageData) {
LOG.info("Extracting completed");
LOG.info("Extracted message: {}", extractedMessage);
if (!filePaths.isEmpty()) {
......@@ -112,10 +129,8 @@ public class Cli implements StegosuiteUI {
}
@Override
public void embeddingCompleted(ImageFormat embeddedImage, String outputPath, Visualizer visualizer) {
}
public void embeddingCompleted(ImageFormat embeddedImage, String outputPath, Visualizer visualizer) {}
@Override
public void addPayloadFile(String filename, String extension, long fileSize) {
}
public void addPayloadFile(String filename, String extension, long fileSize) {}
}
......@@ -41,7 +41,7 @@ public class CliParser {
options.addOption(stegokey); // TODO
options.addOption(cryptokey); // TODO
options.addOption(noNoise); // TODO
options.addOption(noNoise);
options.addOption(extractPath); // TODO
try {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!