Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Stegosuite
/
Stegosuite
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
3
Merge Requests
0
Wiki
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit c9bfae67
authored
2017-09-06 12:25:21 -0300
by
Tobias
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added "disable-noise-detection" to CLI
1 parent
fe406b47
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
19 deletions
src/main/java/org/stegosuite/application/StegosuitePresenter.java
src/main/java/org/stegosuite/ui/cli/Cli.java
src/main/java/org/stegosuite/ui/cli/CliParser.java
src/main/java/org/stegosuite/application/StegosuitePresenter.java
View file @
c9bfae6
...
...
@@ -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
);
...
...
src/main/java/org/stegosuite/ui/cli/Cli.java
View file @
c9bfae6
...
...
@@ -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
)
{}
}
src/main/java/org/stegosuite/ui/cli/CliParser.java
View file @
c9bfae6
...
...
@@ -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
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment