malware_db 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/malware_db.rb +160 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 145692560a70fcdf60d5394e2e4cf81d346d4ef4fb83803451f3b7748162e94c
4
+ data.tar.gz: 10d17c647c007745198565fc4576956d338b3556fb1216e6ca205a6d9a0c9ebd
5
+ SHA512:
6
+ metadata.gz: b8e89597bc31f2ec0dfcdca26f271e3871a47deda71bae70223578054740e4ab7b0196f1f484c9878fd9cc75675506592101a889155ac01d966ce51701484882
7
+ data.tar.gz: 9e772fe8f116a0c30db5baf63fb3e0d1764439b6ea86c79b6889cb038b505e390918d7150e1408b60bb666fc22c9a98c1b6dc9dccc13f889cbd69bce8cf3636b
data/lib/malware_db.rb ADDED
@@ -0,0 +1,160 @@
1
+ require 'sqlite3'
2
+
3
+ # Create a new SQLite3 database
4
+ db = SQLite3::Database.new 'malware_database.db'
5
+
6
+ # Create tables for malware samples and posts
7
+ db.execute <<-SQL
8
+ CREATE TABLE IF NOT EXISTS malware_samples (
9
+ id INTEGER PRIMARY KEY,
10
+ name TEXT,
11
+ type TEXT,
12
+ description TEXT
13
+ );
14
+ SQL
15
+
16
+ db.execute <<-SQL
17
+ CREATE TABLE IF NOT EXISTS posts (
18
+ id INTEGER PRIMARY KEY,
19
+ name TEXT,
20
+ description TEXT
21
+ );
22
+ SQL
23
+
24
+ # Function to add a new malware sample
25
+ def add_malware_sample(db, name, type, description)
26
+ db.execute("INSERT INTO malware_samples (name, type, description)
27
+ VALUES (?, ?, ?)", [name, type, description])
28
+ rescue SQLite3::Exception => e
29
+ puts "Error adding malware sample: #{e.message}"
30
+ end
31
+
32
+ # Function to search for malware by type
33
+ def search_malware_by_type(db, type)
34
+ db.execute("SELECT * FROM malware_samples WHERE type = ?", [type]) do |row|
35
+ puts "Name: #{row[1]}, Type: #{row[2]}, Description: #{row[3]}"
36
+ end
37
+ rescue SQLite3::Exception => e
38
+ puts "Error searching for malware: #{e.message}"
39
+ end
40
+
41
+ # Function to add a new post
42
+ def add_post(db, name, description)
43
+ db.execute("INSERT INTO posts (name, description) VALUES (?, ?)", [name, description])
44
+ rescue SQLite3::Exception => e
45
+ puts "Error adding post: #{e.message}"
46
+ end
47
+
48
+ # Function to display all posts
49
+ def display_posts(db)
50
+ db.execute("SELECT * FROM posts") do |row|
51
+ puts "Post Name: #{row[1]}, Description: #{row[2]}"
52
+ end
53
+ rescue SQLite3::Exception => e
54
+ puts "Error displaying posts: #{e.message}"
55
+ end
56
+
57
+ # Example usage
58
+ add_malware_sample(db, 'ILOVEYOU', 'Email Worm', 'A computer worm that spread through email attachments.')
59
+ add_malware_sample(db, 'Conficker', 'Worm', 'A worm that targets Microsoft Windows operating systems.')
60
+
61
+ # Command-line interface
62
+ puts "Welcome to the malware database! Here you can learn about different types of malware and how to protect against them."
63
+ puts "Type 'help' for a list of commands."
64
+
65
+ def malware_db_shell(db)
66
+ loop do
67
+ print "malwareDB> "
68
+ input = gets.chomp.strip
69
+
70
+ case input
71
+ when ''
72
+ when 'help'
73
+ puts "Available commands:"
74
+ puts "help - Show this help message"
75
+ puts "types - List types of malware"
76
+ puts "info <type> - Get information about a type of malware"
77
+ puts "search <type> - Search for malware by type"
78
+ puts "malwareDBworld - Enter the malwareDBworld mode"
79
+ puts "exit - Exit the malware database CLI"
80
+ when 'types'
81
+ puts "Viruses, Worms, Ransomware, Bots, Trojan horses, Keyloggers, Rootkits, Spyware"
82
+ when /^info (.+)$/
83
+ type = $1.downcase
84
+ case type
85
+ when 'viruses'
86
+ puts "Viruses: Malicious software that attaches itself to a host file and spreads when the file is executed."
87
+ puts "Examples: Boot Sector Virus, Web Scripting Virus, Browser Hijacker, Resident Virus, Direct Action Virus, Polymorphic Virus, File Infector Virus, Multipartite Virus, Ebola"
88
+ when 'worms'
89
+ puts "Worms: Standalone malware that replicates itself to spread to other computers."
90
+ puts "Examples: Email worms, Instant Messaging worms, ILOVEYOU, Storm Worm, SQL Slammer, Conficker, CryptoLocker, WannaCry ransomware attack, Mydoom, Tapeworm"
91
+ when 'ransomware'
92
+ puts "Ransomware: Malware that encrypts the victim's data and demands a ransom for the decryption key."
93
+ puts "Examples: CryptoLocker, Bad Rabbit, NotPetya (Petya), Cerber, WannaCry, Dharma (CrySiS), Maze"
94
+ when 'bots'
95
+ puts "Bots: Malware that allows an attacker to take control of an infected computer."
96
+ puts "Examples: Fireball"
97
+ when 'trojan horses'
98
+ puts "Trojan horses: Malware disguised as legitimate software to trick users into installing it."
99
+ puts "Examples: Downloader Trojan, Backdoor Trojan, Spyware, Rootkit Trojans, DDoS Attack Trojan (Botnet), Zeus, ILOVEYOU, Cryptolocker"
100
+ when 'keyloggers'
101
+ puts "Keyloggers: Malware that records keystrokes to steal sensitive information like passwords."
102
+ puts "Examples: Hardware keyloggers, Software keyloggers, Actual Keylogger, Spyrix Free Keylogger, Elite Keylogger, KidLogger, Acoustic keyloggers, Ardamax Keylogger, Best Free Keylogger"
103
+ when 'rootkits'
104
+ puts "Rootkits: Malware designed to gain unauthorized access to a computer and hide its presence."
105
+ puts "Examples: Kernel mode rootkits, Firmware rootkits, User-mode rootkit, Bootloader rootkit, Stuxnet, Bootkit, Keyloggers, Ransomware, Sony BMG"
106
+ when 'spyware'
107
+ puts "Spyware: Malware that secretly monitors and collects information about a user's activities."
108
+ puts "Examples: Keyloggers, Adware, Tracking cookies, System monitors"
109
+ else
110
+ puts "Unknown malware type. Available types: Viruses, Worms, Ransomware, Bots, Trojan horses, Keyloggers, Rootkits, Spyware"
111
+ end
112
+ when /^search (.+)$/
113
+ type = $1
114
+ search_malware_by_type(db, type)
115
+ when 'malwareDBworld'
116
+ malware_db_world_shell(db)
117
+ when 'exit'
118
+ puts "Exiting the malware database. Goodbye!"
119
+ break
120
+ else
121
+ puts "Unknown command. Type 'help' for a list of commands."
122
+ end
123
+ end
124
+ end
125
+
126
+ def malware_db_world_shell(db)
127
+ puts "Welcome to malwareDBworld! Here you can share and read posts about malware analysis and experiences with the malware database."
128
+ puts "Type '?' for a list of commands."
129
+
130
+ loop do
131
+ print "malwareDBworld> "
132
+ input = gets.chomp.strip
133
+
134
+ case input
135
+ when ''
136
+ when '?'
137
+ puts "Available commands:"
138
+ puts "? - Show this help message"
139
+ puts "posts - Display all posts"
140
+ puts "makepost - Create a new post"
141
+ puts "exit - Exit malwareDBworld"
142
+ when 'posts'
143
+ display_posts(db)
144
+ when 'makepost'
145
+ print "Post name: "
146
+ post_name = gets.chomp.strip
147
+ print "Post description: "
148
+ post_description = gets.chomp.strip
149
+ add_post(db, post_name, post_description)
150
+ puts "Post added successfully!"
151
+ when 'exit'
152
+ puts "Exiting malwareDBworld."
153
+ break
154
+ else
155
+ puts "Unknown command. Type '?' for a list of commands."
156
+ end
157
+ end
158
+ end
159
+
160
+ malware_db_shell(db)
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: malware_db
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Ckiono
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-07-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This is just a malware-database.
14
+ email:
15
+ - aimaankhankvs@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/malware_db.rb
21
+ homepage: https://github.com/sojoyork/malware-database.git
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.5.9
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A regular malware-database
44
+ test_files: []