Custom userscripts

<<

Jeix

Team Member

Posts: 186

Joined: Sat Jul 10, 2010 12:40 pm

Post Thu Jul 15, 2010 11:29 am

Custom userscripts

Post your userscripts here if you like to.
<<

DHMH

Member

Posts: 123

Joined: Sat Jul 10, 2010 6:27 pm

Post Thu Jul 15, 2010 12:09 pm

Re: Custom userscripts

Maybe an extra forum would be better?
Here's my first user script:
(only german, maybe I will translate it)
GoogleMail pyLoad Notifier 0.1
  Code:
#!/usr/bin/python
import smtplib
import sys
from time import strftime

dl_name = sys.argv[1]
dl_location = sys.argv[2]
dl_time = strftime("%d.%m.%Y - %H:%M:%S")
to = '[b]yourusername[/b]@gmail.com'
gmail_user = '[b]yourusername[/b]'
gmail_pwd = '[b]yourpassword[/b]'
smtpserver = smtplib.SMTP("smtp.gmail.com",587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_user, gmail_pwd)
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject: Download abgeschlossen: '+dl_name+' \n' + 'Content-Type: text/html \n'
#print header
stylesheet = '<style type="text/css">body { font-family: Verdana; font-size: 11px; } a { text-decoration: none; color: grey } #footer { color:grey; } a:hover { color: orange; }</style>'
logo = '<img src="http://pyload.org/lib/tpl/pyload//images/pyload-logo-edited3.5-new-font-small.png" /><br />'
msg = header + '\n' + stylesheet + '\n'+logo+'Hallo,<br />\n\n<br />der Download von <b>'+dl_name+'</b> ist abgeschlossen ('+dl_time+').\n<br />Er befindet sich in '+dl_location+'.\n\n<br /><hr /><span id="footer">Powered by <a href="http://pyload.org">pyLoad</a>!</span>'
smtpserver.sendmail(gmail_user, to, msg)
#print 'done!'
smtpserver.close()


Install:
Change the bold written information to your login credentials and copy the script to a file named 'mail.py'.
Save it to pyload/scripts/package_finished.
You need to restart pyLoad! in order to apply the script.

That's it!
Have fun!
Image Image
<<

kevku

Posts: 1

Joined: Wed Sep 08, 2010 9:39 am

Post Wed Sep 08, 2010 9:52 am

Re: Custom userscripts

a perl-telnet script that i use to reconnect my speedtouch 546v6 needs perl and net-telnet module

  Code:
#!/usr/bin/perl

use strict;
use Net::Telnet();

my %config = ( USERNAME => 'user', PASSWORD => 'pass', HOST => '192.168.1.254');
my $t = new Net::Telnet(Timeout => 5, Prompt => '/\=\>(\[.*\])?$/');

$t->open( $config{HOST} );
$t->login( $config{USERNAME}, $config{PASSWORD} );

$t->cmd(":ppp ifdetach intf=Internet");
$t->cmd(":ppp ifattach intf=Internet");
$t->errmode(sub {die @_ unless $_[0] =~ /eof/});
$t->cmd("exit");
<<

mestre_kame

Posts: 1

Joined: Tue Oct 12, 2010 6:32 am

Post Tue Oct 12, 2010 6:35 am

Re: Custom userscripts

shell script (or curl script?) to reconnect on netgear DG834G (maybe other similar)

  Code:
#!/bin/sh
curl -u userhere:passwordhere "http://192.168.0.1/setup.cgi" -d "next_file=diag.htm&todo=disconnect" > /dev/null
sleep 5
curl -u userhere:passwordhere "http://192.168.0.1/setup.cgi" -d "next_file=diag.htm&todo=connect" > /dev/null
<<

darkside40

Member

Posts: 54

Joined: Thu Jul 22, 2010 8:36 am

Post Wed Oct 20, 2010 10:12 am

Re: Custom userscripts

Reconnect Script for TP-Link TL-WR1043ND

  Code:
#!/bin/sh
curl "http://USER:PWD@IP/userRpm/StatusRpm.htm?Disconnect=Disconnect&wan=1"
curl "http://USER:PWD@IP/userRpm/StatusRpm.htm?Connect=Connect&wan=1"
exit 0


USER, PWD and IP must match your routers config.

Please dont use the Windows Editor for creating a unix script, it might not work. In worste case simply retype the lines in nano.
Or take that one in the attachment.
Attachments
reconnect.sh.zip
(594 Bytes) Downloaded 436 times
<<

rubengrimm

Posts: 1

Joined: Mon Nov 08, 2010 2:13 am

Post Mon Nov 08, 2010 2:16 am

Re: Custom userscripts

Script for Netgear WGR614v9 with firmware 1.2.30

  Code:
