Skip to content

Instantly share code, notes, and snippets.

@mhubig
Created December 12, 2011 13:32
Show Gist options
  • Save mhubig/1467161 to your computer and use it in GitHub Desktop.
Save mhubig/1467161 to your computer and use it in GitHub Desktop.
Patch to get stegdetect v0.6 compile on Mac OS X (got from macports.org).
diff --git a/Makefile.in b/Makefile.in
index 4bfbb1e..0a61813 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -70,7 +70,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
JPEGDIR = ./jpeg-6b
JPEGINC = -I$(JPEGDIR)
-JPEGLIB = -L$(JPEGDIR) -ljpeg
+JPEGLIB = $(JPEGDIR)/libjpeg.a
JPEGDEP = $(JPEGDIR)/libjpeg.a
FILEDIR = ./file
diff --git a/configure b/configure
index 8953760..6c5610a 100755
--- a/configure
+++ b/configure
@@ -2563,6 +2563,10 @@ echo "$as_me:2562: checking blowfish object" >&5
echo $ECHO_N "checking blowfish object... $ECHO_C" >&6
case "$target" in
+*-*-darwin*)
+ echo "$as_me:2563: result: bf_enc.o" >&5
+echo "${ECHO_T}bf_enc.o" >&6
+ BFOBJ=bf_enc.o;;
i386-*-*)
echo "$as_me:2567: result: bf-586.o" >&5
echo "${ECHO_T}bf-586.o" >&6
diff --git a/file/Makefile.in b/file/Makefile.in
index 7dcb893..b569184 100644
--- a/file/Makefile.in
+++ b/file/Makefile.in
@@ -504,9 +504,9 @@ magic: Header Localstuff $(magic_FRAGMENTS)
done >> $@
magic.inc: magic
- echo -n "\"" > $@
+ /bin/echo -n "\"" > $@
sed -e 's/\\/\\\\/g' -e 's/"/\\\"/g' -e 's/$$/\ \\/' magic >> $@
- echo -n "\"" >> $@
+ /bin/echo -n "\"" >> $@
file.1: Makefile file.man
@rm -f $@
diff --git a/stegdetect.c b/stegdetect.c
index 74814a5..ea521f5 100644
--- a/stegdetect.c
+++ b/stegdetect.c
@@ -78,7 +78,7 @@ char *progname;
float DCThist[257];
float scale = 1; /* Sensitivity scaling */
-static int debug = 0;
+static int stegdebug = 0;
static int quiet = 0;
static int ispositive = 0; /* Current images contain stego */
static char *transformname; /* Current transform name */
@@ -135,7 +135,7 @@ buildDCThist(short *data, int x, int y)
sum = count = 0;
for (i = x; i < y; i++) {
if ((i & ~63) == i) {
- if (debug & DBG_PRINTONES)
+ if (stegdebug & DBG_PRINTONES)
fprintf(stdout, "%d] %d\n", i, count);
sum += count;
count = 0;
@@ -159,7 +159,7 @@ buildDCThist(short *data, int x, int y)
DCThist[off + 128]++;
}
- if (debug & DBG_PRINTHIST) {
+ if (stegdebug & DBG_PRINTHIST) {
for (i = 0; i < 256; i++) {
fprintf(stdout, "%4d: %8.1f\n", i - 128, DCThist[i]);
}
@@ -291,7 +291,7 @@ unify_outguess(float *hist, float *theo, float *obs, float *pdiscard)
*/
if ((fbar > f/4) &&
((f - f/3) - (fbar + f/3) > 0)) {
- if ((debug & DBG_CHIDIFF) && (one || two))
+ if ((stegdebug & DBG_CHIDIFF) && (one || two))
fprintf(stdout,
"%4d: %8.3f - %8.3f skipped (%f)\n",
i*2 - 128,
@@ -356,7 +356,7 @@ chi2(float *DCTtheo, float *DCTobs, int size, float discard)
ymt += DCTobs[i];
ytt += DCTtheo[i];
- if (debug & DBG_CHIDIFF) {
+ if (stegdebug & DBG_CHIDIFF) {
if (DCTobs[i] || DCTtheo[i])
fprintf(stdout, "%4d: %8.3f - %8.3f\n", i,
DCTobs[i],
@@ -368,7 +368,7 @@ chi2(float *DCTtheo, float *DCTobs, int size, float discard)
chi = ymt - ytt;
- if (debug & DBG_CHICALC) {
+ if (stegdebug & DBG_CHICALC) {
fprintf(stdout,
" (%8.3f - %8.3f)^2 = %8.3f / %8.3f = %8.3f | %8.3f\n",
ymt, ytt,
@@ -388,7 +388,7 @@ chi2(float *DCTtheo, float *DCTobs, int size, float discard)
f = 1 - chi2cdf(sumchi, dgf - 1);
- if (debug & DBG_CHIEND) {
+ if (stegdebug & DBG_CHIEND) {
fprintf(stdout,
"Categories: %d, Chi: %f, Q: %f, dis: %f -> %f\n",
dgf, sumchi, f, discard, f * (1 - discard));
@@ -435,7 +435,7 @@ chi2test(short *data, int bits,
while (_iteration < (imaxiter))
#define BINSEARCH_NEXT(thresh) \
- if (debug & DBG_BINSRCH) \
+ if (stegdebug & DBG_BINSRCH) \
fprintf(stdout, "sum: %f, percent: %f, good: %f\n", \
sum, percent, _good); \
if (_iteration == 0) { \
@@ -481,7 +481,7 @@ histogram_chi_jsteg(short *data, int bits)
break;
if (f > 0.4)
sum += f * percent;
- if ((debug & DBG_CHI) && f != 0)
+ if ((stegdebug & DBG_CHI) && f != 0)
fprintf(stdout, "%04f[:] %8.5f%% %f\n",
i, f * 100, sum);
}
@@ -491,7 +491,7 @@ histogram_chi_jsteg(short *data, int bits)
BINSEARCH_IFABORT(end) {
abort:
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout,
"Accumulation: no detection possible\n");
return (-1);
@@ -528,8 +528,8 @@ histogram_chi_jsteg(short *data, int bits)
}
}
- if ((debug & DBG_CHI) &&
- ((debug & DBG_PRINTZERO) || f != 0))
+ if ((stegdebug & DBG_CHI) &&
+ ((stegdebug & DBG_PRINTZERO) || f != 0))
fprintf(stdout, "%04f: %8.5f%%\n",
i, f * 100);
}
@@ -537,7 +537,7 @@ histogram_chi_jsteg(short *data, int bits)
length = jsteg_size(data, bits, NULL);
minlen = where/8;
maxlen = (where + percent)/8;
- if (debug & DBG_ENDVAL) {
+ if (stegdebug & DBG_ENDVAL) {
fprintf(stdout,
"Accumulation (%d): %f%% - %f (%f) (%d:%d - %d)\n",
(int)percent,
@@ -596,7 +596,7 @@ histogram_chi_outguess(short *data, int bits)
f = chi2test(data, bits, unify_false_outguess,
off - range, off + range);
sum += f;
- if ((debug & DBG_CHI) && f != 0)
+ if ((stegdebug & DBG_CHI) && f != 0)
fprintf(stdout, "%04d[:] %8.5f%%\n",
i, f * 100);
}
@@ -618,8 +618,8 @@ histogram_chi_outguess(short *data, int bits)
sum += f;
if (f > 0.001)
count++;
- if ((debug & DBG_CHI) &&
- ((debug & DBG_PRINTZERO) || f != 0))
+ if ((stegdebug & DBG_CHI) &&
+ ((stegdebug & DBG_PRINTZERO) || f != 0))
fprintf(stdout, "%04d: %8.5f%%\n", i, f * 100);
}
@@ -631,7 +631,7 @@ histogram_chi_outguess(short *data, int bits)
norm = sum / norm_outguess[off];
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout,
"Accumulation (%4.1f%%): %8.3f%% (%8.3f%%) (%4.1f)\n",
percent,
@@ -714,7 +714,7 @@ jphide_zero_one(void)
else if (sum >= 15 && res <= -1)
negative = 1;
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
printf("Zero/One: %d : %d -> %5.1f%s\n",
one, zero, (float)res/2, negative ? " **" : "");
@@ -740,7 +740,7 @@ jphide_empty_pair(void)
(!DCThist[i] || !DCThist[i+1]))
res++;
}
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
printf("Empty pairs: %d\n", res);
if (res > 3)
return (1);
@@ -770,7 +770,7 @@ histogram_chi_jphide(short *data, int bits)
buildDCTreset();
f = chi2test(data, bits, unify_jphide, 0, jphpos[0]);
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout, "Pos[0]: %04d: %8.5f%%\n", jphpos[0], f*100);
/* If JPhide was used, we should get a high value at this position */
@@ -793,7 +793,7 @@ histogram_chi_jphide(short *data, int bits)
false = 0;
f2 = chi2test(data, bits, unify_false_jphide, 0, jphpos[0]);
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout, "Pos[0]: %04d[:] %8.5f%%: %8.5f%%\n",
jphpos[0], f2*100, (f2 - f)*100);
@@ -802,13 +802,13 @@ histogram_chi_jphide(short *data, int bits)
return (0);
f = chi2test(data, bits, unify_jphide, jphpos[0]/2, jphpos[0]);
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout, "Pos[0]/2: %04d: %8.5f%%\n", jphpos[0], f*100);
if (f < 0.9)
return (0);
f2 = chi2test(data, bits, unify_false_jphide, jphpos[0]/2, jphpos[0]);
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout, "Pos[0]/2: %04d[:] %8.5f%%: %8.5f%%\n",
jphpos[0], f2*100, (f2 - f)*100);
if (f2 * 0.95 > f)
@@ -816,7 +816,7 @@ histogram_chi_jphide(short *data, int bits)
f = chi2test(data, bits, unify_jphide, 0, jphpos[0]/2);
f2 = chi2test(data, bits, unify_false_jphide, 0, jphpos[0]/2);
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout, "0->1/2: %04d[:] %8.5f%% %8.5f%%\n",
jphpos[0], f*100, f2*100);
@@ -864,8 +864,8 @@ histogram_chi_jphide(short *data, int bits)
else if (f < 0.2)
break;
- if ((debug & DBG_CHI) &&
- ((debug & DBG_PRINTZERO) || f != 0))
+ if ((stegdebug & DBG_CHI) &&
+ ((stegdebug & DBG_PRINTZERO) || f != 0))
fprintf(stdout, "%04d: %8.5f%% %8.5f%% %.2f %.2f %s\n",
i, f * 100, f2*100, sum, false,
(i <= jphpos[0] && f2*0.99 > f) ||
@@ -876,7 +876,7 @@ histogram_chi_jphide(short *data, int bits)
sum /= 1000;
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout, "Accumulation (neg = %d, %d): %f%% [%d]\n",
negative, range, sum * 100, jphpos[1]);
@@ -913,7 +913,7 @@ histogram_chi_jphide_old(short *data, int bits)
sum += f;
else if (f < 0.2)
break;
- if ((debug & DBG_CHI) && f != 0)
+ if ((stegdebug & DBG_CHI) && f != 0)
fprintf(stdout, "%04d[:] %8.5f%%\n",
i, f * 100);
}
@@ -939,12 +939,12 @@ histogram_chi_jphide_old(short *data, int bits)
else if (f < 0.2)
break;
- if ((debug & DBG_CHI) &&
- ((debug & DBG_PRINTZERO) || f != 0))
+ if ((stegdebug & DBG_CHI) &&
+ ((stegdebug & DBG_PRINTZERO) || f != 0))
fprintf(stdout, "%04d: %8.5f%%\n", i, f * 100);
}
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout, "Accumulation (%4.0f): %f%%\n",
percent,
sum * 100);
@@ -1277,7 +1277,7 @@ detect(char *filename, int scans)
if (jdcts != NULL)
free(jdcts);
scans = 0;
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout,
"Disabled by comment check: %d\n",
ncomments);
@@ -1291,7 +1291,7 @@ detect(char *filename, int scans)
if (jdcts != NULL)
free(jdcts);
scans = 0;
- if (debug & DBG_ENDVAL)
+ if (stegdebug & DBG_ENDVAL)
fprintf(stdout,
"Disabled by header check: %d.%d %#0x\n",
major, minor, marker);
@@ -1478,7 +1478,7 @@ main(int argc, char *argv[])
fprintf(stdout, "Stegdetect Version %s\n", VERSION);
exit(1);
case 'd':
- debug = atoi(optarg);
+ stegdebug = atoi(optarg);
break;
case 't':
scans = 0;
@@ -1580,7 +1580,7 @@ main(int argc, char *argv[])
detect(line, scans);
}
- if (debug & FLAG_JPHIDESTAT) {
+ if (stegdebug & FLAG_JPHIDESTAT) {
fprintf(stdout, "Positive rejected because of\n"
"\tRunlength: %d\n"
"\tZero-One: %d\n"
@evandrix
Copy link

doesn't seem to work on OS X Mountain Lion 10.8.2

@phreakazoid21
Copy link

Doesn't work on 10.9 either.

Here's a gist with the output from make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment