Skip to content

Commit

Permalink
Merge pull request #6 from FalsePattern/dev
Browse files Browse the repository at this point in the history
1.2.0
  • Loading branch information
FalsePattern authored Feb 12, 2023
2 parents 73e38ee + 92ff3f5 commit 8ff7e44
Show file tree
Hide file tree
Showing 44 changed files with 2,464 additions and 211 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
java-version: '17'

- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
10 changes: 5 additions & 5 deletions .github/workflows/release-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
java-version: '17'
server-id: mavenpattern
server-username: MAVEN_DEPLOY_USER
server-password: MAVEN_DEPLOY_PASSWORD

- name: Build and Publish with Maven
run: mvn --batch-mode --update-snapshots deploy
env:
MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
MAVEN_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}

- name: Release under current tag
uses: "marvinpinto/action-automatic-releases@latest"
Expand Down
1 change: 0 additions & 1 deletion COPYING

This file was deleted.

674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion LICENSE

This file was deleted.

15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
JFunge - A standard-conforming Befunge-98 and Trefunge-98 interpreter
Copyright (C) 2022-2023 FalsePattern

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
37 changes: 30 additions & 7 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ A standard-conforming Funge-98 interpreter.

### Usage
```
usage: jfunge [-f <file> | --help | --license | --version] [-i <file>]
[--maxiter <iterations>] [-o <file>] [--syscall] [-t] [--trefunge]
usage: jfunge [--env] [-f <file> | --help | --license | --version] [-i <file>]
[--maxiter <iterations>] [-o <file>] [--perl] [--syscall] [-t]
[--trefunge]
JFunge, a Funge98 interpeter for java.
--env Allows the interpreter to access the environment
variables of the host system.
-f,--file <file> The file to load into the interpreter at the origin
on startup.
--help Displays this help page
Expand All @@ -22,6 +25,10 @@ JFunge, a Funge98 interpeter for java.
directory (o instruction). Specify / to allow write
access to every file on the system (dangerous). Can
specify multiple files/folders.
--perl Enable the PERL fingerprint. This requires the
working directory of the interpreter to be
writable, and is also an arbitrary code execution
risk.
--syscall Enables the syscall feature (= instruction). This
is a very dangerous permission to grant, it can
call any arbitrary program on your system.
Expand All @@ -33,11 +40,14 @@ JFunge, a Funge98 interpeter for java.
--version Prints the current program version, along with the
handprint and version given by befunge's y
instruction.
Process finished with exit code 0
```

### Compatibility

The interpreter's handprint is `0xfa15e9a7` (`-99227225` in decimal), which is a hexadecimal approximation of "`falsepat`" from FalsePattern.
The interpreter's handprint is `0x74708578` ("JFUN")

The version number given to befunge is `major * 256 * 256 + minor * 256 + patch`, where major, minor, patch are the 3
primary version numbers in the standard semver format.
Expand All @@ -51,18 +61,31 @@ The interpreter supports the following Funge-98 specification extensions:
- Optional Trefunge mode (experimental)