#!/bin/bash
echo "STEP 1: Create ID"
curl -b cookies.txt -c cookies.txt -m 10 "http://USER:PWD@IP/RST_st_poe.htm" > html.txt
ID=""
while read LINE && [ "$ID" == "" ]
do
   CUT=${LINE##*st_poe.cgi?id=}
   if [ "$CUT" != "$LINE" ]
   then
      ID=${CUT%%\">*}
   fi
done < html.txt


echo "STEP 2: Disconnect"
curl -b cookies.txt -c cookies.txt -m 10 -d "ConMethod=Disconnect" "http://USER:PWD@IP/st_poe.cgi?id=$ID" > /dev/null


echo "STEP 3: Connect"
curl -b cookies.txt -c cookies.txt -m 10 -d "ConMethod=++Connect++" "http://USER:PWD@IP/st_poe.cgi?id=$ID" > /dev/null


The problem with this router is, that it creates an ID everytime you open up the status window and only listens to this ID. So we need to get one before we can do the reconnect. Works perfectly for me.
<<

mistergonzo85

Posts: 5

Joined: Mon Nov 15, 2010 5:11 pm

Post Tue Nov 16, 2010 11:10 pm

Re: Custom userscripts

Reconnect Script for ALICE GATE VOIP 2 PLUS Wi-Fi

  Code:
#!/bin/sh
curl  "http://192.168.1.1/admin.cgi" -d "active_page=9117&page_title=Stato+Modem&mimic_button_field=submit_button_disattiva%3A+nat..&button_value=&strip_page_top=0 " > /dev/null
sleep 5
curl  "http:// 192.168.1.1/admin.cgi" -d "active_page=9117&page_title=Stato+Modem&mimic_button_field=submit_button_attiva%3A+nat..&button_value=nat&strip_page_top=0 " > /dev/null


works perfectly on my Freenas machine.
Thank you darkside40 for the inspiration!!
Ciauz :D
<<

neoyoshi

Posts: 2

Joined: Thu Nov 18, 2010 6:46 pm

Post Thu Nov 18, 2010 6:50 pm

Re: Custom userscripts

DHMH wrote:Maybe an extra forum would be better?
Here's my first user script:
(only german, maybe I will translate it)
GoogleMail pyLoad Notifier 0.1
  Code:
#!/usr/bin/python
import smtplib
import sys
from time import strftime

dl_name = sys.argv[1]
dl_location = sys.argv[2]
dl_time = strftime("%d.%m.%Y - %H:%M:%S")
to = '[b]yourusername[/b]@gmail.com'
gmail_user = '[b]yourusername[/b]'
gmail_pwd = '[b]yourpassword[/b]'
smtpserver = smtplib.SMTP("smtp.gmail.com",587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_user, gmail_pwd)
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject: Download abgeschlossen: '+dl_name+' \n' + 'Content-Type: text/html \n'
#print header
stylesheet = '<style type="text/css">body { font-family: Verdana; font-size: 11px; } a { text-decoration: none; color: grey } #footer { color:grey; } a:hover { color: orange; }</style>'
logo = '<img src="http://pyload.org/lib/tpl/pyload//images/pyload-logo-edited3.5-new-font-small.png" /><br />'
msg = header + '\n' + stylesheet + '\n'+logo+'Hallo,<br />\n\n<br />der Download von <b>'+dl_name+'</b> ist abgeschlossen ('+dl_time+').\n<br />Er befindet sich in '+dl_location+'.\n\n<br /><hr /><span id="footer">Powered by <a href="http://pyload.org">pyLoad</a>!</span>'
smtpserver.sendmail(gmail_user, to, msg)
#print 'done!'
smtpserver.close()


Install:
Change the bold written information to your login credentials and copy the script to a file named 'mail.py'.
Save it to pyload/scripts/package_finished.
You need to restart pyLoad! in order to apply the script.

That's it!
Have fun!


Yop,

Do you have try this script ?
Because, don't run it my system.
<<

DHMH

Member

Posts: 123

Joined: Sat Jul 10, 2010 6:27 pm

Post Fri Nov 19, 2010 3:53 pm

Re: Custom userscripts

Please give me more information, because for me the script works perfect!
Image Image
<<

neoyoshi

Posts: 2

Joined: Thu Nov 18, 2010 6:46 pm

Post Tue Nov 23, 2010 6:33 pm

Re: Custom userscripts

In my Qnap TS509, pyload (last version) it's ok (download ...), it run but when i check externalscript in web config and put mail.py in "/opt/pyload/scripts/package_finished/", it's doesn't run.
I don't know why and not information with "--debug"

And you where you put external script ?

Thanks
Next

Return to General

Who is online

Users browsing this forum: No registered users and 3 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for blacklist.org. Modified by pyLoad - Team © 2008-2011