[ Question Updated by following the commentator's comments ] When I am using the following command for executing prop.obj "perl sendXssl.pl hostname port prop.obj" , It is giving error as "Error Bad file descriptor, ssl_error=SSL connect attempt failed at sendXssl.pl line 6". Please help me to solve this. My Perl program is given below...
use IO::Socket::SSL qw( SSL_VERIFY_NONE );
use strict;
use warnings qw( all );
$|=1;
my $sock = IO::Socket::SSL->new(
PeerHost => $ARGV[0],
PeerPort => $ARGV[1],
SSL_verify_mode => SSL_VERIFY_NONE)
or die "error=$!, ssl_error=$IO::Socket::SSL::SSL_ERROR";
print $sock "X";
my $data ;
my $file = $ARGV[2];
open(my $fh,'<',$file) or die "Error 2 $!\n";
{
local $/;
$data = <$fh>;
}
close($fh);
my $pack = $data;
print $sock $pack;
I created prop.obj object from the following java file
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.Properties;
public class PropertiesX {
public static void main(String[] args) {
try {
String[] s = new String[1];
s[0] = "notepad.exe";
Properties p = new Properties();
p.put("commandArgs",s);
p.setProperty("parent", "c:\\windows\\system32\\notepad.exe");
FileOutputStream fos = new FileOutputStream("prop.obj");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(p);
oos.close();
System.out.println(p.toString());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
You're mixing the direct and indirect method syntax together:
$sock = new IO::Socket::SSL->new(
# ~~~ ~~~
PeerHost => $ARGV[0],
PeerPort => $ARGV[1],
SSL_verify_mode => SSL_VERIFY_NONE)
Remove the first new
and try again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.