Commit ca73c96ffed6bf2f37a19c26f579a89e16be0c30
1 parent
10b4f63f
Exists in
master
and in
2 other branches
Transformed into independent module!!!
Showing
24 changed files
with
55 additions
and
50 deletions
Show diff stats
mdata/CV.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | __author__ = 'chunk' | 2 | __author__ = 'chunk' |
| 3 | 3 | ||
| 4 | -from mdata import * | ||
| 5 | -from mfeat import HOG, IntraBlockDiff | ||
| 6 | -from mspark import SC | 4 | +from . import * |
| 5 | +from ..mfeat import HOG, IntraBlockDiff | ||
| 6 | +from ..mspark import SC | ||
| 7 | +from ..common import * | ||
| 7 | 8 | ||
| 8 | import os, sys | 9 | import os, sys |
| 9 | from PIL import Image | 10 | from PIL import Image |
| 10 | from hashlib import md5 | 11 | from hashlib import md5 |
| 11 | import csv | 12 | import csv |
| 12 | import shutil | 13 | import shutil |
| 13 | -from common import * | ||
| 14 | import json | 14 | import json |
| 15 | import collections | 15 | import collections |
| 16 | import happybase | 16 | import happybase |
mdata/CV.pyc
No preview for this file type
mdata/MSR.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | __author__ = 'chunk' | 2 | __author__ = 'chunk' |
| 3 | 3 | ||
| 4 | -from mdata import * | ||
| 5 | -from mfeat import HOG, IntraBlockDiff | ||
| 6 | -from mspark import SC | 4 | +from . import * |
| 5 | +from ..mfeat import HOG, IntraBlockDiff | ||
| 6 | +from ..mspark import SC | ||
| 7 | +from ..common import * | ||
| 7 | 8 | ||
| 8 | import os, sys | 9 | import os, sys |
| 9 | import base64 | 10 | import base64 |
| @@ -12,7 +13,6 @@ from io import BytesIO | @@ -12,7 +13,6 @@ from io import BytesIO | ||
| 12 | from hashlib import md5 | 13 | from hashlib import md5 |
| 13 | import csv | 14 | import csv |
| 14 | import shutil | 15 | import shutil |
| 15 | -from common import * | ||
| 16 | import json | 16 | import json |
| 17 | import collections | 17 | import collections |
| 18 | import itertools | 18 | import itertools |
mdata/MSR.pyc
No preview for this file type
mfeat/HOG.py
| @@ -7,9 +7,9 @@ chunkplus@gmail.com | @@ -7,9 +7,9 @@ chunkplus@gmail.com | ||
| 7 | """ | 7 | """ |
| 8 | __author__ = 'hadoop' | 8 | __author__ = 'hadoop' |
| 9 | 9 | ||
| 10 | -from mfeat import * | 10 | +from . import * |
| 11 | +from ..common import * | ||
| 11 | 12 | ||
| 12 | -from common import * | ||
| 13 | import numpy as np | 13 | import numpy as np |
| 14 | from PIL import Image | 14 | from PIL import Image |
| 15 | import cv2 | 15 | import cv2 |
mfeat/HOG.pyc
No preview for this file type
mfeat/IntraBlockDiff.py
| 1 | __author__ = 'chunk' | 1 | __author__ = 'chunk' |
| 2 | 2 | ||
| 3 | -from mfeat import * | 3 | +from . import * |
| 4 | +from ..common import * | ||
| 5 | +from ..mjpeg import * | ||
| 6 | +from ..msteg import * | ||
| 7 | +from ..msteg.steganalysis import MPB | ||
| 4 | 8 | ||
| 5 | -from common import * | ||
| 6 | import numpy as np | 9 | import numpy as np |
| 7 | 10 | ||
| 8 | -from mjpeg import * | ||
| 9 | -from msteg import * | ||
| 10 | -from msteg.steganalysis import MPB | ||
| 11 | - | ||
| 12 | - | ||
| 13 | class FeatIntraBlockDiff(FeatureBase): | 11 | class FeatIntraBlockDiff(FeatureBase): |
| 14 | def __init__(self): | 12 | def __init__(self): |
| 15 | FeatureBase.__init__(self) | 13 | FeatureBase.__init__(self) |
mfeat/IntraBlockDiff.pyc
No preview for this file type
mfeat/__init__.py
mfeat/__init__.pyc
No preview for this file type
mmodel/SVM.py
| @@ -5,12 +5,12 @@ SVM Model. | @@ -5,12 +5,12 @@ SVM Model. | ||
| 5 | chunkplus@gmail.com | 5 | chunkplus@gmail.com |
| 6 | 2014 Dec | 6 | 2014 Dec |
| 7 | ''' | 7 | ''' |
| 8 | -from mfeat import * | ||
| 9 | -from mmodel import * | ||
| 10 | -from svmutil import * | ||
| 11 | -from mspark import SC | 8 | +from ..mfeat import * |
| 9 | +from . import * | ||
| 10 | +from .svmutil import * | ||
| 11 | +from ..mspark import SC | ||
| 12 | +from ..common import * | ||
| 12 | 13 | ||
| 13 | -from common import * | ||
| 14 | import numpy as np | 14 | import numpy as np |
| 15 | import csv | 15 | import csv |
| 16 | import json | 16 | import json |
mmodel/SVM.pyc
No preview for this file type
mspark/SC.py
| 1 | __author__ = 'chunk' | 1 | __author__ = 'chunk' |
| 2 | 2 | ||
| 3 | +from ..common import * | ||
| 4 | + | ||
| 3 | import sys | 5 | import sys |
| 4 | -from common import * | ||
| 5 | from dependencies import * | 6 | from dependencies import * |
| 6 | from pyspark import SparkConf, SparkContext | 7 | from pyspark import SparkConf, SparkContext |
| 7 | from pyspark.mllib.classification import LogisticRegressionWithSGD, SVMWithSGD | 8 | from pyspark.mllib.classification import LogisticRegressionWithSGD, SVMWithSGD |
mspark/SC.pyc
No preview for this file type
msteg/__init__.py
| @@ -2,8 +2,8 @@ __author__ = 'chunk' | @@ -2,8 +2,8 @@ __author__ = 'chunk' | ||
| 2 | 2 | ||
| 3 | import numpy as np | 3 | import numpy as np |
| 4 | 4 | ||
| 5 | -import mjpeg | ||
| 6 | -from common import * | 5 | +from ..mjpeg import Jpeg |
| 6 | +from ..common import * | ||
| 7 | 7 | ||
| 8 | __all__ = ['StegBase', 'sample_key'] | 8 | __all__ = ['StegBase', 'sample_key'] |
| 9 | 9 | ||
| @@ -31,7 +31,7 @@ class StegBase(object): | @@ -31,7 +31,7 @@ class StegBase(object): | ||
| 31 | """ | 31 | """ |
| 32 | Returns DCT coefficients of the cover image. | 32 | Returns DCT coefficients of the cover image. |
| 33 | """ | 33 | """ |
| 34 | - self.cov_jpeg = mjpeg.Jpeg(img_path) | 34 | + self.cov_jpeg = Jpeg(img_path) |
| 35 | self.key = self.cov_jpeg.getkey() | 35 | self.key = self.cov_jpeg.getkey() |
| 36 | self.cov_data = self.cov_jpeg.getCoefBlocks() | 36 | self.cov_data = self.cov_jpeg.getCoefBlocks() |
| 37 | return self.cov_data | 37 | return self.cov_data |
msteg/__init__.pyc
No preview for this file type
msteg/steganalysis/ChiSquare.py
| @@ -22,7 +22,7 @@ from scipy.stats import chisquare | @@ -22,7 +22,7 @@ from scipy.stats import chisquare | ||
| 22 | import matplotlib.pyplot as plt | 22 | import matplotlib.pyplot as plt |
| 23 | import itertools as it | 23 | import itertools as it |
| 24 | 24 | ||
| 25 | -from msteg import * | 25 | +from .. import * |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | class ChiSquare(StegBase): | 28 | class ChiSquare(StegBase): |
msteg/steganalysis/MPB.py
| @@ -6,9 +6,10 @@ Yun Q. Shi, et al - A Markov Process Based Approach to Effective Attacking JPEG | @@ -6,9 +6,10 @@ Yun Q. Shi, et al - A Markov Process Based Approach to Effective Attacking JPEG | ||
| 6 | import time | 6 | import time |
| 7 | import math | 7 | import math |
| 8 | import numpy as np | 8 | import numpy as np |
| 9 | -from msteg import * | ||
| 10 | -import mjpeg | ||
| 11 | -from common import * | 9 | + |
| 10 | +from .. import * | ||
| 11 | +from ...mjpeg import Jpeg,colorMap | ||
| 12 | +from ...common import * | ||
| 12 | 13 | ||
| 13 | import csv | 14 | import csv |
| 14 | import json | 15 | import json |
| @@ -237,8 +238,8 @@ class MPB(StegBase): | @@ -237,8 +238,8 @@ class MPB(StegBase): | ||
| 237 | with open('res/tmp.model', 'rb') as modelfile: | 238 | with open('res/tmp.model', 'rb') as modelfile: |
| 238 | clf = pickle.load(modelfile) | 239 | clf = pickle.load(modelfile) |
| 239 | 240 | ||
| 240 | - im = mjpeg.Jpeg(image, key=sample_key) | ||
| 241 | - ciq = im.coef_arrays[mjpeg.colorMap['Y']] | 241 | + im = Jpeg(image, key=sample_key) |
| 242 | + ciq = im.coef_arrays[colorMap['Y']] | ||
| 242 | tpm = self.get_trans_prob_mat(ciq) | 243 | tpm = self.get_trans_prob_mat(ciq) |
| 243 | 244 | ||
| 244 | return clf.predict(tpm) | 245 | return clf.predict(tpm) |
| @@ -268,8 +269,8 @@ class MPB(StegBase): | @@ -268,8 +269,8 @@ class MPB(StegBase): | ||
| 268 | svm = cv2.SVM() | 269 | svm = cv2.SVM() |
| 269 | svm.load('res/svm_data.model') | 270 | svm.load('res/svm_data.model') |
| 270 | 271 | ||
| 271 | - im = mjpeg.Jpeg(image, key=sample_key) | ||
| 272 | - ciq = im.coef_arrays[mjpeg.colorMap['Y']] | 272 | + im = Jpeg(image, key=sample_key) |
| 273 | + ciq = im.coef_arrays[colorMap['Y']] | ||
| 273 | tpm = self.get_trans_prob_mat(ciq) | 274 | tpm = self.get_trans_prob_mat(ciq) |
| 274 | 275 | ||
| 275 | return svm.predict(tpm) | 276 | return svm.predict(tpm) |
msteg/steganalysis/MPB.pyc
No preview for this file type
msteg/steganography/F3.py
| @@ -3,8 +3,8 @@ __author__ = 'chunk' | @@ -3,8 +3,8 @@ __author__ = 'chunk' | ||
| 3 | 3 | ||
| 4 | import math | 4 | import math |
| 5 | import numpy as np | 5 | import numpy as np |
| 6 | -from msteg import * | ||
| 7 | -from common import * | 6 | +from .. import * |
| 7 | +from ...common import * | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | class F3(StegBase): | 10 | class F3(StegBase): |
msteg/steganography/F4-simple.py
| @@ -11,8 +11,9 @@ which is not included in the original description of F4. | @@ -11,8 +11,9 @@ which is not included in the original description of F4. | ||
| 11 | """ | 11 | """ |
| 12 | 12 | ||
| 13 | import numpy as np | 13 | import numpy as np |
| 14 | -from msteg import * | ||
| 15 | -from common import * | 14 | + |
| 15 | +from .. import * | ||
| 16 | +from ...common import * | ||
| 16 | 17 | ||
| 17 | 18 | ||
| 18 | class F4(StegBase): | 19 | class F4(StegBase): |
msteg/steganography/F4.py
| @@ -2,9 +2,10 @@ __author__ = 'chunk' | @@ -2,9 +2,10 @@ __author__ = 'chunk' | ||
| 2 | 2 | ||
| 3 | import numpy as np | 3 | import numpy as np |
| 4 | import numpy.random as rnd | 4 | import numpy.random as rnd |
| 5 | -from msteg import * | ||
| 6 | -import mjpeg | ||
| 7 | -from common import * | 5 | + |
| 6 | +from .. import * | ||
| 7 | +from ...common import * | ||
| 8 | +from ...mjpeg import Jpeg | ||
| 8 | 9 | ||
| 9 | 10 | ||
| 10 | class F4(StegBase): | 11 | class F4(StegBase): |
| @@ -22,7 +23,7 @@ class F4(StegBase): | @@ -22,7 +23,7 @@ class F4(StegBase): | ||
| 22 | """ | 23 | """ |
| 23 | Returns DCT coefficients of the cover image. | 24 | Returns DCT coefficients of the cover image. |
| 24 | """ | 25 | """ |
| 25 | - self.cov_jpeg = mjpeg.Jpeg(img_path, key=self.key) | 26 | + self.cov_jpeg = Jpeg(img_path, key=self.key) |
| 26 | 27 | ||
| 27 | cov_data = self.cov_jpeg.getsignal(channel='Y') | 28 | cov_data = self.cov_jpeg.getsignal(channel='Y') |
| 28 | self.cov_data = np.array(cov_data, dtype=np.int16) | 29 | self.cov_data = np.array(cov_data, dtype=np.int16) |
msteg/steganography/F5.py
| @@ -26,10 +26,11 @@ which embedding function (one of JSteg, F3, F4) should be used. | @@ -26,10 +26,11 @@ which embedding function (one of JSteg, F3, F4) should be used. | ||
| 26 | import math | 26 | import math |
| 27 | import numpy as np | 27 | import numpy as np |
| 28 | import numpy.random as rnd | 28 | import numpy.random as rnd |
| 29 | -from msteg import * | ||
| 30 | -from F4 import F4 | ||
| 31 | -import mjpeg | ||
| 32 | -from common import * | 29 | + |
| 30 | +from .. import * | ||
| 31 | +from .F4 import F4 | ||
| 32 | +from ...mjpeg import Jpeg | ||
| 33 | +from ...common import * | ||
| 33 | 34 | ||
| 34 | 35 | ||
| 35 | class F5(StegBase): | 36 | class F5(StegBase): |
| @@ -53,7 +54,7 @@ class F5(StegBase): | @@ -53,7 +54,7 @@ class F5(StegBase): | ||
| 53 | """ | 54 | """ |
| 54 | Returns DCT coefficients of the cover image. | 55 | Returns DCT coefficients of the cover image. |
| 55 | """ | 56 | """ |
| 56 | - self.cov_jpeg = mjpeg.Jpeg(img_path, key=self.key) | 57 | + self.cov_jpeg = Jpeg(img_path, key=self.key) |
| 57 | 58 | ||
| 58 | cov_data = self.cov_jpeg.getsignal(channel='Y') | 59 | cov_data = self.cov_jpeg.getsignal(channel='Y') |
| 59 | self.cov_data = np.array(cov_data, dtype=np.int16) | 60 | self.cov_data = np.array(cov_data, dtype=np.int16) |
msteg/steganography/LSB.py
| @@ -2,8 +2,9 @@ __author__ = 'chunk' | @@ -2,8 +2,9 @@ __author__ = 'chunk' | ||
| 2 | 2 | ||
| 3 | import time | 3 | import time |
| 4 | import numpy as np | 4 | import numpy as np |
| 5 | -from msteg import * | ||
| 6 | -from common import * | 5 | + |
| 6 | +from .. import * | ||
| 7 | +from ...common import * | ||
| 7 | 8 | ||
| 8 | 9 | ||
| 9 | class LSB(StegBase): | 10 | class LSB(StegBase): |