-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from bafflingbug/dev
Dev
- Loading branch information
Showing
6 changed files
with
104 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,52 @@ | ||
import urllib | ||
import urllib2 | ||
import socket | ||
from py3 import py3 | ||
|
||
if py3: | ||
from urllib import request, parse | ||
else: | ||
import urllib | ||
import urllib2 | ||
|
||
|
||
def portopen(ip,port): | ||
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) | ||
try: | ||
s.connect((ip, int(port))) | ||
s.shutdown(2) | ||
print('%d is open' % port) | ||
return True | ||
except: | ||
print('%d is down' % port) | ||
return False | ||
|
||
|
||
def getgroup(url): | ||
res = urllib2.urlopen(url) | ||
if py3: | ||
res = request.urlopen(url) | ||
else: | ||
res = urllib2.urlopen(url) | ||
return str(res.read()) | ||
|
||
|
||
def post(url, data, token, host): | ||
parm = urllib.urlencode({'ssr': data, "token": token, "host": host}) | ||
req = urllib2.Request(url, parm) | ||
res = urllib2.urlopen(req) | ||
if py3: | ||
data = parse.urlencode({'ssr': data, "token": token, "host": host}).encode('utf-8') | ||
req = request.Request(url, data=data) | ||
res = request.urlopen(req) | ||
else: | ||
parm = urllib.urlencode({'ssr': data, "token": token, "host": host}) | ||
req = urllib2.Request(url, parm) | ||
res = urllib2.urlopen(req) | ||
return str(res.read()) | ||
|
||
|
||
def active(url, token, host): | ||
parm = urllib.urlencode({"token": token, "host": host}) | ||
req = urllib2.Request(url, parm) | ||
res = urllib2.urlopen(req) | ||
if py3: | ||
data = parse.urlencode({"token": token, "host": host}).encode('utf-8') | ||
req = request.Request(url, data=data) | ||
res = request.urlopen(req) | ||
else: | ||
parm = urllib.urlencode({"token": token, "host": host}) | ||
req = urllib2.Request(url, parm) | ||
res = urllib2.urlopen(req) | ||
return str(res.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import sys | ||
|
||
if sys.version > '3': | ||
py3 = True | ||
else: | ||
py3 = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters