').addClass('ins-slug').text(slug) : null))
22 | .append(preview ? $('').addClass('ins-search-preview').text(preview) : null)
23 | .attr('data-url', url);
24 | }
25 |
26 | function sectionFactory (type, array) {
27 | var sectionTitle;
28 | var $searchItems;
29 | if (array.length === 0) return null;
30 | sectionTitle = CONFIG.TRANSLATION[type];
31 | switch (type) {
32 | case 'POSTS':
33 | case 'PAGES':
34 | $searchItems = array.map(function (item) {
35 | // Use config.root instead of permalink to fix url issue
36 | return searchItem('file', item.title, null, item.text.slice(0, 150), CONFIG.ROOT_URL + item.path);
37 | });
38 | break;
39 | case 'CATEGORIES':
40 | case 'TAGS':
41 | $searchItems = array.map(function (item) {
42 | return searchItem(type === 'CATEGORIES' ? 'folder' : 'tag', item.name, item.slug, null, item.permalink);
43 | });
44 | break;
45 | default:
46 | return null;
47 | }
48 | return section(sectionTitle).append($searchItems);
49 | }
50 |
51 | function extractToSet (json, key) {
52 | var values = {};
53 | var entries = json.pages.concat(json.posts);
54 | entries.forEach(function (entry) {
55 | if (entry[key]) {
56 | entry[key].forEach(function (value) {
57 | values[value.name] = value;
58 | });
59 | }
60 | });
61 | var result = [];
62 | for (var key in values) {
63 | result.push(values[key]);
64 | }
65 | return result;
66 | }
67 |
68 | function parseKeywords (keywords) {
69 | return keywords.split(' ').filter(function (keyword) {
70 | return !!keyword;
71 | }).map(function (keyword) {
72 | return keyword.toUpperCase();
73 | });
74 | }
75 |
76 | /**
77 | * Judge if a given post/page/category/tag contains all of the keywords.
78 | * @param Object obj Object to be weighted
79 | * @param Array fields Object's fields to find matches
80 | */
81 | function filter (keywords, obj, fields) {
82 | var result = false;
83 | var keywordArray = parseKeywords(keywords);
84 | var containKeywords = keywordArray.filter(function (keyword) {
85 | var containFields = fields.filter(function (field) {
86 | if (!obj.hasOwnProperty(field))
87 | return false;
88 | if (obj[field].toUpperCase().indexOf(keyword) > -1)
89 | return true;
90 | });
91 | if (containFields.length > 0)
92 | return true;
93 | return false;
94 | });
95 | return containKeywords.length === keywordArray.length;
96 | }
97 |
98 | function filterFactory (keywords) {
99 | return {
100 | POST: function (obj) {
101 | return filter(keywords, obj, ['title', 'text']);
102 | },
103 | PAGE: function (obj) {
104 | return filter(keywords, obj, ['title', 'text']);
105 | },
106 | CATEGORY: function (obj) {
107 | return filter(keywords, obj, ['name', 'slug']);
108 | },
109 | TAG: function (obj) {
110 | return filter(keywords, obj, ['name', 'slug']);
111 | }
112 | };
113 | }
114 |
115 | /**
116 | * Calculate the weight of a matched post/page/category/tag.
117 | * @param Object obj Object to be weighted
118 | * @param Array fields Object's fields to find matches
119 | * @param Array weights Weight of every field
120 | */
121 | function weight (keywords, obj, fields, weights) {
122 | var value = 0;
123 | parseKeywords(keywords).forEach(function (keyword) {
124 | var pattern = new RegExp(keyword, 'img'); // Global, Multi-line, Case-insensitive
125 | fields.forEach(function (field, index) {
126 | if (obj.hasOwnProperty(field)) {
127 | var matches = obj[field].match(pattern);
128 | value += matches ? matches.length * weights[index] : 0;
129 | }
130 | });
131 | });
132 | return value;
133 | }
134 |
135 | function weightFactory (keywords) {
136 | return {
137 | POST: function (obj) {
138 | return weight(keywords, obj, ['title', 'text'], [3, 1]);
139 | },
140 | PAGE: function (obj) {
141 | return weight(keywords, obj, ['title', 'text'], [3, 1]);
142 | },
143 | CATEGORY: function (obj) {
144 | return weight(keywords, obj, ['name', 'slug'], [1, 1]);
145 | },
146 | TAG: function (obj) {
147 | return weight(keywords, obj, ['name', 'slug'], [1, 1]);
148 | }
149 | };
150 | }
151 |
152 | function search (json, keywords) {
153 | var WEIGHTS = weightFactory(keywords);
154 | var FILTERS = filterFactory(keywords);
155 | var posts = json.posts;
156 | var pages = json.pages;
157 | var tags = extractToSet(json, 'tags');
158 | var categories = extractToSet(json, 'categories');
159 | return {
160 | posts: posts.filter(FILTERS.POST).sort(function (a, b) { return WEIGHTS.POST(b) - WEIGHTS.POST(a); }).slice(0, 5),
161 | pages: pages.filter(FILTERS.PAGE).sort(function (a, b) { return WEIGHTS.PAGE(b) - WEIGHTS.PAGE(a); }).slice(0, 5),
162 | categories: categories.filter(FILTERS.CATEGORY).sort(function (a, b) { return WEIGHTS.CATEGORY(b) - WEIGHTS.CATEGORY(a); }).slice(0, 5),
163 | tags: tags.filter(FILTERS.TAG).sort(function (a, b) { return WEIGHTS.TAG(b) - WEIGHTS.TAG(a); }).slice(0, 5)
164 | };
165 | }
166 |
167 | function searchResultToDOM (searchResult) {
168 | $container.empty();
169 | for (var key in searchResult) {
170 | $container.append(sectionFactory(key.toUpperCase(), searchResult[key]));
171 | }
172 | }
173 |
174 | function scrollTo ($item) {
175 | if ($item.length === 0) return;
176 | var wrapperHeight = $wrapper[0].clientHeight;
177 | var itemTop = $item.position().top - $wrapper.scrollTop();
178 | var itemBottom = $item[0].clientHeight + $item.position().top;
179 | if (itemBottom > wrapperHeight + $wrapper.scrollTop()) {
180 | $wrapper.scrollTop(itemBottom - $wrapper[0].clientHeight);
181 | }
182 | if (itemTop < 0) {
183 | $wrapper.scrollTop($item.position().top);
184 | }
185 | }
186 |
187 | function selectItemByDiff (value) {
188 | var $items = $.makeArray($container.find('.ins-selectable'));
189 | var prevPosition = -1;
190 | $items.forEach(function (item, index) {
191 | if ($(item).hasClass('active')) {
192 | prevPosition = index;
193 | return;
194 | }
195 | });
196 | var nextPosition = ($items.length + prevPosition + value) % $items.length;
197 | $($items[prevPosition]).removeClass('active');
198 | $($items[nextPosition]).addClass('active');
199 | scrollTo($($items[nextPosition]));
200 | }
201 |
202 | function gotoLink ($item) {
203 | if ($item && $item.length) {
204 | location.href = $item.attr('data-url');
205 | }
206 | }
207 |
208 | $.getJSON(CONFIG.CONTENT_URL, function (json) {
209 | if (location.hash.trim() === '#ins-search') {
210 | $main.addClass('show');
211 | }
212 | $input.on('input', function () {
213 | var keywords = $(this).val();
214 | searchResultToDOM(search(json, keywords));
215 | });
216 | $input.trigger('input');
217 | });
218 |
219 |
220 | $(document).on('click focus', '.search-field', function () {
221 | $main.addClass('show');
222 | $main.find('.ins-search-input').focus();
223 | }).on('click focus', '.search-form-submit', function () {
224 | $main.addClass('show');
225 | $main.find('.ins-search-input').focus();
226 | }).on('click', '.ins-search-item', function () {
227 | gotoLink($(this));
228 | }).on('click', '.ins-close', function () {
229 | $main.removeClass('show');
230 | }).on('keydown', function (e) {
231 | if (!$main.hasClass('show')) return;
232 | switch (e.keyCode) {
233 | case 27: // ESC
234 | $main.removeClass('show'); break;
235 | case 38: // UP
236 | selectItemByDiff(-1); break;
237 | case 40: // DOWN
238 | selectItemByDiff(1); break;
239 | case 13: //ENTER
240 | gotoLink($container.find('.ins-selectable.active').eq(0)); break;
241 | }
242 | });
243 | })(jQuery, window.INSIGHT_CONFIG);
--------------------------------------------------------------------------------
/js/main.js:
--------------------------------------------------------------------------------
1 |
2 | // Highlight current nav item
3 | var hasCurrent = false;
4 | $('#main-nav > li').each(function () {
5 | var url = window.location.href;
6 | if(url.toUpperCase().indexOf($(this).text().trim().toUpperCase()) != -1){
7 | $(this).addClass('current-menu-item current_page_item');
8 | hasCurrent = true;
9 | } else {
10 | $(this).removeClass('current-menu-item current_page_item');
11 | }
12 | });
13 |
14 | if (!hasCurrent) {
15 | $('#main-nav > li:first').addClass('current-menu-item current_page_item');
16 | }
17 |
18 |
19 |
20 | // article toc
21 | var toc = document.getElementById('toc')
22 |
23 | if (toc != null) {
24 | window.addEventListener("scroll", scrollcatelogHandler);
25 | var tocPosition = 194+25;
26 |
27 | function scrollcatelogHandler(e) {
28 | var event = e || window.event,
29 | target = event.target || event.srcElement;
30 | var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
31 | if (scrollTop > tocPosition) {
32 | toc.classList.add("toc-fixed");
33 | } else {
34 | toc.classList.remove("toc-fixed");
35 | }
36 | }
37 | }
38 |
39 |
40 | $('#main-navigation').on('click', function(){
41 | if ($('#main-navigation').hasClass('main-navigation-open')){
42 | $('#main-navigation').removeClass('main-navigation-open');
43 | } else {
44 | $('#main-navigation').addClass('main-navigation-open');
45 | }
46 | });
47 |
48 | $('#content').on('click', function(){
49 | if ($('#main-navigation').hasClass('main-navigation-open')){
50 | $('#main-navigation').removeClass('main-navigation-open');
51 | }
52 | });
--------------------------------------------------------------------------------
/js/script.js:
--------------------------------------------------------------------------------
1 | (function($){
2 | // Search
3 | var $searchWrap = $('#search-form-wrap'),
4 | isSearchAnim = false,
5 | searchAnimDuration = 200;
6 |
7 | var startSearchAnim = function(){
8 | isSearchAnim = true;
9 | };
10 |
11 | var stopSearchAnim = function(callback){
12 | setTimeout(function(){
13 | isSearchAnim = false;
14 | callback && callback();
15 | }, searchAnimDuration);
16 | };
17 |
18 | $('#nav-search-btn').on('click', function(){
19 | if (isSearchAnim) return;
20 |
21 | startSearchAnim();
22 | $searchWrap.addClass('on');
23 | stopSearchAnim(function(){
24 | $('.search-form-input').focus();
25 | });
26 | });
27 |
28 | $('.search-form-input').on('blur', function(){
29 | startSearchAnim();
30 | $searchWrap.removeClass('on');
31 | stopSearchAnim();
32 | });
33 |
34 | // Share
35 | $('body').on('click', function(){
36 | $('.article-share-box.on').removeClass('on');
37 | }).on('click', '.article-share-link', function(e){
38 | e.stopPropagation();
39 |
40 | var $this = $(this),
41 | url = $this.attr('data-url'),
42 | encodedUrl = encodeURIComponent(url),
43 | id = 'article-share-box-' + $this.attr('data-id'),
44 | offset = $this.offset();
45 |
46 | if ($('#' + id).length){
47 | var box = $('#' + id);
48 |
49 | if (box.hasClass('on')){
50 | box.removeClass('on');
51 | return;
52 | }
53 | } else {
54 | var html = [
55 | '',
56 | '
',
57 | '
',
58 | '
',
59 | '
',
60 | '
',
61 | '
',
62 | '
',
63 | '
'
64 | ].join('');
65 |
66 | var box = $(html);
67 |
68 | $('body').append(box);
69 | }
70 |
71 | $('.article-share-box.on').hide();
72 |
73 | box.css({
74 | top: offset.top + 25,
75 | left: offset.left
76 | }).addClass('on');
77 | }).on('click', '.article-share-box', function(e){
78 | e.stopPropagation();
79 | }).on('click', '.article-share-box-input', function(){
80 | $(this).select();
81 | }).on('click', '.article-share-box-link', function(e){
82 | e.preventDefault();
83 | e.stopPropagation();
84 |
85 | window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
86 | });
87 |
88 | // Caption
89 | $('.article-entry').each(function(i){
90 | $(this).find('img').each(function(){
91 | if ($(this).parent().hasClass('fancybox')) return;
92 | if ($(this).parent().parent().hasClass('entry-thumbnail')) return;
93 |
94 | var alt = this.alt;
95 |
96 | if (alt) $(this).after('' + alt + ' ');
97 |
98 | $(this).wrap(' ');
99 | });
100 |
101 | $(this).find('.fancybox').each(function(){
102 | $(this).attr('rel', 'article' + i);
103 | });
104 | });
105 |
106 | if ($.fancybox){
107 | $('.fancybox').fancybox();
108 | }
109 |
110 | // Mobile nav
111 | var $container = $('#container'),
112 | isMobileNavAnim = false,
113 | mobileNavAnimDuration = 200;
114 |
115 | var startMobileNavAnim = function(){
116 | isMobileNavAnim = true;
117 | };
118 |
119 | var stopMobileNavAnim = function(){
120 | setTimeout(function(){
121 | isMobileNavAnim = false;
122 | }, mobileNavAnimDuration);
123 | }
124 |
125 | $('#main-nav-toggle').on('click', function(){
126 | if (isMobileNavAnim) return;
127 |
128 | startMobileNavAnim();
129 | $container.toggleClass('mobile-nav-on');
130 | stopMobileNavAnim();
131 | });
132 |
133 | $('#wrap').on('click', function(){
134 | if (isMobileNavAnim || !$container.hasClass('mobile-nav-on')) return;
135 |
136 | $container.removeClass('mobile-nav-on');
137 | });
138 | })(jQuery);
--------------------------------------------------------------------------------
/js/totop.js:
--------------------------------------------------------------------------------
1 | $(window).scroll(function() {
2 | $(window).scrollTop() > $(window).height()*0.5 ? $("#rocket").addClass("show") : $("#rocket").removeClass("show");
3 | });
4 |
5 | $("#rocket").click(function() {
6 | $("#rocket").addClass("launch");
7 | $("html, body").animate({
8 | scrollTop: 0
9 | }, 1000, function() {
10 | $("#rocket").removeClass("show launch");
11 | });
12 | return false;
13 | });
14 |
15 | $("#homelogo").click(function() {
16 | $("html, body").animate({
17 | scrollTop: $(window).height()
18 | }, 1000, null);
19 | return false;
20 | });
--------------------------------------------------------------------------------
/papers/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | papers | 威胁情报与溯源分析
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | 7月 02, 2017
126 |
127 |
128 |
129 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
319 |
320 |
321 |
322 |
323 |
338 |
356 |
357 |
358 |
359 |
360 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
390 |
391 |
398 |
399 |
407 |
408 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
--------------------------------------------------------------------------------
/preview/browser-support.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecWiki/ti/ae315cfc9afed51d2ddab7c5cc19554f5c982d11/preview/browser-support.png
--------------------------------------------------------------------------------
/preview/code-theme-default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecWiki/ti/ae315cfc9afed51d2ddab7c5cc19554f5c982d11/preview/code-theme-default.png
--------------------------------------------------------------------------------
/preview/code-theme.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecWiki/ti/ae315cfc9afed51d2ddab7c5cc19554f5c982d11/preview/code-theme.jpg
--------------------------------------------------------------------------------
/preview/hipaper-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecWiki/ti/ae315cfc9afed51d2ddab7c5cc19554f5c982d11/preview/hipaper-preview.png
--------------------------------------------------------------------------------
/preview/logo-preview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecWiki/ti/ae315cfc9afed51d2ddab7c5cc19554f5c982d11/preview/logo-preview.jpg
--------------------------------------------------------------------------------
/preview/mobile-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecWiki/ti/ae315cfc9afed51d2ddab7c5cc19554f5c982d11/preview/mobile-preview.png
--------------------------------------------------------------------------------
/preview/search-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SecWiki/ti/ae315cfc9afed51d2ddab7c5cc19554f5c982d11/preview/search-preview.png
--------------------------------------------------------------------------------
/projects/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | projects | 威胁情报与溯源分析
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | 7月 23, 2017
126 |
127 |
128 |
129 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
314 |
315 |
316 |
317 |
318 |
333 |
351 |
352 |
353 |
354 |
355 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
385 |
386 |
393 |
394 |
402 |
403 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
--------------------------------------------------------------------------------
/tags/papers/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Tag: papers | 威胁情报
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | 7月 02, 2017
127 |
128 |
129 |
130 |
131 | aaaa
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
271 |
272 |
273 |
274 |
275 |
290 |
308 |
309 |
310 |
311 |
312 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
339 |
340 |
347 |
348 |
356 |
357 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
--------------------------------------------------------------------------------