original delivery
This commit is contained in:
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
.gradle/
|
||||
build/
|
||||
/build/
|
||||
app/build/
|
||||
local.properties
|
||||
.idea/
|
||||
*.iml
|
||||
.DS_Store
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
36
README.md
Normal file
36
README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# KosSSH Mobile
|
||||
|
||||
Android SSH mobile client starter project with interactive PTY, ANSI color rendering, custom terminal font size, keyboard helper keys, and password authentication.
|
||||
|
||||
## Build
|
||||
|
||||
Open this folder in Android Studio (Ladybug or newer) and let Gradle sync. Then run on an Android 8.0+ device/emulator.
|
||||
|
||||
Or from a machine with Gradle/Android SDK configured:
|
||||
|
||||
```bash
|
||||
./gradlew assembleDebug
|
||||
```
|
||||
|
||||
APK output:
|
||||
`app/build/outputs/apk/debug/app-debug.apk`
|
||||
|
||||
## Current features
|
||||
|
||||
- SSH shell over JSch (SSH-2)
|
||||
- PTY `xterm-256color`
|
||||
- Interactive keyboard via InputConnection
|
||||
- ANSI SGR basic 16-color + bright color + bold
|
||||
- Adjustable monospace font size
|
||||
- Dark terminal theme
|
||||
- Ctrl+A-Z helper
|
||||
- Tab/Esc/arrow helper buttons
|
||||
- Host/port/user/password fields
|
||||
|
||||
## Important production hardening
|
||||
|
||||
This is a functional MVP, not yet a production-grade SSH client. Before shipping, replace `StrictHostKeyChecking=no` in `SshClient.kt` with persistent known-hosts / host-key fingerprint verification, add encrypted profile storage with Android Keystore, private-key authentication, SFTP, terminal resize (`windowChange`), robust VT100/VT220/VT420 parsing, selection/copy, scrollback UI, and connection lifecycle handling.
|
||||
|
||||
## Package
|
||||
|
||||
`com.bozz.kosssh`
|
||||
16
app/build.gradle.kts
Normal file
16
app/build.gradle.kts
Normal file
@@ -0,0 +1,16 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
android { namespace = "com.bozz.kosssh"; compileSdk = 37
|
||||
defaultConfig { applicationId = "com.bozz.kosssh"; minSdk = 26; targetSdk = 35; versionCode = 1; versionName = "1.0.0" }
|
||||
buildToolsVersion = "35.0.0"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.15.0")
|
||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("com.github.mwiede:jsch:0.2.23")
|
||||
}
|
||||
10
app/src/main/AndroidManifest.xml
Normal file
10
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application android:theme="@style/Theme.KosSSHMobile" android:label="KosSSH Mobile" android:allowBackup="true" android:supportsRtl="true">
|
||||
<activity android:name=".ui.MainActivity" android:screenOrientation="unspecified" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/><category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
58
app/src/main/java/com/bozz/kosssh/ssh/SshClient.kt
Normal file
58
app/src/main/java/com/bozz/kosssh/ssh/SshClient.kt
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.bozz.kosssh.ssh
|
||||
|
||||
import com.jcraft.jsch.ChannelShell
|
||||
import com.jcraft.jsch.JSch
|
||||
import com.jcraft.jsch.Session
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
class SshClient {
|
||||
private var session: Session? = null
|
||||
private var channel: ChannelShell? = null
|
||||
private var input: InputStream? = null
|
||||
private var output: OutputStream? = null
|
||||
|
||||
fun connect(host: String, port: Int, user: String, password: String,
|
||||
onData: (String) -> Unit, onState: (String) -> Unit) {
|
||||
Thread {
|
||||
try {
|
||||
onState("Connecting…")
|
||||
val jsch = JSch()
|
||||
val s = jsch.getSession(user, host, port)
|
||||
s.setPassword(password)
|
||||
s.setConfig("StrictHostKeyChecking", "no") // MVP; replace with known_hosts verification before production.
|
||||
s.connect(12_000)
|
||||
session = s
|
||||
val c = s.openChannel("shell") as ChannelShell
|
||||
c.setPtyType("xterm-256color", 120, 40, 0, 0)
|
||||
c.setEnv("TERM", "xterm-256color")
|
||||
c.connect(8_000)
|
||||
channel = c
|
||||
input = c.inputStream
|
||||
output = c.outputStream
|
||||
onState("Connected")
|
||||
val buf = ByteArray(8192)
|
||||
while (!c.isClosed) {
|
||||
val n = input!!.read(buf)
|
||||
if (n > 0) onData(String(buf, 0, n, Charsets.UTF_8))
|
||||
}
|
||||
onState("Disconnected")
|
||||
} catch (e: Exception) {
|
||||
onState("Error: ${e.message ?: e.javaClass.simpleName}")
|
||||
close()
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
fun write(bytes: ByteArray) {
|
||||
try { output?.write(bytes); output?.flush() } catch (_: Exception) { }
|
||||
}
|
||||
|
||||
fun write(text: String) = write(text.toByteArray(Charsets.UTF_8))
|
||||
|
||||
fun close() {
|
||||
try { channel?.disconnect() } catch (_: Exception) {}
|
||||
try { session?.disconnect() } catch (_: Exception) {}
|
||||
channel = null; session = null; input = null; output = null
|
||||
}
|
||||
}
|
||||
158
app/src/main/java/com/bozz/kosssh/terminal/TerminalView.kt
Normal file
158
app/src/main/java/com/bozz/kosssh/terminal/TerminalView.kt
Normal file
@@ -0,0 +1,158 @@
|
||||
package com.bozz.kosssh.terminal
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.*
|
||||
import android.text.InputType
|
||||
import android.view.*
|
||||
import android.view.inputmethod.*
|
||||
import java.util.ArrayDeque
|
||||
import kotlin.math.max
|
||||
|
||||
class TerminalView(context: Context) : View(context) {
|
||||
private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { typeface = Typeface.MONOSPACE }
|
||||
private val lines = ArrayDeque<MutableList<Cell>>()
|
||||
private var current = mutableListOf<Cell>()
|
||||
private var cursorX = 0
|
||||
private var cursorY = 0
|
||||
private var fg = Color.rgb(230, 237, 243)
|
||||
private var bg = Color.rgb(13, 17, 23)
|
||||
private var bold = false
|
||||
private var escape = ""
|
||||
var fontSizePx = 15f
|
||||
set(v) { field = v.coerceIn(8f, 40f); invalidate() }
|
||||
var cursorColor = Color.rgb(126, 231, 135)
|
||||
private var ctrlLatch = false
|
||||
private var sender: ((ByteArray) -> Unit)? = null
|
||||
private val scrollback = 2000
|
||||
|
||||
data class Cell(val ch: Char, val color: Int, val bold: Boolean)
|
||||
|
||||
init {
|
||||
isFocusableInTouchMode = true
|
||||
setBackgroundColor(bg)
|
||||
clear()
|
||||
}
|
||||
|
||||
fun setSender(s: (ByteArray) -> Unit) { sender = s }
|
||||
fun clear() { lines.clear(); current = mutableListOf(); cursorX = 0; cursorY = 0; invalidate() }
|
||||
fun setTheme(background: Int, foreground: Int) { bg = background; fg = foreground; setBackgroundColor(bg); invalidate() }
|
||||
|
||||
fun feed(data: String) {
|
||||
data.forEach { ch -> process(ch) }
|
||||
invalidate()
|
||||
}
|
||||
|
||||
private fun process(ch: Char) {
|
||||
if (escape.isNotEmpty() || ch == '\u001b') { processEscape(ch); return }
|
||||
when (ch) {
|
||||
'\r' -> cursorX = 0
|
||||
'\n' -> newLine()
|
||||
'\b' -> cursorX = max(0, cursorX - 1)
|
||||
'\t' -> repeat(4) { put(' ') }
|
||||
'\u0007' -> Unit
|
||||
else -> if (ch >= ' ') put(ch)
|
||||
}
|
||||
}
|
||||
|
||||
private fun put(ch: Char) {
|
||||
while (current.size < cursorX) current.add(Cell(' ', fg, bold))
|
||||
if (cursorX < current.size) current[cursorX] = Cell(ch, fg, bold) else current.add(Cell(ch, fg, bold))
|
||||
cursorX++
|
||||
if (cursorX >= 200) newLine()
|
||||
}
|
||||
|
||||
private fun newLine() {
|
||||
lines.addLast(current); if (lines.size > scrollback) lines.removeFirst()
|
||||
current = mutableListOf(); cursorX = 0; cursorY++
|
||||
}
|
||||
|
||||
private fun processEscape(ch: Char) {
|
||||
if (escape.isEmpty()) { escape = "\u001b"; return }
|
||||
escape += ch
|
||||
if (ch == 'm') { sgr(escape.drop(2).dropLast(1)); escape = ""; return }
|
||||
if (escape.startsWith("\u001b[") && ch in "ABCDEFGHJKfnsu") { escape = ""; return }
|
||||
if (escape.length > 32) escape = ""
|
||||
}
|
||||
|
||||
private fun sgr(seq: String) {
|
||||
if (seq.isEmpty()) { fg = Color.rgb(230,237,243); bold = false; return }
|
||||
seq.split(';').mapNotNull { it.toIntOrNull() }.forEach { n ->
|
||||
when {
|
||||
n == 0 -> { fg = Color.rgb(230,237,243); bold = false }
|
||||
n == 1 -> bold = true
|
||||
n == 22 -> bold = false
|
||||
n in 30..37 -> fg = ansi16(n - 30)
|
||||
n in 90..97 -> fg = ansi16(n - 90 + 8)
|
||||
n == 39 -> fg = Color.rgb(230,237,243)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun ansi16(i: Int): Int = intArrayOf(
|
||||
Color.rgb(72,79,88), Color.rgb(255,123,114), Color.rgb(126,231,135), Color.rgb(210,153,34),
|
||||
Color.rgb(121,192,255), Color.rgb(210,168,255), Color.rgb(86,212,221), Color.rgb(240,246,252),
|
||||
Color.rgb(139,148,158), Color.rgb(255,123,114), Color.rgb(126,231,135), Color.rgb(227,179,65),
|
||||
Color.rgb(121,192,255), Color.rgb(210,168,255), Color.rgb(86,212,221), Color.WHITE
|
||||
)[i.coerceIn(0,15)]
|
||||
|
||||
override fun onDraw(c: Canvas) {
|
||||
super.onDraw(c)
|
||||
paint.textSize = fontSizePx
|
||||
paint.typeface = Typeface.MONOSPACE
|
||||
val fm = paint.fontMetrics
|
||||
val lineH = (fm.descent - fm.ascent) * 1.12f
|
||||
val charW = paint.measureText("M")
|
||||
val visible = height / lineH
|
||||
val all = lines.toList() + listOf(current)
|
||||
val start = max(0, all.size - visible.toInt())
|
||||
var y = -fm.ascent
|
||||
for (i in start until all.size) {
|
||||
var x = 0f
|
||||
for (cell in all[i]) {
|
||||
paint.color = cell.color
|
||||
paint.typeface = if (cell.bold) Typeface.create(Typeface.MONOSPACE, Typeface.BOLD) else Typeface.MONOSPACE
|
||||
c.drawText(cell.ch.toString(), x, y, paint); x += charW
|
||||
}
|
||||
y += lineH
|
||||
}
|
||||
paint.color = cursorColor
|
||||
val cursorLine = all.size - 1
|
||||
if (cursorLine >= start) c.drawRect(cursorX * charW, y - lineH, cursorX * charW + 2, y - 2, paint)
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
if (event.action == MotionEvent.ACTION_DOWN) { requestFocus(); showKeyboard(); return true }
|
||||
return true
|
||||
}
|
||||
|
||||
private fun showKeyboard() { (context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).showSoftInput(this, InputMethodManager.SHOW_IMPLICIT) }
|
||||
|
||||
override fun onCheckIsTextEditor() = true
|
||||
override fun onCreateInputConnection(outAttrs: EditorInfo): InputConnection {
|
||||
outAttrs.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
|
||||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
|
||||
return object : BaseInputConnection(this, false) {
|
||||
override fun commitText(text: CharSequence, newCursorPosition: Int): Boolean { send(text.toString()); return true }
|
||||
override fun deleteSurroundingText(beforeLength: Int, afterLength: Int): Boolean { send("\u007f".repeat(max(1,beforeLength))); return true }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
||||
val seq = when (keyCode) {
|
||||
KeyEvent.KEYCODE_ENTER -> "\r"
|
||||
KeyEvent.KEYCODE_TAB -> "\t"
|
||||
KeyEvent.KEYCODE_DEL -> "\u007f"
|
||||
KeyEvent.KEYCODE_ESCAPE -> "\u001b"
|
||||
KeyEvent.KEYCODE_DPAD_UP -> "\u001b[A"
|
||||
KeyEvent.KEYCODE_DPAD_DOWN -> "\u001b[B"
|
||||
KeyEvent.KEYCODE_DPAD_LEFT -> "\u001b[D"
|
||||
KeyEvent.KEYCODE_DPAD_RIGHT -> "\u001b[C"
|
||||
else -> if (event.unicodeChar != 0) event.unicodeChar.toChar().toString() else null
|
||||
}
|
||||
if (seq != null) { send(seq); return true }
|
||||
return super.onKeyDown(keyCode, event)
|
||||
}
|
||||
|
||||
fun sendCtrl(letter: Char) { send(byteArrayOf((letter.uppercaseChar().code - 64).toByte())) }
|
||||
private fun send(s: String) { sender?.invoke(s.toByteArray(Charsets.UTF_8)) }
|
||||
}
|
||||
57
app/src/main/java/com/bozz/kosssh/ui/MainActivity.kt
Normal file
57
app/src/main/java/com/bozz/kosssh/ui/MainActivity.kt
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.bozz.kosssh.ui
|
||||
|
||||
import android.app.*
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import com.bozz.kosssh.R
|
||||
import com.bozz.kosssh.ssh.SshClient
|
||||
import com.bozz.kosssh.terminal.TerminalView
|
||||
|
||||
class MainActivity : Activity() {
|
||||
private lateinit var terminal: TerminalView
|
||||
private val ssh = SshClient()
|
||||
private lateinit var status: TextView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
terminal = findViewById(R.id.terminal)
|
||||
status = findViewById(R.id.status)
|
||||
terminal.setSender { ssh.write(it) }
|
||||
findViewById<Button>(R.id.connect).setOnClickListener { connect() }
|
||||
findViewById<Button>(R.id.ctrl).setOnClickListener { showCtrlDialog() }
|
||||
findViewById<Button>(R.id.esc).setOnClickListener { ssh.write(byteArrayOf(27)) }
|
||||
findViewById<Button>(R.id.tab).setOnClickListener { ssh.write("\t") }
|
||||
findViewById<Button>(R.id.up).setOnClickListener { ssh.write("\u001b[A") }
|
||||
findViewById<Button>(R.id.down).setOnClickListener { ssh.write("\u001b[B") }
|
||||
findViewById<Button>(R.id.left).setOnClickListener { ssh.write("\u001b[D") }
|
||||
findViewById<Button>(R.id.right).setOnClickListener { ssh.write("\u001b[C") }
|
||||
findViewById<Button>(R.id.settings).setOnClickListener { showSettings() }
|
||||
}
|
||||
|
||||
private fun connect() {
|
||||
val host = findViewById<EditText>(R.id.host).text.toString().trim()
|
||||
val port = findViewById<EditText>(R.id.port).text.toString().toIntOrNull() ?: 22
|
||||
val user = findViewById<EditText>(R.id.user).text.toString().trim()
|
||||
val pass = findViewById<EditText>(R.id.password).text.toString()
|
||||
if (host.isEmpty() || user.isEmpty()) { Toast.makeText(this,"Host dan username wajib diisi",Toast.LENGTH_SHORT).show(); return }
|
||||
terminal.clear()
|
||||
ssh.connect(host, port, user, pass, { data -> runOnUiThread { terminal.feed(data) } }, { s -> runOnUiThread { status.text = s } })
|
||||
}
|
||||
|
||||
private fun showCtrlDialog() {
|
||||
val letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
AlertDialog.Builder(this).setTitle("CTRL + …").setItems(letters.map { "Ctrl + $it" }.toTypedArray()) { _, which -> terminal.sendCtrl(letters[which]) }.show()
|
||||
}
|
||||
|
||||
private fun showSettings() {
|
||||
val size = SeekBar(this).apply { max = 32; progress = (terminal.fontSizePx - 8).toInt() }
|
||||
val box = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL; setPadding(32,16,32,8); addView(TextView(this@MainActivity).apply { text = "Font size" }); addView(size) }
|
||||
size.setOnSeekBarChangeListener(object: SeekBar.OnSeekBarChangeListener { override fun onProgressChanged(s: SeekBar?, p: Int, f: Boolean) { terminal.fontSizePx = (p + 8).toFloat() }; override fun onStartTrackingTouch(s: SeekBar?){}; override fun onStopTrackingTouch(s: SeekBar?){} })
|
||||
AlertDialog.Builder(this).setTitle("Terminal Settings").setView(box).setPositiveButton("Close", null).setNeutralButton("GitHub Dark") { _, _ -> terminal.setTheme(Color.rgb(13,17,23), Color.rgb(230,237,243)) }.show()
|
||||
}
|
||||
|
||||
override fun onDestroy() { ssh.close(); super.onDestroy() }
|
||||
}
|
||||
24
app/src/main/res/layout/activity_main.xml
Normal file
24
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="16dp" android:layout_width="match_parent" android:layout_height="match_parent">
|
||||
<TextView android:text="KosSSH Mobile" android:textSize="24sp" android:textStyle="bold" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="12dp"/>
|
||||
<EditText android:id="@+id/host" android:hint="Host / IP" android:inputType="textUri" android:layout_width="match_parent" android:layout_height="wrap_content"/>
|
||||
<LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content">
|
||||
<EditText android:id="@+id/port" android:hint="Port" android:text="22" android:inputType="number" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content"/>
|
||||
<EditText android:id="@+id/user" android:hint="Username" android:layout_weight="2" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp"/>
|
||||
</LinearLayout>
|
||||
<EditText android:id="@+id/password" android:hint="Password" android:inputType="textPassword" android:layout_width="match_parent" android:layout_height="wrap_content"/>
|
||||
<LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp"><Button android:id="@+id/connect" android:text="Connect" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content"/><Button android:id="@+id/settings" android:text="Terminal Settings" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content"/></LinearLayout>
|
||||
<TextView android:id="@+id/status" android:text="Disconnected" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp"/>
|
||||
<com.bozz.kosssh.terminal.TerminalView android:id="@+id/terminal" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:layout_marginTop="8dp"/>
|
||||
<HorizontalScrollView android:layout_width="match_parent" android:layout_height="wrap_content">
|
||||
<LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||
<Button android:id="@+id/ctrl" android:text="CTRL" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
||||
<Button android:id="@+id/esc" android:text="ESC" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
||||
<Button android:id="@+id/tab" android:text="TAB" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
||||
<Button android:id="@+id/up" android:text="↑" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
||||
<Button android:id="@+id/down" android:text="↓" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
||||
<Button android:id="@+id/left" android:text="←" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
||||
<Button android:id="@+id/right" android:text="→" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
1
app/src/main/res/values/colors.xml
Normal file
1
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1 @@
|
||||
<resources><color name="black">#000000</color><color name="white">#FFFFFF</color></resources>
|
||||
6
app/src/main/res/values/themes.xml
Normal file
6
app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<style name="Theme.KosSSHMobile" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="android:fontFamily">monospace</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
</resources>
|
||||
4
build.gradle.kts
Normal file
4
build.gradle.kts
Normal file
@@ -0,0 +1,4 @@
|
||||
plugins {
|
||||
id("com.android.application") version "8.6.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.4.10" apply false
|
||||
}
|
||||
3
gradle.properties
Normal file
3
gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
android.useAndroidX=true
|
||||
kotlin.code.style=official
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
248
gradlew
vendored
Executable file
248
gradlew
vendored
Executable file
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
93
gradlew.bat
vendored
Normal file
93
gradlew.bat
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
4
settings.gradle.kts
Normal file
4
settings.gradle.kts
Normal file
@@ -0,0 +1,4 @@
|
||||
pluginManagement { repositories { google(); mavenCentral(); gradlePluginPortal() } }
|
||||
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS); repositories { google(); mavenCentral() } }
|
||||
rootProject.name = "KosSSHMobile"
|
||||
include(":app")
|
||||
Reference in New Issue
Block a user