Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/undo-ransomware/ransomware_detection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias <ilovemilk@wusa.io>2020-08-22 15:51:03 +0300
committerMatthias <ilovemilk@wusa.io>2020-08-22 15:51:03 +0300
commitaee82db023f41dda1cfc1996008a4979aefd5cad (patch)
tree21442a7733ab0f8c568ab97096779803e7a7b88c
parentef36788ed484ef105f1f9dc4f5ef033759922775 (diff)
update compatibility to nextcloud version 19feature/nextcloud-19-compatibility
-rw-r--r--appinfo/info.xml4
-rw-r--r--js/utils.js2
-rw-r--r--js/vendor/filesize/filesize.js189
-rw-r--r--js/vendor/filesize/filesize.min.js6
-rw-r--r--js/vendor/filesize/filesize.min.js.map1
-rw-r--r--templates/index.php1
-rw-r--r--templates/scan.php1
7 files changed, 201 insertions, 3 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index c98bb38..2b6c715 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,7 +5,7 @@
<name>Ransomware recovery</name>
<summary><![CDATA[This app offers synchronization monitoring and a file storage scanner for a guided user-controlled one-step ransomare recovery.]]></summary>
<description><![CDATA[This app monitors file operations during the synchronization to detect ransomware attacks and also offers a post infection file storage scanner, which works even if it happend that you didn't have this app installed during an attack. This is done by using generic indicators for a guided user-controlled one-step recovery utilizing the integrated file versioning methods. Sponsored by the German Federal Ministry of Education and Research, and Prototype Fund.]]></description>
- <version>0.7.1</version>
+ <version>0.8.0</version>
<licence>agpl</licence>
<author mail="matthias.held@uni-konstanz.de">Matthias Held</author>
<namespace>RansomwareDetection</namespace>
@@ -22,7 +22,7 @@
<screenshot>https://github.com/undo-ransomware/ransomware_detection/raw/master/screenshots/monitoring-0.3.0.png</screenshot>
<screenshot>https://github.com/undo-ransomware/ransomware_detection/raw/master/screenshots/scan-files-0.3.0.png</screenshot>
<dependencies>
- <nextcloud min-version="18" max-version="18"/>
+ <nextcloud min-version="19" max-version="19"/>
</dependencies>
<background-jobs>
diff --git a/js/utils.js b/js/utils.js
index ac11271..e4d5ac8 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -129,7 +129,7 @@
// size
if (typeof(fileData.size) !== 'undefined' && fileData.size >= 0) {
- simpleSize = humanFileSize(parseInt(fileData.size, 10), true);
+ simpleSize = filesize(parseInt(fileData.size, 10), true);
} else {
simpleSize = t('ransomware_detection', 'Pending');
}
diff --git a/js/vendor/filesize/filesize.js b/js/vendor/filesize/filesize.js
new file mode 100644
index 0000000..7bc7775
--- /dev/null
+++ b/js/vendor/filesize/filesize.js
@@ -0,0 +1,189 @@
+"use strict";
+
+/**
+ * filesize
+ *
+ * @copyright 2020 Jason Mulligan <jason.mulligan@avoidwork.com>
+ * @license BSD-3-Clause
+ * @version 6.1.0
+ */
+(function (global) {
+ var b = /^(b|B)$/,
+ symbol = {
+ iec: {
+ bits: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"],
+ bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
+ },
+ jedec: {
+ bits: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
+ bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
+ }
+ },
+ fullform = {
+ iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
+ jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
+ };
+ /**
+ * filesize
+ *
+ * @method filesize
+ * @param {Mixed} arg String, Int or Float to transform
+ * @param {Object} descriptor [Optional] Flags
+ * @return {String} Readable file size String
+ */
+
+ function filesize(arg) {
+ var descriptor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var result = [],
+ val = 0,
+ e = void 0,
+ base = void 0,
+ bits = void 0,
+ ceil = void 0,
+ full = void 0,
+ fullforms = void 0,
+ locale = void 0,
+ localeOptions = void 0,
+ neg = void 0,
+ num = void 0,
+ output = void 0,
+ round = void 0,
+ unix = void 0,
+ separator = void 0,
+ spacer = void 0,
+ standard = void 0,
+ symbols = void 0;
+
+ if (isNaN(arg)) {
+ throw new TypeError("Invalid number");
+ }
+
+ bits = descriptor.bits === true;
+ unix = descriptor.unix === true;
+ base = descriptor.base || 2;
+ round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
+ locale = descriptor.locale !== void 0 ? descriptor.locale : "";
+ localeOptions = descriptor.localeOptions || {};
+ separator = descriptor.separator !== void 0 ? descriptor.separator : "";
+ spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
+ symbols = descriptor.symbols || {};
+ standard = base === 2 ? descriptor.standard || "jedec" : "jedec";
+ output = descriptor.output || "string";
+ full = descriptor.fullform === true;
+ fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
+ e = descriptor.exponent !== void 0 ? descriptor.exponent : -1;
+ num = Number(arg);
+ neg = num < 0;
+ ceil = base > 2 ? 1000 : 1024; // Flipping a negative number to determine the size
+
+ if (neg) {
+ num = -num;
+ } // Determining the exponent
+
+
+ if (e === -1 || isNaN(e)) {
+ e = Math.floor(Math.log(num) / Math.log(ceil));
+
+ if (e < 0) {
+ e = 0;
+ }
+ } // Exceeding supported length, time to reduce & multiply
+
+
+ if (e > 8) {
+ e = 8;
+ }
+
+ if (output === "exponent") {
+ return e;
+ } // Zero is now a special case because bytes divide by 1
+
+
+ if (num === 0) {
+ result[0] = 0;
+ result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
+ } else {
+ val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
+
+ if (bits) {
+ val = val * 8;
+
+ if (val >= ceil && e < 8) {
+ val = val / ceil;
+ e++;
+ }
+ }
+
+ result[0] = Number(val.toFixed(e > 0 ? round : 0));
+
+ if (result[0] === ceil && e < 8 && descriptor.exponent === void 0) {
+ result[0] = 1;
+ e++;
+ }
+
+ result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
+
+ if (unix) {
+ result[1] = standard === "jedec" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, "") : result[1];
+
+ if (b.test(result[1])) {
+ result[0] = Math.floor(result[0]);
+ result[1] = "";
+ }
+ }
+ } // Decorating a 'diff'
+
+
+ if (neg) {
+ result[0] = -result[0];
+ } // Applying custom symbol
+
+
+ result[1] = symbols[result[1]] || result[1];
+
+ if (locale === true) {
+ result[0] = result[0].toLocaleString();
+ } else if (locale.length > 0) {
+ result[0] = result[0].toLocaleString(locale, localeOptions);
+ } else if (separator.length > 0) {
+ result[0] = result[0].toString().replace(".", separator);
+ } // Returning Array, Object, or String (default)
+
+
+ if (output === "array") {
+ return result;
+ }
+
+ if (full) {
+ result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
+ }
+
+ if (output === "object") {
+ return {
+ value: result[0],
+ symbol: result[1],
+ exponent: e
+ };
+ }
+
+ return result.join(spacer);
+ } // Partial application for functional programming
+
+
+ filesize.partial = function (opt) {
+ return function (arg) {
+ return filesize(arg, opt);
+ };
+ }; // CommonJS, AMD, script tag
+
+
+ if (typeof exports !== "undefined") {
+ module.exports = filesize;
+ } else if (typeof define === "function" && define.amd !== void 0) {
+ define(function () {
+ return filesize;
+ });
+ } else {
+ global.filesize = filesize;
+ }
+})(typeof window !== "undefined" ? window : global);
diff --git a/js/vendor/filesize/filesize.min.js b/js/vendor/filesize/filesize.min.js
new file mode 100644
index 0000000..c21bda9
--- /dev/null
+++ b/js/vendor/filesize/filesize.min.js
@@ -0,0 +1,6 @@
+/*
+ 2020 Jason Mulligan <jason.mulligan@avoidwork.com>
+ @version 6.1.0
+*/
+"use strict";!function(e){var x=/^(b|B)$/,M={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},w={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function t(e){var i,t,o,n,b,r,a,l,s,d,u,c,f,p,B,y=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},g=[],v=0,m=void 0,h=void 0;if(isNaN(e))throw new TypeError("Invalid number");return t=!0===y.bits,u=!0===y.unix,i=y.base||2,d=void 0!==y.round?y.round:u?1:2,r=void 0!==y.locale?y.locale:"",a=y.localeOptions||{},c=void 0!==y.separator?y.separator:"",f=void 0!==y.spacer?y.spacer:u?"":" ",B=y.symbols||{},p=2===i&&y.standard||"jedec",s=y.output||"string",n=!0===y.fullform,b=y.fullforms instanceof Array?y.fullforms:[],m=void 0!==y.exponent?y.exponent:-1,o=2<i?1e3:1024,(l=(h=Number(e))<0)&&(h=-h),(-1===m||isNaN(m))&&(m=Math.floor(Math.log(h)/Math.log(o)))<0&&(m=0),8<m&&(m=8),"exponent"===s?m:(0===h?(g[0]=0,g[1]=u?"":M[p][t?"bits":"bytes"][m]):(v=h/(2===i?Math.pow(2,10*m):Math.pow(1e3,m)),t&&o<=(v*=8)&&m<8&&(v/=o,m++),g[0]=Number(v.toFixed(0<m?d:0)),g[0]===o&&m<8&&void 0===y.exponent&&(g[0]=1,m++),g[1]=10===i&&1===m?t?"kb":"kB":M[p][t?"bits":"bytes"][m],u&&(g[1]="jedec"===p?g[1].charAt(0):0<m?g[1].replace(/B$/,""):g[1],x.test(g[1])&&(g[0]=Math.floor(g[0]),g[1]=""))),l&&(g[0]=-g[0]),g[1]=B[g[1]]||g[1],!0===r?g[0]=g[0].toLocaleString():0<r.length?g[0]=g[0].toLocaleString(r,a):0<c.length&&(g[0]=g[0].toString().replace(".",c)),"array"===s?g:(n&&(g[1]=b[m]?b[m]:w[p][m]+(t?"bit":"byte")+(1===g[0]?"":"s")),"object"===s?{value:g[0],symbol:g[1],exponent:m}:g.join(f)))}t.partial=function(i){return function(e){return t(e,i)}},"undefined"!=typeof exports?module.exports=t:"function"==typeof define&&void 0!==define.amd?define(function(){return t}):e.filesize=t}("undefined"!=typeof window?window:global);
+//# sourceMappingURL=filesize.min.js.map \ No newline at end of file
diff --git a/js/vendor/filesize/filesize.min.js.map b/js/vendor/filesize/filesize.min.js.map
new file mode 100644
index 0000000..6d395fd
--- /dev/null
+++ b/js/vendor/filesize/filesize.min.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["filesize.js"],"names":["global","b","symbol","iec","bits","bytes","jedec","fullform","filesize","arg","base","ceil","full","fullforms","locale","localeOptions","neg","output","round","unix","separator","spacer","standard","symbols","descriptor","arguments","length","undefined","result","val","e","num","isNaN","TypeError","Array","exponent","Number","Math","floor","log","pow","toFixed","charAt","replace","test","toLocaleString","toString","value","join","partial","opt","exports","module","define","amd","window"],"mappings":";;;;AAAA,cASA,SAAWA,GACT,IAAIC,EAAI,UACJC,EAAS,CACXC,IAAK,CACHC,KAAM,CAAC,IAAK,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,OAC7DC,MAAO,CAAC,IAAK,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,QAEhEC,MAAO,CACLF,KAAM,CAAC,IAAK,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,MACtDC,MAAO,CAAC,IAAK,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,QAGvDE,EAAW,CACbJ,IAAK,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QAClEG,MAAO,CAAC,GAAI,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,MAAO,QAAS,UAWtE,SAASE,EAASC,GAChB,IAIIC,EACAN,EACAO,EACAC,EACAC,EACAC,EACA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AAwC,IAAfA,OAAOC,IAChDD,OAAO,WACL,OAAO7C,IAGTR,EAAOQ,SAAWA,EAjLtB,CAmLqB,oBAAX+C,OAAyBA,OAASvD","file":"filesize.min.js"} \ No newline at end of file
diff --git a/templates/index.php b/templates/index.php
index 8793b69..3a63118 100644
--- a/templates/index.php
+++ b/templates/index.php
@@ -21,6 +21,7 @@ script('ransomware_detection', 'app');
script('ransomware_detection', 'utils');
script('ransomware_detection', 'filelist');
script('ransomware_detection', 'vendor/font-awesome/fontawesome-all');
+script('ransomware_detection', 'vendor/filesize/filesize');
style('ransomware_detection', 'style');
?>
<div id="app-navigation">
diff --git a/templates/scan.php b/templates/scan.php
index bd2de43..c5bfff0 100644
--- a/templates/scan.php
+++ b/templates/scan.php
@@ -21,6 +21,7 @@ script('ransomware_detection', 'app');
script('ransomware_detection', 'utils');
script('ransomware_detection', 'scan');
script('ransomware_detection', 'vendor/font-awesome/fontawesome-all');
+script('ransomware_detection', 'vendor/filesize/filesize');
style('ransomware_detection', 'style');
?>
<div id="app-navigation">