Commit 04cd1acfc16565f202755ef7df65e6d1a33dfb7a
1 parent
f8dfbefc
Exists in
master
before 开题答辩~~~
Showing
23 changed files
with
36 additions
and
56 deletions
Show diff stats
common.pyc
No preview for this file type
mjpeg/__init__.pyc
No preview for this file type
mjpeg/base.pyc
No preview for this file type
mjpeg/dct.pyc
No preview for this file type
msteg/__init__.pyc
No preview for this file type
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 |
@@ -92,7 +93,7 @@ class MPB(StegBase): | @@ -92,7 +93,7 @@ class MPB(StegBase): | ||
92 | :return: TPM - 3-D tensor, numpy array of size (2*T+1, 2*T+1, 4) | 93 | :return: TPM - 3-D tensor, numpy array of size (2*T+1, 2*T+1, 4) |
93 | """ | 94 | """ |
94 | 95 | ||
95 | - # return self._get_trans_prob_mat_orig(ciq, T) | 96 | + return self._get_trans_prob_mat_orig(ciq, T) |
96 | 97 | ||
97 | 98 | ||
98 | # timer = Timer() | 99 | # timer = Timer() |
@@ -105,17 +106,17 @@ class MPB(StegBase): | @@ -105,17 +106,17 @@ class MPB(StegBase): | ||
105 | Fd = ciq[:-1, :-1] - ciq[1:, 1:] | 106 | Fd = ciq[:-1, :-1] - ciq[1:, 1:] |
106 | Fm = ciq[:-1, 1:] - ciq[1:, :-1] | 107 | Fm = ciq[:-1, 1:] - ciq[1:, :-1] |
107 | 108 | ||
108 | - Fh1 = Fh[:-1, :-1] | ||
109 | - Fh2 = Fh[:-1, 1:] | 109 | + Fh1 = Fh[:-1, :-1].ravel() |
110 | + Fh2 = Fh[:-1, 1:].ravel() | ||
110 | 111 | ||
111 | - Fv1 = Fv[:-1, :-1] | ||
112 | - Fv2 = Fv[1:, :-1] | 112 | + Fv1 = Fv[:-1, :-1].ravel() |
113 | + Fv2 = Fv[1:, :-1].ravel() | ||
113 | 114 | ||
114 | - Fd1 = Fd[:-1, :-1] | ||
115 | - Fd2 = Fd[1:, 1:] | 115 | + Fd1 = Fd[:-1, :-1].ravel() |
116 | + Fd2 = Fd[1:, 1:].ravel() | ||
116 | 117 | ||
117 | - Fm1 = Fm[:-1, 1:] | ||
118 | - Fm2 = Fm[1:, :-1] | 118 | + Fm1 = Fm[:-1, 1:].ravel() |
119 | + Fm2 = Fm[1:, :-1].ravel() | ||
119 | 120 | ||
120 | 121 | ||
121 | 122 | ||
@@ -127,7 +128,19 @@ class MPB(StegBase): | @@ -127,7 +128,19 @@ class MPB(StegBase): | ||
127 | # TPM[Fm1.ravel(), Fm2.ravel(), 3] += 1 | 128 | # TPM[Fm1.ravel(), Fm2.ravel(), 3] += 1 |
128 | # timer.report() | 129 | # timer.report() |
129 | 130 | ||
130 | - # 1.936746s | 131 | + # 1.459668s |
132 | + # timer.mark() | ||
133 | + # for i in range(len(Fh1)): | ||
134 | + # TPM[Fh1[i], Fh2[i], 0] += 1 | ||
135 | + # for i in range(len(Fv1)): | ||
136 | + # TPM[Fv1[i], Fv2[i], 1] += 1 | ||
137 | + # for i in range(len(Fd1)): | ||
138 | + # TPM[Fd1[i], Fd2[i], 2] += 1 | ||
139 | + # for i in range(len(Fm1)): | ||
140 | + # TPM[Fm1[i], Fm2[i], 3] += 1 | ||
141 | + # timer.report() | ||
142 | + | ||
143 | + # 1.463982s | ||
131 | # timer.mark() | 144 | # timer.mark() |
132 | for m, n in zip(Fh1.ravel(), Fh2.ravel()): | 145 | for m, n in zip(Fh1.ravel(), Fh2.ravel()): |
133 | TPM[m, n, 0] += 1 | 146 | TPM[m, n, 0] += 1 |
msteg/steganalysis/MPB.pyc
No preview for this file type
msteg/steganalysis/__init__.pyc
No preview for this file type
msteg/steganography/F3.pyc
No preview for this file type
msteg/steganography/F4.pyc
No preview for this file type
msteg/steganography/F5.pyc
No preview for this file type
msteg/steganography/LSB.pyc
No preview for this file type
msteg/steganography/__init__.pyc
No preview for this file type
res/extracted
@@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
1 | -this is to be embeded. | ||
2 | -//0216 | ||
3 | -vim of clang - https://github.com/JBakamovic/yavide | ||
4 | -# Usage overview | ||
5 | -Category | Shortcut | Description | ||
6 | ---------------------------------- | --------------------------------- | --------------------------------- | ||
7 | -**Project management** | | | ||
8 | - | `<Ctrl-s>n` | Create new project | ||
9 | - | `<Ctrl-s>i` | Import project with already existing code base | ||
10 | - | `<Ctrl-s>o` | Open project | ||
11 | - | `<Ctrl-s>c` | Close project | ||
12 | - | `<Ctrl-s>s` | Save project | ||
13 | - | `<Ctrl-s>d` | Delete project | ||
14 | -**Buffer management** | | | ||
15 | - | `<Ctrl-c>` | Close current buffer | ||
16 | - | `<Ctrl-s>` | Save current buffer | ||
17 | - | `<Ctrl-Tab>` | Go to next buffer | ||
18 | - | `<Ctrl-Shift-Tab>` | Go to previous buffer | ||
19 | - | `<Ctrl-Down>` | Scroll buffer by one line (down) | ||
20 | - | `<Ctrl-Up>` | Scroll buffer by one line (up) | ||
21 | -**Buffer modes** | | | ||
22 | - | `<ESC>` | Enter the `normal` mode | ||
23 | - | `<a>` | Enter the `insert` mode (append after cursor) | ||
24 | - | `<i>` | Enter the `insert` mode (insert before cursor) | ||
25 | - | `<Shift-v>` | Enter the `visual` mode (line mode) | ||
26 | - | `<v>` | Enter the `visual` mode (character mode) | ||
27 | -**Buffer editing** | | | ||
28 | - | `<Ctrl-a>` | Select all | ||
29 | - | `<Ctrl-x>` | Cut | ||
30 | - | `<Ctrl-c>` | Copy | ||
31 | - | `<Ctrl-v>` | Paste | ||
32 | - | `<Ctrl-z>` | Undo | ||
33 | - | `<Ctrl-r>` | Redo | ||
34 | - | `<Shift-s>` | Delete the whole line |
7.11 KB
31.1 KB
11.2 KB
7.11 KB
res/steged.jpg
124 KB
83.8 KB
test_steg.py
@@ -27,11 +27,12 @@ txtsample = [116, 104, 105, 115, 32, 105, 115, 32, 116, 111, 32, 98, 101, 32, 10 | @@ -27,11 +27,12 @@ txtsample = [116, 104, 105, 115, 32, 105, 115, 32, 116, 111, 32, 98, 101, 32, 10 | ||
27 | 27 | ||
28 | if __name__ == '__main__': | 28 | if __name__ == '__main__': |
29 | # f3test = F4.F4(sample_key) | 29 | # f3test = F4.F4(sample_key) |
30 | - f3test = F5.F5(sample_key, 3) | ||
31 | - f3test.embed_raw_data("res/test3.jpg", "res/embeded", "res/steged.jpg") | 30 | + f3test = F5.F5(sample_key, 1) |
31 | + # f3test.embed_raw_data("res/test3.jpg", "res/embeded", "res/steged.jpg") | ||
32 | + f3test.embed_raw_data("res/thulib2.jpg", "res/lena64gray.jpg", "res/steged.jpg") | ||
32 | 33 | ||
33 | # f3test2 = F4.F4(sample_key) | 34 | # f3test2 = F4.F4(sample_key) |
34 | - f3test.extract_raw_data("res/steged.jpg", "res/extracted") | 35 | + f3test.extract_raw_data("res/steged.jpg", "res/extracted.jpg") |
35 | print f3test.get_key() | 36 | print f3test.get_key() |
36 | pass | 37 | pass |
37 | 38 |
test_steganal.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 | from mjpeg import * | 4 | from mjpeg import * |
5 | -from msteg.steganography import LSB, F3, F4, F5 | ||
6 | -from msteg.steganalysis import MPB | 5 | +from msteg.steganography import LSB, F3, F4, F5 |
6 | +from msteg.steganalysis import MPB | ||
7 | 7 | ||
8 | from common import * | 8 | from common import * |
9 | 9 | ||
@@ -29,14 +29,14 @@ if __name__ == '__main__': | @@ -29,14 +29,14 @@ if __name__ == '__main__': | ||
29 | 29 | ||
30 | timer.mark() | 30 | timer.mark() |
31 | ima = Jpeg("res/test3.jpg", key=sample_key) | 31 | ima = Jpeg("res/test3.jpg", key=sample_key) |
32 | - timer.report() # 0.006490s | 32 | + timer.report() # 0.006490s |
33 | 33 | ||
34 | ciq = ima.coef_arrays[colorMap['Y']] | 34 | ciq = ima.coef_arrays[colorMap['Y']] |
35 | - timer.report() # 0.000019s | 35 | + timer.report() # 0.000019s |
36 | 36 | ||
37 | mpbSteg = MPB.MPB() | 37 | mpbSteg = MPB.MPB() |
38 | - tpm = mpbSteg.get_trans_prob_mat(ciq) | ||
39 | - timer.report() # 1.365718s | 38 | + tpm = mpbSteg._get_trans_prob_mat_orig(ciq) |
39 | + timer.report() # 1.365718s | ||
40 | 40 | ||
41 | print tpm, tpm.shape | 41 | print tpm, tpm.shape |
42 | pass | 42 | pass |