Written by: Helio Loureiro
Category: Python
Hits: 17871

 Esse é o script usado para autenticar automaticamente no Speedy da Telefonica (região de São Paulo). Evita que usuários residenciais, como eu, precisem estar em frente à máquina, permitindo que a mesma volte à rede sem intervenção humana.

Instruções para Linux:
    Copie o arquivo com o nome "0speedy_auth" dentro de "/etc/ppp/ip-up.d/". Isso fará com que seja executada no início de cada inicialização ppp. Para tornar o pppoe também automática, inclua a seguinte entrada em "/etc/inittab":
S1:2345:respawn:/usr/sbin/pppd nodetach call speedy
    O nome "speedy" é relativo ao arquivo que deve existir em "/etc/ppp/peers/speedy" com o conteúdo semelhante à:


pty "pppoe -I eth0 -T 80 -m 1452"
noauth
defaultroute
user "This email address is being protected from spambots. You need JavaScript enabled to view it."
usepeerdns

Instruções para FreeBSD:
    Inclua o nome do arquivo (e o caminho) em "/etc/ppp/ppp.linkup".


 

 
# $Id: speedy_auth.py,v 1.1 2003/09/12 02:57:40 helio Exp $
# COPYRIGHT
#
#    Copyright © 2003 Helio Loureiro
#
#    Permission to use, copy, modify, distribute, and sell this software
#    for any purpose is hereby granted without fee, provided that the above
#    copyright notice appear in all copies and that both that copyright
#    notice and this permission notice appear in supporting documentation.
#    No representations are made about the suitability of this software for
#    any purpose. It is provided "as is" without express or implied
#    warranty.


import os, sys, time
from socket import *

print "Autenticador para speedy $Revision: 1.1 $ - versão super alfa \
\nEscrito em Python (multiplataforma :-) \
\nEnvie suas sugestões e críticas para \"helio AT loureiro DT eng DT br\""

hostfake="www.google.com.br"
web=80
host='200.171.222.97'
port=86

adsl = socket(AF_INET, SOCK_STREAM)
adsl.connect((hostfake, web))
adsl.send("""GET /intl/pt/ HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Python
Keep-Alive: 300
Connection: keep-alive\n\n
""")

adsl.recv(1024)
adsl.close()

adsl = socket(AF_INET, SOCK_STREAM)
adsl.connect((host, port))
adsl.send("""GET /speedywebapp/html/redirect.html?CPURL=http://www.google.com/intl/pt/ HTTP/1.1
Host: 200.171.222.97:86
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Python
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/pla
in;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Language: pt-br
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Mon, 08 Sep 2003 12:21:49 GMT
If-None-Match: "12bc10-4d1-7e901140"\n\n
""")
adsl.recv(1024)
adsl.close()

adsl = socket(AF_INET, SOCK_STREAM)
adsl.connect((host, port))
adsl.send("""GET /speedywebapp/servlet/logon?CPURL=http://www.google.com/intl/pt/&opcion=internet HTTP/1.1
Host: 200.171.222.97:86
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Python
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/pla
in;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Language: pt-br
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Referer: http://200.171.222.97:86/speedywebapp/servlet/popupView?CPURL=http://www.google.com/intl/pt/\n\n
""")
adsl.recv(1024)
adsl.close()

print "Conexão estabelecida.  Divirta-se!!!"