Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/pages/Dashboard/dashbaord.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { EncrptPublicKeyFile } from "../../cryptography";
import { AddFile, ContractConnect, loadWeb3 } from "../../Web3";
import { StringRetrive } from "../../Ipfs";
import FileBar from "../../components/FileBar";
import {malicious_file_check} from "./malicious_filedata";
import {
Button,
Grid,
Expand Down Expand Up @@ -56,6 +57,13 @@ const DashBoard = (_props) => {
event.preventDefault();
const file = files[0];
setfilename(file.name);
const fileupload=files[0].name
const fileext=fileupload.split('.').reverse()[0]
console.log(malicious_file_check(fileext))
if((malicious_file_check(fileext))){
console.log("hi")
window.alert("Warning! The file you upload is in category of the malicious file types.Please be careful");
}
let reader = new window.FileReader();
reader.readAsArrayBuffer(file);
reader.onloadend = () => convertToBuffer(reader);
Expand Down Expand Up @@ -182,6 +190,7 @@ const DashBoard = (_props) => {
filesize={uploadFiles[0].size}
/>
)}

</div>
</FileDrop>
</div>
Expand Down
192 changes: 192 additions & 0 deletions src/pages/Dashboard/malicious_filedata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
const filetypes=[
"ace",
"ade",
"adp",
"ani",
"app",
"asp",
"aspx",
"asx",
"bas",
"bat",
"cer",
"chm",
"cmd",
"cnt",
"com",
"cpl",
"crt",
"csh",
"der",
"docm",
"exe",
"fxp",
"gadget",
"hlp",
"hpj",
"hta",
"htc",
"inf",
"ins",
"isp",
"its",
"jar",
"js",
"jse",
"ksh",
"lnk",
"mad",
"maf",
"mag",
"mam",
"maq",
"mar",
"mas",
"mat",
"mau",
"mav",
"maw",
"mda",
"mdb",
"mde",
"mdt",
"mdw",
"mdz",
"mht",
"mhtml",
"msc",
"msh",
"msh1",
"msh1xml",
"msh2",
"msh2xml",
"mshxml",
"msi",
"msp",
"mst",
"ops",
"osd",
"pcd",
"pif",
"plg",
"prf",
"prg",
"ps1",
"ps1xml",
"ps2",
"ps2xml",
"psc1",
"psc2",
"pst",
"reg",
"scf",
"scr",
"sct",
"shb",
"shs",
"tmp",
"url",
"vb",
"vbe",
"vbp",
"vbs",
"vsmacros",
"vss",
"vst",
"vsw",
"ws",
"wsc",
"wsf",
"wsh",
"xml",
"py",
"pyc",
"pyo",
"pyw",
"pyz",
"pyzw",
"ps1",
"ps1.xml",
"ps2",
"ps2xml",
"psc1",
"psc2",
"psd1",
"psdm1",
"cdxml",
"pssc      ",
"appref-ms",
"udl",
"wsb",
"cer",
"crt",
"der",
"jar",
"jnlp",
"appcontent-ms",
"settingcontent-ms",
"cnt",
"hpj",
"website",
"webpnp",
"mcf",
"printerexport",
"pl",
"theme",
"vbp",
"xbap",
"xll",
"xnk",
"msu",
"diagcab",
"grp",
"pyc",
"pyo",
"pyw",
"pyz",
"pyzw",
"pst",
"ps1xml",
"ps2",
"ps2xml",
"psc1",
"psc2",
"psd1",
"psdm1cdxml",
"pssc",
"appref-ms",
"udl",
"wsb",
"cer",
"crt",
"der",
"jar",
"jnlp",
"appcontent-ms",
"settingcontent-ms",
"cnt",
"hpj",
"website",
"webpnp",
"mcf",
"printerexport",
"pl",
"theme",
"vbp",
"xbap",
"xll",
"xnk",
"msu",
"diagcab",
"grp"
];

const malicious_file_check=(filetype)=>{
const file_type_found=filetypes.indexOf(filetype);
if(file_type_found==-1){
return false;
}
return true;
}

export {malicious_file_check};
Loading