rubyment 0.4.25420984 → 0.4.25421155
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubyment.rb +49 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 223806d4e749c22e87f11f4d8ae60bc9fceb30fb
|
4
|
+
data.tar.gz: 001a571bbec4ff8541f1df6900991b5fbcc7614e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0057e911dc8939e732294246c15279618c2e116ca85537d332f4a4fb7030ee0118eb6553eb30577d4fca7559f2033717c91a03d2f9dbb583653d0304fb8d425c
|
7
|
+
data.tar.gz: 5bb729c19882a52e50e20fcdbff9f930416c767f1328c4775699c3a431fef83db3996dc968653a543ee359a76eb4b62f5c10127b15ae8f0528326077118bafc3
|
data/lib/rubyment.rb
CHANGED
@@ -754,11 +754,30 @@ class Rubyment
|
|
754
754
|
# don't output to stdout
|
755
755
|
def test__shell_enc_dec args=ARGV
|
756
756
|
shell_enc ["my secret", "", "", "tijolo22", "", ""]
|
757
|
-
# shell_dec will read from the output file:
|
758
757
|
judgement = ( shell_dec ["", "", "tijolo22"] || true) rescue false
|
759
758
|
end
|
760
759
|
|
761
760
|
|
761
|
+
# an alternative interface to dec -- reads password if
|
762
|
+
# nil or empty.
|
763
|
+
#
|
764
|
+
# @param [Array] args Defaults to +ARGV+. Elements:
|
765
|
+
# * +data+ [String, nil] data to be encrypted, If empty or nil, read (without
|
766
|
+
# echo) from @memory[:stdin], which defaults to STDIN
|
767
|
+
# * +password+ [String, nil] password to be used to encryption.
|
768
|
+
# If empty or nil, read (without echo) from @memory[:stdin], which defaults to STDIN
|
769
|
+
#
|
770
|
+
# @return [TrueClass, FalseClass] depending on whether test succeeds.
|
771
|
+
def dec_interactive args=ARGV
|
772
|
+
stderr = @memory[:stderr]
|
773
|
+
iv, encrypted, base64_salt, base64_iter, password = args
|
774
|
+
stderr.print "[password]"
|
775
|
+
password = (input_single_line_non_echo [password])
|
776
|
+
stderr.puts
|
777
|
+
dec [password, iv, encrypted, nil, base64_salt, base64_iter]
|
778
|
+
end
|
779
|
+
|
780
|
+
|
762
781
|
# test for enc and dec.
|
763
782
|
# "" and nil are expected to be treated
|
764
783
|
# as the same.
|
@@ -800,6 +819,7 @@ class Rubyment
|
|
800
819
|
password = input_single_line_non_echo [password]
|
801
820
|
base64_encrypted, base64_iv, base64_salt, base64_iter, base64_key = enc [password, data]
|
802
821
|
dec_args = [password, base64_iv, base64_encrypted, nil, base64_salt, base64_iter]
|
822
|
+
stderr.puts "# WARNING: secrets, including password are printed here. Storing them may be a major security incident."
|
803
823
|
stderr.puts "# programmatically:"
|
804
824
|
stderr.puts "dec " + dec_args.to_s
|
805
825
|
stderr.puts "# shell: "
|
@@ -812,6 +832,33 @@ class Rubyment
|
|
812
832
|
end
|
813
833
|
|
814
834
|
|
835
|
+
# test for enc and dec_interactive.
|
836
|
+
# good idea is to use this function once with the desired
|
837
|
+
# data, password, and use the stderr output
|
838
|
+
def test__enc_dec_interactive args=ARGV
|
839
|
+
stderr = @memory[:stderr]
|
840
|
+
data, password = args
|
841
|
+
stderr.print "[data]"
|
842
|
+
data = input_multi_line_non_echo [data]
|
843
|
+
stderr.print "[password]"
|
844
|
+
password = input_single_line_non_echo [password]
|
845
|
+
stderr.puts
|
846
|
+
base64_encrypted, base64_iv, base64_salt, base64_iter, base64_key = enc [password, data]
|
847
|
+
# the output is supposed to be safe to store,
|
848
|
+
# so password is not placed in from dec_interactive_args:
|
849
|
+
dec_interactive_args = [base64_iv, base64_encrypted, base64_salt, base64_iter]
|
850
|
+
stderr.puts "# programmatically:"
|
851
|
+
stderr.puts "dec_interactive " + dec_interactive_args.to_s
|
852
|
+
stderr.puts "# shell: "
|
853
|
+
stderr.puts "#{$0} invoke_double puts dec_interactive " + (output_array_to_shell dec_interactive_args).to_s
|
854
|
+
data_plain = dec_interactive(dec_interactive_args + [password])
|
855
|
+
judgement =
|
856
|
+
[
|
857
|
+
[data, data_plain, "data"]
|
858
|
+
].map(&method("expect_equal")).all?
|
859
|
+
end
|
860
|
+
|
861
|
+
|
815
862
|
# gem_spec
|
816
863
|
# args (Array like the one returned by rubyment_gem_defaults)
|
817
864
|
# returns: a gem spec string accordingly to args
|
@@ -1020,8 +1067,7 @@ end
|
|
1020
1067
|
# console output of gem push (String)
|
1021
1068
|
def gem_push args=ARGV
|
1022
1069
|
gem_spec, future_arg = args
|
1023
|
-
|
1024
|
-
p `gem push #{gem_spec}`
|
1070
|
+
`gem push #{gem_spec}`
|
1025
1071
|
end
|
1026
1072
|
|
1027
1073
|
# gem_uninstall
|