Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
uk.co.bithatch:linuxio4j
Advanced tools
A JNA based library providing access to some low-level Linux subsystems, including :- * UInput. Create virtual devices such as keyboards, mice and touchpads and emit events from them as if they were real. * Evdev. Read events from various devices such as keyboards, mice, touchpads, and all other devices exposed by Linux. * Frame Buffer. Write directly to the Linux framebuffer. Allows graphical user interfaces without X being present. As from version 2.0, this library is now in uk.co.bithatch namespace. Version 2.1 and above support Java 8, and module Java 9 and above.
Java Interface to parts of the Linux I/O system, specifically UInput/Evdev and the Framebuffer.
The library is available in Maven Central, so configure your project according to the build system you use.
Version 2.0 was released as Java 9 or higher only, but as from version 2.1-SNAPSHOT, Java 8 compatibility is restored through the use of a multi release jar (MRJAR). So for Java 9 modularity support, use anything from version 2.0. For Java 8, use any version except version 2.0. Be aware though, that Java 8 compatibility may be completely removed at some future version.
<dependency>
<groupId>uk.co.bithatch</groupId>
<artifactId>linuxio4j</artifactId>
<version>2.1</version>
</dependency>
Or for the current development version (will be occasionally updated between releases).
<dependency>
<groupId>uk.co.bithatch</groupId>
<artifactId>linuxio4j</artifactId>
<version>2.1</version>
</dependency>
You can run the test application from the command line (requires Maven).
mvn compile exec:java
If all is well, you'll see a simple menu.
1. FB List GraphicsDevice
2. FB random colours (full speed)
3. FB noise (direct to buffer)
4. FB Test Card
5. UINPUT Keyboard
6. UINPUT Pointer
7. UINPUT All
8. UINPUT Virtual Device
To integrate with your own project, here are some basics.
To find all the frame buffer devices :-
List<FrameBuffer> fbs = FrameBuffer.getFrameBuffers();
To get the resolution of a buffer device :-
try(FrameBuffer fb = FrameBuffer.getFrameBuffer()) {
int xres = fb.getVariableScreenInfo().xres;
int yres = fb.getVariableScreenInfo().xres;
System.out.println("The buffer is " + xres + " x " + yres);
}
To write a whole screen of random noise directly to the display :-
try(FrameBuffer fb = FrameBuffer.getFrameBuffer()) {
/* Get a whole page of random numbers */
byte[] rnd = new byte[fb.getVariableScreenInfo().yres * fb.getVariableScreenInfo().xres * Math.max(1, fb.getVariableScreenInfo().bits_per_pixel / 8)];
new Random().nextBytes(rnd);
/* Write the noise */
fb.getBuffer().put(rnd);
}
To get a Graphics
to draw on :-
try(FrameBuffer fb = FrameBuffer.getFrameBuffer()) {
Graphics2D g = fb.getGraphics();
g.setColor(Color.RED);
g.drawRect(100, 100, 400, 400);
fb.commit();
}
To grab and read mouse events :-
try(InputDevice mouse = InputDevice.getFirstPointerDevice()) {
mouse.open();
mouse.grab();
while (true) {
Event ev = mouse.nextEvent();
if (ev == null) {
break;
}
System.out.println(ev);
}
}
To create a new virtual keyboard device and emit some keys :-
try (InputDevice dev = new InputDevice("LinuxIO Test", (short) 0x1234, (short) 0x5678)) {
dev.getCapabilities().put(
Type.EV_KEY, new LinkedHashSet<>(Arrays.asList(
EventCode.KEY_H,
EventCode.KEY_E,
EventCode.KEY_L,
EventCode.KEY_O,
EventCode.KEY_W,
EventCode.KEY_R,
EventCode.KEY_D,
EventCode.KEY_ENTER)));
dev.open();
dev.typeKeys(
EventCode.KEY_H, EventCode.KEY_E, EventCode.KEY_L, EventCode.KEY_L, EventCode.KEY_O,
EventCode.KEY_W, EventCode.KEY_O, EventCode.KEY_R, EventCode.KEY_L, EventCode.KEY_D,
EventCode.KEY_ENTER);
}
Non-blocking monitoring of multiple devices (internally a single thread is created).
for (InputDevice device : InputDevice.getAllPointerDevices()) {
device.open();
device.grab();
InputController.getInstance().add(device, (d, e) -> {
System.err.println(d + " = " + e);
});
}
InputEventCode
renamed to EventCode
and turned into an enum
. More convenience methods for typing keys.UInputDevice
renamed to InputDevice
.UInputController
renamed to InputController
.FAQs
A JNA based library providing access to some low-level Linux subsystems, including :- * UInput. Create virtual devices such as keyboards, mice and touchpads and emit events from them as if they were real. * Evdev. Read events from various devices such as keyboards, mice, touchpads, and all other devices exposed by Linux. * Frame Buffer. Write directly to the Linux framebuffer. Allows graphical user interfaces without X being present. As from version 2.0, this library is now in uk.co.bithatch namespace. Version 2.1 and above support Java 8, and module Java 9 and above.
We found that uk.co.bithatch:linuxio4j demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.