This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Process.spawn do | |
Dir.mktmpdir do |temp_dir| | |
driver = Driver.new(temp_dir) | |
%x(sudo mv backup* #{temp_dir}) | |
print "\nDone, the backup archive has been created at #{temp_dir}/backup#{Time.now.strftime('%Y%m%d-%H%M')}.tar.gz" | |
server = Ftpd::FtpServer.new(driver) | |
get_ip | |
server.interface = @localip | |
server.start | |
puts "\nFTP server listening on port #{server.bound_port}, Press enter to close the FTP server\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'savon' | |
user = "" | |
pass = "" | |
server = "" | |
msg = "######################################################################\n"\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@cookies = [] | |
@cookies << ["1234", Time.now, "this will be deleted"] | |
sleep 1 | |
@cookies << ["1234", Time.now + 1, "this also should be deleted"] | |
sleep 1 | |
@cookies << ["1234", Time.now + 60, "this wont be deleted"] | |
sleep 5 | |
puts "This is the whole array: ", @cookies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_s_client | |
server = "Generel Settings: " | |
renegotiation = "Insecure Renegotiation".colorize(:red) | |
crime = "SSL Compression Enabled <= CRIME - CVE-2012-4929".colorize(:red) | |
results = %x(echo "q" | openssl s_client -host #{@server} -port #{@port} 2> /dev/null) | |
if results =~ /Secure Renegotiation IS supported/i | |
renegotiation = "Secured Renegotiation".colorize(:green) | |
end | |
if results =~ /Compression: NONE/ | |
crime = "SSL Compression is disabled".colorize(:green) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ffi' | |
require 'socket' | |
module SSL_Client | |
extend FFI::Library | |
ffi_lib 'ssl' | |
attach_function :SSL_library_init, [], :int | |
attach_function :SSL_load_error_strings, [], :long | |
attach_function :SSLv3_client_method, [], :long |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fiddle' | |
require 'socket' | |
libssl = Fiddle.dlopen('/usr/lib/libssl.so') | |
ssl_init = Fiddle::Function.new(libssl['SSL_library_init'],[],Fiddle::TYPE_INT) | |
ssl_load_error = Fiddle::Function.new(libssl['SSL_load_error_strings'],[],Fiddle::TYPE_INT) | |
ssl_client_method = Fiddle::Function.new(libssl['SSLv3_client_method'],[],Fiddle::TYPE_LONG) | |
ssl_ctx = Fiddle::Function.new(libssl['SSL_CTX_new'],[Fiddle::TYPE_LONG],Fiddle::TYPE_LONG) | |
ssl_ctx_reneg = Fiddle::Function.new(libssl['SSL_CTX_sess_connect_renegotiate'],[Fiddle::TYPE_LONG],Fiddle::TYPE_LONG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fiddle' | |
require 'socket' | |
libssh = Fiddle.dlopen('/usr/lib/libssh.so') | |
# sshbind = ssh_bind_new(); | |
# session = ssh_new(); | |
ssh_bind = Fiddle::Function.new(libssh['ssh_bind_new'],[],Fiddle::TYPE_LONG) | |
ssh_session = Fiddle::Function.new(libssh['ssh_new'],[],Fiddle::TYPE_LONG) | |
ssh_bind_listen = Fiddle::Function.new(libssh['ssh_bind_listen'],[Fiddle::TYPE_LONG],Fiddle::TYPE_INT) | |
ssh_bind_accept = Fiddle::Function.new(libssh['ssh_bind_accept'],[Fiddle::TYPE_LONG, Fiddle::TYPE_LONG],Fiddle::TYPE_CHAR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fiddle' | |
require 'socket' | |
libssh = Fiddle.dlopen('/usr/lib/libssh.so') | |
ssh_bind = Fiddle::Function.new(libssh['ssh_bind_new'],[],Fiddle::TYPE_LONG_LONG) | |
ssh_session = Fiddle::Function.new(libssh['ssh_new'],[],Fiddle::TYPE_LONG_LONG) | |
ssh_bind_listen = Fiddle::Function.new(libssh['ssh_bind_listen'],[Fiddle::TYPE_LONG_LONG],Fiddle::TYPE_INT) | |
ssh_bind_accept = Fiddle::Function.new(libssh['ssh_bind_accept'],[Fiddle::TYPE_LONG_LONG,Fiddle::TYPE_LONG_LONG],Fiddle::TYPE_CHAR) | |
ssh_get_error = Fiddle::Function.new(libssh['ssh_get_error'],[Fiddle::TYPE_LONG],Fiddle::TYPE_CHAR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'ffi' | |
module SSHSocket | |
extend FFI::Library | |
ffi_lib_flags :now, :global | |
ffi_lib 'libssh' | |
attach_function :ssh_init, [], :int | |
attach_function :ssh_bind_new, [], :pointer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby sshsocket.rb | |
No Error: 0 | |
No Error: 0 | |
No Error: 0 | |
No Error: 0 | |
No Error: 0 | |
should return 'SSH_OK': | |
sshsocket.rb:65: [BUG] Segmentation fault at 0x000000ffffffc0 | |
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux] |
OlderNewer