Posted: Wed Dec 10, 2008 18:52 Post subject: I need to run a pearl script.
I need to run a script, but I have no idea how. I got it unto my router using wget, and have installed pearl and OpenVPN, now I just need to run the script.
Code:
#!/usr/bin/perl
use strict;
# torrentfreedom perl client
# v1.1
# initiates and manages a connection to TorrentFreedom without using a GUI.
# set additional proxy settings here - check out openvpn.net's manpage for options.
# eg: my $additional_options = "--http-proxy 11.22.33.44 8080";
# to tell the client to use a http proxy.
my $additional_options = "";
my $username = shift;
my $password = shift;
if (length($username) < 1 || length($password) < 1)
{
# poke user if they didn't enter a username or password
print "usage: perl torrentfreedom.pl [username] [password]\n";
exit;
}
# report version - used for stats and update notifications
my $argstream1 = "https://www.torrentfreedom.com/scripts/version.php?username=$username&password=$password";
my $argstream2 = "--output-document=/dev/null";
system("wget",$argstream1,$argstream2);
# get CA
$argstream1 = "https://www.torrentfreedom.com/scripts/ca.php?username=$username&password=$password";
$argstream2 = "--output-document=ca.crt";
system("wget",$argstream1,$argstream2);
# connect to openvpn - note, we never return from this - so the perl script basically ends here.
exec("openvpn --config $username.conf $additional_options") or print STDERR "couldn't run openvpn: $!";
_________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
I changed the line I tried to run the script, but it returns "-sh: /proxy.pl/: not found"
"ls" tells me that it is there, though. What's wrong?
Code:
root@DD-WRT:~# wget http://rapidshare.com/files/172192543/proxy.pl
Connecting to rapidshare.com (195.122.131.22:80)
root@DD-WRT:~# ls
proxy.pl
root@DD-WRT:~# proxy.pl
-sh: proxy.pl: not found
root@DD-WRT:~# /proxy.pl
-sh: /proxy.pl: not found
root@DD-WRT:~# /proxy.pl/
-sh: /proxy.pl/: not found
root@DD-WRT:~#
Thank you, it worked. I am now able to run the script, but after I do, I lose my internet connection. I'm still able to talk to the router, so it hasn't crashed, it just can't acces the web through the proxy. Here's my output:
Code:
root@DD-WRT:/opt/proxy# ./torrentfreedom.pl username password
Thu Dec 11 19:54:46 2008 OpenVPN 2.1_rc7 mipsel-unknown-linux-gnu [SSL] [LZO1] [EPOLL] built on Jul 27 2008
Enter Auth Username:username
Enter Auth Password:
Thu Dec 11 19:54:56 2008 WARNING: file 'username.key' is group or others accessible
Thu Dec 11 19:54:56 2008 LZO compression initialized
Thu Dec 11 19:54:56 2008 Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:0 EL:0 ]
Thu Dec 11 19:54:56 2008 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:0 EL:0 AF:3/1 ]
Thu Dec 11 19:54:56 2008 Attempting to establish TCP connection with 81.173.31.83:443 [nonblock]
Thu Dec 11 19:54:57 2008 TCP connection established with 81.173.31.83:443
Thu Dec 11 19:54:57 2008 Socket Buffers: R=[43689->65534] S=[16384->65534]
Thu Dec 11 19:54:57 2008 TCPv4_CLIENT link local: [undef]
Thu Dec 11 19:54:57 2008 TCPv4_CLIENT link remote: 81.173.31.83:443
Thu Dec 11 19:54:57 2008 TLS: Initial packet from 81.173.31.83:443, sid=39c35fd7 89140fd3
Thu Dec 11 19:54:58 2008 VERIFY OK: depth=1, /C=../ST=../L=./O=../CN=.._CA/emailAddress=..
Thu Dec 11 19:54:58 2008 VERIFY OK: nsCertType=SERVER
Thu Dec 11 19:54:58 2008 VERIFY OK: depth=0, /C=../ST=../L=./O=../CN=boris/emailAddress=..
Thu Dec 11 19:55:03 2008 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bitkey
Thu Dec 11 19:55:03 2008 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Dec 11 19:55:03 2008 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bitkey
Thu Dec 11 19:55:03 2008 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Dec 11 19:55:03 2008 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA,2048 bit RSA
Thu Dec 11 19:55:03 2008 [boris] Peer Connection Initiated with 81.173.31.83:443
Thu Dec 11 19:55:04 2008 SENT CONTROL [boris]: 'PUSH_REQUEST' (status=1)
Thu Dec 11 19:55:04 2008 PUSH: Received control message: 'PUSH_REPLY,route-gateway 81.173.5.129,redirect-gateway def1,dhcp-option DNS 208.67.222.222,dhcp-option DOMAIN boris.baneki.org,topology subnet,ping 10,ping-restart 40,ifconfig 81.173.5.192 255.255.255.128'
Thu Dec 11 19:55:04 2008 OPTIONS IMPORT: timers and/or timeouts modified
Thu Dec 11 19:55:04 2008 OPTIONS IMPORT: --ifconfig/up options modified
Thu Dec 11 19:55:04 2008 OPTIONS IMPORT: route options modified
Thu Dec 11 19:55:04 2008 OPTIONS IMPORT: route-related options modified
Thu Dec 11 19:55:04 2008 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Thu Dec 11 19:55:04 2008 TUN/TAP device tun0 opened
Thu Dec 11 19:55:04 2008 TUN/TAP TX queue length set to 100
Thu Dec 11 19:55:04 2008 /sbin/ifconfig tun0 81.173.5.192 netmask 255.255.255.128 mtu 1500 broadcast 81.173.5.255
Thu Dec 11 19:55:04 2008 /sbin/route add -net 81.173.31.83 netmask 255.255.255.255 gw 83.91.98.1
Thu Dec 11 19:55:04 2008 /sbin/route add -net 0.0.0.0 netmask 128.0.0.0 gw 81.173.5.129
Thu Dec 11 19:55:04 2008 /sbin/route add -net 128.0.0.0 netmask 128.0.0.0 gw 81.173.5.129
Thu Dec 11 19:55:04 2008 Initialization Sequence Completed