question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jython HTTP sender scripts not printing to Script Console after first run

See original GitHub issue

Describe the bug

When trying to use python script in HTTP sender using, it only runs on every new request. I’m assuming this is a bug since the script is is run every time when using JavaScript.

Steps to reproduce the behavior

  1. Go to scripts
  2. From the left pane scripting right click on HTTP Sender
  3. From the spawned option menu select new script
  4. Write a name for the script, for example, temp.py
  5. Select template HttpSender default_template.py
  6. Select Load on Start and Enabled
  7. Click Save
  8. Navigate to a web address using ZAP as a proxy or replay a request using Request Editor

Expected behavior

When using the template default_template.py it should run the script everytime a request is made logging the request and response url everytime a request is send.

Software versions

OWASP ZAP
Version: 2.11.1

Installed Add-ons: [[id=alertFilters, version=13.0.0],
[id=ascanrules, version=47.0.0], [id=ascanrulesAlpha,
version=38.0.0], [id=ascanrulesBeta, version=41.0.0],
[id=authstats, version=2.0.0], [id=automation,
version=0.16.0], [id=bruteforce, version=11.0.0],
[id=callhome, version=0.4.0], [id=commonlib, version=1.9.0],
[id=communityScripts, version=14.0.0], [id=custompayloads,
version=0.11.0], [id=diff, version=11.0.0],
[id=directorylistv1, version=5.0.0], [id=domxss,
version=13.0.0], [id=encoder, version=0.6.0], [id=exim,
version=0.2.0], [id=fileupload, version=1.1.0],
[id=formhandler, version=5.0.0], [id=fuzz, version=13.6.0],
[id=fuzzdb, version=8.0.0], [id=fuzzdboffensive,
version=4.0.0], [id=gettingStarted, version=13.0.0],
[id=graaljs, version=0.2.0], [id=graphql, version=0.9.0],
[id=help, version=14.0.0], [id=hud, version=0.13.0],
[id=importurls, version=9.0.0], [id=invoke, version=11.0.0],
[id=jruby, version=8.0.0], [id=jwt, version=1.0.2],
[id=jython, version=12.0.0], [id=kotlin, version=1.1.0],
[id=network, version=0.2.0], [id=oast, version=0.10.0],
[id=onlineMenu, version=9.0.0], [id=openapi,
version=27.0.0], [id=pscanrules, version=42.0.0],
[id=pscanrulesAlpha, version=35.0.0], [id=pscanrulesBeta,
version=29.0.0], [id=quickstart, version=33.0.0],
[id=replacer, version=9.0.0], [id=reports, version=0.15.0],
[id=retest, version=0.2.0], [id=retire, version=0.14.0],
[id=reveal, version=4.0.0], [id=saverawmessage,
version=7.0.0], [id=savexmlmessage, version=0.3.0],
[id=scripts, version=30.0.0], [id=selenium, version=15.9.0],
[id=soap, version=13.0.0], [id=spiderAjax, version=23.8.0],
[id=tips, version=9.0.0], [id=tokengen, version=15.0.0],
[id=wappalyzer, version=21.12.0], [id=webdriverlinux,
version=42.0.0], [id=websocket, version=26.0.0], [id=zest,
version=35.0.0]]

Operating System: Linux
Java Version: Ubuntu 11.0.16
System's Locale: en_US
Display Locale: en_GB
Format Locale: en_US
ZAP Home Directory: /home/<redacted>/.ZAP/
ZAP Installation Directory: /opt/zaproxy/./
Look and Feel: FlatLaf Light (com.formdev.flatlaf.FlatLightLaf)

Screenshots

No response

Errors from the zap.log file

No response

Additional context

No response

Would you like to help fix this issue?

  • Yes

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
thc202commented, Aug 30, 2022

Issue title updated to better reflect the issue, the scripts are being executed it’s not printing to the Script Console but ZAP’s output on following runs.

0reactions
Paippicommented, Aug 30, 2022

Comparing the logs the script prints in the Script Console

Read more comments on GitHub >

github_iconTop Results From Across the Web

Call and receive output from Python script in Java?
I've looked for different libraries like Jepp or Jython, but most appear out of date. Another problem with the libraries is that I...
Read more >
Can Jython script be used as a hook? - Google Groups
Only python scripts are supported as packaged scan hooks. However you should be able to use the linked script as an HTTP Sender...
Read more >
Jython FAQ
1.1 What is Jython? Jython implements the Python programming language on the Java(tm) Platform. It consists of a compiler to compile Python source...
Read more >
Administrative problems with the wsadmin scripting tool - IBM
If you are not able to enter wsadmin command mode, try running wsadmin ... The following errors may occur when you run this...
Read more >
Scripting Examples - JMRI
To run one of these scripts, start DecoderPro or PanelPro (set preferences ... current set of scripts, please see the jython directory on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found