SlideShare a Scribd company logo
Python program to build deep learning algorithm using a CNNs model to detect malware attacks.
The code is working, but I faced issues with the last part of the code, and I needed to know
precisely where the problem was.
I have the dataset of malware and benign in exe, I convert them to grayscale images, and it goes
through the filters, and it shows me the output.
this is the code
import keras from keras.models import Sequential from keras.layers import Dense, Dropout,
Activation, Flatten from keras.layers import Conv2D, MaxPooling2D import numpy as np from
os import listdir from PIL import Image import os.path import numpy as np path =
'/media/malkuwari/New Volume/Ransomware_Detection_using _CNN/mixEXE' h = 256
#height of image w = 256 #width of image # be careful with using this function, it will consume
memory, access to disk and time images = [] for f in listdir('/media/malkuwari/New
Volume/Ransomware_Detection_using _CNN/mixEXE'): with
open(os.path.join('/media/malkuwari/New Volume/Ransomware_Detection_using
_CNN/mixEXE', f), 'rb') as img_set: img_arr = img_set.read(h*w) while img_arr: if len(img_arr)
== h*w and img_arr not in images: images.append(img_arr) img_arr = img_set.read(h*w) #And
you can save them into png files # count = 0 # for img in images: # png =
Image.fromarray(np.reshape(list(img), (h,w)).astype('float32'), mode='L') #
png.save('image_l%d.png'%count) # count += 1 #reshape images to fit into the CNN model
img_list = np.zeros(shape = (len(images), h,w,1), dtype = np.uint8) for j in range(len(images)):
img_list[j,:,:,0] = np.reshape(list(images[j]), (h,w)) img_list = img_list.astype('float32') img_list
/= 255 # ################################################################
#approca 1 failed go back from scrtuch # implement the architecture of the CNN model =
Sequential() #Conv2D Layers model.add(Conv2D(12, (25, 25),
padding='same',input_shape=img_list.shape[1:], activation = 'relu')) model.add(Conv2D(12, (25,
25), activation = 'relu')) #Max Pooling Layer model.add(MaxPooling2D(pool_size=(2, 2)))
#Conv2D Layer model.add(Conv2D(12, (13, 13), padding='same', activation = 'relu'))
model.add(Conv2D(12, (13, 13), activation = 'relu')) #Max Pooling
model.add(MaxPooling2D(pool_size=(2, 2))) #Flattening Layer model.add(Flatten()) #Dense
Layer model.add(Dense(1024, activation = 'relu')) model.add(Dense(1, activation = 'sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['binary_accuracy'])
model.summary()
''' FINALLY If you have a set of executable files from both types (benign and malicious) you can
try to fit the model. You should prepare a list of images for malwares and a list for benign and
here how you fit the model. ''' #Change the parameters to whatever suits you
I already have to files that contain benign files and malicious images, but it shows me
syntax error!
batch_size = 512 epochs = 100 labels = [0 for _ in benign_images ] + [1 for _ in
malicious_images ] model.fit( benign_images + malicious_images , labels, batch_size =
batch_size, epochs = epochs, validation_split = 0.25,
please, if you can help me with this issue and if there is additional coding needed to my project,
thank you

More Related Content

Similar to Python program to build deep learning algorithm using a CNNs model to.docx

I have to understand this code and i have to explain the each line of.pdf
I have to understand this code and i have to explain the each line of.pdfI have to understand this code and i have to explain the each line of.pdf
I have to understand this code and i have to explain the each line of.pdf
shreeaadithyaacellso
 
Denis Sergienko "Pip install driven deep learning"
Denis Sergienko "Pip install driven deep learning"Denis Sergienko "Pip install driven deep learning"
Denis Sergienko "Pip install driven deep learning"
Fwdays
 
I have tried running this code below- and it is working- but the accur.pdf
I have tried running this code below- and it is working- but the accur.pdfI have tried running this code below- and it is working- but the accur.pdf
I have tried running this code below- and it is working- but the accur.pdf
GordonF2XPatersonh
 
What is the UML Class diagram for accident detection using CNN- i have.pdf
What is the UML Class diagram for accident detection using CNN- i have.pdfWhat is the UML Class diagram for accident detection using CNN- i have.pdf
What is the UML Class diagram for accident detection using CNN- i have.pdf
anilagarwal8880432
 
Image classification using cnn
Image classification using cnnImage classification using cnn
Image classification using cnn
Debarko De
 
#Covnet model had been defined class ConvNetNew(torch.nn.Module).pdf
#Covnet model had been defined class ConvNetNew(torch.nn.Module).pdf#Covnet model had been defined class ConvNetNew(torch.nn.Module).pdf
#Covnet model had been defined class ConvNetNew(torch.nn.Module).pdf
computersmartdwarka
 
Generation of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.pptGeneration of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.ppt
DivyaGugulothu
 
could you draw uml diagram for this code from PIL import Image, Im.pdf
could you draw uml diagram for this code from PIL import Image, Im.pdfcould you draw uml diagram for this code from PIL import Image, Im.pdf
could you draw uml diagram for this code from PIL import Image, Im.pdf
murtuzadahadwala3
 
Hello- I hope you are doing well- I am doing my project- which is Rans (1).pdf
Hello- I hope you are doing well- I am doing my project- which is Rans (1).pdfHello- I hope you are doing well- I am doing my project- which is Rans (1).pdf
Hello- I hope you are doing well- I am doing my project- which is Rans (1).pdf
Ian0J2Bondo
 
Intro to computer vision in .net
Intro to computer vision in .netIntro to computer vision in .net
Intro to computer vision in .net
Stephen Lorello
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLAB
Sriram Emarose
 
Python openCV codes
Python openCV codesPython openCV codes
Python openCV codes
Amarjeetsingh Thakur
 
I need  An expert person in machine learning  that can help me . I n.docx
I need  An expert person in machine learning  that can help me . I n.docxI need  An expert person in machine learning  that can help me . I n.docx
I need  An expert person in machine learning  that can help me . I n.docx
elishaoatway
 
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdfI want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
GordonF2XPatersonh
 
[AI07] Revolutionizing Image Processing with Cognitive Toolkit
[AI07] Revolutionizing Image Processing with Cognitive Toolkit[AI07] Revolutionizing Image Processing with Cognitive Toolkit
[AI07] Revolutionizing Image Processing with Cognitive Toolkit
de:code 2017
 
Introduction to Deep Learning and Tensorflow
Introduction to Deep Learning and TensorflowIntroduction to Deep Learning and Tensorflow
Introduction to Deep Learning and Tensorflow
Oswald Campesato
 
Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화
Tae wook kang
 
How the Go runtime implement maps efficiently
How the Go runtime implement maps efficientlyHow the Go runtime implement maps efficiently
How the Go runtime implement maps efficiently
Ting-Li Chou
 
Computer vision
Computer vision Computer vision
Computer vision
Dmitry Ryabokon
 
Cypherock Assessment (1).pdf
Cypherock Assessment (1).pdfCypherock Assessment (1).pdf
Cypherock Assessment (1).pdf
PARNIKA GUPTA
 

Similar to Python program to build deep learning algorithm using a CNNs model to.docx (20)

I have to understand this code and i have to explain the each line of.pdf
I have to understand this code and i have to explain the each line of.pdfI have to understand this code and i have to explain the each line of.pdf
I have to understand this code and i have to explain the each line of.pdf
 
Denis Sergienko "Pip install driven deep learning"
Denis Sergienko "Pip install driven deep learning"Denis Sergienko "Pip install driven deep learning"
Denis Sergienko "Pip install driven deep learning"
 
I have tried running this code below- and it is working- but the accur.pdf
I have tried running this code below- and it is working- but the accur.pdfI have tried running this code below- and it is working- but the accur.pdf
I have tried running this code below- and it is working- but the accur.pdf
 
What is the UML Class diagram for accident detection using CNN- i have.pdf
What is the UML Class diagram for accident detection using CNN- i have.pdfWhat is the UML Class diagram for accident detection using CNN- i have.pdf
What is the UML Class diagram for accident detection using CNN- i have.pdf
 
Image classification using cnn
Image classification using cnnImage classification using cnn
Image classification using cnn
 
#Covnet model had been defined class ConvNetNew(torch.nn.Module).pdf
#Covnet model had been defined class ConvNetNew(torch.nn.Module).pdf#Covnet model had been defined class ConvNetNew(torch.nn.Module).pdf
#Covnet model had been defined class ConvNetNew(torch.nn.Module).pdf
 
Generation of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.pptGeneration of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.ppt
 
could you draw uml diagram for this code from PIL import Image, Im.pdf
could you draw uml diagram for this code from PIL import Image, Im.pdfcould you draw uml diagram for this code from PIL import Image, Im.pdf
could you draw uml diagram for this code from PIL import Image, Im.pdf
 
Hello- I hope you are doing well- I am doing my project- which is Rans (1).pdf
Hello- I hope you are doing well- I am doing my project- which is Rans (1).pdfHello- I hope you are doing well- I am doing my project- which is Rans (1).pdf
Hello- I hope you are doing well- I am doing my project- which is Rans (1).pdf
 
Intro to computer vision in .net
Intro to computer vision in .netIntro to computer vision in .net
Intro to computer vision in .net
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLAB
 
Python openCV codes
Python openCV codesPython openCV codes
Python openCV codes
 
I need  An expert person in machine learning  that can help me . I n.docx
I need  An expert person in machine learning  that can help me . I n.docxI need  An expert person in machine learning  that can help me . I n.docx
I need  An expert person in machine learning  that can help me . I n.docx
 
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdfI want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
 
[AI07] Revolutionizing Image Processing with Cognitive Toolkit
[AI07] Revolutionizing Image Processing with Cognitive Toolkit[AI07] Revolutionizing Image Processing with Cognitive Toolkit
[AI07] Revolutionizing Image Processing with Cognitive Toolkit
 
Introduction to Deep Learning and Tensorflow
Introduction to Deep Learning and TensorflowIntroduction to Deep Learning and Tensorflow
Introduction to Deep Learning and Tensorflow
 
Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화
 
How the Go runtime implement maps efficiently
How the Go runtime implement maps efficientlyHow the Go runtime implement maps efficiently
How the Go runtime implement maps efficiently
 
Computer vision
Computer vision Computer vision
Computer vision
 
Cypherock Assessment (1).pdf
Cypherock Assessment (1).pdfCypherock Assessment (1).pdf
Cypherock Assessment (1).pdf
 

More from LukeQVdGrantg

Provide examples of the -monkey- attempting to be transferred from a s.docx
Provide examples of the -monkey- attempting to be transferred from a s.docxProvide examples of the -monkey- attempting to be transferred from a s.docx
Provide examples of the -monkey- attempting to be transferred from a s.docx
LukeQVdGrantg
 
Provide 3 substantive audit procedures chosen among the following topi.docx
Provide 3 substantive audit procedures chosen among the following topi.docxProvide 3 substantive audit procedures chosen among the following topi.docx
Provide 3 substantive audit procedures chosen among the following topi.docx
LukeQVdGrantg
 
Provide an appropriate response- Determine the probability distributio.docx
Provide an appropriate response- Determine the probability distributio.docxProvide an appropriate response- Determine the probability distributio.docx
Provide an appropriate response- Determine the probability distributio.docx
LukeQVdGrantg
 
Punnett square problems continued Complete the following problems- Lis.docx
Punnett square problems continued Complete the following problems- Lis.docxPunnett square problems continued Complete the following problems- Lis.docx
Punnett square problems continued Complete the following problems- Lis.docx
LukeQVdGrantg
 
public class ThreeTenDLList-T- implements Iterable-T- { -- doubly.docx
public class ThreeTenDLList-T- implements Iterable-T- {      -- doubly.docxpublic class ThreeTenDLList-T- implements Iterable-T- {      -- doubly.docx
public class ThreeTenDLList-T- implements Iterable-T- { -- doubly.docx
LukeQVdGrantg
 
Public - Week 12- Interactive activity 12-1 Learning Outcomes- Discuss.docx
Public - Week 12- Interactive activity 12-1 Learning Outcomes- Discuss.docxPublic - Week 12- Interactive activity 12-1 Learning Outcomes- Discuss.docx
Public - Week 12- Interactive activity 12-1 Learning Outcomes- Discuss.docx
LukeQVdGrantg
 
public class Bitset implements Set{ private boolean set--- pub.docx
public class Bitset implements Set{     private boolean set---     pub.docxpublic class Bitset implements Set{     private boolean set---     pub.docx
public class Bitset implements Set{ private boolean set--- pub.docx
LukeQVdGrantg
 
Protecting the Business 14- Briefly describe any business insurance yo.docx
Protecting the Business 14- Briefly describe any business insurance yo.docxProtecting the Business 14- Briefly describe any business insurance yo.docx
Protecting the Business 14- Briefly describe any business insurance yo.docx
LukeQVdGrantg
 
ProShares UltraPro QQQ has a total asset turnover of 1-29- a debt-equi.docx
ProShares UltraPro QQQ has a total asset turnover of 1-29- a debt-equi.docxProShares UltraPro QQQ has a total asset turnover of 1-29- a debt-equi.docx
ProShares UltraPro QQQ has a total asset turnover of 1-29- a debt-equi.docx
LukeQVdGrantg
 
Properties that Define Life ( 10 points) Matching- Please write the le.docx
Properties that Define Life ( 10 points) Matching- Please write the le.docxProperties that Define Life ( 10 points) Matching- Please write the le.docx
Properties that Define Life ( 10 points) Matching- Please write the le.docx
LukeQVdGrantg
 
Prompt 3- 70- of the light aircraft that disappear while in flight in.docx
Prompt 3- 70- of the light aircraft that disappear while in flight in.docxPrompt 3- 70- of the light aircraft that disappear while in flight in.docx
Prompt 3- 70- of the light aircraft that disappear while in flight in.docx
LukeQVdGrantg
 
Prompt- (Part 1) Is life in the metaverse inevitable or unlikely- Are.docx
Prompt- (Part 1) Is life in the metaverse inevitable or unlikely- Are.docxPrompt- (Part 1) Is life in the metaverse inevitable or unlikely- Are.docx
Prompt- (Part 1) Is life in the metaverse inevitable or unlikely- Are.docx
LukeQVdGrantg
 
Prokaryotes are all gram positive- eukaryotes are all gram negative Pr.docx
Prokaryotes are all gram positive- eukaryotes are all gram negative Pr.docxProkaryotes are all gram positive- eukaryotes are all gram negative Pr.docx
Prokaryotes are all gram positive- eukaryotes are all gram negative Pr.docx
LukeQVdGrantg
 
Prolessor fsadore (Lmy) Invest-a-Lot retired two years ago from Except.docx
Prolessor fsadore (Lmy) Invest-a-Lot retired two years ago from Except.docxProlessor fsadore (Lmy) Invest-a-Lot retired two years ago from Except.docx
Prolessor fsadore (Lmy) Invest-a-Lot retired two years ago from Except.docx
LukeQVdGrantg
 
PROLOG Convert this proposition to Object-Attribute-Value proposition(.docx
PROLOG Convert this proposition to Object-Attribute-Value proposition(.docxPROLOG Convert this proposition to Object-Attribute-Value proposition(.docx
PROLOG Convert this proposition to Object-Attribute-Value proposition(.docx
LukeQVdGrantg
 
Project Part 1- Analysis of the opportunities and risks of a company i.docx
Project Part 1- Analysis of the opportunities and risks of a company i.docxProject Part 1- Analysis of the opportunities and risks of a company i.docx
Project Part 1- Analysis of the opportunities and risks of a company i.docx
LukeQVdGrantg
 
Project Objectives- To write a program that implements the following A.docx
Project Objectives- To write a program that implements the following A.docxProject Objectives- To write a program that implements the following A.docx
Project Objectives- To write a program that implements the following A.docx
LukeQVdGrantg
 
Project gamesmanship in organizations performs what purpose- Creates c.docx
Project gamesmanship in organizations performs what purpose- Creates c.docxProject gamesmanship in organizations performs what purpose- Creates c.docx
Project gamesmanship in organizations performs what purpose- Creates c.docx
LukeQVdGrantg
 
Project managers should turn customer needs into requirements- The sum.docx
Project managers should turn customer needs into requirements- The sum.docxProject managers should turn customer needs into requirements- The sum.docx
Project managers should turn customer needs into requirements- The sum.docx
LukeQVdGrantg
 
Project managers use this conflict resolution technique most often- A-.docx
Project managers use this conflict resolution technique most often- A-.docxProject managers use this conflict resolution technique most often- A-.docx
Project managers use this conflict resolution technique most often- A-.docx
LukeQVdGrantg
 

More from LukeQVdGrantg (20)

Provide examples of the -monkey- attempting to be transferred from a s.docx
Provide examples of the -monkey- attempting to be transferred from a s.docxProvide examples of the -monkey- attempting to be transferred from a s.docx
Provide examples of the -monkey- attempting to be transferred from a s.docx
 
Provide 3 substantive audit procedures chosen among the following topi.docx
Provide 3 substantive audit procedures chosen among the following topi.docxProvide 3 substantive audit procedures chosen among the following topi.docx
Provide 3 substantive audit procedures chosen among the following topi.docx
 
Provide an appropriate response- Determine the probability distributio.docx
Provide an appropriate response- Determine the probability distributio.docxProvide an appropriate response- Determine the probability distributio.docx
Provide an appropriate response- Determine the probability distributio.docx
 
Punnett square problems continued Complete the following problems- Lis.docx
Punnett square problems continued Complete the following problems- Lis.docxPunnett square problems continued Complete the following problems- Lis.docx
Punnett square problems continued Complete the following problems- Lis.docx
 
public class ThreeTenDLList-T- implements Iterable-T- { -- doubly.docx
public class ThreeTenDLList-T- implements Iterable-T- {      -- doubly.docxpublic class ThreeTenDLList-T- implements Iterable-T- {      -- doubly.docx
public class ThreeTenDLList-T- implements Iterable-T- { -- doubly.docx
 
Public - Week 12- Interactive activity 12-1 Learning Outcomes- Discuss.docx
Public - Week 12- Interactive activity 12-1 Learning Outcomes- Discuss.docxPublic - Week 12- Interactive activity 12-1 Learning Outcomes- Discuss.docx
Public - Week 12- Interactive activity 12-1 Learning Outcomes- Discuss.docx
 
public class Bitset implements Set{ private boolean set--- pub.docx
public class Bitset implements Set{     private boolean set---     pub.docxpublic class Bitset implements Set{     private boolean set---     pub.docx
public class Bitset implements Set{ private boolean set--- pub.docx
 
Protecting the Business 14- Briefly describe any business insurance yo.docx
Protecting the Business 14- Briefly describe any business insurance yo.docxProtecting the Business 14- Briefly describe any business insurance yo.docx
Protecting the Business 14- Briefly describe any business insurance yo.docx
 
ProShares UltraPro QQQ has a total asset turnover of 1-29- a debt-equi.docx
ProShares UltraPro QQQ has a total asset turnover of 1-29- a debt-equi.docxProShares UltraPro QQQ has a total asset turnover of 1-29- a debt-equi.docx
ProShares UltraPro QQQ has a total asset turnover of 1-29- a debt-equi.docx
 
Properties that Define Life ( 10 points) Matching- Please write the le.docx
Properties that Define Life ( 10 points) Matching- Please write the le.docxProperties that Define Life ( 10 points) Matching- Please write the le.docx
Properties that Define Life ( 10 points) Matching- Please write the le.docx
 
Prompt 3- 70- of the light aircraft that disappear while in flight in.docx
Prompt 3- 70- of the light aircraft that disappear while in flight in.docxPrompt 3- 70- of the light aircraft that disappear while in flight in.docx
Prompt 3- 70- of the light aircraft that disappear while in flight in.docx
 
Prompt- (Part 1) Is life in the metaverse inevitable or unlikely- Are.docx
Prompt- (Part 1) Is life in the metaverse inevitable or unlikely- Are.docxPrompt- (Part 1) Is life in the metaverse inevitable or unlikely- Are.docx
Prompt- (Part 1) Is life in the metaverse inevitable or unlikely- Are.docx
 
Prokaryotes are all gram positive- eukaryotes are all gram negative Pr.docx
Prokaryotes are all gram positive- eukaryotes are all gram negative Pr.docxProkaryotes are all gram positive- eukaryotes are all gram negative Pr.docx
Prokaryotes are all gram positive- eukaryotes are all gram negative Pr.docx
 
Prolessor fsadore (Lmy) Invest-a-Lot retired two years ago from Except.docx
Prolessor fsadore (Lmy) Invest-a-Lot retired two years ago from Except.docxProlessor fsadore (Lmy) Invest-a-Lot retired two years ago from Except.docx
Prolessor fsadore (Lmy) Invest-a-Lot retired two years ago from Except.docx
 
PROLOG Convert this proposition to Object-Attribute-Value proposition(.docx
PROLOG Convert this proposition to Object-Attribute-Value proposition(.docxPROLOG Convert this proposition to Object-Attribute-Value proposition(.docx
PROLOG Convert this proposition to Object-Attribute-Value proposition(.docx
 
Project Part 1- Analysis of the opportunities and risks of a company i.docx
Project Part 1- Analysis of the opportunities and risks of a company i.docxProject Part 1- Analysis of the opportunities and risks of a company i.docx
Project Part 1- Analysis of the opportunities and risks of a company i.docx
 
Project Objectives- To write a program that implements the following A.docx
Project Objectives- To write a program that implements the following A.docxProject Objectives- To write a program that implements the following A.docx
Project Objectives- To write a program that implements the following A.docx
 
Project gamesmanship in organizations performs what purpose- Creates c.docx
Project gamesmanship in organizations performs what purpose- Creates c.docxProject gamesmanship in organizations performs what purpose- Creates c.docx
Project gamesmanship in organizations performs what purpose- Creates c.docx
 
Project managers should turn customer needs into requirements- The sum.docx
Project managers should turn customer needs into requirements- The sum.docxProject managers should turn customer needs into requirements- The sum.docx
Project managers should turn customer needs into requirements- The sum.docx
 
Project managers use this conflict resolution technique most often- A-.docx
Project managers use this conflict resolution technique most often- A-.docxProject managers use this conflict resolution technique most often- A-.docx
Project managers use this conflict resolution technique most often- A-.docx
 

Recently uploaded

TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
ShivajiThube2
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 

Recently uploaded (20)

TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 

Python program to build deep learning algorithm using a CNNs model to.docx

  • 1. Python program to build deep learning algorithm using a CNNs model to detect malware attacks. The code is working, but I faced issues with the last part of the code, and I needed to know precisely where the problem was. I have the dataset of malware and benign in exe, I convert them to grayscale images, and it goes through the filters, and it shows me the output. this is the code import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Conv2D, MaxPooling2D import numpy as np from os import listdir from PIL import Image import os.path import numpy as np path = '/media/malkuwari/New Volume/Ransomware_Detection_using _CNN/mixEXE' h = 256 #height of image w = 256 #width of image # be careful with using this function, it will consume memory, access to disk and time images = [] for f in listdir('/media/malkuwari/New Volume/Ransomware_Detection_using _CNN/mixEXE'): with open(os.path.join('/media/malkuwari/New Volume/Ransomware_Detection_using _CNN/mixEXE', f), 'rb') as img_set: img_arr = img_set.read(h*w) while img_arr: if len(img_arr) == h*w and img_arr not in images: images.append(img_arr) img_arr = img_set.read(h*w) #And you can save them into png files # count = 0 # for img in images: # png = Image.fromarray(np.reshape(list(img), (h,w)).astype('float32'), mode='L') # png.save('image_l%d.png'%count) # count += 1 #reshape images to fit into the CNN model img_list = np.zeros(shape = (len(images), h,w,1), dtype = np.uint8) for j in range(len(images)): img_list[j,:,:,0] = np.reshape(list(images[j]), (h,w)) img_list = img_list.astype('float32') img_list /= 255 # ################################################################ #approca 1 failed go back from scrtuch # implement the architecture of the CNN model = Sequential() #Conv2D Layers model.add(Conv2D(12, (25, 25), padding='same',input_shape=img_list.shape[1:], activation = 'relu')) model.add(Conv2D(12, (25, 25), activation = 'relu')) #Max Pooling Layer model.add(MaxPooling2D(pool_size=(2, 2))) #Conv2D Layer model.add(Conv2D(12, (13, 13), padding='same', activation = 'relu')) model.add(Conv2D(12, (13, 13), activation = 'relu')) #Max Pooling model.add(MaxPooling2D(pool_size=(2, 2))) #Flattening Layer model.add(Flatten()) #Dense Layer model.add(Dense(1024, activation = 'relu')) model.add(Dense(1, activation = 'sigmoid')) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['binary_accuracy']) model.summary() ''' FINALLY If you have a set of executable files from both types (benign and malicious) you can try to fit the model. You should prepare a list of images for malwares and a list for benign and here how you fit the model. ''' #Change the parameters to whatever suits you I already have to files that contain benign files and malicious images, but it shows me syntax error!
  • 2. batch_size = 512 epochs = 100 labels = [0 for _ in benign_images ] + [1 for _ in malicious_images ] model.fit( benign_images + malicious_images , labels, batch_size = batch_size, epochs = epochs, validation_split = 0.25, please, if you can help me with this issue and if there is additional coding needed to my project, thank you