I am running moss by Stanford.
I am using Perl script sent by Stanford at the time of registration.
but it is giving error as :
Checking files . . .
OK
Could not connect to server moss.stanford.edu: Connection refused
I tried adding institute proxy also in the code as follows :
$sock = new IO::Socket::INET (
ProxyAddr => '10.3.100.207',
ProxyPort => '8080',
PeerAddr => $server,
PeerPort => $port,
Proto => 'tcp',
);
But it is giving the same error as above.
One possible solution is to set up a virtual environment and run the script.
But what can be another solution ?
Here is what I did and it worked.
I used Google colab for it.
I uploaded the files to be checked for plagiarism and the perl script to colab and then ran the perl script in the notebook
!perl moss.pl -l python -m 53 -c "Files" ./*.py
I want to copy the file from remote host to the local host with the preservation of file permission, hence i tried to use the 'copy_perm' option as per the documentation of Net::SFTP::Foreign as mentioned below -
my $sftp = Net::SFTP::Foreign->new(
host => $host,
key_path => $ssh_key_path,
copy_perm => 1,
more => [ -o => 'Compression yes' ]
);
But I am getting the below error -
Invalid option 'copy_perm' or bad combination of options at test.pl at line 101.
The line 101 is the Net::SFTP::Foreign object creation as mentioned above.
Did i miss anything or anyone has faced same issue before?
That's because copy_perm isn't an option for the new method. You use it in get and put.
After playing dependency hell with a server that does not have internet access I finally was able to get a script running. Problem is I get the following error and I have no idea how to find what is missing or wrong:
Missing required arguments: personality, transport at (eval 50) line 75.
The code is:
#!/usr/bin/perl
use Net::Appliance::Session;
my $s = Net::Appliance::Session->new( Host => '10.9.217.144', Transport => 'SSH', );
$s->connect( Name => 'cworks', Password => '****' );
print $s->cmd('show dialer | i :');
print "*********************\n**********************\n";
print $s->cmd('show ISDN stat | i ACTIV');
print "*********************\n**********************\n";
print $s->cmd('show ver');
$s->close;
According to the documentation, the new method has two required arguments:
personality => $name (required)
Tells the module which "language" to use when talking to the connected device, for example ios for Cisco IOS devices. There's a list of all the supported platforms in the Phrasebook documentation. It's also possible to write new phrasebooks.
transport => $backend (required)
The name of the transport backend used for the session, which may be one of Telnet, SSH, or Serial.
You need to change Transport to transport and add a personality option, as in the example in the docs:
my $s = Net::Appliance::Session->new({
personality => 'ios',
transport => 'SSH',
host => 'hostname.example',
});
I have two asterisk servers, the first is a call initiator and the second is a call receiver. What I want is that a call initiated by the first gets recorded automatically in the second.
The configuration of the first server is as follows:
sip.conf
[general]
register => AS2AS1:welcome#192.168.1.67
[AS1AS2]
type=friend
disallow=all
allow=iLBC
secret=welcome
host=dynamic
context=startcall
username=AS2AS1
dtmfmode=rfc2833
qualify=1000
extensions.conf
[startcall]
exten => 333,1,Playback(sa11)
and the configuration of the second server is as follows
sip.conf
[general]
register => AS1AS2:welcome#192.168.1.66
[AS2AS1]
disallow=all
allow=iLBC
type=friend
secret=welcome
host=dynamic
username=AS1AS2
context=recordcall
dtmfmode=rfc2833
qualify=1000
extensions.conf
[recordcall]
exten => 333,1,Answer()
exten => 333,2,Set(curtime=$(STRFTIME(,,%s)})
exten => 333,3,Record(/home/basma/recorded/${curtime}.wav)
exten => 333,4,Hangup()
the call file(in the call initiator server):
Channel:SIP/AS1AS2/333
Context:startcall
Extension:333
but when the call is completed i find nothing in the recorded directory!
Can be anything, including "asterisk not able call out at all"
To see more info, connect to asterisk using
asterisk -r
core set verbose 10
and see output while calling.
But note, you call file is incorrect. Have be Priority.
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
Try adding any action after Record() for example Playback(hello-world) or Wait(10)
[recordcall]
exten => 333,1,Answer()
exten => 333,n,Set(curtime=${STRFTIME(${EPOCH},,%s)})
exten => 333,n,Record(/home/basma/recorded/${curtime}.wav)
exten => 333,n,Playback(hello-world)
exten => 333,n,Hangup()
The beep you hear from Record application, but after that Hangup is called and call is ended.
Also make sure asterisk or user that runs * has write permissions to /home/basma/recorded/
check which user runs * with
ps aux | grep asterisk
and then
chown -R <user>:<user> /home/basma/recorded/
I finally solve the problem and the recorded file is generated after some modifications in extensions.conf in both initiator and receiver servers.
In the initiator server extensions.conf is as follows:
[startcall]
exten => 333,1,Wait(1)
exten => 333,n,Playback(sa11)
exten => 333,n,WaitExten(10)
And in the receiver server extensions.conf is:
[recordcall]
exten => 333,1,Answer()
exten => 333,n,Set(curtime=${STRFTIME(,,%s)})
exten => 333,n,Record(/home/basma/recorded/${curtime}.wav,0,5)
exten => 333,n,Wait(3)
exten => 333,n, Hangup()
I am trying to reboot a Cisco device using net::appliance::session library. But even the code doesn't give en error the device doesn't reboot. This is the two lines I am using:
$session->cmd(String => 'Reload',Match => ['/Proceed/'], );
$session->cmd(String => "\n", Match => ['//'],);
In the Cisco shell a reload command is given like this:
test#reload
Proceed with reload? [confirm]
Connection closed by foreign host.
This thread in the cpan forum also tells me to do this way. I think there is a problem with carriage returns and confirm dialogs. Because when I try to create a directory it works fine:
$session->cmd(String => 'mkdir',Match => ['/Create dire.*/'] );
$session->cmd(String => 'test',Match => ['//'] );
The equivelant of this in Cisco shell:
test#mkdir
Create directory filename []? test
Created dir flash:test
But when I try to delete this directory which needs a carriage return as confirmation the scripts fails again.
$session->cmd(String => 'rmdir asd',Match => ['/Remove directory.*/'] );
$session->cmd(String => '\n' ,Match => ['/Delete flash.*/'] );
$session->cmd(String => '\n');
The equivelant in Cisco is this:
test#rmdir test
Remove directory filename [test]?
Delete flash:test? [confirm]
Removed dir flash:test
So I think the problem isn't with reload command. But the problem is sending carriage returns as confirmation. I have tried \n \r \n\r \r\n and empty string but they didn't work.
Any ideas?
Maybe the Cisco device is case sensitive? In the example you used 'reload' and 'Reload' in the Perl code.
Maybe you could try this:
$session->say('reload');
$session->gather();
$session->say('confirm');
$session->gather();