Additionally, the following fingerprints are currently supported (more to come):
- [3DSP](http://rcfunge98.com/rcsfingers.html#3DSP)
- [FPSP](http://rcfunge98.com/rcsfingers.html#FPSP)
- [3DSP](https://rcfunge98.com/rcsfingers.html#3DSP)
- [BASE](https://rcfunge98.com/rcsfingers.html#BASE)
- [CPLI](https://rcfunge98.com/rcsfingers.html#CPLI)
- [DATE](https://rcfunge98.com/rcsfingers.html#DATE)
- [DIRF](https://rcfunge98.com/rcsfingers.html#DIRF)
- [EVAR](https://rcfunge98.com/rcsfingers.html#EVAR)
- [FING](https://rcfunge98.com/rcsfingers.html#FING)
- [FIXP](https://rcfunge98.com/rcsfingers.html#FIXP)
- [FPDP](https://rcfunge98.com/rcsfingers.html#FPDP)
- [FPSP](https://rcfunge98.com/rcsfingers.html#FPSP)
- [HRTI](./docs/catseye/library/HRTI.markdown)
- [INDV](https://rcfunge98.com/rcsfingers.html#INDV)
- [JSTR](https://web.archive.org/web/20070525220700/http://www.jess2.net:80/code/funge/myexts.txt)
- [MODE](./docs/catseye/library/MODE.markdown)
- [MODU](./docs/catseye/library/MODU.markdown)
- [NULL](./docs/catseye/library/NULL.markdown)
- [ORTH](./docs/catseye/library/ORTH.markdown)
- [PERL](./docs/catseye/library/PERL.markdown)
- [PERL](./docs/catseye/library/PERL.markdown) (Disabled by default, needs command line flag)
- [REFC](./docs/catseye/library/REFC.markdown)
- [ROMA](./docs/catseye/library/ROMA.markdown)
- [SOCK](https://rcfunge98.com/rcsfingers.html#SOCK)
- [SCKE](https://www.rcfunge98.com/rcfunge2_manual.html#SCKE)
- [STRN](https://rcfunge98.com/rcsfingers.html#STRN)
- [TOYS](./docs/catseye/library/TOYS.markdown)
- [TURT](./docs/catseye/library/TURT.markdown)
- [TURT](./docs/catseye/library/TURT.markdown) (Broken, disabled in source code, will be fixed in the future)

### Version Release Checklist
- Update the version number inside the [pom](./pom.xml)
Expand Down
42 changes: 40 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

<groupId>com.falsepattern</groupId>
<artifactId>jfunge</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>

<properties>
<java.version>8</java.version>
<java.version>17</java.version>
<lombok.version>1.18.24</lombok.version>
<trove.version>3.0.3</trove.version>
<joml.version>1.10.2</joml.version>
<commons-cli.version>1.5.0</commons-cli.version>
<asm.version>9.4</asm.version>
<project.encoding>UTF-8</project.encoding>
<project.distribution.name>mavenpattern</project.distribution.name>
<project.distribution.url>https://mvn.falsepattern.com/releases/</project.distribution.url>
Expand All @@ -22,6 +23,9 @@
<!--Test deps -->
<commons-io.version>2.11.0</commons-io.version>
<junit.version>5.8.2</junit.version>
<junit-pioneer.version>2.0.0</junit-pioneer.version>
<javassist.version>3.29.2-GA</javassist.version>

</properties>

<dependencies>
Expand All @@ -46,18 +50,52 @@
<artifactId>commons-cli</artifactId>
<version>${commons-cli.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-tree</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-util</artifactId>
<version>${asm.version}</version>
</dependency>

<!--Test dependencies-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit-pioneer</groupId>
<artifactId>junit-pioneer</artifactId>
<version>${junit-pioneer.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<distributionManagement>
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/falsepattern/jfunge/Globals.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.falsepattern.jfunge;

public class Globals {
public static final String VERSION = "1.1.0";
public static final int FUNGE_VERSION = 1 * 256 * 256 + 1 * 256 + 0;
public static final int MAJOR_VERSION = 1;
public static final int MINOR_VERSION = 2;
public static final int PATCH_VERSION = 0;
public static final int HANDPRINT = 0x74_70_85_78; //"JFUN"
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + PATCH_VERSION;
public static final int FUNGE_VERSION = MAJOR_VERSION * 256 * 256 + MINOR_VERSION * 256 + PATCH_VERSION;
}
5 changes: 4 additions & 1 deletion src/main/java/com/falsepattern/jfunge/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.falsepattern.jfunge.interpreter.FeatureSet;
import com.falsepattern.jfunge.interpreter.Interpreter;
import lombok.val;
import lombok.var;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
Expand Down Expand Up @@ -70,6 +69,10 @@ public static void main(String[] args) throws IOException, ParseException {
.longOpt("perl")
.desc("Enable the PERL fingerprint. This requires the working directory of the interpreter to be writable, and is also an arbitrary code execution risk.")
.build());
options.addOption(Option.builder()
.longOpt("sock")
.desc("Enable the SOCK and SCKE fingerprints. This allows the program to open a socket and listen for connections, as well as connect to external hosts. This is a very dangerous permission to grant, it can potentially allow remote code execution.")
.build());
val parser = new DefaultParser();
val cmd = parser.parse(options, args);
if (cmd.hasOption("help")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import com.falsepattern.jfunge.ip.IP;
import com.falsepattern.jfunge.ip.IStack;
import com.falsepattern.jfunge.storage.FungeSpace;
import org.joml.Vector3i;

import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -47,22 +45,20 @@ public interface ExecutionContext {

OutputStream output();

byte[] readFile(String file);
byte[] readFile(String file) throws PermissionException;

boolean writeFile(String file, byte[] data);
boolean writeFile(String file, byte[] data) throws PermissionException;

int envFlags();

default boolean concurrentAllowed() {
return (envFlags() & 0x01) != 0;
}
boolean changeDirectory(String dir) throws PermissionException;

default boolean fileInputAllowed(String path) throws IOException {
return (envFlags() & 0x02) != 0;
}
boolean makeDirectory(String dir) throws PermissionException;

default boolean fileOutputAllowed(String path) throws IOException {
return (envFlags() & 0x04) != 0;
boolean removeDirectory(String dir) throws PermissionException;

default boolean concurrentAllowed() {
return (envFlags() & 0x01) != 0;
}

default boolean syscallAllowed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ public class FeatureSet {
public final boolean environment;
public final long maxIter;

//Dangerous fingerpritns
public final boolean perl;
public final boolean socket;
}
Loading

0 comments on commit 8ff7e44

Please sign in to comment.