StegaX 1.0

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/StegaX.rb +56 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 657f574c9ec3c7a144a85711652dde04473957b12e40f254ce6be124d5e9b4e8
4
+ data.tar.gz: 6558430da6334c07e4d62a3f922abe85dae59aeefd4edb39df9860c9deea91fb
5
+ SHA512:
6
+ metadata.gz: 9b34188dc4b051310635e99d501d6f729b612a3f66c06d74963399e9fe17fa737e924148ddcc0160ebcc13d46461077a7999a5d5331fa0af2dbbec71f643424b
7
+ data.tar.gz: 34f6c7180bbc9ce85c31d9bbba357a08f650ad4a9e34f2d0c04d1e0ad064d715926523b3f6772c63c8c7e9caec59ee49c15ccfdfa57dd970177ce62dff296258
data/lib/StegaX.rb ADDED
@@ -0,0 +1,56 @@
1
+
2
+
3
+
4
+ class StegaX
5
+
6
+ @@file_to_hide = nil
7
+ @@norm_file = nil
8
+ @@output = nil
9
+ @@separator = "======================="
10
+ @@content_output_file = nil
11
+
12
+
13
+ def initialize(file_to_hide = nil, file_norm = nil, output = nil)
14
+ @@file_to_hide = file_to_hide
15
+ @@norm_file = file_norm
16
+ @@output = output
17
+ end
18
+
19
+ def issetFile(files)
20
+ return File.file?(files) ? true : false
21
+ end
22
+
23
+ def attach
24
+ if !issetFile(@@file_to_hide) && !issetFile(@@norm_file)
25
+ return "File not exist"
26
+ end
27
+ file_to_hide_read = File.read @@file_to_hide
28
+ file_nor_read = File.read @@norm_file
29
+
30
+
31
+ @@content_output_file = [file_nor_read, @@separator, file_to_hide_read]
32
+
33
+ File.open(@@output, "wb") do |out|
34
+ @@content_output_file.each do |f|
35
+ out.puts f
36
+ end
37
+ end
38
+
39
+ return "File attached success to #{@@output}"
40
+
41
+ end
42
+
43
+
44
+ def detach(file_to_detach, output)
45
+ if !issetFile(file_to_detach)
46
+ return "File not exist"
47
+ end
48
+
49
+ recov_file = File.read(file_to_detach).force_encoding("BINARY").split(@@separator).last
50
+
51
+ File.open(output, 'wb') do |f|
52
+ f.puts recov_file
53
+ end
54
+ end
55
+
56
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: StegaX
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Muham'RB
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-05-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: StegaX class is a class to hide file in picture and reverse
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/StegaX.rb
20
+ homepage: https://rubygems.com/gems/StegaX
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.0.3
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: StegaX class
43
+ test_files: []