Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有个报错,不知道怎么处理 #20

Closed
haibara3839 opened this issue Mar 28, 2021 · 4 comments
Closed

有个报错,不知道怎么处理 #20

haibara3839 opened this issue Mar 28, 2021 · 4 comments

Comments

@haibara3839
Copy link

error

@mr-m0nst3r
Copy link
Owner

请按照issue的模板提问。

一般你直接使用python执行这个脚本报错的话,会提示这个错误。有可能是一些库或语法错误。
另外,检查一下burpy版本和python版本。

@haibara3839
Copy link
Author

Describe the bug
在burpsuite 的Burpy 图形界面点击start server 按钮后会报错,Failed to get python file, pls recheck
burpy_1
经过排查好像是burpyServicePyro.py 脚本接收不到 sys.argv[-1]这个参数,burpyServicePyro.py 是不是安装burpy 时产生的
burpy_2

To Reproduce
Steps to reproduce the behavior:

  1. 打开burpsuite
  2. 在extensions 共add Burpy jar 包,直接在您github上下载的打包好的 。完成后burp 多了一个burpy模块
  3. 在burpy 中输入python.exe和python脚本的 绝对路径,python 脚本是https://raw.githubusercontent.com/yearnwang/Burpy_web_decode/master/ex.py
  4. See error :Failed to get python file, pls recheck

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [win10 64位]
  • Python: [python3.9.1]
  • Burpy: [v2.4.3]

Burpy Scripts

#coding:utf-8
import codecs
import Pyro4
import sys
m_module = sys.argv[-1]
import imp
try:
    imp.load_source("f",m_module) #imp.load_source("test","/tmp/test.py")
except Exception:
    print("Failed to get python file, pls recheck")
from f import Burpy # which loads the destination file


@Pyro4.expose
class BridaServicePyro:
    def __init__(self, daemon):
        self.daemon = daemon
        self.burpy = Burpy()

    def disconnect_application(self):

        self.device.kill(self.pid)
        return

    def hello_spawn(self):
        data = "it's working"
        return data

    def hello(self, header, body):
        data = body[0].decode("hex")
        if data is None:
        	return "No data selected"
        try:
            # header is a list, but body is string
            # so we append body to header list
            nheader, nbody = self.burpy.main(header, data)
            nheader = nheader or list()
            nheader.append("")
            nheader.append(nbody)
            http_str = "\x0d\x0a".join(nheader)
            ret_val = http_str

        except Exception as e:
            print( e )
            ret_val = "helo(main) BurpyService failed"
        return ret_val

    def encrypt(self, header, body):
        data = body[0].decode("hex")
        if data is None:
            return "No data selected"
        try:
            # header is a list, but body is string
            # so we append body to header list
            nheader, nbody = self.burpy.encrypt(header, data)
            nheader = nheader or list()
            header.append("")
            nheader.append(nbody)
            http_str = "\x0d\x0a".join(nheader)
            ret_val = http_str

        except Exception as e:
            print( e )
            ret_val = "Encrypt in BurpyService failed"
        return ret_val

    def decrypt(self, header, body):
        data = body[0].decode("hex")
        if data is None:
            return "No data selected"
        try:
            # header is a list, but body is string
            # so we append body to header list
            nheader, nbody = self.burpy.decrypt(header, data)
            nheader = nheader or list()
            nheader.append("")
            nheader.append(nbody)
            http_str = "\x0d\x0a".join(nheader)
            ret_val = http_str

        except Exception as e:
            print( e )
            ret_val = "Decrypt in BurpyService Failed"
        return ret_val

    def sign(self, header, body):
        data = body[0].decode("hex")
        if data is None:
            return "No data selected"
        try:
            # header is a list, but body is string
            # so we append body to header list
            nheader, nbody = self.burpy.sign(header, data)
            nheader.append("")
            nheader.append(nbody)
            http_str = "\x0d\x0a".join(nheader)
            ret_val = http_str

        except Exception as e:
            print( e )
            ret_val = "Can't find method name burpy or script file not found"
        return ret_val

    def processor(self, data):
        try:
            ret_val = self.burpy.processor(data)
            return ret_val
        except Exception as e:
            print( e )
            return "Can't process payload"


    @Pyro4.oneway
    def shutdown(self):
        print('shutting down...')
        try:
            # self.burpy.down()
            del self.burpy
        except Exception:
            print("burpy.down() method not found, skipped.")
        self.daemon.shutdown()


host = sys.argv[1]
port = int(sys.argv[2])
daemon = Pyro4.Daemon(host=host,port=port)

#daemon = Pyro4.Daemon(host='127.0.0.1',port=9999)
bs = BridaServicePyro(daemon)
uri = daemon.register(bs,objectId='BurpyServicePyro')

print("Ready.")
daemon.requestLoop()

Additional context
Add any other context about the problem here.

@mr-m0nst3r
Copy link
Owner

image
你直接使用python执行你要加载的脚本,也就是https://raw.githubusercontent.com/yearnwang/Burpy_web_decode/master/ex.py这个,如果能正常执行,才会正常加载。

burpyService这个脚本不需要拿出来,一般不会是这里的问题。

另外,ex.py应该是老版本的burpy使用的脚本,里面是python2的语法,你应该根据情况调整一下再运行。建议使用README里面的示例试一下。

@mr-m0nst3r
Copy link
Owner

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants