Cerrado

Pass code from PERL to Python 3

Hello good. I have a perl script that I need to transform to Python 3

use Net::Telnet ();

use Data::Dumper;

use strict;

(my $path = $0) =~ s/\/?[^\/]*\z//; # directorio donde reside el script

sub new

{

my ($class, $args) = @_;

my $hdt = "A001";

my $host = "123.456.789";

my $opcuser = "user_123";

my $opcpass = "pass_123";

my $hdtuser = 'csvsys';

my $hdtpass = 'csv_sys';

my $timeout = 30;

my $t = new Net::Telnet (

Timeout => $timeout

, Binmode => 0

, Errmode => 'die' #\&terror

, Prompt => '/>$/' );

my $fninput = "$path/log/input_$[login to view URL]";

my $fhinput = $t->input_log($fninput);

$t->open($host);

# Login OPC

$t->waitfor('/login: ?$/i');

$t->print($opcuser);

$t->waitfor('/password: ?$/i');

$t->print($opcpass);

# Login HDT

#$t->waitfor(Match => '/enter user name$/i', Timeout => $timeout*3);

#$t->waitfor('/>$/');

$t->waitfor(Match => '/>$/', Timeout => $timeout*3);

$t->print($hdtuser);

#$t->waitfor('/enter password$/i');

$t->waitfor('/>$/');

$t->print($hdtpass);

# Going to CI mode

$t->waitfor(Match => '/MORE\.\.\./', Timeout => $timeout*3);

$t->print(chr(13)); # enter

$t->waitfor('/>$/');

$t->print('quit all');

$t->waitfor('/>$/');

return bless {

hdt => $hdt

, host => $host

, opcuser => $opcuser

, telnet => $t

, fhinput => $fhinput

, timeout => $timeout

}, $class;

}

sub check

{

my $self = shift;

my $hdt = $self->{hdt};

my $opcuser = $self->{opcuser};

my $t = $self->{telnet};

my $fhinput = $self->{fhinput};

my $timeout = $self->{timeout};

my $vplevels = [];

my $key;

my $value;

# QUERYDMC

#

$t->print('cornerstone;cveqpt;cvprov;cvpath');

$t->waitfor('/>$/');

$t->print("querycp");

my ($pmatch, $match) = $t->waitfor (

Match => '/>$/',

Timeout => $timeout*3

);

my $salida = ($pmatch =~ s/querycp//r);

my @mi_matriz = obtener_matriz_campos($salida);

leer_matriz( @mi_matriz );

return $vplevels;

}

sub DESTROY

{

my $self = shift;

my $t = $self->{telnet};

my $fhinput = $self->{fhinput};

# Logout

$t->print('logout');

$t->waitfor('/press return to exit\.$/i');

$t->print(chr(13)); # enter

close $fhinput;

}

sub terror # telnet error

{

my $msg = shift;

die "telnet error - $msg\n";

}

return 1;

# vi: ts=4 sw=4

Only people who have worked with Perl and Python 3 telnet connections

I will only look at the proposal that they put at the beginning "HELLO - 14-12-2021"

Thanks.

Habilidades: Python, Arquitectura de software, Perl, Linux

Ver más: rhce know perl python, create php document perl python, extracting data html file perl python, html formmail php perl python, good perl shell script, 3dsmax script perl python, asterisk written perl python, gps tracking code perl python, perl python source code, code using python 3 on ubuntu for computer security, code using python 3, diffiehellman key exchange code using python 3 on ubuntu, python 3 hello world, call python 2 code from python 3, convert python 2 code to python 3 online, qr code reader python 3, google app engine python 3 hello world, convert python 2 code to python 3, convert java code to python 3 online

Información del empleador:
( 4 comentarios ) Calabozo, Venezuela

Nº del proyecto: #31813040

9 freelancers están ofertando un promedio de $38 por este trabajo

Ragesh77

Hi, If you can give me a little overview on what the script does I would be able to help you. Lets discuss. Cheers.

$30 USD en 1 día
(19 comentarios)
4.8
GreenTower

hello 14-12-2021 I have gone through your requirements, please explain me your requirements clearly I can do the same using python 3.. and share me operating system name too..

$30 USD en 1 día
(16 comentarios)
4.1
zotil

Hello, I can rewrite your script to python 3, but there is a missing function that is called "obtener_matriz_campos" and "leer_matriz" to know what $vplevels returns. If you have the full code, there is no problem to c Más

$150 USD en 7 días
(6 comentarios)
4.0
ivanlysundev

Hello. Nice to see you. I saw the description of your project. As you know, I am a new freelancer. I am a freelancer with perfect abilities. Talk to me and you will know everything about me. I always guarantee my abili Más

$20 USD en 1 día
(0 comentarios)
0.0
vadimseveryn

Hello I read carefully your problem. It must consists of four steps. I can do it with high quality. I am looking forward to your good news.

$30 USD en 1 día
(0 comentarios)
0.0
branthanmar

HELLO - 14-12-2021 Easy project. Three hours task. I have seven years experience in programming (including python and perl) Let me know if you are interested. Thank you

$18 USD en 1 día
(0 comentarios)
0.0
AychaSattouf97

Hello, Hope you are doing well i read the code and believe i can pass it to python during the specified time

$20 USD en 7 días
(0 comentarios)
0.0
Alex9393

I have the experience working in perl and python running on linux managing my project. it's been more than 3 years since using python and 2 years using perl. actually I'm a new freelancer, hope to get the chance workin Más

$20 USD en 7 días
(0 comentarios)
0.0
Jesuseltech

Dear Client. How are you? I am happy to put my bid on your project. I have read your job description carefully and I am confident in your project. • HTML • Java Core • Docker, Linux,Unix, Windows I am sure you will be Más

$25 USD en 7 días
(0 comentarios)
0.0