From 125c07509d1b11aa234e7370b08060b2ed0dda95 Mon Sep 17 00:00:00 2001
From: Dhrubajyoti Bhattacharjee
<35187462+cornercoding@users.noreply.github.com>
Date: Wed, 12 Feb 2020 12:41:05 +0100
Subject: [PATCH] BAEL-2980 Getting started with CRaSH (#8684)
---
spring-mvc-xml/pom.xml | 27 ++++++++
.../WEB-INF/crash/commands/message.groovy | 14 ++++
.../WEB-INF/crash/commands/message2.java | 14 ++++
.../webapp/WEB-INF/crash/crash.properties | 1 +
.../webapp/WEB-INF/crash/telnet.properties | 65 +++++++++++++++++++
.../src/main/webapp/WEB-INF/mvc-servlet.xml | 11 ++++
.../src/main/webapp/WEB-INF/web.xml | 3 +
7 files changed, 135 insertions(+)
create mode 100644 spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message.groovy
create mode 100644 spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message2.java
create mode 100644 spring-mvc-xml/src/main/webapp/WEB-INF/crash/crash.properties
create mode 100644 spring-mvc-xml/src/main/webapp/WEB-INF/crash/telnet.properties
diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml
index e93b426119..c389e41e29 100644
--- a/spring-mvc-xml/pom.xml
+++ b/spring-mvc-xml/pom.xml
@@ -92,6 +92,30 @@
${spring-boot.version}
test
+
+
+
+ org.crashub
+ crash.embed.spring
+ ${crash.version}
+
+
+ org.crashub
+ crash.cli
+ ${crash.version}
+
+
+ org.crashub
+ crash.connectors.telnet
+ ${crash.version}
+
+
+
+
+ org.codehaus.groovy
+ groovy
+ ${groovy.version}
+
@@ -137,6 +161,9 @@
1.6.1
+
+ 1.3.2
+ 3.0.0-rc-3
diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message.groovy b/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message.groovy
new file mode 100644
index 0000000000..d66ab13d96
--- /dev/null
+++ b/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message.groovy
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message2.java b/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message2.java
new file mode 100644
index 0000000000..d1ead88024
--- /dev/null
+++ b/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message2.java
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/crash/crash.properties b/spring-mvc-xml/src/main/webapp/WEB-INF/crash/crash.properties
new file mode 100644
index 0000000000..f9ad0d7cf6
--- /dev/null
+++ b/spring-mvc-xml/src/main/webapp/WEB-INF/crash/crash.properties
@@ -0,0 +1 @@
+crash.telnet.port=50001
diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/crash/telnet.properties b/spring-mvc-xml/src/main/webapp/WEB-INF/crash/telnet.properties
new file mode 100644
index 0000000000..99071d09ff
--- /dev/null
+++ b/spring-mvc-xml/src/main/webapp/WEB-INF/crash/telnet.properties
@@ -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
\ No newline at end of file
diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml
index 5c8fa611ed..126fea996e 100644
--- a/spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml
+++ b/spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml
@@ -52,4 +52,15 @@
+
+
+
+
+
+ 5000
+
+
+
diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml b/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml
index 6ff435b84b..4a3d6cb321 100644
--- a/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml
+++ b/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml
@@ -21,6 +21,9 @@
org.springframework.web.context.ContextLoaderListener
+
+ org.crsh.plugin.WebPluginLifeCycle
+