2.data5u 프록시 IP의 포트 암호화 해제 (2)
계속 해독하다
이 부분은 스크립트로 잡은 html 페이지에 IP가 표시되는 부분입니다.
- 180.97.81.215
- 8635
...
이것은 지난번에 해독된 js 코드입니다.$(function() {
$('.port')['each'](function() {
var a = $(this)['html']();
if (a['indexOf']('*') != -0x1) {
return
};
var b = $(this)["attr"]("class");
try {
b = (b["split"](" "))[0x1];
var c = b["split"]("");
var d = c["length"];
var f = [];
for (var g = 0x0; g < d; g++) {
f["push"]("ABCDEFGHIZ"["indexOf"](c[g]))
};
$(this)["html"](window["parseInt"](f["join"]("")) >> 0x3)
} catch(e) {}
})
})
코드 해독
우리 두 개를 대조해서 함께 봅시다.
- 180.97.81.215
- 8635
...
$(function() {
$('.port')['each'](function() {
var a = $(this)['html']();
if (a['indexOf']('*') != -0x1) {
return
};
var b = $(this)["attr"]("class");
try {
b = (b["split"](" "))[0x1];
var c = b["split"]("");
var d = c["length"];
var f = [];
for (var g = 0x0; g < d; g++) {
f["push"]("ABCDEFGHIZ"["indexOf"](c[g]))
};
$(this)["html"](window["parseInt"](f["join"]("")) >> 0x3)
} catch(e) {}
})
})
우리 두 개를 대조해서 함께 봅시다.
class에 포함된 port의 html 블록을 골라서 그것들을 순환시킨다.*가 포함되면 처리하지 않는 것을 건너뜁니다.class을 꺼내 split로 분해한 후 두 번째(0x1)를 취한 결과 우리 위의 html, 여기b의 값은 CFACE일 것이다.CFACE를 문자수조(c)로 분해하여 수조를 순환시킨다.ABCDEFGHIZ 안에 있는 인덱스를 찾아 새로운 문자 그룹 (f) 을 구성합니다.8635.여기서 나는 알고리즘을 단독으로python으로 썼다.
def decrypt(src):
s = 'ABCDEFGHIZ'
dst = ''
for c in src:
dst += str(s.find(c))
dst = int(dst) >> 3
return dst
이로써 포트는 해독되었다.
결어
데이터 5u를 직접 잡는 페이지를 볼 수 있습니다. 안에 표시된 포트 번호는 무작위로 잘못된 값입니다. 진정한 값은 class 속성에 저장된 다음에 js 함수를 통해 반해된 것입니다.
그러나 어쨌든 js 코드이기 때문에 이런 암호화는 혼동이라고 할 수 있을 뿐, 일부 고수들에게는 여전히 이해하기 쉽다.
마지막으로 제가 쓴 프록시 ip를 잡는 스크립트를 올려서 여러분께 도움이 되었으면 합니다.import requests
from bs4 import BeautifulSoup
URL = "http://www.data5u.com/"
def extract_proxy_ip():
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'}
r = requests.get(URL, headers=headers)
if r.status_code != 200:
print 'get url error:', r.status_code
print r.cookies
html = r.text
soup = BeautifulSoup(html)
for tag in soup.find_all("ul", "l2"):
g_ip_list[tag.li.string] = [tag.li.string,decrypt(tag.find_all("li", "port")[0]['class'][1])]
return ip_list
def decrypt(src):
s = 'ABCDEFGHIZ'
dst = ''
for c in src:
dst += str(s.find(c))
dst = int(dst) >> 3
return dst
print extract_proxy_ip()
import requests
from bs4 import BeautifulSoup
URL = "http://www.data5u.com/"
def extract_proxy_ip():
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'}
r = requests.get(URL, headers=headers)
if r.status_code != 200:
print 'get url error:', r.status_code
print r.cookies
html = r.text
soup = BeautifulSoup(html)
for tag in soup.find_all("ul", "l2"):
g_ip_list[tag.li.string] = [tag.li.string,decrypt(tag.find_all("li", "port")[0]['class'][1])]
return ip_list
def decrypt(src):
s = 'ABCDEFGHIZ'
dst = ''
for c in src:
dst += str(s.find(c))
dst = int(dst) >> 3
return dst
print extract_proxy_ip()