Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
java-access-bridge-wrapper
Advanced tools
Python wrapper around the Java Access Bridge / Windows Access Bridge.
Enable the Java Access Bridge in windows
C:\path\to\java\bin\jabswitch -enable
pip install java-access-bridge-wrapper
Import the Java Access Bridge (JAB) wrapper and optionally the context tree
from JABWrapper.jab_wrapper import JavaAccessBridgeWrapper
from JABWrapper.context_tree import ContextNode, ContextTree, SearchElement
The JAB creates an virtual GUI window when it is opened. For the JAB to operate and receive events from the GUI, the calling code needs to implement the windows message pump and call it in a loop. The JABWrapper object needs to be in the same thread.
This can be achieved for example by starting the message pump in a separate thread, where the JAB object is also initialized.
GetMessage = ctypes.windll.user32.GetMessageW
TranslateMessage = ctypes.windll.user32.TranslateMessage
DispatchMessage = ctypes.windll.user32.DispatchMessageW
def pump_background(pipe: queue.Queue):
try:
jab_wrapper = JavaAccessBridgeWrapper()
pipe.put(jab_wrapper)
message = byref(wintypes.MSG())
while GetMessage(message, 0, 0, 0) > 0:
TranslateMessage(message)
logging.debug("Dispatching msg={}".format(repr(message)))
DispatchMessage(message)
except Exception as err:
pipe.put(None)
def main():
pipe = queue.Queue()
thread = threading.Thread(target=pump_background, daemon=True, args=[pipe])
thread.start()
jab_wrapper = pipe.get()
if not jab_wrapper:
raise Exception("Failed to initialize Java Access Bridge Wrapper")
time.sleep(0.1) # Wait until the initial messages are parsed, before accessing frames
if __name__ == "__main__":
main()
Once the JABWrapper object is initialized, attach to some frame and optionally create the context tree to get the element tree of the application.
jab_wrapper.switch_window_by_title("Frame title")
context_tree = ContextTree(jab_wrapper)
pip install -Ur requirements.txt
.
inv setup
.
-h
on how to pass credentials for ensuring that both your production PyPI and CI DevPI are
configured. You'll find these in our Robocorp > Shared 1Password by searching for keywords like "pypi"
(where we recommend a personal token instead) and "devpi".inv update
so the library gets ready for development.Run test script against a simple Swing application.
Set environment variable
set RC_JAVA_ACCESS_BRIDGE_DLL="C:\path\to\Java\bin\WindowsAccessBridge-64.dll"
Update requirements and install the library in development mode
inv update
Run tests
inv test # runs all the tests in all scenarios
inv test -s -t test_jab_wrapper.py # runs all the tests from a file in one simple common scenario
inv test -s -c -t test_jab_wrapper.py::test_depth # as above, but specific test and captures output
Check linting
inv lint # apply with '-a'
Building and publishing
inv publish # '-c' for DevPI
FAQs
Python wrapper for the Windows Java Access Bridge
We found that java-access-bridge-wrapper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.