Skip to content

Instantly share code, notes, and snippets.

@itsuwari
Last active September 11, 2019 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsuwari/e705f810f50446c6ad1b96e4a69f4d92 to your computer and use it in GitHub Desktop.
Save itsuwari/e705f810f50446c6ad1b96e4a69f4d92 to your computer and use it in GitHub Desktop.
import urllib2
import urllib
from time import sleep
def login(username, passwd, v6):
post_t = {
'0MKKey': '123456789',
'v6ip': v6,
'DDDDD': username,
'upass': passwd
}
post = urllib.urlencode(post_t)
# post = post
# url = 'http://202.204.48.66'
url = 'http://202.204.48.82'
req = urllib2.Request(url, data=post)
res = urllib2.urlopen(req)
return res.getcode()
# print(req)
def getv6():
url = 'http://[2001:da8:ad:3213::3]:9002/v6'
print('Getting V6')
req = urllib2.Request(url)
res = urllib2.urlopen(req).read()
address = str(res)
start = int(address.find('value=')) + 7
end = int(address.find('></FORM>')) - 1
address = address[start:end]
return address
def getv6_v2():
url = 'http://cippv6.ustb.edu.cn/get_ip.php'
# url = 'http://[2001:da8:208:100::115]:80/get_ip.php'
print('Getting V6')
req = urllib2.Request(url)
res = urllib2.urlopen(req).read()
address = str(res)
start = int(address.find('Addr = ')) + len('Addr = ')+1
end = int(address.find(';')) - 1
address = address[start:end]
return address
def getv6_v3():
import socket
s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
s.connect(('2001:da8:208:5876:71de:789f:bf17:867', 80))
v6 = s.getsockname()[0]
s.close()
return v6
while True:
try:
v6 = getv6_v3()
login('41521008', '3334037', v6)
print('Login, ipv6=%s' % v6)
sleep(300)
except:
print('Retry')
import traceback
traceback.print_exc()
sleep(2)
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment