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

Sample script #1

Open
bytecod3r opened this issue Nov 6, 2017 · 3 comments
Open

Sample script #1

bytecod3r opened this issue Nov 6, 2017 · 3 comments

Comments

@bytecod3r
Copy link

bytecod3r commented Nov 6, 2017

Hello,

Has anyone any sample python script to work with this extension?

Thanks.

@evering7
Copy link

Me too.

@egilas
Copy link

egilas commented Jan 12, 2019

Sample code

if (messageIsRequest):
	# Crude state:
	fname="c:/BURP/mystate5.txt"
	with open(fname,"r+") as myfile:
		myvalue=myfile.read()
		myvalue=int(myvalue)
		myvalue+=1
		print(myvalue)
		myfile.seek(0)
		myfile.write(str(myvalue))
		myfile.truncate()
	reqbytes=messageInfo.getRequest()
	req=helpers.analyzeRequest(reqbytes)
	headers=req.getHeaders()
	mydate="date: Wed, 22 Feb 2019 14:40:"+str(myvalue)+" GMT"
	headers.add(mydate)
	print(mydate)
	msgbody=reqbytes[(req.getBodyOffset()):]
	newreq=helpers.buildHttpMessage(headers,msgbody)
	messageInfo.setRequest(newreq)

@FranklinYu
Copy link

Can confirm that it works. Pretty print:

if (messageIsRequest):
    # Crude state:
    fname = "c:/BURP/mystate5.txt"
    with open(fname, "r+") as myfile:
        myvalue = myfile.read()
        myvalue = int(myvalue)
        myvalue += 1
        print(myvalue)
        myfile.seek(0)
        myfile.write(str(myvalue))
        myfile.truncate()
    reqbytes = messageInfo.getRequest()
    req = helpers.analyzeRequest(reqbytes)
    headers = req.getHeaders()
    mydate = "date: Wed, 22 Feb 2019 14:40:" + str(myvalue) + " GMT"
    headers.add(mydate)
    print(mydate)
    msgbody = reqbytes[(req.getBodyOffset()):]
    newreq = helpers.buildHttpMessage(headers, msgbody)
    messageInfo.setRequest(newreq)

Hannah-PortSwigger pushed a commit that referenced this issue Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants