BAEL-2980 Getting started with CRaSH (#8684)

This commit is contained in:
Dhrubajyoti Bhattacharjee 2020-02-12 12:41:05 +01:00 committed by GitHub
parent 806ba12f4a
commit 125c07509d
7 changed files with 135 additions and 0 deletions

View File

@ -92,6 +92,30 @@
<version>${spring-boot.version}</version>
<scope>test</scope>
</dependency>
<!-- CRaSH Dependency -->
<dependency>
<groupId>org.crashub</groupId>
<artifactId>crash.embed.spring</artifactId>
<version>${crash.version}</version>
</dependency>
<dependency>
<groupId>org.crashub</groupId>
<artifactId>crash.cli</artifactId>
<version>${crash.version}</version>
</dependency>
<dependency>
<groupId>org.crashub</groupId>
<artifactId>crash.connectors.telnet</artifactId>
<version>${crash.version}</version>
</dependency>
<!-- Groovy -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy.version}</version>
</dependency>
</dependencies>
<build>
@ -137,6 +161,9 @@
<!-- Maven plugins -->
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
<crash.version>1.3.2</crash.version>
<groovy.version>3.0.0-rc-3</groovy.version>
</properties>

View File

@ -0,0 +1,14 @@
import org.crsh.cli.Command;
import org.crsh.cli.Usage;
import org.crsh.cli.Option;
class message {
@Usage("show my own message")
@Command
Object main(@Usage("custom message") @Option(names=["m","message"]) String message) {
if (message == null)
message = "No message given...";
return message;
}
}

View File

@ -0,0 +1,14 @@
import org.crsh.command.BaseCommand;
import org.crsh.cli.Usage;
import org.crsh.cli.Command;
import org.crsh.cli.Option;
public class message2 extends BaseCommand {
@Usage("show my own message using java")
@Command
public Object main(@Usage("custom message") @Option(names = { "m", "message" }) String message) {
if (message == null)
message = "No message given...";
return message;
}
}

View File

@ -0,0 +1 @@
crash.telnet.port=50001

View File

@ -0,0 +1,65 @@
############################
# Telnet daemon properties #
############################
#####################
# Terminals Section #
#####################
# List of terminals available and defined below
terminals=vt100,ansi,windoof,xterm
# vt100 implementation and aliases
term.vt100.class=net.wimpi.telnetd.io.terminal.vt100
term.vt100.aliases=default,vt100-am,vt102,dec-vt100
# ansi implementation and aliases
term.ansi.class=net.wimpi.telnetd.io.terminal.ansi
term.ansi.aliases=color-xterm,xterm-color,vt320,vt220,linux,screen
# windoof implementation and aliases
term.windoof.class=net.wimpi.telnetd.io.terminal.Windoof
term.windoof.aliases=
# xterm implementation and aliases
term.xterm.class=net.wimpi.telnetd.io.terminal.xterm
term.xterm.aliases=
##################
# Shells Section #
##################
# List of shells available and defined below
shells=simple
# shell implementations
shell.simple.class=org.crsh.telnet.term.TelnetHandler
#####################
# Listeners Section #
#####################
listeners=std
# std listener specific properties
#Basic listener and connection management settings (port is commented because CRaSH configures it)
# std.port=5000
std.floodprotection=5
std.maxcon=25
# Timeout Settings for connections (ms)
std.time_to_warning=3600000
std.time_to_timedout=60000
# Housekeeping thread active every 1 secs
std.housekeepinginterval=1000
std.inputmode=character
# Login shell
std.loginshell=simple
# Connection filter class
std.connectionfilter=none

View File

@ -52,4 +52,15 @@
<!-- End: Mapping by ControllerClassNameHandlerMapping with prefix -->
<bean class="org.crsh.spring.SpringWebBootstrap">
<property name="cmdMountPointConfig"
value="war:/WEB-INF/crash/commands/" />
<property name="confMountPointConfig"
value="war:/WEB-INF/crash/" />
<property name="config">
<props>
<prop key="crash.telnet.port">5000</prop>
</props>
</property>
</bean>
</beans>

View File

@ -21,6 +21,9 @@
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.crsh.plugin.WebPluginLifeCycle</listener-class>
</listener>
<!-- Spring child -->
<servlet>