Burpsuite combined with mitmproxy to achieve encryption and decryption of data

0 21
1. Implementation PrincipleBurpsutie forwards requests to the mitmproxy proxy vi...

1. Implementation Principle

Burpsutie forwards requests to the mitmproxy proxy via an upstream proxy, and after the mitmproxy encrypts and decrypts the data using encryption and decryption scripts, it forwards the requests to the server


2. Achieve the goal

  • Can encrypt or decrypt the request data
  • Can encrypt or decrypt the response data

3. Mitmproxy environment installation

Burpsuite combined with mitmproxy to achieve encryption and decryption of data

pip install mitmproxy

4. Environment configuration

  • mitmproxy startup command

Method 1: mitmproxy.exe -p 8888 -s md5.py

Method 2: mitmweb.exe -p 8888 -s md5.py

Description: -p specifies the listening port, -s specifies the loaded script, which is the encryption and decryption script

  • Configure burpsuite upstream proxy servers

Configure upstream proxy, address and port of mitmproxy proxy

1718856633_6673abb9ccc4dd1bd7f8b.png!small?1718856635119



5. MD5 encryption example


Request packet:

POST /login_check.php HTTP/1.1

Host: 127.0.0.1

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0

Accept: */*

Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2

Accept-Encoding: gzip, deflate, br

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

X-Requested-With: XMLHttpRequest

Content-Length: 60

Origin: http://127.0.0.1

Connection: close

Referer: http://127.0.0.1/

Sec-Fetch-Dest: empty

Sec-Fetch-Mode: cors

Sec-Fetch-Site: same-origin

Priority: u=1


m=1&username=admin&password=21232f297a57a5a743894a0e4a801fc3


Encryption can be judged as MD5 through the request

1718856661_6673abd5e8c40a1ef810e.png!small?1718856662481





MD5 script:

# -*- coding: utf-8 -*-

from mitmproxy import http, ctx

import hashlib


def md5_encryption(pwd):

md5 = hashlib.md5()

md5.update(pwd.encode('utf-8'))

md5_pass = md5.hexdigest()

return md5_pass


class MD5:

def request(self, flow: http.HTTPFlow)-> None:

# Get the request POST data, such as m=1&username=admin&password=admin

data = flow.request.text

# Split the data into an array with '=', such as ['m', '1&username', 'admin&password', 'admin']

d = data.split('=')

# Encrypt the plaintext password using the md5_encryption method

md5_pass = md5_encryption(d[3])

# Reassign the encrypted ciphertext to the array

d[3] = md5_pass

# Reformat the array elements into a POST string format

data = '='.join(d)

# Assign the encrypted data to flow.request.text

flow.request.text = data


#info = ctx.log.info

#info(data)

def response(self, flow: http.HTTPFlow):

# Get the response object


response = flow.response


# Instantiate the output class


info = ctx.log.info


# Print response code


info(str(response.status_code))


# Print all headers


info(str(response.headers))


# Print cookie header


info(str(response.cookies))


# Print the response message content


info(str(response.text))


addons = [MD5()]


你可能想看:

d) Adopt identification technologies such as passwords, password technologies, biometric technologies, and combinations of two or more to identify users, and at least one identification technology sho

In today's rapidly developing digital economy, data has become an important engine driving social progress and enterprise development. From being initially regarded as part of intangible assets to now

Burpy + frida to implement automatic encryption and decryption on Burp

As announced today, Glupteba is a multi-component botnet targeting Windows computers. Google has taken action to disrupt the operation of Glupteba, and we believe this action will have a significant i

Data security can be said to be a hot topic in recent years, especially with the rapid development of information security technologies such as big data and artificial intelligence, the situation of d

Ensure that the ID can be accessed even if it is guessed or cannot be tampered with; the scenario is common in resource convenience and unauthorized vulnerability scenarios. I have found many vulnerab

2. Use ShardingSphere-Proxy to implement sensitive data encryption

Bubba AI launches open-source compliance platform Comp AI, helping 100,000 startups achieve security compliance

Announcement regarding the addition of 7 units as technical support units for the Ministry of Industry and Information Technology's mobile Internet APP product security vulnerability database

b) It should have a login failure handling function, and should configure and enable measures such as ending the session, limiting the number of illegal login attempts, and automatically logging out w

最后修改时间:
admin
上一篇 2025年03月27日 17:46
下一篇 2025年03月27日 18:09

评论已关闭